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.

UnitySignalsVariables.f90 14 KiB

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