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.
 
 
 
 
 
 

409 lines
17 KiB

  1. module NotificationModule
  2. use SimulationVariables
  3. implicit none
  4. contains
  5. subroutine Set_UnlatchLed(v)
  6. use CDrillingConsoleVariables
  7. use SimulationVariables
  8. !use CLatchLedNotification
  9. implicit none
  10. logical , intent(in) :: v
  11. #ifdef ExcludeExtraChanges
  12. if(data%State%notifications%UnlatchLed == v) return
  13. #endif
  14. data%State%notifications%UnlatchLed = v
  15. if(data%State%notifications%UnlatchLed) then
  16. data%EquipmentControl%DrillingConsole%UnlatchPipeLED = 1
  17. !call Set_LatchLed(.false.)
  18. else
  19. data%EquipmentControl%DrillingConsole%UnlatchPipeLED = 0
  20. endif
  21. !**call data%State%notifications%OnUnlatchLedChange%RunAll()
  22. end subroutine
  23. logical function Get_UnlatchLed()
  24. implicit none
  25. Get_UnlatchLed = data%State%notifications%UnlatchLed
  26. end function
  27. subroutine Set_TongNotification(v)
  28. implicit none
  29. logical , intent(in) :: v
  30. #ifdef ExcludeExtraChanges
  31. if(data%State%notifications%TongNotification == v) return
  32. #endif
  33. data%State%notifications%TongNotification = v
  34. ! if(associated(data%State%notifications%TongNotificationPtr)) !**call data%State%notifications%TongNotificationPtr(data%State%notifications%TongNotification)
  35. #ifdef deb
  36. print*, 'data%State%notifications%TongNotification=', data%State%notifications%TongNotification
  37. #endif
  38. !**call data%State%notifications%OnTongNotificationChange%RunAll()
  39. end subroutine
  40. logical function Get_TongNotification()
  41. implicit none
  42. Get_TongNotification = data%State%notifications%TongNotification
  43. end function
  44. subroutine Set_TorqueWrenchLed(v)
  45. use CTopDrivePanelVariables
  46. use SimulationVariables!, only: data%EquipmentControl%TopDrivePanel%TopDriveTorqueWrenchLed
  47. implicit none
  48. integer , intent(in) :: v
  49. #ifdef ExcludeExtraChanges
  50. if(data%State%notifications%TorqueWrenchLed == v) return
  51. #endif
  52. data%State%notifications%TorqueWrenchLed = v
  53. data%EquipmentControl%TopDrivePanel%TopDriveTorqueWrenchLed = v
  54. !**call data%State%notifications%OnTorqueWrenchLedChange%RunAll()
  55. end subroutine
  56. logical function Get_TorqueWrenchLed()
  57. implicit none
  58. Get_TorqueWrenchLed = data%State%notifications%TorqueWrenchLed
  59. end function
  60. subroutine Set_PowerLed(v)
  61. use CTopDrivePanelVariables
  62. use SimulationVariables!, only: data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerLed
  63. !use CLatchLedNotification
  64. implicit none
  65. logical , intent(in) :: v
  66. #ifdef ExcludeExtraChanges
  67. if(data%State%notifications%PowerLed == v) return
  68. #endif
  69. data%State%notifications%PowerLed = v
  70. if(data%State%notifications%PowerLed) then
  71. data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerLed = 1
  72. !call Set_LatchLed(.false.)
  73. else
  74. data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerLed = 0
  75. endif
  76. !**call data%State%notifications%OnPowerLedChange%RunAll()
  77. end subroutine
  78. logical function Get_PowerLed()
  79. implicit none
  80. Get_PowerLed = data%State%notifications%PowerLed
  81. end function
  82. subroutine Set_IbopLed(v)
  83. use CTopDrivePanelVariables
  84. use SimulationVariables!, only: data%EquipmentControl%TopDrivePanel%TopDriveIbopLed
  85. use CManifolds, Only: OpenTopDriveIBop, CloseTopDriveIBop
  86. !use CLatchLedNotification
  87. implicit none
  88. logical , intent(in) :: v
  89. #ifdef ExcludeExtraChanges
  90. if(data%State%notifications%IbopLed == v) return
  91. #endif
  92. data%State%notifications%IbopLed = v
  93. if(data%State%notifications%IbopLed) then
  94. data%EquipmentControl%TopDrivePanel%TopDriveIbopLed = 1
  95. call CloseTopDriveIBop()
  96. else
  97. data%EquipmentControl%TopDrivePanel%TopDriveIbopLed = 0
  98. call OpenTopDriveIBop()
  99. endif
  100. !**call data%State%notifications%OnIbopLedChange%RunAll()
  101. end subroutine
  102. logical function Get_IbopLed()
  103. implicit none
  104. Get_IbopLed = data%State%notifications%IbopLed
  105. end function
  106. subroutine Set_SwingLed(v)
  107. use CDrillingConsoleVariables
  108. use SimulationVariables
  109. use SimulationVariables!, only: SwingLedHw => SwingLed
  110. implicit none
  111. logical , intent(in) :: v
  112. #ifdef ExcludeExtraChanges
  113. if(data%State%notifications%SwingLed == v) return
  114. #endif
  115. data%State%notifications%SwingLed = v
  116. if(data%State%notifications%SwingLed) then
  117. data%EquipmentControl%DrillingConsole%SwingLed = 1
  118. else
  119. data%EquipmentControl%DrillingConsole%SwingLed = 0
  120. endif
  121. !**call data%State%notifications%OnSwingLedChange%RunAll()
  122. end subroutine
  123. logical function Get_SwingLed()
  124. implicit none
  125. Get_SwingLed = data%State%notifications%SwingLed
  126. end function
  127. subroutine Set_SlipsNotification(v)
  128. implicit none
  129. logical , intent(in) :: v
  130. #ifdef ExcludeExtraChanges
  131. if(data%State%notifications%SlipsNotification == v) return
  132. #endif
  133. data%State%notifications%SlipsNotification = v
  134. ! if(associated(data%State%notifications%SlipsNotificationPtr)) !**call data%State%notifications%SlipsNotificationPtr(data%State%notifications%SlipsNotification)
  135. #ifdef deb
  136. print*, 'data%State%notifications%SlipsNotification=', data%State%notifications%SlipsNotification
  137. #endif
  138. !**call data%State%notifications%OnSlipsNotificationChange%RunAll()
  139. end subroutine
  140. logical function Get_SlipsNotification()
  141. implicit none
  142. Get_SlipsNotification = data%State%notifications%SlipsNotification
  143. end function
  144. subroutine Set_OpenSafetyValveLed(v)
  145. use CDrillingConsoleVariables
  146. use SimulationVariables
  147. use SimulationVariables!, only: OpenSafetyValveLedHw => OpenSafetyValveLed
  148. use CManifolds, only: OpenSafetyValve_TopDrive, OpenSafetyValve_KellyMode, OpenSafetyValve_TripMode
  149. use CHoistingVariables
  150. use SimulationVariables!, only: data%Configuration%Hoisting%DriveType, TopDrive_DriveType, Kelly_DriveType
  151. implicit none
  152. logical , intent(in) :: v
  153. #ifdef ExcludeExtraChanges
  154. if(data%State%notifications%OpenSafetyValveLed == v) return
  155. #endif
  156. data%State%notifications%OpenSafetyValveLed = v
  157. if(data%State%notifications%OpenSafetyValveLed) then
  158. !!call OpenSafetyValve()
  159. if(data%Configuration%Hoisting%DriveType == TopDrive_DriveType) call OpenSafetyValve_TopDrive()
  160. if(data%Configuration%Hoisting%DriveType == Kelly_DriveType .and. data%State%notifications%operation_OpenSafetyValveLed == 0) call OpenSafetyValve_KellyMode()
  161. if(data%Configuration%Hoisting%DriveType == Kelly_DriveType .and. data%State%notifications%operation_OpenSafetyValveLed == 1) call OpenSafetyValve_TripMode()
  162. endif
  163. !**call data%State%notifications%OnOpenSafetyValveLedChange%RunAll()
  164. end subroutine
  165. logical function Get_OpenSafetyValveLed()
  166. implicit none
  167. Get_OpenSafetyValveLed = data%State%notifications%OpenSafetyValveLed
  168. end function
  169. subroutine Set_OpenKellyCockLed(v)
  170. ! use CDrillingConsoleVariables
  171. use SimulationVariables
  172. use SimulationVariables!, only: OpenKellyCockLedHw => OpenKellyCockLed
  173. use CManifolds, only: OpenKellyCock
  174. implicit none
  175. logical , intent(in) :: v
  176. #ifdef ExcludeExtraChanges
  177. if(data%State%notifications%OpenKellyCockLed == v) return
  178. #endif
  179. data%State%notifications%OpenKellyCockLed = v
  180. if(data%State%notifications%OpenKellyCockLed) then
  181. call OpenKellyCock()
  182. endif
  183. ! HAS BEEN IMPLEMENTED IN CMANIFOLD
  184. !if(OpenKellyCockLed) then
  185. ! OpenKellyCockLedHw = 1
  186. !else
  187. ! OpenKellyCockLedHw = 0
  188. !endif
  189. !**call data%State%notifications%OnOpenKellyCockLedChange%RunAll()
  190. end subroutine
  191. logical function Get_OpenKellyCockLed()
  192. implicit none
  193. Get_OpenKellyCockLed = data%State%notifications%OpenKellyCockLed
  194. end function
  195. subroutine Set_LatchLed(v)
  196. use CDrillingConsoleVariables
  197. use SimulationVariables
  198. use SimulationVariables!, only: data%EquipmentControl%DrillingConsole%LatchPipeLED
  199. !use CUnlatchLedNotification
  200. implicit none
  201. logical , intent(in) :: v
  202. #ifdef ExcludeExtraChanges
  203. if(data%State%notifications%LatchLed == v) return
  204. #endif
  205. data%State%notifications%LatchLed = v
  206. if(data%State%notifications%LatchLed) then
  207. data%EquipmentControl%DrillingConsole%LatchPipeLED = 1
  208. !call Set_UnlatchLed(.false.)
  209. else
  210. data%EquipmentControl%DrillingConsole%LatchPipeLED = 0
  211. endif
  212. !**call data%State%notifications%OnLatchLedChange%RunAll()
  213. end subroutine
  214. logical function Get_LatchLed()
  215. implicit none
  216. Get_LatchLed = data%State%notifications%LatchLed
  217. end function
  218. subroutine Set_IrSafetyValveLed(v)
  219. use CDrillingConsoleVariables
  220. use SimulationVariables
  221. use SimulationVariables!, only: data%EquipmentControl%DrillingConsole%CloseKellyCockLed => IRSafetyValveLed
  222. use CManifolds, only: &
  223. InstallSafetyValve_TopDrive, &
  224. InstallSafetyValve_KellyMode, &
  225. InstallSafetyValve_TripMode, &
  226. RemoveSafetyValve_TopDrive, &
  227. RemoveSafetyValve_KellyMode, &
  228. RemoveSafetyValve_TripMode
  229. use UnitySignalVariables
  230. use UnitySignalsModule, only: Set_SafetyValve_Install, Set_SafetyValve_Remove
  231. use CHoistingVariables
  232. use SimulationVariables!, only: data%Configuration%Hoisting%DriveType, TopDrive_DriveType, Kelly_DriveType
  233. implicit none
  234. logical , intent(in) :: v
  235. #ifdef ExcludeExtraChanges
  236. if(data%State%notifications%IrSafetyValveLed == v) return
  237. #endif
  238. data%State%notifications%IrSafetyValveLed = v
  239. if(data%State%notifications%IrSafetyValveLed) then
  240. data%EquipmentControl%DrillingConsole%IRSafetyValveLed = 1
  241. if(data%Configuration%Hoisting%DriveType == TopDrive_DriveType) call InstallSafetyValve_TopDrive()
  242. if(data%Configuration%Hoisting%DriveType == Kelly_DriveType .and. data%State%notifications%operation_IrSafetyValveLed == 0) call InstallSafetyValve_KellyMode()
  243. if(data%Configuration%Hoisting%DriveType == Kelly_DriveType .and. data%State%notifications%operation_IrSafetyValveLed == 1) call InstallSafetyValve_TripMode()
  244. call Set_SafetyValve_Install()
  245. else
  246. data%EquipmentControl%DrillingConsole%IRSafetyValveLed = 0
  247. if(data%Configuration%Hoisting%DriveType == TopDrive_DriveType) call RemoveSafetyValve_TopDrive()
  248. if(data%Configuration%Hoisting%DriveType == Kelly_DriveType .and. data%State%notifications%operation_IrSafetyValveLed == 0) call RemoveSafetyValve_KellyMode()
  249. if(data%Configuration%Hoisting%DriveType == Kelly_DriveType .and. data%State%notifications%operation_IrSafetyValveLed == 1) call RemoveSafetyValve_TripMode()
  250. call Set_SafetyValve_Remove()
  251. endif
  252. !**call data%State%notifications%OnIrSafetyValveLedChange%RunAll()
  253. end subroutine
  254. logical function Get_IrSafetyValveLed()
  255. implicit none
  256. Get_IrSafetyValveLed = data%State%notifications%IrSafetyValveLed
  257. end function
  258. subroutine Set_IrIBopLed(v)
  259. use CDrillingConsoleVariables
  260. use SimulationVariables
  261. use SimulationVariables!, only: IRIBopLedHw => IRIBopLed
  262. use CManifolds, only: InstallIBop, RemoveIBop
  263. use UnitySignalVariables
  264. use UnitySignalsModule, only: Set_Ibop_Install, Set_Ibop_Remove
  265. implicit none
  266. logical , intent(in) :: v
  267. #ifdef ExcludeExtraChanges
  268. if(data%State%notifications%IrIBopLed == v) return
  269. #endif
  270. data%State%notifications%IrIBopLed = v
  271. if(data%State%notifications%IrIBopLed) then
  272. data%EquipmentControl%DrillingConsole%IRIBopLed = 1
  273. call InstallIBop()
  274. call Set_Ibop_Install()
  275. else
  276. data%EquipmentControl%DrillingConsole%IRIBopLed = 0
  277. call RemoveIBop()
  278. call Set_Ibop_Remove()
  279. endif
  280. !**call data%State%notifications%OnIrIBopLedChange%RunAll()
  281. end subroutine
  282. logical function Get_IrIBopLed()
  283. implicit none
  284. Get_IrIBopLed = data%State%notifications%IrIBopLed
  285. end function
  286. subroutine Set_FillMouseHoleLed(v)
  287. use CDrillingConsoleVariables
  288. use SimulationVariables
  289. use SimulationVariables!, only: FillMouseHoleLedHw => FillMouseHoleLed
  290. ! use CMouseHoleEnumVariables
  291. use UnitySignalVariables
  292. use UnitySignalsModule
  293. implicit none
  294. logical , intent(in) :: v
  295. #ifdef ExcludeExtraChanges
  296. if(data%State%notifications%FillMouseHoleLed == v) return
  297. #endif
  298. data%State%notifications%FillMouseHoleLed = v
  299. if(data%State%notifications%FillMouseHoleLed) then
  300. data%EquipmentControl%DrillingConsole%FillMouseHoleLed = 1
  301. !call Set_MouseHole(MOUSE_HOLE_FILL)
  302. else
  303. data%EquipmentControl%DrillingConsole%FillMouseHoleLed = 0
  304. !call Set_MouseHole(MOUSE_HOLE_EMPTY)
  305. endif
  306. !**call data%State%notifications%OnFillMouseHoleLedChange%RunAll()
  307. end subroutine
  308. logical function Get_FillMouseHoleLed()
  309. implicit none
  310. Get_FillMouseHoleLed = data%State%notifications%FillMouseHoleLed
  311. end function
  312. subroutine Set_CloseKellyCockLed(v)
  313. use CDrillingConsoleVariables
  314. use SimulationVariables
  315. use SimulationVariables!, only: CloseKellyCockLedHw => CloseKellyCockLed
  316. use CManifolds, only: CloseKellyCock
  317. implicit none
  318. logical , intent(in) :: v
  319. #ifdef ExcludeExtraChanges
  320. if(data%State%notifications%CloseKellyCockLed == v) return
  321. #endif
  322. data%State%notifications%CloseKellyCockLed = v
  323. if(data%State%notifications%CloseKellyCockLed) then
  324. call CloseKellyCock()
  325. endif
  326. !**call data%State%notifications%OnCloseKellyCockLedChange%RunAll()
  327. end subroutine
  328. logical function Get_CloseKellyCockLed()
  329. implicit none
  330. Get_CloseKellyCockLed = data%State%notifications%CloseKellyCockLed
  331. end function
  332. subroutine Set_CloseSafetyValveLed(v)
  333. ! use CDrillingConsoleVariables
  334. use SimulationVariables
  335. !@use ConfigurationVariables, only: CloseSafetyValveLedHw => CloseSafetyValveLed
  336. use CManifolds, only: CloseSafetyValve_TopDrive, CloseSafetyValve_KellyMode, CloseSafetyValve_TripMode
  337. use CHoistingVariables
  338. use SimulationVariables!, only: data%Configuration%Hoisting%DriveType, TopDrive_DriveType, Kelly_DriveType
  339. implicit none
  340. logical , intent(in) :: v
  341. #ifdef ExcludeExtraChanges
  342. if(data%State%notifications%CloseSafetyValveLed == v) return
  343. #endif
  344. data%State%notifications%CloseSafetyValveLed = v
  345. if(data%State%notifications%CloseSafetyValveLed) then
  346. !!call CloseSafetyValve()
  347. if(data%Configuration%Hoisting%DriveType == TopDrive_DriveType) call CloseSafetyValve_TopDrive()
  348. if(data%Configuration%Hoisting%DriveType == Kelly_DriveType .and. data%State%notifications%operation_CloseSafetyValveLed == 0) call CloseSafetyValve_KellyMode()
  349. if(data%Configuration%Hoisting%DriveType == Kelly_DriveType .and. data%State%notifications%operation_CloseSafetyValveLed == 1) call CloseSafetyValve_TripMode()
  350. endif
  351. !**call data%State%notifications%OnCloseSafetyValveLedChange%RunAll()
  352. end subroutine
  353. logical function Get_CloseSafetyValveLed()
  354. implicit none
  355. Get_CloseSafetyValveLed = data%State%notifications%CloseSafetyValveLed
  356. end function
  357. end module NotificationModule