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.
 
 
 
 
 
 

274 lines
8.5 KiB

  1. # 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/Unity/UnityModule.f90"
  2. module UnityModule
  3. use SimulationVariables
  4. implicit none
  5. contains
  6. subroutine UnityInputsFromJson(jsonfile)
  7. type(json_file)::jsonfile
  8. logical::found
  9. call jsonfile%get('UnityInputs.ElevatorConnectionPossible',data%Equipments%UnityInputs%ElevatorConnectionPossible,found)
  10. if ( .not. found ) call logg(4,"Not found: UnityInputs%ElevatorConnectionPossible")
  11. call jsonfile%get('UnityInputs.JointConnectionPossible',data%Equipments%UnityInputs%JointConnectionPossible,found)
  12. if ( .not. found ) call logg(4,"Not found: UnityInputs%JointConnectionPossible")
  13. call jsonfile%get('UnityInputs.IsKellyBushingSetInTable',data%Equipments%UnityInputs%IsKellyBushingSetInTable,found)
  14. if ( .not. found ) call logg(4,"Not found: UnityInputs%IsKellyBushingSetInTable")
  15. call jsonfile%get('UnityInputs.ElevatorPickup',data%Equipments%UnityInputs%ElevatorPickup,found)
  16. if ( .not. found ) call logg(4,"Not found: UnityInputs%ElevatorPickup")
  17. call jsonfile%get('UnityInputs.NearFloorPosition',data%Equipments%UnityInputs%NearFloorPosition,found)
  18. if ( .not. found ) call logg(4,"Not found: UnityInputs%NearFloorPosition")
  19. call jsonfile%get('UnityInputs.SingleSetInMouseHole',data%Equipments%UnityInputs%SingleSetInMouseHole,found)
  20. if ( .not. found ) call logg(4,"Not found: UnityInputs%SingleSetInMouseHole")
  21. call jsonfile%get('UnityInputs.TdsConnectionPossible',data%Equipments%UnityInputs%TdsConnectionPossible,found)
  22. if ( .not. found ) call logg(4,"Not found: UnityInputs%TdsConnectionPossible")
  23. call jsonfile%get('UnityInputs.TdsStemIn',data%Equipments%UnityInputs%TdsStemIn,found)
  24. if ( .not. found ) call logg(4,"Not found: UnityInputs%TdsStemIn")
  25. end subroutine
  26. subroutine UnityOutputsToJson(parent)
  27. type(json_value),pointer :: parent
  28. type(json_core) :: json
  29. type(json_value),pointer :: p
  30. ! 1. create new node
  31. call json%create_object(p,'Unity')
  32. ! 2. add member of data type to new node
  33. call json%add(p,"KellyHoseVibrationRate",data%Equipments%UnityOutputs%KellyHoseVibrationRate)
  34. call json%add(p,"BlowoutFromStringPercent",data%Equipments%UnityOutputs%BlowoutFromStringPercent)
  35. call json%add(p,"Pedal",data%Equipments%UnityOutputs%Pedal)
  36. call json%add(p,"FlowRate",data%Equipments%UnityOutputs%FlowRate)
  37. call json%add(p,"RotaryRpm",data%Equipments%UnityOutputs%RotaryRpm)
  38. call json%add(p,"BlowoutFromString",data%Equipments%UnityOutputs%BlowoutFromString)
  39. call json%add(p,"BlowoutFromAnnular",data%Equipments%UnityOutputs%BlowoutFromAnnular)
  40. call json%add(p,"FlowFromReturnLine",data%Equipments%UnityOutputs%FlowFromReturnLine)
  41. call json%add(p,"FlowFromKelly",data%Equipments%UnityOutputs%FlowFromKelly)
  42. call json%add(p,"FlowFromFillupHead",data%Equipments%UnityOutputs%FlowFromFillupHead)
  43. call json%add(p,"FlowKellyDisconnect",data%Equipments%UnityOutputs%FlowKellyDisconnect)
  44. call json%add(p,"FlowPipeDisconnect",data%Equipments%UnityOutputs%FlowPipeDisconnect)
  45. ! 3. add new node to parent
  46. call json%add(parent,p)
  47. end subroutine
  48. logical function Get_ElevatorPickup()
  49. Get_ElevatorPickup = data%Equipments%UnityInputs%ElevatorPickup
  50. end function
  51. logical function Get_IsKellyBushingSetInTable()
  52. Get_IsKellyBushingSetInTable = data%Equipments%UnityInputs%IsKellyBushingSetInTable
  53. end function
  54. logical function Get_JointConnectionPossible()
  55. Get_JointConnectionPossible = data%Equipments%UnityInputs%JointConnectionPossible
  56. end function
  57. logical function Get_ElevatorConnectionPossible()
  58. implicit none
  59. Get_ElevatorConnectionPossible = data%Equipments%UnityInputs%ElevatorConnectionPossible
  60. end function
  61. logical function Get_NearFloorPosition()
  62. Get_NearFloorPosition = data%Equipments%UnityInputs%NearFloorPosition
  63. end function
  64. subroutine Set_NearFloorPosition(v)
  65. implicit none
  66. logical, intent(in) :: v
  67. ! #ifdef ExcludeExtraChanges
  68. ! if(data%Equipments%UnityInputs%NearFloorPosition == v) return
  69. ! #endif
  70. data%Equipments%UnityInputs%NearFloorPosition = v
  71. !**call data%Equipments%UnityInputs%OnNearFloorPositionChange%RunAll()
  72. if(log_level>4) then
  73. if(print_log) print*, 'NearFloorPosition =', data%Equipments%UnityInputs%NearFloorPosition
  74. endif
  75. end subroutine
  76. logical function Get_SingleSetInMouseHole()
  77. Get_SingleSetInMouseHole = data%Equipments%UnityInputs%SingleSetInMouseHole
  78. end function
  79. logical function Get_TdsConnectionPossible()
  80. Get_TdsConnectionPossible = data%Equipments%UnityInputs%TdsConnectionPossible
  81. end function
  82. logical function Get_TdsStemIn()
  83. Get_TdsStemIn = data%Equipments%UnityInputs%TdsStemIn
  84. end function
  85. subroutine Set_BlowoutFromString(v)
  86. implicit none
  87. logical, intent (in) :: v
  88. data%Equipments%UnityOutputs%BlowoutFromString = v
  89. # 101
  90. end subroutine
  91. logical function Get_BlowoutFromString()
  92. implicit none
  93. Get_BlowoutFromString = data%Equipments%UnityOutputs%BlowoutFromString
  94. end function
  95. subroutine Set_BlowoutFromAnnular(v)
  96. implicit none
  97. logical, intent (in) :: v
  98. data%Equipments%UnityOutputs%BlowoutFromAnnular = v
  99. # 115
  100. end subroutine
  101. logical function Get_BlowoutFromAnnular()
  102. implicit none
  103. Get_BlowoutFromAnnular = data%Equipments%UnityOutputs%BlowoutFromAnnular
  104. end function
  105. subroutine Set_FlowFromReturnLine(v)
  106. implicit none
  107. logical, intent (in) :: v
  108. data%Equipments%UnityOutputs%FlowFromReturnLine = v
  109. # 133
  110. end subroutine
  111. logical function Get_FlowFromReturnLine()
  112. implicit none
  113. Get_FlowFromReturnLine = data%Equipments%UnityOutputs%FlowFromReturnLine
  114. end function
  115. subroutine Set_FlowFromKelly(v)
  116. implicit none
  117. real, intent (in) :: v
  118. data%Equipments%UnityOutputs%FlowFromKelly = v
  119. # 149
  120. end subroutine
  121. real function Get_FlowFromKelly()
  122. implicit none
  123. Get_FlowFromKelly = data%Equipments%UnityOutputs%FlowFromKelly
  124. end function
  125. subroutine Set_FlowFromFillupHead(v)
  126. implicit none
  127. real, intent (in) :: v
  128. data%Equipments%UnityOutputs%FlowFromFillupHead = v
  129. # 167
  130. end subroutine
  131. real function Get_FlowFromFillupHead()
  132. implicit none
  133. Get_FlowFromFillupHead = data%Equipments%UnityOutputs%FlowFromFillupHead
  134. end function
  135. subroutine Set_FlowKellyDisconnect(v)
  136. implicit none
  137. logical, intent (in) :: v
  138. data%Equipments%UnityOutputs%FlowKellyDisconnect = v
  139. # 186
  140. end subroutine
  141. logical function Get_FlowKellyDisconnect()
  142. implicit none
  143. Get_FlowKellyDisconnect = data%Equipments%UnityOutputs%FlowKellyDisconnect
  144. end function
  145. subroutine Set_FlowPipeDisconnect(v)
  146. implicit none
  147. logical, intent (in) :: v
  148. data%Equipments%UnityOutputs%FlowPipeDisconnect = v
  149. # 203
  150. end subroutine
  151. logical function Get_FlowPipeDisconnect()
  152. implicit none
  153. Get_FlowPipeDisconnect = data%Equipments%UnityOutputs%FlowPipeDisconnect
  154. end function
  155. subroutine Set_BlowoutFromStringPercent(v)
  156. implicit none
  157. real(8), intent (in) :: v
  158. data%Equipments%UnityOutputs%BlowoutFromStringPercent = v
  159. # 217
  160. end subroutine
  161. real(8) function GetBlowoutFromStringPercent()
  162. implicit none
  163. GetBlowoutFromStringPercent = data%Equipments%UnityOutputs%BlowoutFromStringPercent
  164. end function
  165. subroutine Calc_KellyHoseVibrationRate(spm1, spm2)
  166. use CScaleRange
  167. implicit none
  168. real(8), intent (in) :: spm1, spm2
  169. real :: total
  170. total = (spm1 + spm2)/2
  171. data%Equipments%UnityOutputs%KellyHoseVibrationRate = ScaleRange(total, 0.0, 10.0, 0.0, 120.0)
  172. # 234
  173. end subroutine
  174. real(8) function GetKellyHoseVibrationRate()
  175. implicit none
  176. GetKellyHoseVibrationRate = data%Equipments%UnityOutputs%KellyHoseVibrationRate
  177. end function
  178. subroutine Set_Pedal(v)
  179. implicit none
  180. real(8), intent (in) :: v
  181. data%Equipments%UnityOutputs%Pedal = v
  182. # 248
  183. end subroutine
  184. real(8) function GetPedal()
  185. implicit none
  186. GetPedal = data%Equipments%UnityOutputs%Pedal
  187. end function
  188. subroutine Set_FlowRate(v)
  189. implicit none
  190. real(8), intent (in) :: v
  191. data%Equipments%UnityOutputs%FlowRate = v
  192. # 262
  193. end subroutine
  194. real(8) function GetFlowRate()
  195. implicit none
  196. GetFlowRate = data%Equipments%UnityOutputs%FlowRate
  197. end function
  198. subroutine Set_RotaryRpm(v)
  199. implicit none
  200. real(8), intent (in) :: v
  201. data%Equipments%UnityOutputs%RotaryRpm = v
  202. # 276
  203. end subroutine
  204. real(8) function GetRotaryRpm()
  205. implicit none
  206. GetRotaryRpm = data%Equipments%UnityOutputs%RotaryRpm
  207. end function
  208. end module UnityModule