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.
 
 
 
 
 
 

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