Simulation Core
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

CSimulationVariables.f90 42 KiB

pirms 1 gada
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211
  1. module CSimulationVariables
  2. use CVoidEventHandlerCollection
  3. ! use CSimulationThreads
  4. use CIActionReference
  5. ! use ifcore
  6. use ifmt
  7. ! use CTimer
  8. use CError
  9. use CLog3
  10. implicit none
  11. public
  12. integer, parameter :: SimulationState_Stopped = 0;
  13. integer, parameter :: SimulationState_Started = 1;
  14. integer, parameter :: SimulationState_Paused = 2;
  15. logical :: IsStopped = .false.
  16. logical :: IsSnapshot = .false.
  17. logical :: IsPortable = .false.
  18. integer :: IsPortableInt = 0
  19. integer :: SimulationState_old
  20. integer :: SimulationState
  21. integer :: SimulationTime
  22. integer :: SimulationSpeed ! 1, 2, 5, 10
  23. integer :: SleepLimit = 0
  24. integer :: TotalPumpStrokes
  25. real(8) :: TotalVolumePumped
  26. real(8) :: DistanceDrilled
  27. type(VoidEventHandlerCollection) :: OnSimulationInitialization
  28. type(VoidEventHandlerCollection) :: OnSimulationStart
  29. type(VoidEventHandlerCollection) :: OnSimulationStop
  30. type(VoidEventHandlerCollection) :: OnSimulationPause
  31. !type(VoidEventHandlerCollection) :: OnSimulationGetOutput
  32. procedure (ActionVoid), pointer :: ForceRealTimeSpeedPtr
  33. procedure (ActionBool), pointer :: SpeedChangePossibilityPtr
  34. logical :: SpeedChangePossibilityValue
  35. procedure (ActionInteger), pointer :: TotalStrokesChangedPtr
  36. procedure (ActionInteger), pointer :: TotalStrokesPtr
  37. procedure (ActionDouble), pointer :: TotalVolumePumpedPtr
  38. procedure (ActionDouble), pointer :: DistanceDrilledPtr
  39. ! modules...
  40. !BopStack
  41. type(VoidEventHandlerCollection) :: OnBopStackStep
  42. type(VoidEventHandlerCollection) :: OnBopStackStart
  43. type(VoidEventHandlerCollection) :: OnBopStackOutput
  44. type(VoidEventHandlerCollection) :: OnBopStackPause
  45. type(VoidEventHandlerCollection) :: OnBopStackMain
  46. logical :: BopStackStarted
  47. !Pumps
  48. type(VoidEventHandlerCollection) :: OnPump1Step
  49. type(VoidEventHandlerCollection) :: OnPump1Start
  50. type(VoidEventHandlerCollection) :: OnPump1Output
  51. type(VoidEventHandlerCollection) :: OnPump1Pause
  52. type(VoidEventHandlerCollection) :: OnPump1Main
  53. logical :: Pump1Started
  54. type(VoidEventHandlerCollection) :: OnPump2Step
  55. type(VoidEventHandlerCollection) :: OnPump2Start
  56. type(VoidEventHandlerCollection) :: OnPump2Output
  57. type(VoidEventHandlerCollection) :: OnPump2Pause
  58. type(VoidEventHandlerCollection) :: OnPump2Main
  59. logical :: Pump2Started
  60. type(VoidEventHandlerCollection) :: OnPump3Step
  61. type(VoidEventHandlerCollection) :: OnPump3Start
  62. type(VoidEventHandlerCollection) :: OnPump3Output
  63. type(VoidEventHandlerCollection) :: OnPump3Pause
  64. type(VoidEventHandlerCollection) :: OnPump3Main
  65. logical :: Pump3Started
  66. !ChokeControl
  67. type(VoidEventHandlerCollection) :: OnChokeControlStep
  68. type(VoidEventHandlerCollection) :: OnChokeControlStart
  69. type(VoidEventHandlerCollection) :: OnChokeControlOutput
  70. type(VoidEventHandlerCollection) :: OnChokeControlPause
  71. type(VoidEventHandlerCollection) :: OnChokeControlMain
  72. logical :: ChokeControlStarted
  73. !ROP
  74. type(VoidEventHandlerCollection) :: OnRopStep
  75. type(VoidEventHandlerCollection) :: OnRopStart
  76. type(VoidEventHandlerCollection) :: OnRopOutput
  77. type(VoidEventHandlerCollection) :: OnRopPause
  78. type(VoidEventHandlerCollection) :: OnRopMain
  79. logical :: RopStarted
  80. !RotaryTable
  81. type(VoidEventHandlerCollection) :: OnRotaryTableStep
  82. type(VoidEventHandlerCollection) :: OnRotaryTableStart
  83. type(VoidEventHandlerCollection) :: OnRotaryTableOutput
  84. type(VoidEventHandlerCollection) :: OnRotaryTablePause
  85. type(VoidEventHandlerCollection) :: OnRotaryTableMain
  86. logical :: RotaryTableStarted
  87. !Drawworks
  88. type(VoidEventHandlerCollection) :: OnDrawworksStep
  89. type(VoidEventHandlerCollection) :: OnDrawworksStart
  90. type(VoidEventHandlerCollection) :: OnDrawworksOutput
  91. type(VoidEventHandlerCollection) :: OnDrawworksPause
  92. type(VoidEventHandlerCollection) :: OnDrawworksMain
  93. logical :: DrawworksStarted
  94. !FluidFlow
  95. type(VoidEventHandlerCollection) :: OnFluidFlowStep
  96. type(VoidEventHandlerCollection) :: OnFluidFlowStart
  97. type(VoidEventHandlerCollection) :: OnFluidFlowOutput
  98. type(VoidEventHandlerCollection) :: OnFluidFlowPause
  99. type(VoidEventHandlerCollection) :: OnFluidFlowMain
  100. logical :: FluidFlowStarted
  101. !TorqueDrag
  102. type(VoidEventHandlerCollection) :: OnTorqueDragStep
  103. type(VoidEventHandlerCollection) :: OnTorqueDragStart
  104. type(VoidEventHandlerCollection) :: OnTorqueDragOutput
  105. type(VoidEventHandlerCollection) :: OnTorqueDragPause
  106. type(VoidEventHandlerCollection) :: OnTorqueDragMain
  107. logical :: TorqueDragStarted
  108. !TopDrive
  109. type(VoidEventHandlerCollection) :: OnTopDriveStep
  110. type(VoidEventHandlerCollection) :: OnTopDriveStart
  111. type(VoidEventHandlerCollection) :: OnTopDriveOutput
  112. type(VoidEventHandlerCollection) :: OnTopDrivePause
  113. type(VoidEventHandlerCollection) :: OnTopDriveMain
  114. logical :: TopDriveStarted
  115. !MudSystem
  116. type(VoidEventHandlerCollection) :: OnMudSystemStep
  117. type(VoidEventHandlerCollection) :: OnMudSystemStart
  118. type(VoidEventHandlerCollection) :: OnMudSystemOutput
  119. type(VoidEventHandlerCollection) :: OnMudSystemPause
  120. type(VoidEventHandlerCollection) :: OnMudSystemMain
  121. logical :: MudSystemStarted
  122. !PipeRams1
  123. type(VoidEventHandlerCollection) :: OnPipeRams1Step
  124. type(VoidEventHandlerCollection) :: OnPipeRams1Start
  125. type(VoidEventHandlerCollection) :: OnPipeRams1Output
  126. type(VoidEventHandlerCollection) :: OnPipeRams1Pause
  127. type(VoidEventHandlerCollection) :: OnPipeRams1Main
  128. logical :: PipeRams1Started
  129. !PipeRams2
  130. type(VoidEventHandlerCollection) :: OnPipeRams2Step
  131. type(VoidEventHandlerCollection) :: OnPipeRams2Start
  132. type(VoidEventHandlerCollection) :: OnPipeRams2Output
  133. type(VoidEventHandlerCollection) :: OnPipeRams2Pause
  134. type(VoidEventHandlerCollection) :: OnPipeRams2Main
  135. logical :: PipeRams2Started
  136. !KillLine
  137. type(VoidEventHandlerCollection) :: OnKillLineStep
  138. type(VoidEventHandlerCollection) :: OnKillLineStart
  139. type(VoidEventHandlerCollection) :: OnKillLineOutput
  140. type(VoidEventHandlerCollection) :: OnKillLinePause
  141. type(VoidEventHandlerCollection) :: OnKillLineMain
  142. logical :: KillLineStarted
  143. !ChokeLine
  144. type(VoidEventHandlerCollection) :: OnChokeLineStep
  145. type(VoidEventHandlerCollection) :: OnChokeLineStart
  146. type(VoidEventHandlerCollection) :: OnChokeLineOutput
  147. type(VoidEventHandlerCollection) :: OnChokeLinePause
  148. type(VoidEventHandlerCollection) :: OnChokeLineMain
  149. logical :: ChokeLineStarted
  150. !BlindRams
  151. type(VoidEventHandlerCollection) :: OnBlindRamsStep
  152. type(VoidEventHandlerCollection) :: OnBlindRamsStart
  153. type(VoidEventHandlerCollection) :: OnBlindRamsOutput
  154. type(VoidEventHandlerCollection) :: OnBlindRamsPause
  155. type(VoidEventHandlerCollection) :: OnBlindRamsMain
  156. logical :: BlindRamsStarted
  157. !Annular
  158. type(VoidEventHandlerCollection) :: OnAnnularStep
  159. type(VoidEventHandlerCollection) :: OnAnnularStart
  160. type(VoidEventHandlerCollection) :: OnAnnularOutput
  161. type(VoidEventHandlerCollection) :: OnAnnularPause
  162. type(VoidEventHandlerCollection) :: OnAnnularMain
  163. logical :: AnnularStarted
  164. !Geo
  165. type(VoidEventHandlerCollection) :: OnGeoStep
  166. type(VoidEventHandlerCollection) :: OnGeoStart
  167. type(VoidEventHandlerCollection) :: OnGeoOutput
  168. type(VoidEventHandlerCollection) :: OnGeoPause
  169. type(VoidEventHandlerCollection) :: OnGeoMain
  170. logical :: GeoStarted
  171. !OperationScenarios
  172. type(VoidEventHandlerCollection) :: OnOperationScenariosStep
  173. type(VoidEventHandlerCollection) :: OnOperationScenariosOutput
  174. type(VoidEventHandlerCollection) :: OnOperationScenariosPause
  175. type(VoidEventHandlerCollection) :: OnOperationScenariosMain
  176. !PathFinding
  177. type(VoidEventHandlerCollection) :: OnPathFindingStep
  178. type(VoidEventHandlerCollection) :: OnPathFindingOutput
  179. type(VoidEventHandlerCollection) :: OnPathFindingPause
  180. type(VoidEventHandlerCollection) :: OnPathFindingMain
  181. ! sample
  182. type(VoidEventHandlerCollection) :: OnSampleStep
  183. type(VoidEventHandlerCollection) :: OnSampleStart
  184. type(VoidEventHandlerCollection) :: OnSampleOutput
  185. type(VoidEventHandlerCollection) :: OnSamplePause
  186. type(VoidEventHandlerCollection) :: OnSampleMain
  187. logical :: SampleStarted
  188. !!MudFlowFillIndicator
  189. !type(VoidEventHandlerCollection) :: OnMudFlowFillIndicatorStep
  190. !type(VoidEventHandlerCollection) :: OnMudFlowFillIndicatorOutput
  191. !type(VoidEventHandlerCollection) :: OnMudFlowFillIndicatorMain
  192. contains
  193. subroutine Quit()
  194. use ifmt
  195. call ExitThread(0)
  196. end subroutine
  197. real function GetSimulationSpeedSecond()
  198. implicit none
  199. GetSimulationSpeedSecond = 1.0 / SimulationSpeed
  200. end function GetSimulationSpeedSecond
  201. integer function GetSimulationSpeedMilisecond()
  202. implicit none
  203. GetSimulationSpeedMilisecond = int(GetSimulationSpeedSecond()* 1000.0)
  204. end function GetSimulationSpeedMilisecond
  205. subroutine DrillMode_ON()
  206. implicit none
  207. call SpeedChangePossibility(.true.)
  208. end subroutine
  209. subroutine DrillMode_OFF()
  210. implicit none
  211. call ForceRealTimeSpeed()
  212. call SpeedChangePossibility(.false.)
  213. end subroutine
  214. subroutine ForceRealTimeSpeed()
  215. implicit none
  216. if(associated(ForceRealTimeSpeedPtr)) call ForceRealTimeSpeedPtr()
  217. end subroutine
  218. subroutine SpeedChangePossibility(v)
  219. implicit none
  220. logical, intent(in) :: v
  221. SpeedChangePossibilityValue = v
  222. if(associated(SpeedChangePossibilityPtr)) call SpeedChangePossibilityPtr(SpeedChangePossibilityValue)
  223. end subroutine
  224. subroutine SubscribeSpeedChangePossibility(a)
  225. !DEC$ ATTRIBUTES DLLEXPORT :: SubscribeSpeedChangePossibility
  226. !DEC$ ATTRIBUTES ALIAS: 'SubscribeSpeedChangePossibility' :: SubscribeSpeedChangePossibility
  227. implicit none
  228. procedure (ActionBool) :: a
  229. SpeedChangePossibilityPtr => a
  230. end subroutine
  231. subroutine SubscribeForceRealTimeSpeed(a)
  232. !DEC$ ATTRIBUTES DLLEXPORT :: SubscribeForceRealTimeSpeed
  233. !DEC$ ATTRIBUTES ALIAS: 'SubscribeForceRealTimeSpeed' :: SubscribeForceRealTimeSpeed
  234. implicit none
  235. procedure (ActionVoid) :: a
  236. ForceRealTimeSpeedPtr => a
  237. end subroutine
  238. subroutine SubscribeTotalStrokesChanged(a)
  239. !DEC$ ATTRIBUTES DLLEXPORT :: SubscribeTotalStrokesChanged
  240. !DEC$ ATTRIBUTES ALIAS: 'SubscribeTotalStrokesChanged' :: SubscribeTotalStrokesChanged
  241. implicit none
  242. procedure (ActionInteger) :: a
  243. TotalStrokesChangedPtr => a
  244. end subroutine
  245. subroutine SetTotalStrokes(strokes)
  246. implicit none
  247. integer, intent(in) :: strokes
  248. if (TotalPumpStrokes == strokes) return
  249. TotalPumpStrokes = strokes
  250. if(associated(TotalStrokesChangedPtr)) call TotalStrokesChangedPtr(TotalPumpStrokes)
  251. if(associated(TotalStrokesPtr)) call TotalStrokesPtr(TotalPumpStrokes)
  252. end subroutine
  253. subroutine SetTotalVolumePumped(volume)
  254. implicit none
  255. real(8), intent(in) :: volume
  256. if (TotalVolumePumped == volume) return
  257. TotalVolumePumped = volume
  258. if(associated(TotalVolumePumpedPtr)) call TotalVolumePumpedPtr(TotalVolumePumped)
  259. end subroutine
  260. subroutine SetDistanceDrilled(distance)
  261. implicit none
  262. real(8), intent(in) :: distance
  263. if (DistanceDrilled == distance) return
  264. DistanceDrilled = distance
  265. if(associated(DistanceDrilledPtr)) call DistanceDrilledPtr(DistanceDrilled)
  266. end subroutine
  267. ! integer(4) function BopStackThread(arg)
  268. ! !DEC$ ATTRIBUTES STDCALL, ALIAS:"_bopstackthread" :: BopStackThread
  269. ! use ifport
  270. ! use ifmt
  271. ! implicit none
  272. ! integer(4), pointer :: arg
  273. ! integer i, j
  274. ! integer elapsed, speed, remaining
  275. ! type(Timer) t
  276. ! #ifdef M_BopStack
  277. ! call OnBopStackMain%RunAll()
  278. ! #endif
  279. ! #ifdef S_BopStack
  280. ! if(.not.BopStackStarted) then
  281. ! call OnBopStackStart%RunAll()
  282. ! BopStackStarted = .true.
  283. ! end if
  284. ! loop: do
  285. ! if(IsStopped) call ExitThread(0)
  286. ! do i=1, 10
  287. ! if(IsStopped) call ExitThread(0)
  288. ! call t%Start()
  289. ! do j=1, SimulationSpeed
  290. ! if(IsStopped) call ExitThread(0)
  291. ! call OnBopStackStep%RunAll()
  292. ! end do
  293. ! call t%Finish()
  294. ! elapsed = t%ElapsedTimeMs()
  295. ! remaining = 100 - elapsed
  296. ! #ifdef E_SpeedWatchdog
  297. ! if(elapsed > 100) call Error('BOP Stack Module: exceeding more than 100ms interval, the time was ', elapsed)
  298. ! #endif
  299. ! if(remaining > 0 .and. i < 10) call sleepqq(remaining - SleepLimit)
  300. ! call OnBopStackOutput%RunAll()
  301. ! end do
  302. ! call OnBopStackPause%RunAll()
  303. ! end do loop
  304. ! #endif
  305. ! BopStackThread = 0;
  306. ! call ExitThread(0)
  307. ! end function BopStackThread
  308. ! integer(4) function Pump1Thread(arg)
  309. ! !DEC$ ATTRIBUTES STDCALL, ALIAS:"_pump1thread" :: Pump1Thread
  310. ! use ifport
  311. ! use ifmt
  312. ! implicit none
  313. ! integer(4), pointer :: arg
  314. ! integer i, j
  315. ! integer elapsed, speed, remaining
  316. ! type(Timer) t
  317. ! #ifdef M_Pump1
  318. ! call OnPump1Main%RunAll()
  319. ! #endif
  320. ! #ifdef S_Pump1
  321. ! if(.not.Pump1Started) then
  322. ! call OnPump1Start%RunAll()
  323. ! Pump1Started = .true.
  324. ! end if
  325. ! loop: do
  326. ! if(IsStopped) call ExitThread(0)
  327. ! do i=1, 10
  328. ! if(IsStopped) call ExitThread(0)
  329. ! call t%Start()
  330. ! do j=1, SimulationSpeed
  331. ! if(IsStopped) call ExitThread(0)
  332. ! call OnPump1Step%RunAll()
  333. ! end do
  334. ! call t%Finish()
  335. ! elapsed = t%ElapsedTimeMs()
  336. ! remaining = 100 - elapsed
  337. ! #ifdef E_SpeedWatchdog
  338. ! if(elapsed > 100) call Error('Pump 1 Module: exceeding more than 100ms interval, the time was ', elapsed)
  339. ! #endif
  340. ! if(remaining > 0 .and. i < 10) call sleepqq(remaining - SleepLimit)
  341. ! call OnPump1Output%RunAll()
  342. ! end do
  343. ! call OnPump1Pause%RunAll()
  344. ! end do loop
  345. ! #endif
  346. ! Pump1Thread = 0;
  347. ! call ExitThread(0)
  348. ! end function Pump1Thread
  349. ! integer(4) function Pump2Thread(arg)
  350. ! !DEC$ ATTRIBUTES STDCALL, ALIAS:"_pump2thread" :: Pump2Thread
  351. ! use ifport
  352. ! use ifmt
  353. ! implicit none
  354. ! integer(4), pointer :: arg
  355. ! integer i, j
  356. ! integer elapsed, speed, remaining
  357. ! type(Timer) t
  358. ! #ifdef M_Pump2
  359. ! call OnPump2Main%RunAll()
  360. ! #endif
  361. ! #ifdef S_Pump2
  362. ! if(.not.Pump2Started) then
  363. ! call OnPump2Start%RunAll()
  364. ! Pump2Started = .true.
  365. ! end if
  366. ! loop: do
  367. ! if(IsStopped) call ExitThread(0)
  368. ! do i=1, 10
  369. ! if(IsStopped) call ExitThread(0)
  370. ! call t%Start()
  371. ! do j=1, SimulationSpeed
  372. ! if(IsStopped) call ExitThread(0)
  373. ! call OnPump2Step%RunAll()
  374. ! end do
  375. ! call t%Finish()
  376. ! elapsed = t%ElapsedTimeMs()
  377. ! remaining = 100 - elapsed
  378. ! #ifdef E_SpeedWatchdog
  379. ! if(elapsed > 100) call Error('Pump 2 Module: exceeding more than 100ms interval, the time was ', elapsed)
  380. ! #endif
  381. ! if(remaining > 0 .and. i < 10) call sleepqq(remaining - SleepLimit)
  382. ! call OnPump2Output%RunAll()
  383. ! end do
  384. ! call OnPump2Pause%RunAll()
  385. ! end do loop
  386. ! #endif
  387. ! Pump2Thread = 0;
  388. ! call ExitThread(0)
  389. ! end function Pump2Thread
  390. ! integer(4) function Pump3Thread(arg)
  391. ! !DEC$ ATTRIBUTES STDCALL, ALIAS:"_pump3thread" :: Pump3Thread
  392. ! use ifport
  393. ! use ifmt
  394. ! implicit none
  395. ! integer(4), pointer :: arg
  396. ! integer i, j
  397. ! integer elapsed, speed, remaining
  398. ! type(Timer) t
  399. ! #ifdef M_Pump3
  400. ! call OnPump3Main%RunAll()
  401. ! #endif
  402. ! #ifdef S_Pump3
  403. ! if(.not.Pump3Started) then
  404. ! call OnPump3Start%RunAll()
  405. ! Pump3Started = .true.
  406. ! end if
  407. ! loop: do
  408. ! if(IsStopped) call ExitThread(0)
  409. ! do i=1, 10
  410. ! if(IsStopped) call ExitThread(0)
  411. ! call t%Start()
  412. ! do j=1, SimulationSpeed
  413. ! if(IsStopped) call ExitThread(0)
  414. ! call OnPump3Step%RunAll()
  415. ! end do
  416. ! call t%Finish()
  417. ! elapsed = t%ElapsedTimeMs()
  418. ! remaining = 100 - elapsed
  419. ! #ifdef E_SpeedWatchdog
  420. ! if(elapsed > 100) call Error('Pump 3 Module: exceeding more than 100ms interval, the time was ', elapsed)
  421. ! #endif
  422. ! if(remaining > 0 .and. i < 10) call sleepqq(remaining - SleepLimit)
  423. ! call OnPump3Output%RunAll()
  424. ! end do
  425. ! call OnPump3Pause%RunAll()
  426. ! end do loop
  427. ! #endif
  428. ! Pump3Thread = 0;
  429. ! call ExitThread(0)
  430. ! end function Pump3Thread
  431. ! integer(4) function ChokeControlThread(arg)
  432. ! !DEC$ ATTRIBUTES STDCALL, ALIAS:"_chokecontrolthread" :: ChokeControlThread
  433. ! use ifport
  434. ! use ifmt
  435. ! implicit none
  436. ! integer(4), pointer :: arg
  437. ! integer i, j
  438. ! integer elapsed, speed, remaining
  439. ! type(Timer) t
  440. ! #ifdef M_ChokeControl
  441. ! call OnChokeControlMain%RunAll()
  442. ! #endif
  443. ! #ifdef S_ChokeControl
  444. ! if(.not.ChokeControlStarted) then
  445. ! call OnChokeControlStart%RunAll()
  446. ! ChokeControlStarted = .true.
  447. ! end if
  448. ! loop: do
  449. ! if(IsStopped) call ExitThread(0)
  450. ! do i=1, 10
  451. ! if(IsStopped) call ExitThread(0)
  452. ! call t%Start()
  453. ! do j=1, SimulationSpeed
  454. ! if(IsStopped) call ExitThread(0)
  455. ! call OnChokeControlStep%RunAll()
  456. ! end do
  457. ! call t%Finish()
  458. ! elapsed = t%ElapsedTimeMs()
  459. ! remaining = 100 - elapsed
  460. ! #ifdef E_SpeedWatchdog
  461. ! if(elapsed > 100) call Error('Choke Control Module: exceeding more than 100ms interval, the time was ', elapsed)
  462. ! #endif
  463. ! if(remaining > 0 .and. i < 10) call sleepqq(remaining - SleepLimit)
  464. ! call OnChokeControlOutput%RunAll()
  465. ! end do
  466. ! call OnChokeControlPause%RunAll()
  467. ! end do loop
  468. ! #endif
  469. ! ChokeControlThread = 0;
  470. ! call ExitThread(0)
  471. ! end function ChokeControlThread
  472. ! integer(4) function RopThread(arg)
  473. ! !DEC$ ATTRIBUTES STDCALL, ALIAS:"_ropthread" :: RopThread
  474. ! use ifport
  475. ! use ifmt
  476. ! implicit none
  477. ! integer(4), pointer :: arg
  478. ! integer i, j
  479. ! integer elapsed, speed, remaining
  480. ! type(Timer) t
  481. ! #ifdef M_Rop
  482. ! call OnRopMain%RunAll()
  483. ! #endif
  484. ! #ifdef S_Rop
  485. ! if(.not.RopStarted) then
  486. ! call OnRopStart%RunAll()
  487. ! RopStarted = .true.
  488. ! end if
  489. ! loop: do
  490. ! if(IsStopped) call ExitThread(0)
  491. ! do i=1, 10
  492. ! if(IsStopped) call ExitThread(0)
  493. ! call t%Start()
  494. ! do j=1, SimulationSpeed
  495. ! if(IsStopped) call ExitThread(0)
  496. ! call OnRopStep%RunAll()
  497. ! end do
  498. ! call t%Finish()
  499. ! elapsed = t%ElapsedTimeMs()
  500. ! remaining = 100 - elapsed
  501. ! #ifdef E_SpeedWatchdog
  502. ! if(elapsed > 100) call Error('ROP Module: exceeding more than 100ms interval, the time was ', elapsed)
  503. ! #endif
  504. ! if(remaining > 0 .and. i < 10) call sleepqq(remaining - SleepLimit)
  505. ! call OnRopOutput%RunAll()
  506. ! end do
  507. ! call OnRopPause%RunAll()
  508. ! end do loop
  509. ! #endif
  510. ! RopThread = 0;
  511. ! call ExitThread(0)
  512. ! end function RopThread
  513. ! integer(4) function RotaryTableThread(arg)
  514. ! !DEC$ ATTRIBUTES STDCALL, ALIAS:"_rotarytablethread" :: RotaryTableThread
  515. ! use ifport
  516. ! use ifmt
  517. ! implicit none
  518. ! integer(4), pointer :: arg
  519. ! integer i, j
  520. ! integer elapsed, speed, remaining
  521. ! type(Timer) t
  522. ! #ifdef M_RotaryTable
  523. ! call OnRotaryTableMain%RunAll()
  524. ! #endif
  525. ! #ifdef S_RotaryTable
  526. ! if(.not.RotaryTableStarted) then
  527. ! call OnRotaryTableStart%RunAll()
  528. ! RotaryTableStarted = .true.
  529. ! end if
  530. ! loop: do
  531. ! if(IsStopped) call ExitThread(0)
  532. ! do i=1, 10
  533. ! if(IsStopped) call ExitThread(0)
  534. ! call t%Start()
  535. ! do j=1, SimulationSpeed
  536. ! if(IsStopped) call ExitThread(0)
  537. ! call OnRotaryTableStep%RunAll()
  538. ! end do
  539. ! call t%Finish()
  540. ! elapsed = t%ElapsedTimeMs()
  541. ! remaining = 100 - elapsed
  542. ! #ifdef E_SpeedWatchdog
  543. ! if(elapsed > 100) call Error('Rotary Table Module: exceeding more than 100ms interval, the time was ', elapsed)
  544. ! #endif
  545. ! if(remaining > 0 .and. i < 10) call sleepqq(remaining - SleepLimit)
  546. ! call OnRotaryTableOutput%RunAll()
  547. ! end do
  548. ! call OnRotaryTablePause%RunAll()
  549. ! end do loop
  550. ! #endif
  551. ! RotaryTableThread = 0;
  552. ! call ExitThread(0)
  553. ! end function RotaryTableThread
  554. ! integer(4) function DrawworksThread(arg)
  555. ! !DEC$ ATTRIBUTES STDCALL, ALIAS:"_drawworksthread" :: DrawworksThread
  556. ! use ifport
  557. ! use ifmt
  558. ! implicit none
  559. ! integer(4), pointer :: arg
  560. ! integer i, j
  561. ! integer elapsed, speed, remaining
  562. ! type(Timer) t
  563. ! #ifdef M_Drawworks
  564. ! call OnDrawworksMain%RunAll()
  565. ! #endif
  566. ! #ifdef S_Drawworks
  567. ! if(.not.DrawworksStarted) then
  568. ! call OnDrawworksStart%RunAll()
  569. ! DrawworksStarted = .true.
  570. ! end if
  571. ! loop: do
  572. ! if(IsStopped) call ExitThread(0)
  573. ! do i=1, 10
  574. ! if(IsStopped) call ExitThread(0)
  575. ! call t%Start()
  576. ! do j=1, SimulationSpeed
  577. ! if(IsStopped) call ExitThread(0)
  578. ! call OnDrawworksStep%RunAll()
  579. ! end do
  580. ! call t%Finish()
  581. ! elapsed = t%ElapsedTimeMs()
  582. ! remaining = 100 - elapsed
  583. ! #ifdef E_SpeedWatchdog
  584. ! if(elapsed > 100) call Error('Drawworks Module: exceeding more than 100ms interval, the time was ', elapsed)
  585. ! #endif
  586. ! if(remaining > 0 .and. i < 10) call sleepqq(remaining - SleepLimit)
  587. ! call OnDrawworksOutput%RunAll()
  588. ! end do
  589. ! call OnDrawworksPause%RunAll()
  590. ! end do loop
  591. ! #endif
  592. ! DrawworksThread = 0;
  593. ! call ExitThread(0)
  594. ! end function DrawworksThread
  595. ! integer(4) function FluidFlowThread(arg)
  596. ! !DEC$ ATTRIBUTES STDCALL, ALIAS:"_fluidflowthread" :: FluidFlowThread
  597. ! use ifport
  598. ! use ifmt
  599. ! implicit none
  600. ! integer(4), pointer :: arg
  601. ! integer i, j
  602. ! integer elapsed, speed, remaining
  603. ! type(Timer) t
  604. ! #ifdef M_FluidFlow
  605. ! call OnFluidFlowMain%RunAll()
  606. ! #endif
  607. ! #ifdef S_FluidFlow
  608. ! if(.not.FluidFlowStarted) then
  609. ! call OnFluidFlowStart%RunAll()
  610. ! FluidFlowStarted = .true.
  611. ! end if
  612. ! loop: do
  613. ! if(IsStopped) call ExitThread(0)
  614. ! do i=1, 10
  615. ! if(IsStopped) call ExitThread(0)
  616. ! call t%Start()
  617. ! do j=1, SimulationSpeed
  618. ! if(IsStopped) call ExitThread(0)
  619. ! call OnFluidFlowStep%RunAll()
  620. ! end do
  621. ! call t%Finish()
  622. ! elapsed = t%ElapsedTimeMs()
  623. ! remaining = 100 - elapsed
  624. ! #ifdef E_SpeedWatchdog
  625. ! if(elapsed > 100) call Error('Fluid Flow Module: exceeding more than 100ms interval, the time was ', elapsed)
  626. ! #endif
  627. ! if(remaining > 0 .and. i < 10) call sleepqq(remaining - SleepLimit)
  628. ! call OnFluidFlowOutput%RunAll()
  629. ! end do
  630. ! call OnFluidFlowPause%RunAll()
  631. ! end do loop
  632. ! #endif
  633. ! FluidFlowThread = 0;
  634. ! call ExitThread(0)
  635. ! end function FluidFlowThread
  636. ! integer(4) function TorqueDragThread(arg)
  637. ! !DEC$ ATTRIBUTES STDCALL, ALIAS:"_torquedragthread" :: TorqueDragThread
  638. ! use ifport
  639. ! use ifmt
  640. ! implicit none
  641. ! integer(4), pointer :: arg
  642. ! integer i, j
  643. ! integer elapsed, speed, remaining
  644. ! type(Timer) t
  645. ! #ifdef M_TorqueDrag
  646. ! call OnTorqueDragMain%RunAll()
  647. ! #endif
  648. ! #ifdef S_TorqueDrag
  649. ! if(.not.TorqueDragStarted) then
  650. ! call OnTorqueDragStart%RunAll()
  651. ! TorqueDragStarted = .true.
  652. ! end if
  653. ! loop: do
  654. ! if(IsStopped) call ExitThread(0)
  655. ! do i=1, 10
  656. ! if(IsStopped) call ExitThread(0)
  657. ! call t%Start()
  658. ! do j=1, SimulationSpeed
  659. ! if(IsStopped) call ExitThread(0)
  660. ! call OnTorqueDragStep%RunAll()
  661. ! end do
  662. ! call t%Finish()
  663. ! elapsed = t%ElapsedTimeMs()
  664. ! remaining = 100 - elapsed
  665. ! #ifdef E_SpeedWatchdog
  666. ! if(elapsed > 100) call Error('Torque Drag Module: exceeding more than 100ms interval, the time was ', elapsed)
  667. ! #endif
  668. ! if(remaining > 0 .and. i < 10) call sleepqq(remaining - SleepLimit)
  669. ! call OnTorqueDragOutput%RunAll()
  670. ! end do
  671. ! call OnTorqueDragPause%RunAll()
  672. ! end do loop
  673. ! #endif
  674. ! TorqueDragThread = 0;
  675. ! call ExitThread(0)
  676. ! end function TorqueDragThread
  677. ! integer(4) function TopDriveThread(arg)
  678. ! !DEC$ ATTRIBUTES STDCALL, ALIAS:"_topdrivethread" :: TopDriveThread
  679. ! use ifport
  680. ! use ifmt
  681. ! implicit none
  682. ! integer(4), pointer :: arg
  683. ! integer i, j
  684. ! integer elapsed, speed, remaining
  685. ! type(Timer) t
  686. ! #ifdef M_TopDrive
  687. ! call OnTopDriveMain%RunAll()
  688. ! #endif
  689. ! #ifdef S_TopDrive
  690. ! if(.not.TopDriveStarted) then
  691. ! call OnTopDriveStart%RunAll()
  692. ! TopDriveStarted = .true.
  693. ! end if
  694. ! loop: do
  695. ! if(IsStopped) call ExitThread(0)
  696. ! do i=1, 10
  697. ! if(IsStopped) call ExitThread(0)
  698. ! call t%Start()
  699. ! do j=1, SimulationSpeed
  700. ! if(IsStopped) call ExitThread(0)
  701. ! call OnTopDriveStep%RunAll()
  702. ! end do
  703. ! call t%Finish()
  704. ! elapsed = t%ElapsedTimeMs()
  705. ! remaining = 100 - elapsed
  706. ! #ifdef E_SpeedWatchdog
  707. ! if(elapsed > 100) call Error('TopDrive Module: exceeding more than 100ms interval, the time was ', elapsed)
  708. ! #endif
  709. ! if(remaining > 0 .and. i < 10) call sleepqq(remaining - SleepLimit)
  710. ! call OnTopDriveOutput%RunAll()
  711. ! end do
  712. ! call OnTopDrivePause%RunAll()
  713. ! end do loop
  714. ! #endif
  715. ! TopDriveThread = 0;
  716. ! call ExitThread(0)
  717. ! end function TopDriveThread
  718. ! integer(4) function MudSystemThread(arg)
  719. ! !DEC$ ATTRIBUTES STDCALL, ALIAS:"_MudSystemthread" :: MudSystemThread
  720. ! use ifport
  721. ! use ifmt
  722. ! implicit none
  723. ! integer(4), pointer :: arg
  724. ! integer i, j
  725. ! integer elapsed, speed, remaining
  726. ! type(Timer) t
  727. ! #ifdef M_MudSystem
  728. ! call OnMudSystemMain%RunAll()
  729. ! #endif
  730. ! #ifdef S_MudSystem
  731. ! if(.not.MudSystemStarted) then
  732. ! call OnMudSystemStart%RunAll()
  733. ! MudSystemStarted = .true.
  734. ! end if
  735. ! loop: do
  736. ! if(IsStopped) call ExitThread(0)
  737. ! do i=1, 10
  738. ! if(IsStopped) call ExitThread(0)
  739. ! call t%Start()
  740. ! do j=1, SimulationSpeed
  741. ! if(IsStopped) call ExitThread(0)
  742. ! call OnMudSystemStep%RunAll()
  743. ! end do
  744. ! call t%Finish()
  745. ! elapsed = t%ElapsedTimeMs()
  746. ! remaining = 100 - elapsed
  747. ! #ifdef E_SpeedWatchdog
  748. ! if(elapsed > 100) call Error('Mud System Module: exceeding more than 100ms interval, the time was ', elapsed)
  749. ! #endif
  750. ! if(remaining > 0 .and. i < 10) call sleepqq(remaining - SleepLimit)
  751. ! call OnMudSystemOutput%RunAll()
  752. ! end do
  753. ! call OnMudSystemPause%RunAll()
  754. ! end do loop
  755. ! #endif
  756. ! MudSystemThread = 0;
  757. ! call ExitThread(0)
  758. ! end function MudSystemThread
  759. ! integer(4) function PipeRams1Thread(arg)
  760. ! !DEC$ ATTRIBUTES STDCALL, ALIAS:"_piperams1thread" :: PipeRams1Thread
  761. ! use ifport
  762. ! use ifmt
  763. ! implicit none
  764. ! integer(4), pointer :: arg
  765. ! integer i, j
  766. ! integer elapsed, speed, remaining
  767. ! type(Timer) t
  768. ! #ifdef M_PipeRams1
  769. ! call OnPipeRams1Main%RunAll()
  770. ! #endif
  771. ! #ifdef S_PipeRams1
  772. ! if(.not.PipeRams1Started) then
  773. ! call OnPipeRams1Start%RunAll()
  774. ! PipeRams1Started = .true.
  775. ! end if
  776. ! loop: do
  777. ! if(IsStopped) call ExitThread(0)
  778. ! do i=1, 10
  779. ! if(IsStopped) call ExitThread(0)
  780. ! call t%Start()
  781. ! do j=1, SimulationSpeed
  782. ! if(IsStopped) call ExitThread(0)
  783. ! call OnPipeRams1Step%RunAll()
  784. ! end do
  785. ! call t%Finish()
  786. ! elapsed = t%ElapsedTimeMs()
  787. ! remaining = 100 - elapsed
  788. ! #ifdef E_SpeedWatchdog
  789. ! if(elapsed > 100) call Error('Pipe Rams 1 Module: exceeding more than 100ms interval, the time was ', elapsed)
  790. ! #endif
  791. ! if(remaining > 0 .and. i < 10) call sleepqq(remaining - SleepLimit)
  792. ! call OnPipeRams1Output%RunAll()
  793. ! end do
  794. ! call OnPipeRams1Pause%RunAll()
  795. ! end do loop
  796. ! #endif
  797. ! PipeRams1Thread = 0;
  798. ! call ExitThread(0)
  799. ! end function PipeRams1Thread
  800. ! integer(4) function PipeRams2Thread(arg)
  801. ! !DEC$ ATTRIBUTES STDCALL, ALIAS:"_piperams2thread" :: PipeRams2Thread
  802. ! use ifport
  803. ! use ifmt
  804. ! implicit none
  805. ! integer(4), pointer :: arg
  806. ! integer i, j
  807. ! integer elapsed, speed, remaining
  808. ! type(Timer) t
  809. ! #ifdef M_PipeRams2
  810. ! call OnPipeRams2Main%RunAll()
  811. ! #endif
  812. ! #ifdef S_PipeRams2
  813. ! if(.not.PipeRams2Started) then
  814. ! call OnPipeRams2Start%RunAll()
  815. ! PipeRams2Started = .true.
  816. ! end if
  817. ! loop: do
  818. ! if(IsStopped) call ExitThread(0)
  819. ! do i=1, 10
  820. ! if(IsStopped) call ExitThread(0)
  821. ! call t%Start()
  822. ! do j=1, SimulationSpeed
  823. ! if(IsStopped) call ExitThread(0)
  824. ! call OnPipeRams2Step%RunAll()
  825. ! end do
  826. ! call t%Finish()
  827. ! elapsed = t%ElapsedTimeMs()
  828. ! remaining = 100 - elapsed
  829. ! #ifdef E_SpeedWatchdog
  830. ! if(elapsed > 100) call Error('Pipe Rams 2 Module: exceeding more than 100ms interval, the time was ', elapsed)
  831. ! #endif
  832. ! if(remaining > 0 .and. i < 10) call sleepqq(remaining - SleepLimit)
  833. ! call OnPipeRams2Output%RunAll()
  834. ! end do
  835. ! call OnPipeRams2Pause%RunAll()
  836. ! end do loop
  837. ! #endif
  838. ! PipeRams2Thread = 0;
  839. ! call ExitThread(0)
  840. ! end function PipeRams2Thread
  841. ! integer(4) function KillLineThread(arg)
  842. ! !DEC$ ATTRIBUTES STDCALL, ALIAS:"_killlinethread" :: KillLineThread
  843. ! use ifport
  844. ! use ifmt
  845. ! implicit none
  846. ! integer(4), pointer :: arg
  847. ! integer i, j
  848. ! integer elapsed, speed, remaining
  849. ! type(Timer) t
  850. ! #ifdef M_KillLine
  851. ! call OnKillLineMain%RunAll()
  852. ! #endif
  853. ! #ifdef S_KillLine
  854. ! if(.not.KillLineStarted) then
  855. ! call OnKillLineStart%RunAll()
  856. ! KillLineStarted = .true.
  857. ! end if
  858. ! loop: do
  859. ! if(IsStopped) call ExitThread(0)
  860. ! do i=1, 10
  861. ! if(IsStopped) call ExitThread(0)
  862. ! call t%Start()
  863. ! do j=1, SimulationSpeed
  864. ! if(IsStopped) call ExitThread(0)
  865. ! call OnKillLineStep%RunAll()
  866. ! end do
  867. ! call t%Finish()
  868. ! elapsed = t%ElapsedTimeMs()
  869. ! remaining = 100 - elapsed
  870. ! #ifdef E_SpeedWatchdog
  871. ! if(elapsed > 100) call Error('Kill Line Module: exceeding more than 100ms interval, the time was ', elapsed)
  872. ! #endif
  873. ! if(remaining > 0 .and. i < 10) call sleepqq(remaining - SleepLimit)
  874. ! call OnKillLineOutput%RunAll()
  875. ! end do
  876. ! call OnKillLinePause%RunAll()
  877. ! end do loop
  878. ! #endif
  879. ! KillLineThread = 0;
  880. ! call ExitThread(0)
  881. ! end function KillLineThread
  882. ! integer(4) function ChokeLineThread(arg)
  883. ! !DEC$ ATTRIBUTES STDCALL, ALIAS:"_chokelinethread" :: ChokeLineThread
  884. ! use ifport
  885. ! use ifmt
  886. ! implicit none
  887. ! integer(4), pointer :: arg
  888. ! integer i, j
  889. ! integer elapsed, speed, remaining
  890. ! type(Timer) t
  891. ! #ifdef M_ChokeLine
  892. ! call OnChokeLineMain%RunAll()
  893. ! #endif
  894. ! #ifdef S_ChokeLine
  895. ! if(.not.ChokeLineStarted) then
  896. ! call OnChokeLineStart%RunAll()
  897. ! ChokeLineStarted = .true.
  898. ! end if
  899. ! loop: do
  900. ! if(IsStopped) call ExitThread(0)
  901. ! do i=1, 10
  902. ! if(IsStopped) call ExitThread(0)
  903. ! call t%Start()
  904. ! do j=1, SimulationSpeed
  905. ! if(IsStopped) call ExitThread(0)
  906. ! call OnChokeLineStep%RunAll()
  907. ! end do
  908. ! call t%Finish()
  909. ! elapsed = t%ElapsedTimeMs()
  910. ! remaining = 100 - elapsed
  911. ! #ifdef E_SpeedWatchdog
  912. ! if(elapsed > 100) call Error('Choke Line Module: exceeding more than 100ms interval, the time was ', elapsed)
  913. ! #endif
  914. ! if(remaining > 0 .and. i < 10) call sleepqq(remaining - SleepLimit)
  915. ! call OnChokeLineOutput%RunAll()
  916. ! end do
  917. ! call OnChokeLinePause%RunAll()
  918. ! end do loop
  919. ! #endif
  920. ! ChokeLineThread = 0;
  921. ! call ExitThread(0)
  922. ! end function ChokeLineThread
  923. ! integer(4) function BlindRamsThread(arg)
  924. ! !DEC$ ATTRIBUTES STDCALL, ALIAS:"_blindramsthread" :: BlindRamsThread
  925. ! use ifport
  926. ! use ifmt
  927. ! implicit none
  928. ! integer(4), pointer :: arg
  929. ! integer i, j
  930. ! integer elapsed, speed, remaining
  931. ! type(Timer) t
  932. ! #ifdef M_BlindRams
  933. ! call OnBlindRamsMain%RunAll()
  934. ! #endif
  935. ! #ifdef S_BlindRams
  936. ! if(.not.BlindRamsStarted) then
  937. ! call OnBlindRamsStart%RunAll()
  938. ! BlindRamsStarted = .true.
  939. ! end if
  940. ! loop: do
  941. ! if(IsStopped) call ExitThread(0)
  942. ! do i=1, 10
  943. ! if(IsStopped) call ExitThread(0)
  944. ! call t%Start()
  945. ! do j=1, SimulationSpeed
  946. ! if(IsStopped) call ExitThread(0)
  947. ! call OnBlindRamsStep%RunAll()
  948. ! end do
  949. ! call t%Finish()
  950. ! elapsed = t%ElapsedTimeMs()
  951. ! remaining = 100 - elapsed
  952. ! #ifdef E_SpeedWatchdog
  953. ! if(elapsed > 100) call Error('Blind Rams Module: exceeding more than 100ms interval, the time was ', elapsed)
  954. ! #endif
  955. ! if(remaining > 0 .and. i < 10) call sleepqq(remaining - SleepLimit)
  956. ! call OnBlindRamsOutput%RunAll()
  957. ! end do
  958. ! call OnBlindRamsPause%RunAll()
  959. ! end do loop
  960. ! #endif
  961. ! BlindRamsThread = 0;
  962. ! call ExitThread(0)
  963. ! end function BlindRamsThread
  964. ! integer(4) function AnnularThread(arg)
  965. ! !DEC$ ATTRIBUTES STDCALL, ALIAS:"_annularthread" :: AnnularThread
  966. ! use ifport
  967. ! use ifmt
  968. ! implicit none
  969. ! integer(4), pointer :: arg
  970. ! integer i, j
  971. ! integer elapsed, speed, remaining
  972. ! type(Timer) t
  973. ! #ifdef M_Annular
  974. ! call OnAnnularMain%RunAll()
  975. ! #endif
  976. ! #ifdef S_Annular
  977. ! if(.not.AnnularStarted) then
  978. ! call OnAnnularStart%RunAll()
  979. ! AnnularStarted = .true.
  980. ! end if
  981. ! loop: do
  982. ! if(IsStopped) call ExitThread(0)
  983. ! do i=1, 10
  984. ! if(IsStopped) call ExitThread(0)
  985. ! call t%Start()
  986. ! do j=1, SimulationSpeed
  987. ! if(IsStopped) call ExitThread(0)
  988. ! call OnAnnularStep%RunAll()
  989. ! end do
  990. ! call t%Finish()
  991. ! elapsed = t%ElapsedTimeMs()
  992. ! remaining = 100 - elapsed
  993. ! #ifdef E_SpeedWatchdog
  994. ! if(elapsed > 100) call Error('Annular Module: exceeding more than 100ms interval, the time was ', elapsed)
  995. ! #endif
  996. ! if(remaining > 0 .and. i < 10) call sleepqq(remaining - SleepLimit)
  997. ! call OnAnnularOutput%RunAll()
  998. ! end do
  999. ! call OnAnnularPause%RunAll()
  1000. ! end do loop
  1001. ! #endif
  1002. ! AnnularThread = 0;
  1003. ! call ExitThread(0)
  1004. ! end function AnnularThread
  1005. ! integer(4) function GeoThread(arg)
  1006. ! !DEC$ ATTRIBUTES STDCALL, ALIAS:"_geothread" :: GeoThread
  1007. ! use ifport
  1008. ! use ifmt
  1009. ! implicit none
  1010. ! integer(4), pointer :: arg
  1011. ! integer i, j
  1012. ! integer elapsed, speed, remaining
  1013. ! type(Timer) t
  1014. ! #ifdef M_Geo
  1015. ! call OnGeoMain%RunAll()
  1016. ! #endif
  1017. ! #ifdef S_Geo
  1018. ! if(.not.GeoStarted) then
  1019. ! call OnGeoStart%RunAll()
  1020. ! GeoStarted = .true.
  1021. ! end if
  1022. ! loop: do
  1023. ! if(IsStopped) call ExitThread(0)
  1024. ! do i=1, 10
  1025. ! if(IsStopped) call ExitThread(0)
  1026. ! call t%Start()
  1027. ! do j=1, SimulationSpeed
  1028. ! if(IsStopped) call ExitThread(0)
  1029. ! call OnGeoStep%RunAll()
  1030. ! end do
  1031. ! call t%Finish()
  1032. ! elapsed = t%ElapsedTimeMs()
  1033. ! remaining = 100 - elapsed
  1034. ! #ifdef E_SpeedWatchdog
  1035. ! if(elapsed > 100) call Error('Geo Module: exceeding more than 100ms interval, the time was ', elapsed)
  1036. ! #endif
  1037. ! if(remaining > 0 .and. i < 10) call sleepqq(remaining - SleepLimit)
  1038. ! call OnGeoOutput%RunAll()
  1039. ! end do
  1040. ! call OnGeoPause%RunAll()
  1041. ! end do loop
  1042. ! #endif
  1043. ! GeoThread = 0;
  1044. ! call ExitThread(0)
  1045. ! end function GeoThread
  1046. ! integer(4) function OperationScenariosThread(arg)
  1047. ! !DEC$ ATTRIBUTES STDCALL, ALIAS:"_operationscenariosthread" :: OperationScenariosThread
  1048. ! use ifport
  1049. ! use ifmt
  1050. ! implicit none
  1051. ! integer(4), pointer :: arg
  1052. ! call OnOperationScenariosMain%RunAll()
  1053. ! OperationScenariosThread = 0;
  1054. ! call ExitThread(0)
  1055. ! end function OperationScenariosThread
  1056. ! integer(4) function PathFindingThread(arg)
  1057. ! !DEC$ ATTRIBUTES STDCALL, ALIAS:"_pathfindingthread" :: PathFindingThread
  1058. ! use ifport
  1059. ! use ifmt
  1060. ! implicit none
  1061. ! integer(4), pointer :: arg
  1062. ! call OnPathFindingMain%RunAll()
  1063. ! PathFindingThread = 0;
  1064. ! call ExitThread(0)
  1065. ! end function PathFindingThread
  1066. ! integer(4) function SampleThread(arg)
  1067. ! !DEC$ ATTRIBUTES STDCALL, ALIAS:"_samplethread" :: SampleThread
  1068. ! use ifport
  1069. ! use ifmt
  1070. ! implicit none
  1071. ! integer(4), pointer :: arg
  1072. ! integer i, j
  1073. ! integer elapsed, speed, remaining
  1074. ! type(Timer) t
  1075. ! #ifdef M_Sample
  1076. ! call OnSampleMain%RunAll()
  1077. ! #endif
  1078. ! #ifdef S_Sample
  1079. ! if(.not.SampleStarted) then
  1080. ! call OnSampleStart%RunAll()
  1081. ! SampleStarted = .true.
  1082. ! end if
  1083. ! loop: do
  1084. ! if(IsStopped) call ExitThread(0)
  1085. ! do i=1, 10
  1086. ! if(IsStopped) call ExitThread(0)
  1087. ! call t%Start()
  1088. ! do j=1, SimulationSpeed
  1089. ! if(IsStopped) call ExitThread(0)
  1090. ! call OnSampleStep%RunAll()
  1091. ! end do
  1092. ! call t%Finish()
  1093. ! elapsed = t%ElapsedTimeMs()
  1094. ! remaining = 100 - elapsed
  1095. ! #ifdef E_SpeedWatchdog
  1096. ! if(elapsed > 100) call Error('Sample Module: exceeding more than 100ms interval, the time was ', elapsed)
  1097. ! #endif
  1098. ! if(remaining > 0 .and. i < 10) call sleepqq(remaining - SleepLimit)
  1099. ! call OnSampleOutput%RunAll()
  1100. ! end do
  1101. ! call OnSamplePause%RunAll()
  1102. ! end do loop
  1103. ! #endif
  1104. ! SampleThread = 0;
  1105. ! call ExitThread(0)
  1106. ! end function SampleThread
  1107. end module CSimulationVariables