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 16 KiB

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