Simulation Core
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

UnitySignals.f90 14 KiB

vor 1 Jahr
vor 1 Jahr
vor 1 Jahr
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. module UnitySignalsModule
  2. use UnitySignalVariables
  3. use SimulationVariables
  4. contains
  5. subroutine Set_TdsElevatorModes(v)
  6. implicit none
  7. integer , intent(in) :: v
  8. #ifdef ExcludeExtraChanges
  9. if(data%State%unitySignals%TdsElevatorModes == v) return
  10. #endif
  11. data%State%unitySignals%TdsElevatorModes = v
  12. !**call TdsElevatorModesEnum%OnTdsElevatorModesChange%RunAll()
  13. end subroutine
  14. integer function Get_TdsElevatorModes()
  15. implicit none
  16. Get_TdsElevatorModes = data%State%unitySignals%TdsElevatorModes
  17. end function
  18. subroutine Set_Ibop_Install()
  19. implicit none
  20. call Set_Ibop(IBOP_INSTALL)
  21. end subroutine
  22. subroutine Set_Ibop_Remove()
  23. implicit none
  24. call Set_Ibop(IBOP_REMOVE)
  25. end subroutine
  26. subroutine Set_Tong(v)
  27. implicit none
  28. integer , intent(in) :: v
  29. #ifdef ExcludeExtraChanges
  30. if(data%State%unitySignals%Tong == v) return
  31. #endif
  32. data%State%unitySignals%Tong = v
  33. #ifdef deb
  34. print*, 'Tong=', data%State%unitySignals%Tong
  35. #endif
  36. !**call data%State%unitySignals%OnTongChange%RunAll()
  37. end subroutine
  38. integer function Get_Tong()
  39. implicit none
  40. Get_Tong = data%State%unitySignals%Tong
  41. end function
  42. subroutine Set_TdsTong(v)
  43. implicit none
  44. integer , intent(in) :: v
  45. #ifdef ExcludeExtraChanges
  46. if(data%State%unitySignals%TdsTong == v) return
  47. #endif
  48. data%State%unitySignals%TdsTong = v
  49. #ifdef deb
  50. print*, 'TdsTong=', data%State%unitySignals%TdsTong
  51. #endif
  52. !**call data%State%unitySignals%OnTdsTongChange%RunAll()
  53. end subroutine
  54. integer function Get_TdsTong()
  55. implicit none
  56. Get_TdsTong = data%State%unitySignals%TdsTong
  57. end function
  58. subroutine Set_TdsSwing(v)
  59. implicit none
  60. integer , intent(in) :: v
  61. #ifdef ExcludeExtraChanges
  62. if(data%State%unitySignals%TdsSwing == v) return
  63. #endif
  64. data%State%unitySignals%TdsSwing = v
  65. #ifdef deb
  66. print*, 'TdsSwing=', data%State%unitySignals%TdsSwing
  67. #endif
  68. !**call data%State%unitySignals%OnTdsSwingChange%RunAll()
  69. end subroutine
  70. integer function Get_TdsSwing()
  71. implicit none
  72. Get_TdsSwing = data%State%unitySignals%TdsSwing
  73. end function
  74. subroutine Set_TdsSpine(v)
  75. implicit none
  76. integer , intent(in) :: v
  77. #ifdef ExcludeExtraChanges
  78. if(data%State%unitySignals%TdsSpine == v) return
  79. #endif
  80. data%State%unitySignals%TdsSpine = v
  81. #ifdef deb
  82. print*, 'TdsSpine=', data%State%unitySignals%TdsSpine
  83. #endif
  84. !**call data%State%unitySignals%OnTdsSpineChange%RunAll()
  85. end subroutine
  86. integer function Get_TdsSpine()
  87. implicit none
  88. Get_TdsSpine = data%State%unitySignals%TdsSpine
  89. end function
  90. subroutine Set_TdsBackupClamp(v)
  91. implicit none
  92. integer , intent(in) :: v
  93. #ifdef ExcludeExtraChanges
  94. if(data%State%unitySignals%TdsBackupClamp == v) return
  95. #endif
  96. data%State%unitySignals%TdsBackupClamp = v
  97. #ifdef deb
  98. print*, 'TdsBackupClamp=', data%State%unitySignals%TdsBackupClamp
  99. #endif
  100. !**call data%State%unitySignals%OnTdsBackupClampChange%RunAll()
  101. end subroutine
  102. integer function Get_TdsBackupClamp()
  103. implicit none
  104. Get_TdsBackupClamp = data%State%unitySignals%TdsBackupClamp
  105. end function
  106. subroutine Set_Swing(v)
  107. implicit none
  108. integer , intent(in) :: v
  109. #ifdef ExcludeExtraChanges
  110. if(data%State%unitySignals%Swing == v) return
  111. #endif
  112. data%State%unitySignals%Swing = v
  113. #ifdef deb
  114. print*, 'Swing=', data%State%unitySignals%Swing
  115. #endif
  116. !**call data%State%unitySignals%OnSwingChange%RunAll()
  117. end subroutine
  118. integer function Get_Swing()
  119. implicit none
  120. Get_Swing = data%State%unitySignals%Swing
  121. end function
  122. subroutine Set_Slips(v)
  123. implicit none
  124. integer , intent(in) :: v
  125. #ifdef ExcludeExtraChanges
  126. if(data%State%unitySignals%Slips == v) return
  127. #endif
  128. data%State%unitySignals%Slips = v
  129. #ifdef deb
  130. print*, 'Slips=', data%State%unitySignals%Slips
  131. #endif
  132. !**call data%State%unitySignals%OnSlipsChange%RunAll()
  133. end subroutine
  134. integer function Get_Slips()
  135. implicit none
  136. Get_Slips = data%State%unitySignals%Slips
  137. end function
  138. subroutine Set_Operation(i)
  139. implicit none
  140. integer, intent (in) :: i
  141. data%State%unitySignals%operation = i
  142. end subroutine
  143. subroutine Set_SafetyValve(v)
  144. implicit none
  145. integer , intent(in) :: v
  146. #ifdef ExcludeExtraChanges
  147. if(data%State%unitySignals%SafetyValve == v) return
  148. #endif
  149. data%State%unitySignals%SafetyValve = v
  150. #ifdef deb
  151. if(data%State%unitySignals%SafetyValve == SAFETY_VALVE_NEUTRAL) then
  152. print*, 'SafetyValve=SAFETY_VALVE_NEUTRAL'
  153. else if (data%State%unitySignals%SafetyValve == SAFETY_VALVE_INSTALL) then
  154. print*, 'SafetyValve=SAFETY_VALVE_INSTALL'
  155. else if (data%State%unitySignals%SafetyValve == SAFETY_VALVE_INSTALL) then
  156. print*, 'SafetyValve=SAFETY_VALVE_REMOVE'
  157. endif
  158. #endif
  159. !**call data%State%unitySignals%OnSafetyValveChange%RunAll()
  160. end subroutine
  161. integer function Get_SafetyValve()
  162. implicit none
  163. Get_SafetyValve = data%State%unitySignals%SafetyValve
  164. end function
  165. subroutine Set_SafetyValve_Install()
  166. implicit none
  167. call Set_SafetyValve(SAFETY_VALVE_INSTALL)
  168. end subroutine
  169. subroutine Set_SafetyValve_Remove()
  170. implicit none
  171. call Set_SafetyValve(SAFETY_VALVE_REMOVE)
  172. end subroutine
  173. subroutine Set_OperationCondition(v)
  174. ! use CKellyEnumVariables
  175. implicit none
  176. integer , intent(in) :: v
  177. #ifdef ExcludeExtraChanges
  178. if(data%State%unitySignals%OperationCondition == v) return
  179. #endif
  180. data%State%unitySignals%OperationCondition = v
  181. #ifdef deb
  182. print*, 'OperationCondition=', data%State%unitySignals%OperationCondition
  183. #endif
  184. !**call data%State%unitySignals%OnOperationConditionChange%RunAll()
  185. !**call data%State%unitySignals%OnOperationConditionChangeInt%RunAll(data%State%unitySignals%OperationCondition)
  186. end subroutine
  187. integer function Get_OperationCondition()
  188. implicit none
  189. Get_OperationCondition = data%State%unitySignals%OperationCondition
  190. end function
  191. subroutine Evaluate_OperationCondition()
  192. implicit none
  193. end subroutine
  194. subroutine Set_MouseHole(v)
  195. implicit none
  196. integer , intent(in) :: v
  197. #ifdef ExcludeExtraChanges
  198. if(data%State%unitySignals%MouseHole == v) return
  199. #endif
  200. !call sleep(2)
  201. data%State%unitySignals%MouseHole = v
  202. #ifdef deb
  203. print*, 'MouseHole=', data%State%unitySignals%MouseHole
  204. #endif
  205. !**call data%State%unitySignals%OnMouseHoleChange%RunAll()
  206. end subroutine
  207. integer function Get_MouseHole()
  208. implicit none
  209. Get_MouseHole = data%State%unitySignals%MouseHole
  210. end function
  211. subroutine Set_Kelly(v)
  212. implicit none
  213. integer , intent(in) :: v
  214. #ifdef ExcludeExtraChanges
  215. if(data%State%unitySignals%Kelly == v) return
  216. #endif
  217. data%State%unitySignals%Kelly = v
  218. #ifdef deb
  219. print*, 'Kelly=', data%State%unitySignals%Kelly
  220. #endif
  221. !**call data%State%unitySignals%OnKellyChange%RunAll()
  222. end subroutine
  223. integer function Get_Kelly()
  224. implicit none
  225. Get_Kelly = data%State%unitySignals%Kelly
  226. end function
  227. subroutine Set_Ibop(v)
  228. implicit none
  229. integer , intent(in) :: v
  230. #ifdef ExcludeExtraChanges
  231. if(data%State%unitySignals%Ibop == v) return
  232. #endif
  233. data%State%unitySignals%Ibop = v
  234. #ifdef deb
  235. print*, 'Ibop=', data%State%unitySignals%Ibop
  236. #endif
  237. !**call data%State%unitySignals%OnIbopChange%RunAll()
  238. end subroutine
  239. integer function Get_Ibop()
  240. implicit none
  241. Get_Ibop = data%State%unitySignals%Ibop
  242. end function
  243. subroutine Set_FillupHead(v)
  244. use CManifolds, only: ToggleFillupHead
  245. implicit none
  246. integer , intent(in) :: v
  247. #ifdef ExcludeExtraChanges
  248. if(data%State%unitySignals%FillupHead == v) return
  249. #endif
  250. data%State%unitySignals%FillupHead = v
  251. if (data%State%unitySignals%FillupHead == FILLUP_HEAD_INSTALL) then
  252. call ToggleFillupHead(.true.)
  253. else if (data%State%unitySignals%FillupHead == FILLUP_HEAD_REMOVE) then
  254. call ToggleFillupHead(.false.)
  255. endif
  256. #ifdef deb
  257. print*, 'FillupHead=', data%State%unitySignals%FillupHead
  258. #endif
  259. !**call data%State%unitySignals%OnFillupHeadChange%RunAll()
  260. end subroutine
  261. integer function Get_FillupHead()
  262. implicit none
  263. Get_FillupHead = data%State%unitySignals%FillupHead
  264. end function
  265. subroutine Evaluate_FillupHead()
  266. use CHoistingVariables
  267. use SimulationVariables
  268. use CStudentStationVariables!, only: data%State%StudentStation%FillupHeadInstallation
  269. implicit none
  270. if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then
  271. #ifdef OST
  272. print*, 'Evaluate_FillupHead=TopDrive'
  273. #endif
  274. endif
  275. if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then
  276. #ifdef OST
  277. print*, 'Evaluate_FillupHead=Kelly'
  278. #endif
  279. endif
  280. if (Get_FillupHead() == FILLUP_HEAD_INSTALL) then
  281. data%State%StudentStation%FillupHeadInstallation = .true.
  282. else if (Get_FillupHead() == FILLUP_HEAD_REMOVE) then
  283. data%State%StudentStation%FillupHeadInstallation = .false.
  284. endif
  285. end subroutine
  286. subroutine Set_Elevator(v)
  287. implicit none
  288. integer , intent(in) :: v
  289. #ifdef ExcludeExtraChanges
  290. if(data%State%unitySignals%Elevator == v) return
  291. #endif
  292. data%State%unitySignals%Elevator = v
  293. #ifdef deb
  294. print*, 'Elevator=', data%State%unitySignals%Elevator
  295. #endif
  296. !**call data%State%unitySignals%OnElevatorChange%RunAll()
  297. end subroutine
  298. integer function Get_Elevator()
  299. implicit none
  300. Get_Elevator = data%State%unitySignals%Elevator
  301. end function
  302. subroutine Set_MudBucket(v)
  303. use CManifolds, only: ToggleMudBox
  304. implicit none
  305. integer , intent(in) :: v
  306. #ifdef ExcludeExtraChanges
  307. if(data%State%unitySignals%MudBucket == v) return
  308. #endif
  309. data%State%unitySignals%MudBucket = v
  310. if (data%State%unitySignals%MudBucket == MUD_BUCKET_INSTALL) then
  311. call ToggleMudBox(.true.)
  312. else if (data%State%unitySignals%MudBucket == MUD_BUCKET_REMOVE) then
  313. call ToggleMudBox(.false.)
  314. endif
  315. #ifdef deb
  316. print*, 'MudBucket=', data%State%unitySignals%MudBucket
  317. #endif
  318. !**call data%State%unitySignals%OnMudBucketChange%RunAll()
  319. end subroutine
  320. integer function Get_MudBucket()
  321. implicit none
  322. Get_MudBucket = data%State%unitySignals%MudBucket
  323. end function
  324. subroutine Evaluate_MudBucket()
  325. use CStudentStationVariables!, only: data%State%StudentStation%MudBoxInstallation
  326. implicit none
  327. if (Get_MudBucket() == MUD_BUCKET_INSTALL) then
  328. data%State%StudentStation%MudBoxInstallation = .true.
  329. else if (Get_MudBucket() == MUD_BUCKET_REMOVE) then
  330. data%State%StudentStation%MudBoxInstallation = .false.
  331. endif
  332. end subroutine
  333. !! Moved from CTdsConnectionModeEnum
  334. subroutine Set_TdsConnectionModes(v)
  335. use CManifolds, Only: KellyConnected, KellyDisconnected
  336. implicit none
  337. integer , intent(in) :: v
  338. #ifdef ExcludeExtraChanges
  339. if(data%State%unitySignals%TdsConnectionModes == v) return
  340. #endif
  341. data%State%unitySignals%TdsConnectionModes = v
  342. if(data%State%unitySignals%TdsConnectionModes == TDS_CONNECTION_NOTHING) then
  343. call KellyDisconnected()
  344. else
  345. call KellyConnected()
  346. endif
  347. #ifdef deb
  348. print*, 'data%State%unitySignals%TdsConnectionModes=', data%State%unitySignals%TdsConnectionModes
  349. #endif
  350. !**call data%State%unitySignals%OnTdsConnectionModesChange%RunAll()
  351. end subroutine
  352. integer function Get_TdsConnectionModes()
  353. use SimulationVariables
  354. implicit none
  355. Get_TdsConnectionModes = data%State%unitySignals%TdsConnectionModes
  356. end function
  357. subroutine Evaluate_TdsConnectionModes()
  358. use CUnityInputs
  359. use SimulationVariables
  360. use UnityModule
  361. implicit none
  362. if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then
  363. #ifdef OST
  364. print*, 'Evaluate_TdsConnectionModes=TopDrive'
  365. #endif
  366. !TOPDRIVE-CODE=3
  367. if (Get_TdsStemIn() .and.&
  368. Get_TdsSpine() == TDS_SPINE_CONNECT_END .and.&
  369. !TopDriveDrillTorqueState == TdsMu_SPINE
  370. Get_TdsConnectionModes() == TDS_CONNECTION_NOTHING) then
  371. call Set_TdsConnectionModes(TDS_CONNECTION_SPINE)
  372. return
  373. end if
  374. !TOPDRIVE-CODE=4
  375. if (Get_TdsTong() == TDS_TONG_MAKEUP_END .and.&
  376. Get_TdsConnectionModes() == TDS_CONNECTION_SPINE ) then
  377. call Set_TdsConnectionModes(TDS_CONNECTION_STRING)
  378. data%Equipments%TopDrivePanel%TopDriveTorqueWrenchLed = LED_OFF
  379. return
  380. end if
  381. !TOPDRIVE-CODE=5
  382. if (Get_TdsTong() == TDS_TONG_BREAKOUT_END .and.&
  383. Get_TdsConnectionModes() == TDS_CONNECTION_STRING ) then
  384. call Set_TdsConnectionModes(TDS_CONNECTION_SPINE)
  385. data%Equipments%TopDrivePanel%TopDriveTorqueWrenchLed = LED_OFF
  386. return
  387. end if
  388. !TOPDRIVE-CODE=6
  389. if (Get_TdsSpine() == TDS_SPINE_DISCONNECT_END .and.&
  390. !Get_TdsStemIn() == .false. .and.&
  391. Get_TdsConnectionModes() == TDS_CONNECTION_SPINE) then
  392. call Set_TdsConnectionModes(TDS_CONNECTION_NOTHING)
  393. return
  394. end if
  395. endif
  396. if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then
  397. #ifdef OST
  398. print*, 'Evaluate_TdsConnectionModes=Kelly'
  399. #endif
  400. endif
  401. end subroutine
  402. end module UnitySignalsModule