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.
 
 
 
 
 
 

482 lines
13 KiB

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