|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- # 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 = v
-
- ! 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
|