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