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