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.

CHook.f90 2.4 KiB

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