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.
 
 
 
 
 
 

480 lines
13 KiB

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