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.
 
 
 
 
 
 

171 lines
6.8 KiB

  1. module DrawworksMain
  2. implicit none
  3. public
  4. contains
  5. subroutine Drawworks_Setup()
  6. use CSimulationVariables
  7. implicit none
  8. call OnSimulationInitialization%Add(Drawworks_Init)
  9. call OnSimulationStop%Add(Drawworks_Init)
  10. call OnDrawworksStep%Add(Drawworks_Step)
  11. call OnDrawworksOutput%Add(Drawworks_Output)
  12. call OnDrawworksMain%Add(DrawworksMainBody)
  13. end subroutine
  14. subroutine Drawworks_Init
  15. implicit none
  16. end subroutine Drawworks_Init
  17. subroutine Drawworks_Step
  18. implicit none
  19. end subroutine Drawworks_Step
  20. subroutine Drawworks_Output
  21. implicit none
  22. end subroutine Drawworks_Output
  23. subroutine DrawworksMainBody
  24. use CDrillingConsoleVariables
  25. use CDataDisplayConsoleVariables
  26. use CHoistingVariables
  27. use CSimulationVariables
  28. use Drawworks_VARIABLES
  29. use CHookVariables
  30. use CWarningsVariables
  31. use CSounds
  32. implicit none
  33. integer,dimension(8) :: DW_START_TIME, DW_END_TIME
  34. INTEGER :: DW_SolDuration
  35. Call Drawworks_StartUp
  36. loopdrawsim : do
  37. CALL DATE_AND_TIME(values=DW_START_TIME)
  38. if (IsPortable) then
  39. Drawworks%AssignmentSwitch = 1
  40. else
  41. Drawworks%AssignmentSwitch = AssignmentSwitch
  42. end if
  43. if((any(Drawworks%AssignmentSwitch==(/1,2,3,4,5,7,8,9,10,11/))) .and. (DWSwitch==-1) .and. (DWThrottle==0.)) then
  44. Drawworks%SoundBlower = .true.
  45. Call SetSoundBlowerDW(Drawworks%SoundBlower)
  46. DWBLWR = 1
  47. loopDrawworks1 : do
  48. CALL DATE_AND_TIME(values=DW_START_TIME)
  49. if (IsPortable) then
  50. Drawworks%AssignmentSwitch = 1
  51. else
  52. Drawworks%AssignmentSwitch = AssignmentSwitch
  53. end if
  54. if(any(Drawworks%AssignmentSwitch==(/1,2,5,7,8,9,10,11/))) then
  55. Drawworks%NumberOfTracMotor = 2.0d0
  56. else if (any(Drawworks%AssignmentSwitch==(/3,4/))) then
  57. Drawworks%NumberOfTracMotor = 1.0d0
  58. end if
  59. Call Drawworks_Solver
  60. DW_TDHookHeight = Drawworks%Hook_Height_final
  61. if ( Drawworks%motion==+1 ) then
  62. Drawworks%SoundRev = 0 ![rpm] , Integer
  63. Call SetSoundDwRev( Drawworks%SoundRev )
  64. Drawworks%SoundFw = INT(Drawworks%w_drum) ![rpm] , Integer
  65. Call SetSoundDwFw(Drawworks%SoundFw)
  66. Call DWBrakeSound
  67. else
  68. Drawworks%SoundFw = 0 ![rpm] , Integer
  69. Call SetSoundDwFw(Drawworks%SoundFw)
  70. Drawworks%SoundRev = INT(Drawworks%w_drum) ![rpm] , Integer
  71. Call SetSoundDwRev( Drawworks%SoundRev )
  72. Call DWBrakeSound
  73. end if
  74. DW_OldTransMode = DWTransmisionLever
  75. if (IsPortable) then
  76. Drawworks%AssignmentSwitch = 1
  77. else
  78. Drawworks%AssignmentSwitch = AssignmentSwitch
  79. end if
  80. if ((any(Drawworks%AssignmentSwitch==(/6,12/))) .or. (any(DWSwitch==(/0,1/))) .or. (IsStopped == .true.)) then
  81. Drawworks%SoundBlower = .false.
  82. Call SetSoundBlowerDW(Drawworks%SoundBlower)
  83. DWBLWR = 0
  84. !Call Drawworks_Solver_FreeTractionMotor
  85. exit loopDrawworks1
  86. end if
  87. CALL DATE_AND_TIME(values=DW_END_TIME)
  88. DW_SolDuration = 100-(DW_END_TIME(5)*3600000+DW_END_TIME(6)*60000+DW_END_TIME(7)*1000+DW_END_TIME(8)-DW_START_TIME(5)*3600000-DW_START_TIME(6)*60000-DW_START_TIME(7)*1000-DW_START_TIME(8))
  89. if(DW_SolDuration > 0.0d0) then
  90. CALL sleepqq(DW_SolDuration)
  91. end if
  92. end do loopDrawworks1
  93. else
  94. if (IsPortable) then
  95. Drawworks%AssignmentSwitch = 1
  96. else
  97. Drawworks%AssignmentSwitch = AssignmentSwitch
  98. end if
  99. if((any(Drawworks%AssignmentSwitch==(/1,2,3,4,5,7,8,9,10,11/))) .and. (DWSwitch==-1)) then
  100. Drawworks%SoundBlower = .true.
  101. Call SetSoundBlowerDW(Drawworks%SoundBlower)
  102. DWBLWR = 1
  103. else
  104. Drawworks%SoundBlower = .false.
  105. Call SetSoundBlowerDW(Drawworks%SoundBlower)
  106. DWBLWR = 0
  107. end if
  108. Call Drawworks_Solver_FreeTractionMotor
  109. DW_TDHookHeight = Drawworks%Hook_Height_final
  110. if ( Drawworks%motion==+1 ) then
  111. Drawworks%SoundRev = 0 ![rpm] , Integer
  112. Call SetSoundDwRev( Drawworks%SoundRev )
  113. Drawworks%SoundFw = INT(Drawworks%w_drum) ![rpm] , Integer
  114. Call SetSoundDwFw(Drawworks%SoundFw)
  115. Call DWBrakeSound
  116. else
  117. Drawworks%SoundFw = 0 ![rpm] , Integer
  118. Call SetSoundDwFw(Drawworks%SoundFw)
  119. Drawworks%SoundRev = INT(Drawworks%w_drum) ![rpm] , Integer
  120. Call SetSoundDwRev( Drawworks%SoundRev )
  121. Call DWBrakeSound
  122. end if
  123. DW_OldTransMode = DWTransmisionLever
  124. end if
  125. if (IsStopped == .true.) then
  126. exit loopdrawsim
  127. end if
  128. CALL DATE_AND_TIME(values=DW_END_TIME)
  129. DW_SolDuration = 100-(DW_END_TIME(5)*3600000+DW_END_TIME(6)*60000+DW_END_TIME(7)*1000+DW_END_TIME(8)-DW_START_TIME(5)*3600000-DW_START_TIME(6)*60000-DW_START_TIME(7)*1000-DW_START_TIME(8))
  130. !print*, 'time=', DW_SolDuration
  131. if(DW_SolDuration > 0.0d0) then
  132. CALL sleepqq(DW_SolDuration)
  133. end if
  134. end do loopdrawsim
  135. end subroutine DrawworksMainBody
  136. end module DrawworksMain