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.

CUnityOutputs.f90 15 KiB

1 year ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. module CUnityOutputs
  2. implicit none
  3. real(8) :: KellyHoseVibrationRate
  4. real(8) :: BlowoutFromStringPercent
  5. real(8) :: Pedal
  6. real(8) :: FlowRate
  7. real(8) :: RotaryRpm
  8. !logical :: Signal1
  9. !logical :: Signal2
  10. !logical :: Signal3
  11. !logical :: Signal4
  12. !logical :: Signal5
  13. !logical :: Signal6
  14. !logical :: Signal7
  15. !logical :: Signal8
  16. !logical :: Signal9
  17. !logical :: Signal10
  18. logical :: BlowoutFromString
  19. logical :: BlowoutFromAnnular
  20. logical :: FlowFromReturnLine
  21. real :: FlowFromKelly
  22. real :: FlowFromFillupHead
  23. logical :: FlowKellyDisconnect
  24. logical :: FlowPipeDisconnect
  25. private :: KellyHoseVibrationRate
  26. private :: BlowoutFromStringPercent
  27. private :: Pedal
  28. private :: FlowRate
  29. private :: RotaryRpm
  30. !private :: Signal1
  31. !private :: Signal2
  32. !private :: Signal3
  33. !private :: Signal4
  34. !private :: Signal5
  35. !private :: Signal6
  36. !private :: Signal7
  37. !private :: Signal8
  38. !private :: Signal9
  39. !private :: Signal10
  40. private :: BlowoutFromString
  41. private :: BlowoutFromAnnular
  42. private :: FlowFromReturnLine
  43. private :: FlowFromKelly
  44. private :: FlowFromFillupHead
  45. private :: FlowKellyDisconnect
  46. private :: FlowPipeDisconnect
  47. public
  48. contains
  49. subroutine Setup()
  50. use CDataDisplayConsoleVariables
  51. implicit none
  52. PumpsSpmChanges => Calc_KellyHoseVibrationRate
  53. call DataDisplayConsole%OnRotaryRpmChange%Add(Set_RotaryRpm)
  54. end subroutine
  55. subroutine Set_BlowoutFromString(v)
  56. implicit none
  57. logical, intent (in) :: v
  58. BlowoutFromString = v
  59. #ifdef deb
  60. print*, 'BlowoutFromString=', v
  61. #endif
  62. end subroutine
  63. logical function Get_BlowoutFromString()
  64. implicit none
  65. Get_BlowoutFromString = BlowoutFromString
  66. end function
  67. subroutine Set_BlowoutFromString_WN(v)
  68. !DEC$ ATTRIBUTES DLLEXPORT :: Set_BlowoutFromString_WN
  69. !DEC$ ATTRIBUTES ALIAS: 'Set_BlowoutFromString_WN' :: Set_BlowoutFromString_WN
  70. implicit none
  71. logical, intent (in) :: v
  72. call Set_BlowoutFromString(v)
  73. end subroutine
  74. logical function Get_BlowoutFromString_WN()
  75. !DEC$ ATTRIBUTES DLLEXPORT :: Get_BlowoutFromString_WN
  76. !DEC$ ATTRIBUTES ALIAS: 'Get_BlowoutFromString_WN' :: Get_BlowoutFromString_WN
  77. implicit none
  78. Get_BlowoutFromString_WN = BlowoutFromString
  79. !Get_BlowoutFromString = .TRUE.
  80. end function
  81. subroutine Set_BlowoutFromAnnular(v)
  82. implicit none
  83. logical, intent (in) :: v
  84. BlowoutFromAnnular = v
  85. #ifdef deb
  86. print*, 'BlowoutFromAnnular=', v
  87. #endif
  88. end subroutine
  89. logical function Get_BlowoutFromAnnular()
  90. implicit none
  91. Get_BlowoutFromAnnular = BlowoutFromAnnular
  92. end function
  93. subroutine Set_BlowoutFromAnnular_WN(v)
  94. !DEC$ ATTRIBUTES DLLEXPORT :: Set_BlowoutFromAnnular_WN
  95. !DEC$ ATTRIBUTES ALIAS: 'Set_BlowoutFromAnnular_WN' :: Set_BlowoutFromAnnular_WN
  96. implicit none
  97. logical, intent (in) :: v
  98. call Set_BlowoutFromAnnular(v)
  99. end subroutine
  100. logical function Get_BlowoutFromAnnular_WN()
  101. !DEC$ ATTRIBUTES DLLEXPORT :: Get_BlowoutFromAnnular_WN
  102. !DEC$ ATTRIBUTES ALIAS: 'Get_BlowoutFromAnnular_WN' :: Get_BlowoutFromAnnular_WN
  103. implicit none
  104. Get_BlowoutFromAnnular_WN = BlowoutFromAnnular
  105. end function
  106. subroutine Set_FlowFromReturnLine(v)
  107. implicit none
  108. logical, intent (in) :: v
  109. FlowFromReturnLine = v
  110. #ifdef deb
  111. print*, 'FlowFromReturnLine=', v
  112. #endif
  113. end subroutine
  114. logical function Get_FlowFromReturnLine()
  115. implicit none
  116. Get_FlowFromReturnLine = FlowFromReturnLine
  117. end function
  118. subroutine Set_FlowFromReturnLine_WN(v)
  119. !DEC$ ATTRIBUTES DLLEXPORT :: Set_FlowFromReturnLine_WN
  120. !DEC$ ATTRIBUTES ALIAS: 'Set_FlowFromReturnLine_WN' :: Set_FlowFromReturnLine_WN
  121. implicit none
  122. logical, intent (in) :: v
  123. call Set_FlowFromReturnLine(v)
  124. end subroutine
  125. logical function Get_FlowFromReturnLine_WN()
  126. !DEC$ ATTRIBUTES DLLEXPORT :: Get_FlowFromReturnLine_WN
  127. !DEC$ ATTRIBUTES ALIAS: 'Get_FlowFromReturnLine_WN' :: Get_FlowFromReturnLine_WN
  128. implicit none
  129. Get_FlowFromReturnLine_WN = FlowFromReturnLine
  130. !Get_FlowFromReturnLine_WN = .FALSE.
  131. end function
  132. subroutine Set_FlowFromKelly(v)
  133. implicit none
  134. real, intent (in) :: v
  135. FlowFromKelly = v
  136. #ifdef deb
  137. print*, 'FlowFromKelly=', v
  138. #endif
  139. end subroutine
  140. real function Get_FlowFromKelly()
  141. implicit none
  142. Get_FlowFromKelly = FlowFromKelly
  143. end function
  144. subroutine Set_FlowFromKelly_WN(v)
  145. !DEC$ ATTRIBUTES DLLEXPORT :: Set_FlowFromKelly_WN
  146. !DEC$ ATTRIBUTES ALIAS: 'Set_FlowFromKelly_WN' :: Set_FlowFromKelly_WN
  147. implicit none
  148. real, intent (in) :: v
  149. call Set_FlowFromKelly(v)
  150. end subroutine
  151. real function Get_FlowFromKelly_WN()
  152. !DEC$ ATTRIBUTES DLLEXPORT :: Get_FlowFromKelly_WN
  153. !DEC$ ATTRIBUTES ALIAS: 'Get_FlowFromKelly_WN' :: Get_FlowFromKelly_WN
  154. implicit none
  155. #ifdef deb
  156. print*, 'FlowFromKellyR=', FlowFromKelly
  157. #endif
  158. Get_FlowFromKelly_WN = FlowFromKelly
  159. !Get_FlowFromKelly = .FALSE.
  160. end function
  161. subroutine Set_FlowFromFillupHead(v)
  162. implicit none
  163. real, intent (in) :: v
  164. FlowFromFillupHead = v
  165. #ifdef deb
  166. print*, 'FlowFromFillupHead=', v
  167. #endif
  168. end subroutine
  169. real function Get_FlowFromFillupHead()
  170. implicit none
  171. Get_FlowFromFillupHead = FlowFromFillupHead
  172. end function
  173. subroutine Set_FlowFromFillupHead_WN(v)
  174. !DEC$ ATTRIBUTES DLLEXPORT :: Set_FlowFromFillupHead_WN
  175. !DEC$ ATTRIBUTES ALIAS: 'Set_FlowFromFillupHead_WN' :: Set_FlowFromFillupHead_WN
  176. implicit none
  177. real, intent (in) :: v
  178. call Set_FlowFromFillupHead(v)
  179. end subroutine
  180. real function Get_FlowFromFillupHead_WN()
  181. !DEC$ ATTRIBUTES DLLEXPORT :: Get_FlowFromFillupHead_WN
  182. !DEC$ ATTRIBUTES ALIAS: 'Get_FlowFromFillupHead_WN' :: Get_FlowFromFillupHead_WN
  183. implicit none
  184. #ifdef deb
  185. print*, 'FlowFromFillupHeadR=', FlowFromFillupHead
  186. #endif
  187. Get_FlowFromFillupHead_WN = FlowFromFillupHead
  188. !Get_FlowFromFillupHead = .FALSE.
  189. end function
  190. subroutine Set_FlowKellyDisconnect(v)
  191. implicit none
  192. logical, intent (in) :: v
  193. FlowKellyDisconnect = v
  194. #ifdef deb
  195. print*, 'FlowKellyDisconnect=', v
  196. #endif
  197. end subroutine
  198. logical function Get_FlowKellyDisconnect()
  199. implicit none
  200. Get_FlowKellyDisconnect = FlowKellyDisconnect
  201. end function
  202. subroutine Set_FlowKellyDisconnect_WN(v)
  203. !DEC$ ATTRIBUTES DLLEXPORT :: Set_FlowKellyDisconnect_WN
  204. !DEC$ ATTRIBUTES ALIAS: 'Set_FlowKellyDisconnect_WN' :: Set_FlowKellyDisconnect_WN
  205. implicit none
  206. logical, intent (in) :: v
  207. call Set_FlowKellyDisconnect(v)
  208. end subroutine
  209. logical function Get_FlowKellyDisconnect_WN()
  210. !DEC$ ATTRIBUTES DLLEXPORT :: Get_FlowKellyDisconnect_WN
  211. !DEC$ ATTRIBUTES ALIAS: 'Get_FlowKellyDisconnect_WN' :: Get_FlowKellyDisconnect_WN
  212. implicit none
  213. Get_FlowKellyDisconnect_WN = FlowKellyDisconnect
  214. !Get_FlowKellyDisconnect_WN = .false.
  215. end function
  216. subroutine Set_FlowPipeDisconnect(v)
  217. implicit none
  218. logical, intent (in) :: v
  219. FlowPipeDisconnect = v
  220. #ifdef deb
  221. print*, 'FlowPipeDisconnect=', v
  222. #endif
  223. end subroutine
  224. logical function Get_FlowPipeDisconnect()
  225. implicit none
  226. Get_FlowPipeDisconnect = FlowPipeDisconnect
  227. end function
  228. subroutine Set_FlowPipeDisconnect_WN(v)
  229. !DEC$ ATTRIBUTES DLLEXPORT :: Set_FlowPipeDisconnect_WN
  230. !DEC$ ATTRIBUTES ALIAS: 'Set_FlowPipeDisconnect_WN' :: Set_FlowPipeDisconnect_WN
  231. implicit none
  232. logical, intent (in) :: v
  233. call Set_FlowPipeDisconnect(v)
  234. end subroutine
  235. logical function Get_FlowPipeDisconnect_WN()
  236. !DEC$ ATTRIBUTES DLLEXPORT :: Get_FlowPipeDisconnect_WN
  237. !DEC$ ATTRIBUTES ALIAS: 'Get_FlowPipeDisconnect_WN' :: Get_FlowPipeDisconnect_WN
  238. implicit none
  239. Get_FlowPipeDisconnect_WN = FlowPipeDisconnect
  240. !Get_FlowPipeDisconnect_WN = .false.
  241. end function
  242. subroutine Set_BlowoutFromStringPercent(v)
  243. implicit none
  244. real(8), intent (in) :: v
  245. BlowoutFromStringPercent = v
  246. #ifdef deb
  247. print*, 'BlowoutFromStringPercent=', v
  248. #endif
  249. end subroutine
  250. real(8) function GetBlowoutFromStringPercent()
  251. implicit none
  252. GetBlowoutFromStringPercent = BlowoutFromStringPercent
  253. end function
  254. subroutine Set_BlowoutFromStringPercent_WN(v)
  255. !DEC$ ATTRIBUTES DLLEXPORT :: Set_BlowoutFromStringPercent_WN
  256. !DEC$ ATTRIBUTES ALIAS: 'Set_BlowoutFromStringPercent_WN' :: Set_BlowoutFromStringPercent_WN
  257. implicit none
  258. real(8), intent (in) :: v
  259. call Set_BlowoutFromStringPercent(v)
  260. end subroutine
  261. real(8) function GetBlowoutFromStringPercent_WN()
  262. !DEC$ ATTRIBUTES DLLEXPORT :: GetBlowoutFromStringPercent_WN
  263. !DEC$ ATTRIBUTES ALIAS: 'GetBlowoutFromStringPercent_WN' :: GetBlowoutFromStringPercent_WN
  264. implicit none
  265. GetBlowoutFromStringPercent_WN = BlowoutFromStringPercent
  266. !GetBlowoutFromStringPercent_WN = 0d0
  267. end function
  268. subroutine Calc_KellyHoseVibrationRate(spm1, spm2)
  269. use CScaleRange
  270. implicit none
  271. real(8), intent (in) :: spm1, spm2
  272. real :: total
  273. total = (spm1 + spm2)/2
  274. KellyHoseVibrationRate = ScaleRange(total, 0.0, 10.0, 0.0, 120.0)
  275. #ifdef deb
  276. print*, 'KellyHoseVibrationRate=', KellyHoseVibrationRate
  277. #endif
  278. end subroutine
  279. real(8) function GetKellyHoseVibrationRate()
  280. implicit none
  281. GetKellyHoseVibrationRate = KellyHoseVibrationRate
  282. end function
  283. real(8) function GetKellyHoseVibrationRate_WN()
  284. !DEC$ ATTRIBUTES DLLEXPORT :: GetKellyHoseVibrationRate_WN
  285. !DEC$ ATTRIBUTES ALIAS: 'GetKellyHoseVibrationRate_WN' :: GetKellyHoseVibrationRate_WN
  286. implicit none
  287. GetKellyHoseVibrationRate_WN = KellyHoseVibrationRate
  288. end function
  289. subroutine Set_Pedal(v)
  290. implicit none
  291. real(8), intent (in) :: v
  292. Pedal = v
  293. #ifdef deb
  294. print*, 'Pedal=', v
  295. #endif
  296. end subroutine
  297. real(8) function GetPedal()
  298. implicit none
  299. GetPedal = Pedal
  300. end function
  301. subroutine Set_Pedal_WN(v)
  302. !DEC$ ATTRIBUTES DLLEXPORT :: Set_Pedal_WN
  303. !DEC$ ATTRIBUTES ALIAS: 'Set_Pedal_WN' :: Set_Pedal_WN
  304. implicit none
  305. real(8), intent (in) :: v
  306. call Set_Pedal(v)
  307. end subroutine
  308. real(8) function GetPedal_WN()
  309. !DEC$ ATTRIBUTES DLLEXPORT :: GetPedal_WN
  310. !DEC$ ATTRIBUTES ALIAS: 'GetPedal_WN' :: GetPedal_WN
  311. implicit none
  312. GetPedal_WN = Pedal
  313. !GetPedal = 50d0
  314. end function
  315. subroutine Set_FlowRate(v)
  316. implicit none
  317. real(8), intent (in) :: v
  318. FlowRate = v
  319. #ifdef deb
  320. print*, 'FlowRate=', v
  321. #endif
  322. end subroutine
  323. real(8) function GetFlowRate()
  324. implicit none
  325. GetFlowRate = FlowRate
  326. end function
  327. subroutine Set_FlowRate_WN(v)
  328. !DEC$ ATTRIBUTES DLLEXPORT :: Set_FlowRate_WN
  329. !DEC$ ATTRIBUTES ALIAS: 'Set_FlowRate_WN' :: Set_FlowRate_WN
  330. implicit none
  331. real(8), intent (in) :: v
  332. call Set_FlowRate(v)
  333. end subroutine
  334. real(8) function GetFlowRate_WN()
  335. !DEC$ ATTRIBUTES DLLEXPORT :: GetFlowRate_WN
  336. !DEC$ ATTRIBUTES ALIAS: 'GetFlowRate_WN' :: GetFlowRate_WN
  337. implicit none
  338. GetFlowRate_WN = FlowRate
  339. !GetFlowRate_WN = 50d0
  340. end function
  341. subroutine Set_RotaryRpm(v)
  342. implicit none
  343. real(8), intent (in) :: v
  344. RotaryRpm = v
  345. #ifdef deb
  346. print*, 'RotaryRpm=', v
  347. #endif
  348. end subroutine
  349. real(8) function GetRotaryRpm()
  350. implicit none
  351. GetRotaryRpm = RotaryRpm
  352. end function
  353. subroutine Set_RotaryRpm_WN(v)
  354. !DEC$ ATTRIBUTES DLLEXPORT :: Set_RotaryRpm_WN
  355. !DEC$ ATTRIBUTES ALIAS: 'Set_RotaryRpm_WN' :: Set_RotaryRpm_WN
  356. implicit none
  357. real(8), intent (in) :: v
  358. call Set_RotaryRpm(v)
  359. end subroutine
  360. real(8) function GetRotaryRpm_WN()
  361. !DEC$ ATTRIBUTES DLLEXPORT :: GetRotaryRpm_WN
  362. !DEC$ ATTRIBUTES ALIAS: 'GetRotaryRpm_WN' :: GetRotaryRpm_WN
  363. implicit none
  364. GetRotaryRpm_WN = RotaryRpm
  365. end function
  366. logical function GetSignal1()
  367. !DEC$ ATTRIBUTES DLLEXPORT :: GetSignal1
  368. !DEC$ ATTRIBUTES ALIAS: 'GetSignal1' :: GetSignal1
  369. implicit none
  370. !GetSignal1 = Signal1
  371. GetSignal1 = .false.
  372. end function
  373. logical function GetSignal2()
  374. !DEC$ ATTRIBUTES DLLEXPORT :: GetSignal2
  375. !DEC$ ATTRIBUTES ALIAS: 'GetSignal2' :: GetSignal2
  376. implicit none
  377. !GetSignal2 = Signal2
  378. GetSignal2 = .false.
  379. end function
  380. logical function GetSignal3()
  381. !DEC$ ATTRIBUTES DLLEXPORT :: GetSignal3
  382. !DEC$ ATTRIBUTES ALIAS: 'GetSignal3' :: GetSignal3
  383. implicit none
  384. !GetSignal3 = Signal3
  385. GetSignal3 = .false.
  386. end function
  387. logical function GetSignal4()
  388. !DEC$ ATTRIBUTES DLLEXPORT :: GetSignal4
  389. !DEC$ ATTRIBUTES ALIAS: 'GetSignal4' :: GetSignal4
  390. implicit none
  391. !GetSignal4 = Signal4
  392. GetSignal4 = .false.
  393. end function
  394. logical function GetSignal5()
  395. !DEC$ ATTRIBUTES DLLEXPORT :: GetSignal5
  396. !DEC$ ATTRIBUTES ALIAS: 'GetSignal5' :: GetSignal5
  397. implicit none
  398. !GetSignal5 = Signal5
  399. GetSignal5 = .false.
  400. end function
  401. logical function GetSignal6()
  402. !DEC$ ATTRIBUTES DLLEXPORT :: GetSignal6
  403. !DEC$ ATTRIBUTES ALIAS: 'GetSignal6' :: GetSignal6
  404. implicit none
  405. !GetSignal6 = Signal6
  406. GetSignal6 = .false.
  407. end function
  408. logical function GetSignal7()
  409. !DEC$ ATTRIBUTES DLLEXPORT :: GetSignal7
  410. !DEC$ ATTRIBUTES ALIAS: 'GetSignal7' :: GetSignal7
  411. implicit none
  412. !GetSignal7 = Signal7
  413. GetSignal7 = .false.
  414. end function
  415. logical function GetSignal8()
  416. !DEC$ ATTRIBUTES DLLEXPORT :: GetSignal8
  417. !DEC$ ATTRIBUTES ALIAS: 'GetSignal8' :: GetSignal8
  418. implicit none
  419. !GetSignal8 = Signal8
  420. GetSignal8 = .false.
  421. end function
  422. logical function GetSignal9()
  423. !DEC$ ATTRIBUTES DLLEXPORT :: GetSignal9
  424. !DEC$ ATTRIBUTES ALIAS: 'GetSignal9' :: GetSignal9
  425. implicit none
  426. !GetSignal9 = Signal9
  427. GetSignal9 = .false.
  428. end function
  429. logical function GetSignal10()
  430. !DEC$ ATTRIBUTES DLLEXPORT :: GetSignal10
  431. !DEC$ ATTRIBUTES ALIAS: 'GetSignal10' :: GetSignal10
  432. implicit none
  433. !GetSignal10 = Signal10
  434. GetSignal10 = .false.
  435. end function
  436. end module CUnityOutputs