|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- # 1 "/home/admin/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
- data%Equipments%Hook%HookHeight = v
-
- ! if(associated(HookHeightPtr)) then
- ! call HookHeightPtr(data%Equipments%Hook%HookHeight)
- ! end if
-
- !**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
|