Simulation Core
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 
 

410 řádky
16 KiB

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