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.

CHookVariables.f90 2.0 KiB

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