module CDataDisplayConsole ! use CDataDisplayConsole use SimulationVariables implicit none public contains subroutine DataDisplayConsoleFromJson(parent) type(json_value),pointer :: parent type(json_core) :: json type(json_value),pointer :: p,pval ! type(json_file)::parent ! 1. get related root call json%get(parent,'DataDisplay',p) call json%get(p,'ResetWob',pval) call json%get(pval,data%Equipments%DataDisplayConsole%ResetWob) call json%get(p,'TotalStrokeCounterResetSwitch',pval) call json%get(pval,data%Equipments%DataDisplayConsole%TotalStrokeCounterResetSwitch) call json%get(p,'MVTSetAlarmSwitch',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MVTSetAlarmSwitch) call json%get(p,'MFFISetAlarmSwitch',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MFFISetAlarmSwitch) ! Alarms Upper - lower bounds call json%get(p,'MFFIAlarmLow',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MFFIAlarmLow) call json%get(p,'MFFIAlarmHigh',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MFFIAlarmHigh) call json%get(p,'MVTAlarmLow',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MVTAlarmLow) call json%get(p,'MVTAlarmHigh',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MVTAlarmHigh) ! 2. get member of data type from node call json%get(p,'TripTankSetAlarmLow',pval) call json%get(pval,data%Equipments%DataDisplayConsole%TripTankSetAlarmLow) call json%get(p,'TripTankSetAlarmHigh',pval) call json%get(pval,data%Equipments%DataDisplayConsole%TripTankSetAlarmHigh) call json%get(p,'TripTankSetAlarmSwitch',pval) call json%get(pval,data%Equipments%DataDisplayConsole%TripTankSetAlarmSwitch) call json%get(p,'TripTankPowerSwitch',pval) call json%get(pval,data%Equipments%DataDisplayConsole%TripTankPowerSwitch) call json%get(p,'TripTankPumpSwitch',pval) call json%get(pval,data%Equipments%DataDisplayConsole%TripTankPumpSwitch) call json%get(p,'TripTankHornSwitch',pval) call json%get(pval,data%Equipments%DataDisplayConsole%TripTankHornSwitch) call json%get(p,'AcidGasDetectionHornSwitch',pval) call json%get(pval,data%Equipments%DataDisplayConsole%AcidGasDetectionHornSwitch) call json%get(p,'DrillingTrippingSelectorSwitch',pval) call json%get(pval,data%Equipments%DataDisplayConsole%DrillingTrippingSelectorSwitch) call json%get(p,'MVTSetAlarmLowKnob',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MVTSetAlarmLowKnob) call json%get(p,'MVTSetAlarmHighKnob',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MVTSetAlarmHighKnob) call json%get(p,'MudTank1Switch',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MudTank1Switch) call json%get(p,'MudTank2Switch',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MudTank2Switch) call json%get(p,'MudTank3Switch',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MudTank3Switch) call json%get(p,'MudTank4Switch',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MudTank4Switch) call json%get(p,'MVTFineKnob',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MVTFineKnob) call json%get(p,'MVTCoarseKnob',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MVTCoarseKnob) call json%get(p,'MVTHornSwitch',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MVTHornSwitch) call json%get(p,'MVTDeviationTripSelectionSwitch',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MVTDeviationTripSelectionSwitch) call json%get(p,'MVTPowerSwitch',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MVTPowerSwitch) call json%get(p,'MFFIResetTotalStrokes',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MFFIResetTotalStrokes) call json%get(p,'MFFIResetFillCounter',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MFFIResetFillCounter) call json%get(p,'MFFIPumpSelectorSwitch',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MFFIPumpSelectorSwitch) call json%get(p,'MFFIFillSPMSelectorSwitch',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MFFIFillSPMSelectorSwitch) call json%get(p,'MFFISetAlarmLowKnob',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MFFISetAlarmLowKnob) call json%get(p,'MFFISetAlarmHighKnob',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MFFISetAlarmHighKnob) call json%get(p,'MFFIPowerSwitch',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MFFIPowerSwitch) call json%get(p,'MFFIHornSwitch',pval) call json%get(pval,data%Equipments%DataDisplayConsole%MFFIHornSwitch) call json%get(p,'Clutch',pval) ! call jsonfile%get('Equipments.DataDisplay.MVTAlarmHigh',data%Equipments%DataDisplayConsole%MVTAlarmHigh,found) end subroutine subroutine DataDisplayConsoleToJson(parent) type(json_value),pointer :: parent type(json_core) :: json type(json_value),pointer :: p ! 1. create new node call json%create_object(p,'DataDisplay') call json%add(p,"WOBPointer",data%Equipments%DataDisplayConsole%WOBPointer) call json%add(p,"HookLoadPointer",data%Equipments%DataDisplayConsole%HookLoadPointer) call json%add(p,"TripTankGauge",data%Equipments%DataDisplayConsole%TripTankGauge) call json%add(p,"TripTankAlarmLED",data%Equipments%DataDisplayConsole%TripTankAlarmLED) call json%add(p,"TripTankPumpLED",data%Equipments%DataDisplayConsole%TripTankPumpLED) call json%add(p,"StandPipePressureGauge",data%Equipments%DataDisplayConsole%StandPipePressureGauge) call json%add(p,"CasingPressureGauge",data%Equipments%DataDisplayConsole%CasingPressureGauge) call json%add(p,"MP1SPMGauge",data%Equipments%DataDisplayConsole%MP1SPMGauge) call json%add(p,"MP2SPMGauge",data%Equipments%DataDisplayConsole%MP2SPMGauge) call json%add(p,"ReturnLineTempGauge",data%Equipments%DataDisplayConsole%ReturnLineTempGauge) call json%add(p,"RotaryTorqueGauge",data%Equipments%DataDisplayConsole%RotaryTorqueGauge) call json%add(p,"RotaryRPMGauge",data%Equipments%DataDisplayConsole%RotaryRPMGauge) call json%add(p,"AcidGasDetectionLED",data%Equipments%DataDisplayConsole%AcidGasDetectionLED) call json%add(p,"TotalStrokeCounter",data%Equipments%DataDisplayConsole%TotalStrokeCounter) call json%add(p,"PitGainLossGauge",data%Equipments%DataDisplayConsole%PitGainLossGauge) call json%add(p,"MudTanksVolumeGauge",data%Equipments%DataDisplayConsole%MudTanksVolumeGauge) call json%add(p,"MVTAlarmLED",data%Equipments%DataDisplayConsole%MVTAlarmLED) call json%add(p,"ReturnMudFlowGauge",data%Equipments%DataDisplayConsole%ReturnMudFlowGauge) call json%add(p,"FillStrokeCounter",data%Equipments%DataDisplayConsole%FillStrokeCounter) call json%add(p,"MFFITotalStrokeCounter",data%Equipments%DataDisplayConsole%MFFITotalStrokeCounter) call json%add(p,"MFFIAlarmLED",data%Equipments%DataDisplayConsole%MFFIAlarmLED) call json%add(p,"MFFIPumpLED",data%Equipments%DataDisplayConsole%MFFIPumpLED) call json%add(p,"TotalWellDepth",data%Equipments%DataDisplayConsole%TotalWellDepth) call json%add(p,"BitDepth",data%Equipments%DataDisplayConsole%BitDepth) call json%add(p,"HookLoad",data%Equipments%DataDisplayConsole%HookLoad) !!! call json%add(p,"StaticHookLoad",data%State%TD_String%StaticHookLoad) call json%add(p,"StandPipePressure",data%Equipments%DataDisplayConsole%StandPipePressure) call json%add(p,"CasingPressure",data%Equipments%DataDisplayConsole%CasingPressure) call json%add(p,"MP1SPM",data%Equipments%DataDisplayConsole%MP1SPM) call json%add(p,"MP2SPM",data%Equipments%DataDisplayConsole%MP2SPM) call json%add(p,"RTTorque",data%Equipments%DataDisplayConsole%RTTorque) call json%add(p,"RTRPM",data%Equipments%DataDisplayConsole%RTRPM) call json%add(p,"WOP",data%Equipments%DataDisplayConsole%WOP) call json%add(p,"ROP",data%Equipments%DataDisplayConsole%ROP) call json%add(p,"MudWeightIn",data%Equipments%DataDisplayConsole%MudWeightIn) call json%add(p,"MudWeightOut",data%Equipments%DataDisplayConsole%MudWeightOut) call json%add(p,"Buzzer1",data%Equipments%DataDisplayConsole%Buzzer1) call json%add(p,"Buzzer2",data%Equipments%DataDisplayConsole%Buzzer2) call json%add(p,"Buzzer3",data%Equipments%DataDisplayConsole%Buzzer3) call json%add(p,"Buzzer4",data%Equipments%DataDisplayConsole%Buzzer4) call json%add(p,"MFFIAlarmLow",data%Equipments%DataDisplayConsole%MFFIAlarmLow) call json%add(p,"MFFIAlarmHigh",data%Equipments%DataDisplayConsole%MFFIAlarmHigh) call json%add(p,"MVTAlarmLow",data%Equipments%DataDisplayConsole%MVTAlarmLow) call json%add(p,"MVTAlarmHigh",data%Equipments%DataDisplayConsole%MVTAlarmHigh) call json%add(p,"MFFISetAlarmSwitch",data%Equipments%DataDisplayConsole%MFFISetAlarmSwitch) call json%add(p,"MVTSetAlarmSwitch",data%Equipments%DataDisplayConsole%MVTSetAlarmSwitch) call json%add(parent,p) end subroutine subroutine Set_TotalDepth(v) implicit none real(8), intent(in) :: v ! print *,"total depth = ",v data%Equipments%DataDisplayConsole%TotalWellDepth = v data%Equipments%DrillingWatch%Depth = v ! call SetDistanceDrilled(v) end subroutine subroutine Set_BitPosition(v) implicit none real(8), intent(in) :: v data%Equipments%DataDisplayConsole%BitDepth = v data%Equipments%DrillingWatch%BitPosition = v end subroutine subroutine Set_RotaryTorque(v) implicit none real(8), intent(in) :: v data%Equipments%DataDisplayConsole%RotaryTorqueGauge = v data%Equipments%DrillingWatch%Torque = v data%Equipments%DataDisplayConsole%RTTorque = v end subroutine subroutine Set_MudWeightIn(v) use SimulationVariables implicit none real(8), intent(in) :: v data%Equipments%DataDisplayConsole%MudWeightIn = v data%Equipments%DrillingWatch%MudWeightIn = v end subroutine subroutine Set_MudWeightOut(v) use SimulationVariables !@!, only: MudWeightOutDw => data%Equipments%DataDisplayConsole%MudWeightOut implicit none real(8), intent(in) :: v data%Equipments%DataDisplayConsole%MudWeightOut = v data%Equipments%DrillingWatch%MudWeightOut = v end subroutine subroutine Set_TripTankVolume(v) use SimulationVariables !@!, only: data%Equipments%DrillingWatch%TripTankVolume implicit none real(8), intent(in) :: v data%Equipments%DrillingWatch%TripTankVolume = v end subroutine subroutine Set_FillVolume(v) use SimulationVariables !@!, only: data%Equipments%DrillingWatch%FillVolume implicit none real(8), intent(in) :: v data%Equipments%DrillingWatch%FillVolume = v end subroutine subroutine Set_HookLoad(v) use SimulationVariables !@!, only: HookLoadDw => data%Equipments%DataDisplayConsole%HookLoad implicit none real(8), intent(in) :: v data%Equipments%DataDisplayConsole%HookLoadPointer = v data%Equipments%DrillingWatch%HookLoad = v * 1000 data%Equipments%DataDisplayConsole%HookLoad = v end subroutine subroutine Set_WeightOnBit(v) use SimulationVariables !@!, only: data%Equipments%DrillingWatch%WeightOnBit implicit none real(8), intent(in) :: v data%Equipments%DataDisplayConsole%WOBPointer = v data%Equipments%DrillingWatch%WeightOnBit = v data%Equipments%DataDisplayConsole%WOP = v end subroutine subroutine Set_ROP(v) implicit none real(8), intent(in) :: v data%Equipments%DataDisplayConsole%ROP = v data%Equipments%DrillingWatch%ROP = v end subroutine subroutine Set_CasingPressure(v) ! use CChokeControlPanelVariables implicit none real(8), intent(in) :: v data%Equipments%DataDisplayConsole%CasingPressureGauge = v data%Equipments%DrillingWatch%CasingPressure = v data%Equipments%ChokeControlPanel%CasingPressure = v data%Equipments%DataDisplayConsole%CasingPressure = v end subroutine subroutine Set_StandPipePressure(v) implicit none real(8), intent(in) :: v data%Equipments%DataDisplayConsole%StandPipePressureGauge = v data%Equipments%DrillingWatch%PumpPressure = v data%Equipments%ChokeControlPanel%StandPipePressure = v data%Equipments%DataDisplayConsole%StandPipePressure = v end subroutine subroutine Set_RotaryRPMGauge(v) implicit none real(8), intent(in) :: v data%Equipments%DataDisplayConsole%RotaryRPMGauge = v data%Equipments%DrillingWatch%RPM = v data%Equipments%DataDisplayConsole%RTRPM = v ! call data%Equipments%DataDisplayConsole%OnRotaryRpmChange%RunAll(v) end subroutine subroutine Set_MP1SPMGauge(v) implicit none real(8), intent(in) :: v data%Equipments%DataDisplayConsole%MP1SPMGauge = v data%Equipments%DataDisplayConsole%MP1SPM = v !@data%State%unitySignals%(PumpsSpmChanges)) call PumpsSpmChanges(data%Equipments%DataDisplayConsole%MP1SPMGauge, data%Equipments%DataDisplayConsole%MP2SPMGauge) #ifdef deb if(print_log) print*, 'MP1SPMGauge=', data%Equipments%DataDisplayConsole%MP1SPMGauge #endif end subroutine subroutine Set_MP2SPMGauge(v) implicit none real(8), intent(in) :: v data%Equipments%DataDisplayConsole%MP2SPMGauge = v data%Equipments%DataDisplayConsole%MP2SPM = v !@data%State%unitySignals%(PumpsSpmChanges)) call PumpsSpmChanges(data%Equipments%DataDisplayConsole%MP1SPMGauge, data%Equipments%DataDisplayConsole%MP2SPMGauge) #ifdef deb if(print_log) print*, 'MP2SPMGauge=', data%Equipments%DataDisplayConsole%MP2SPMGauge #endif end subroutine end module CDataDisplayConsole