Simulation Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

86 lines
2.6 KiB

  1. # 1 "/home/admin/SimulationCore2/CSharp/Equipments/ControlPanels/CHook.f90"
  2. module CHook
  3. use CHookVariables
  4. use SimulationVariables
  5. implicit none
  6. public
  7. contains
  8. subroutine HookFromJson(parent)
  9. type(json_value),pointer :: parent
  10. type(json_core) :: json
  11. type(json_value),pointer :: p,pval
  12. ! 1. get related root
  13. ! call json%get(parent,'Hook',p)
  14. ! ! 2. get member of data type from node
  15. ! call json%get(p,'HookHeight_S',pval)
  16. ! call json%get(pval,data%Equipments%Hook%HookHeight_S)
  17. ! call json%get(p,'HookHeight',pval)
  18. ! call json%get(pval,data%Equipments%Hook%HookHeight)
  19. end subroutine
  20. subroutine HookToJson(parent)
  21. type(json_value),pointer :: parent
  22. type(json_core) :: json
  23. type(json_value),pointer :: p
  24. ! 1. create new node
  25. call json%create_object(p,'Hook')
  26. call json%add(p,"HookHeight_S",data%Equipments%Hook%HookHeight_S)
  27. call json%add(p,"HookHeight",data%Equipments%Hook%HookHeight)
  28. call json%add(parent,p)
  29. end subroutine
  30. subroutine Set_HookHeight(v)
  31. use CDrillingConsoleVariables
  32. use SimulationVariables
  33. implicit none
  34. real , intent(in) :: v
  35. data%Equipments%Hook%HookHeight = v
  36. ! if(associated(HookHeightPtr)) then
  37. ! call HookHeightPtr(data%Equipments%Hook%HookHeight)
  38. ! end if
  39. !**call data%Equipments%Hook%OnHookHeightChange%RunAll(data%Equipments%Hook%HookHeight)
  40. end subroutine
  41. subroutine Set_HookHeight_S(v)
  42. implicit none
  43. real , intent(in) :: v
  44. if(v == data%Equipments%Hook%HookHeight) then
  45. return
  46. elseif (v > data%Equipments%Hook%HookHeight) then
  47. loop1: do
  48. call Set_HookHeight(data%Equipments%Hook%HookHeight + 0.2)
  49. if(abs(v - data%Equipments%Hook%HookHeight) <= 0.1) then
  50. call Set_HookHeight(v)
  51. exit loop1
  52. endif
  53. call sleepqq(100)
  54. enddo loop1
  55. else ! v < HookHeight
  56. loop2: do
  57. call Set_HookHeight(data%Equipments%Hook%HookHeight - 0.2)
  58. if(abs(data%Equipments%Hook%HookHeight - v) <= 0.1) then
  59. call Set_HookHeight(v)
  60. exit loop2
  61. endif
  62. call sleepqq(100)
  63. enddo loop2
  64. endif
  65. end subroutine
  66. subroutine Update_HookHeight_From_Snapshot()
  67. implicit none
  68. call Set_HookHeight_S(data%Equipments%Hook%HookHeight_S)
  69. end subroutine
  70. end module CHook