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.
 
 
 
 
 
 

308 lines
14 KiB

  1. module CDataDisplayConsole
  2. ! use CDataDisplayConsole
  3. use SimulationVariables
  4. implicit none
  5. public
  6. contains
  7. subroutine DataDisplayConsoleFromJson(parent)
  8. type(json_value),pointer :: parent
  9. type(json_core) :: json
  10. type(json_value),pointer :: p,pval
  11. ! type(json_file)::parent
  12. ! 1. get related root
  13. call json%get(parent,'DataDisplay',p)
  14. call json%get(p,'ResetWob',pval)
  15. call json%get(pval,data%Equipments%DataDisplayConsole%ResetWob)
  16. call json%get(p,'TotalStrokeCounterResetSwitch',pval)
  17. call json%get(pval,data%Equipments%DataDisplayConsole%TotalStrokeCounterResetSwitch)
  18. call json%get(p,'MVTSetAlarmSwitch',pval)
  19. call json%get(pval,data%Equipments%DataDisplayConsole%MVTSetAlarmSwitch)
  20. call json%get(p,'MFFISetAlarmSwitch',pval)
  21. call json%get(pval,data%Equipments%DataDisplayConsole%MFFISetAlarmSwitch)
  22. ! Alarms Upper - lower bounds
  23. call json%get(p,'MFFIAlarmLow',pval)
  24. call json%get(pval,data%Equipments%DataDisplayConsole%MFFIAlarmLow)
  25. call json%get(p,'MFFIAlarmHigh',pval)
  26. call json%get(pval,data%Equipments%DataDisplayConsole%MFFIAlarmHigh)
  27. call json%get(p,'MVTAlarmLow',pval)
  28. call json%get(pval,data%Equipments%DataDisplayConsole%MVTAlarmLow)
  29. call json%get(p,'MVTAlarmHigh',pval)
  30. call json%get(pval,data%Equipments%DataDisplayConsole%MVTAlarmHigh)
  31. ! 2. get member of data type from node
  32. call json%get(p,'TripTankSetAlarmLow',pval)
  33. call json%get(pval,data%Equipments%DataDisplayConsole%TripTankSetAlarmLow)
  34. call json%get(p,'TripTankSetAlarmHigh',pval)
  35. call json%get(pval,data%Equipments%DataDisplayConsole%TripTankSetAlarmHigh)
  36. call json%get(p,'TripTankSetAlarmSwitch',pval)
  37. call json%get(pval,data%Equipments%DataDisplayConsole%TripTankSetAlarmSwitch)
  38. call json%get(p,'TripTankPowerSwitch',pval)
  39. call json%get(pval,data%Equipments%DataDisplayConsole%TripTankPowerSwitch)
  40. call json%get(p,'TripTankPumpSwitch',pval)
  41. call json%get(pval,data%Equipments%DataDisplayConsole%TripTankPumpSwitch)
  42. call json%get(p,'TripTankHornSwitch',pval)
  43. call json%get(pval,data%Equipments%DataDisplayConsole%TripTankHornSwitch)
  44. call json%get(p,'AcidGasDetectionHornSwitch',pval)
  45. call json%get(pval,data%Equipments%DataDisplayConsole%AcidGasDetectionHornSwitch)
  46. call json%get(p,'DrillingTrippingSelectorSwitch',pval)
  47. call json%get(pval,data%Equipments%DataDisplayConsole%DrillingTrippingSelectorSwitch)
  48. call json%get(p,'MVTSetAlarmLowKnob',pval)
  49. call json%get(pval,data%Equipments%DataDisplayConsole%MVTSetAlarmLowKnob)
  50. call json%get(p,'MVTSetAlarmHighKnob',pval)
  51. call json%get(pval,data%Equipments%DataDisplayConsole%MVTSetAlarmHighKnob)
  52. call json%get(p,'MudTank1Switch',pval)
  53. call json%get(pval,data%Equipments%DataDisplayConsole%MudTank1Switch)
  54. call json%get(p,'MudTank2Switch',pval)
  55. call json%get(pval,data%Equipments%DataDisplayConsole%MudTank2Switch)
  56. call json%get(p,'MudTank3Switch',pval)
  57. call json%get(pval,data%Equipments%DataDisplayConsole%MudTank3Switch)
  58. call json%get(p,'MudTank4Switch',pval)
  59. call json%get(pval,data%Equipments%DataDisplayConsole%MudTank4Switch)
  60. call json%get(p,'MVTFineKnob',pval)
  61. call json%get(pval,data%Equipments%DataDisplayConsole%MVTFineKnob)
  62. call json%get(p,'MVTCoarseKnob',pval)
  63. call json%get(pval,data%Equipments%DataDisplayConsole%MVTCoarseKnob)
  64. call json%get(p,'MVTHornSwitch',pval)
  65. call json%get(pval,data%Equipments%DataDisplayConsole%MVTHornSwitch)
  66. call json%get(p,'MVTDeviationTripSelectionSwitch',pval)
  67. call json%get(pval,data%Equipments%DataDisplayConsole%MVTDeviationTripSelectionSwitch)
  68. call json%get(p,'MVTPowerSwitch',pval)
  69. call json%get(pval,data%Equipments%DataDisplayConsole%MVTPowerSwitch)
  70. call json%get(p,'MFFIResetTotalStrokes',pval)
  71. call json%get(pval,data%Equipments%DataDisplayConsole%MFFIResetTotalStrokes)
  72. call json%get(p,'MFFIResetFillCounter',pval)
  73. call json%get(pval,data%Equipments%DataDisplayConsole%MFFIResetFillCounter)
  74. call json%get(p,'MFFIPumpSelectorSwitch',pval)
  75. call json%get(pval,data%Equipments%DataDisplayConsole%MFFIPumpSelectorSwitch)
  76. call json%get(p,'MFFIFillSPMSelectorSwitch',pval)
  77. call json%get(pval,data%Equipments%DataDisplayConsole%MFFIFillSPMSelectorSwitch)
  78. call json%get(p,'MFFISetAlarmLowKnob',pval)
  79. call json%get(pval,data%Equipments%DataDisplayConsole%MFFISetAlarmLowKnob)
  80. call json%get(p,'MFFISetAlarmHighKnob',pval)
  81. call json%get(pval,data%Equipments%DataDisplayConsole%MFFISetAlarmHighKnob)
  82. call json%get(p,'MFFIPowerSwitch',pval)
  83. call json%get(pval,data%Equipments%DataDisplayConsole%MFFIPowerSwitch)
  84. call json%get(p,'MFFIHornSwitch',pval)
  85. call json%get(pval,data%Equipments%DataDisplayConsole%MFFIHornSwitch)
  86. call json%get(p,'Clutch',pval)
  87. ! call jsonfile%get('Equipments.DataDisplay.MVTAlarmHigh',data%Equipments%DataDisplayConsole%MVTAlarmHigh,found)
  88. end subroutine
  89. subroutine DataDisplayConsoleToJson(parent)
  90. type(json_value),pointer :: parent
  91. type(json_core) :: json
  92. type(json_value),pointer :: p
  93. ! 1. create new node
  94. call json%create_object(p,'DataDisplay')
  95. call json%add(p,"WOBPointer",data%Equipments%DataDisplayConsole%WOBPointer)
  96. call json%add(p,"HookLoadPointer",data%Equipments%DataDisplayConsole%HookLoadPointer)
  97. call json%add(p,"TripTankGauge",data%Equipments%DataDisplayConsole%TripTankGauge)
  98. call json%add(p,"TripTankAlarmLED",data%Equipments%DataDisplayConsole%TripTankAlarmLED)
  99. call json%add(p,"TripTankPumpLED",data%Equipments%DataDisplayConsole%TripTankPumpLED)
  100. call json%add(p,"StandPipePressureGauge",data%Equipments%DataDisplayConsole%StandPipePressureGauge)
  101. call json%add(p,"CasingPressureGauge",data%Equipments%DataDisplayConsole%CasingPressureGauge)
  102. call json%add(p,"MP1SPMGauge",data%Equipments%DataDisplayConsole%MP1SPMGauge)
  103. call json%add(p,"MP2SPMGauge",data%Equipments%DataDisplayConsole%MP2SPMGauge)
  104. call json%add(p,"ReturnLineTempGauge",data%Equipments%DataDisplayConsole%ReturnLineTempGauge)
  105. call json%add(p,"RotaryTorqueGauge",data%Equipments%DataDisplayConsole%RotaryTorqueGauge)
  106. call json%add(p,"RotaryRPMGauge",data%Equipments%DataDisplayConsole%RotaryRPMGauge)
  107. call json%add(p,"AcidGasDetectionLED",data%Equipments%DataDisplayConsole%AcidGasDetectionLED)
  108. call json%add(p,"TotalStrokeCounter",data%Equipments%DataDisplayConsole%TotalStrokeCounter)
  109. call json%add(p,"PitGainLossGauge",data%Equipments%DataDisplayConsole%PitGainLossGauge)
  110. call json%add(p,"MudTanksVolumeGauge",data%Equipments%DataDisplayConsole%MudTanksVolumeGauge)
  111. call json%add(p,"MVTAlarmLED",data%Equipments%DataDisplayConsole%MVTAlarmLED)
  112. call json%add(p,"ReturnMudFlowGauge",data%Equipments%DataDisplayConsole%ReturnMudFlowGauge)
  113. call json%add(p,"FillStrokeCounter",data%Equipments%DataDisplayConsole%FillStrokeCounter)
  114. call json%add(p,"MFFITotalStrokeCounter",data%Equipments%DataDisplayConsole%MFFITotalStrokeCounter)
  115. call json%add(p,"MFFIAlarmLED",data%Equipments%DataDisplayConsole%MFFIAlarmLED)
  116. call json%add(p,"MFFIPumpLED",data%Equipments%DataDisplayConsole%MFFIPumpLED)
  117. call json%add(p,"TotalWellDepth",data%Equipments%DataDisplayConsole%TotalWellDepth)
  118. call json%add(p,"BitDepth",data%Equipments%DataDisplayConsole%BitDepth)
  119. call json%add(p,"HookLoad",data%Equipments%DataDisplayConsole%HookLoad)
  120. !!!
  121. call json%add(p,"StaticHookLoad",data%State%TD_String%StaticHookLoad)
  122. call json%add(p,"StandPipePressure",data%Equipments%DataDisplayConsole%StandPipePressure)
  123. call json%add(p,"CasingPressure",data%Equipments%DataDisplayConsole%CasingPressure)
  124. call json%add(p,"MP1SPM",data%Equipments%DataDisplayConsole%MP1SPM)
  125. call json%add(p,"MP2SPM",data%Equipments%DataDisplayConsole%MP2SPM)
  126. call json%add(p,"RTTorque",data%Equipments%DataDisplayConsole%RTTorque)
  127. call json%add(p,"RTRPM",data%Equipments%DataDisplayConsole%RTRPM)
  128. call json%add(p,"WOP",data%Equipments%DataDisplayConsole%WOP)
  129. call json%add(p,"ROP",data%Equipments%DataDisplayConsole%ROP)
  130. call json%add(p,"MudWeightIn",data%Equipments%DataDisplayConsole%MudWeightIn)
  131. call json%add(p,"MudWeightOut",data%Equipments%DataDisplayConsole%MudWeightOut)
  132. call json%add(p,"Buzzer1",data%Equipments%DataDisplayConsole%Buzzer1)
  133. call json%add(p,"Buzzer2",data%Equipments%DataDisplayConsole%Buzzer2)
  134. call json%add(p,"Buzzer3",data%Equipments%DataDisplayConsole%Buzzer3)
  135. call json%add(p,"Buzzer4",data%Equipments%DataDisplayConsole%Buzzer4)
  136. call json%add(p,"MFFIAlarmLow",data%Equipments%DataDisplayConsole%MFFIAlarmLow)
  137. call json%add(p,"MFFIAlarmHigh",data%Equipments%DataDisplayConsole%MFFIAlarmHigh)
  138. call json%add(p,"MVTAlarmLow",data%Equipments%DataDisplayConsole%MVTAlarmLow)
  139. call json%add(p,"MVTAlarmHigh",data%Equipments%DataDisplayConsole%MVTAlarmHigh)
  140. call json%add(p,"MFFISetAlarmSwitch",data%Equipments%DataDisplayConsole%MFFISetAlarmSwitch)
  141. call json%add(p,"MVTSetAlarmSwitch",data%Equipments%DataDisplayConsole%MVTSetAlarmSwitch)
  142. call json%add(parent,p)
  143. end subroutine
  144. subroutine Set_TotalDepth(v)
  145. implicit none
  146. real(8), intent(in) :: v
  147. ! print *,"total depth = ",v
  148. data%Equipments%DataDisplayConsole%TotalWellDepth = v
  149. data%Equipments%DrillingWatch%Depth = v
  150. ! call SetDistanceDrilled(v)
  151. end subroutine
  152. subroutine Set_BitPosition(v)
  153. implicit none
  154. real(8), intent(in) :: v
  155. data%Equipments%DataDisplayConsole%BitDepth = v
  156. data%Equipments%DrillingWatch%BitPosition = v
  157. end subroutine
  158. subroutine Set_RotaryTorque(v)
  159. implicit none
  160. real(8), intent(in) :: v
  161. data%Equipments%DataDisplayConsole%RotaryTorqueGauge = v
  162. data%Equipments%DrillingWatch%Torque = v
  163. data%Equipments%DataDisplayConsole%RTTorque = v
  164. end subroutine
  165. subroutine Set_MudWeightIn(v)
  166. use SimulationVariables
  167. implicit none
  168. real(8), intent(in) :: v
  169. data%Equipments%DataDisplayConsole%MudWeightIn = v
  170. data%Equipments%DrillingWatch%MudWeightIn = v
  171. end subroutine
  172. subroutine Set_MudWeightOut(v)
  173. use SimulationVariables !@!, only: MudWeightOutDw => data%Equipments%DataDisplayConsole%MudWeightOut
  174. implicit none
  175. real(8), intent(in) :: v
  176. data%Equipments%DataDisplayConsole%MudWeightOut = v
  177. data%Equipments%DrillingWatch%MudWeightOut = v
  178. end subroutine
  179. subroutine Set_TripTankVolume(v)
  180. use SimulationVariables !@!, only: data%Equipments%DrillingWatch%TripTankVolume
  181. implicit none
  182. real(8), intent(in) :: v
  183. data%Equipments%DrillingWatch%TripTankVolume = v
  184. end subroutine
  185. subroutine Set_FillVolume(v)
  186. use SimulationVariables !@!, only: data%Equipments%DrillingWatch%FillVolume
  187. implicit none
  188. real(8), intent(in) :: v
  189. data%Equipments%DrillingWatch%FillVolume = v
  190. end subroutine
  191. subroutine Set_HookLoad(v)
  192. use SimulationVariables !@!, only: HookLoadDw => data%Equipments%DataDisplayConsole%HookLoad
  193. implicit none
  194. real(8), intent(in) :: v
  195. data%Equipments%DataDisplayConsole%HookLoadPointer = v
  196. data%Equipments%DrillingWatch%HookLoad = v * 1000
  197. data%Equipments%DataDisplayConsole%HookLoad = v
  198. end subroutine
  199. subroutine Set_WeightOnBit(v)
  200. use SimulationVariables !@!, only: data%Equipments%DrillingWatch%WeightOnBit
  201. implicit none
  202. real(8), intent(in) :: v
  203. data%Equipments%DataDisplayConsole%WOBPointer = v
  204. data%Equipments%DrillingWatch%WeightOnBit = v
  205. data%Equipments%DataDisplayConsole%WOP = v
  206. end subroutine
  207. subroutine Set_ROP(v)
  208. implicit none
  209. real(8), intent(in) :: v
  210. data%Equipments%DataDisplayConsole%ROP = v
  211. data%Equipments%DrillingWatch%ROP = v
  212. end subroutine
  213. subroutine Set_CasingPressure(v)
  214. ! use CChokeControlPanelVariables
  215. implicit none
  216. real(8), intent(in) :: v
  217. data%Equipments%DataDisplayConsole%CasingPressureGauge = v
  218. data%Equipments%DrillingWatch%CasingPressure = v
  219. data%Equipments%ChokeControlPanel%CasingPressure = v
  220. data%Equipments%DataDisplayConsole%CasingPressure = v
  221. end subroutine
  222. subroutine Set_StandPipePressure(v)
  223. implicit none
  224. real(8), intent(in) :: v
  225. data%Equipments%DataDisplayConsole%StandPipePressureGauge = v
  226. data%Equipments%DrillingWatch%PumpPressure = v
  227. data%Equipments%ChokeControlPanel%StandPipePressure = v
  228. data%Equipments%DataDisplayConsole%StandPipePressure = v
  229. end subroutine
  230. subroutine Set_RotaryRPMGauge(v)
  231. implicit none
  232. real(8), intent(in) :: v
  233. data%Equipments%DataDisplayConsole%RotaryRPMGauge = v
  234. data%Equipments%DrillingWatch%RPM = v
  235. data%Equipments%DataDisplayConsole%RTRPM = v
  236. ! call data%Equipments%DataDisplayConsole%OnRotaryRpmChange%RunAll(v)
  237. end subroutine
  238. subroutine Set_MP1SPMGauge(v)
  239. implicit none
  240. real(8), intent(in) :: v
  241. data%Equipments%DataDisplayConsole%MP1SPMGauge = v
  242. data%Equipments%DataDisplayConsole%MP1SPM = v
  243. !@data%State%unitySignals%(PumpsSpmChanges)) call PumpsSpmChanges(data%Equipments%DataDisplayConsole%MP1SPMGauge, data%Equipments%DataDisplayConsole%MP2SPMGauge)
  244. #ifdef deb
  245. if(print_log) print*, 'MP1SPMGauge=', data%Equipments%DataDisplayConsole%MP1SPMGauge
  246. #endif
  247. end subroutine
  248. subroutine Set_MP2SPMGauge(v)
  249. implicit none
  250. real(8), intent(in) :: v
  251. data%Equipments%DataDisplayConsole%MP2SPMGauge = v
  252. data%Equipments%DataDisplayConsole%MP2SPM = v
  253. !@data%State%unitySignals%(PumpsSpmChanges)) call PumpsSpmChanges(data%Equipments%DataDisplayConsole%MP1SPMGauge, data%Equipments%DataDisplayConsole%MP2SPMGauge)
  254. #ifdef deb
  255. if(print_log) print*, 'MP2SPMGauge=', data%Equipments%DataDisplayConsole%MP2SPMGauge
  256. #endif
  257. end subroutine
  258. end module CDataDisplayConsole