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.
 
 
 
 
 
 

65 lines
2.0 KiB

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