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.
 
 
 
 
 
 

80 lines
2.1 KiB

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