# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/Equipments/ControlPanels/CHook.f90" module CHook use CHookVariables use SimulationVariables implicit none public contains subroutine HookFromJson(parent) type(json_value),pointer :: parent type(json_core) :: json type(json_value),pointer :: p,pval ! 1. get related root ! call json%get(parent,'Hook',p) ! ! 2. get member of data type from node ! call json%get(p,'HookHeight_S',pval) ! call json%get(pval,data%Equipments%Hook%HookHeight_S) ! call json%get(p,'HookHeight',pval) ! call json%get(pval,data%Equipments%Hook%HookHeight) end subroutine subroutine HookToJson(parent) type(json_value),pointer :: parent type(json_core) :: json type(json_value),pointer :: p ! 1. create new node call json%create_object(p,'Hook') call json%add(p,"HookHeight_S",data%Equipments%Hook%HookHeight_S) call json%add(p,"HookHeight",data%Equipments%Hook%HookHeight) call json%add(parent,p) end subroutine subroutine Set_HookHeight(v) use CDrillingConsoleVariables use SimulationVariables implicit none real , intent(in) :: v #ifdef ExcludeExtraChanges if(data%Equipments%Hook%HookHeight == v) return #endif data%Equipments%Hook%HookHeight = 100 ! if(associated(HookHeightPtr)) then ! call HookHeightPtr(data%Equipments%Hook%HookHeight) ! end if #ifdef deb print*, 'HookHeight=', data%Equipments%Hook%HookHeight #endif !**call data%Equipments%Hook%OnHookHeightChange%RunAll(data%Equipments%Hook%HookHeight) end subroutine subroutine Set_HookHeight_S(v) implicit none real , intent(in) :: v if(v == data%Equipments%Hook%HookHeight) then return elseif (v > data%Equipments%Hook%HookHeight) then loop1: do call Set_HookHeight(data%Equipments%Hook%HookHeight + 0.2) if(abs(v - data%Equipments%Hook%HookHeight) <= 0.1) then call Set_HookHeight(v) exit loop1 endif call sleepqq(100) enddo loop1 else ! v < HookHeight loop2: do call Set_HookHeight(data%Equipments%Hook%HookHeight - 0.2) if(abs(data%Equipments%Hook%HookHeight - v) <= 0.1) then call Set_HookHeight(v) exit loop2 endif call sleepqq(100) enddo loop2 endif end subroutine subroutine Update_HookHeight_From_Snapshot() implicit none call Set_HookHeight_S(data%Equipments%Hook%HookHeight_S) end subroutine end module CHook