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

1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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%Equipments%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_BlowoutFromAnnular(v)
  39. implicit none
  40. logical, intent (in) :: v
  41. UnityOutputs%BlowoutFromAnnular = v
  42. #ifdef deb
  43. print*, 'BlowoutFromAnnular=', v
  44. #endif
  45. end subroutine
  46. logical function Get_BlowoutFromAnnular()
  47. implicit none
  48. Get_BlowoutFromAnnular = UnityOutputs%BlowoutFromAnnular
  49. end function
  50. subroutine Set_FlowFromReturnLine(v)
  51. implicit none
  52. logical, intent (in) :: v
  53. UnityOutputs%FlowFromReturnLine = v
  54. #ifdef deb
  55. print*, 'FlowFromReturnLine=', v
  56. #endif
  57. end subroutine
  58. logical function Get_FlowFromReturnLine()
  59. implicit none
  60. Get_FlowFromReturnLine = UnityOutputs%FlowFromReturnLine
  61. end function
  62. subroutine Set_FlowFromKelly(v)
  63. implicit none
  64. real, intent (in) :: v
  65. UnityOutputs%FlowFromKelly = v
  66. #ifdef deb
  67. print*, 'FlowFromKelly=', v
  68. #endif
  69. end subroutine
  70. real function Get_FlowFromKelly()
  71. implicit none
  72. Get_FlowFromKelly = UnityOutputs%FlowFromKelly
  73. end function
  74. subroutine Set_FlowFromFillupHead(v)
  75. implicit none
  76. real, intent (in) :: v
  77. UnityOutputs%FlowFromFillupHead = v
  78. #ifdef deb
  79. print*, 'FlowFromFillupHead=', v
  80. #endif
  81. end subroutine
  82. real function Get_FlowFromFillupHead()
  83. implicit none
  84. Get_FlowFromFillupHead = UnityOutputs%FlowFromFillupHead
  85. end function
  86. subroutine Set_FlowKellyDisconnect(v)
  87. implicit none
  88. logical, intent (in) :: v
  89. UnityOutputs%FlowKellyDisconnect = v
  90. #ifdef deb
  91. print*, 'FlowKellyDisconnect=', v
  92. #endif
  93. end subroutine
  94. logical function Get_FlowKellyDisconnect()
  95. implicit none
  96. Get_FlowKellyDisconnect = UnityOutputs%FlowKellyDisconnect
  97. end function
  98. subroutine Set_FlowPipeDisconnect(v)
  99. implicit none
  100. logical, intent (in) :: v
  101. UnityOutputs%FlowPipeDisconnect = v
  102. #ifdef deb
  103. print*, 'FlowPipeDisconnect=', v
  104. #endif
  105. end subroutine
  106. logical function Get_FlowPipeDisconnect()
  107. implicit none
  108. Get_FlowPipeDisconnect = UnityOutputs%FlowPipeDisconnect
  109. end function
  110. subroutine Set_BlowoutFromStringPercent(v)
  111. implicit none
  112. real(8), intent (in) :: v
  113. UnityOutputs%BlowoutFromStringPercent = v
  114. #ifdef deb
  115. print*, 'BlowoutFromStringPercent=', v
  116. #endif
  117. end subroutine
  118. real(8) function GetBlowoutFromStringPercent()
  119. implicit none
  120. GetBlowoutFromStringPercent = UnityOutputs%BlowoutFromStringPercent
  121. end function
  122. subroutine Calc_KellyHoseVibrationRate(spm1, spm2)
  123. use CScaleRange
  124. implicit none
  125. real(8), intent (in) :: spm1, spm2
  126. real :: total
  127. total = (spm1 + spm2)/2
  128. UnityOutputs%KellyHoseVibrationRate = ScaleRange(total, 0.0, 10.0, 0.0, 120.0)
  129. #ifdef deb
  130. print*, 'KellyHoseVibrationRate=', UnityOutputs%KellyHoseVibrationRate
  131. #endif
  132. end subroutine
  133. real(8) function GetKellyHoseVibrationRate()
  134. implicit none
  135. GetKellyHoseVibrationRate = UnityOutputs%KellyHoseVibrationRate
  136. end function
  137. subroutine Set_Pedal(v)
  138. implicit none
  139. real(8), intent (in) :: v
  140. UnityOutputs%Pedal = v
  141. #ifdef deb
  142. print*, 'Pedal=', v
  143. #endif
  144. end subroutine
  145. real(8) function GetPedal()
  146. implicit none
  147. GetPedal = UnityOutputs%Pedal
  148. end function
  149. subroutine Set_FlowRate(v)
  150. implicit none
  151. real(8), intent (in) :: v
  152. UnityOutputs%FlowRate = v
  153. #ifdef deb
  154. print*, 'FlowRate=', v
  155. #endif
  156. end subroutine
  157. real(8) function GetFlowRate()
  158. implicit none
  159. GetFlowRate = UnityOutputs%FlowRate
  160. end function
  161. subroutine Set_RotaryRpm(v)
  162. implicit none
  163. real(8), intent (in) :: v
  164. UnityOutputs%RotaryRpm = v
  165. #ifdef deb
  166. print*, 'RotaryRpm=', v
  167. #endif
  168. end subroutine
  169. real(8) function GetRotaryRpm()
  170. implicit none
  171. GetRotaryRpm = UnityOutputs%RotaryRpm
  172. end function
  173. end module CUnityOutputs