# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/Unity/UnityModule.f90" module UnityModule use SimulationVariables implicit none contains subroutine UnityInputsFromJson(parent) use json_module,IK =>json_ik type(json_value),pointer :: parent type(json_core) :: json type(json_value),pointer :: p,pval call json%get(parent,'Unity',p) call json%get(p,'ElevatorConnectionPossible',pval) call json%get(pval,data%Equipments%UnityInputs%ElevatorConnectionPossible) call json%get(p,'JointConnectionPossible',pval) call json%get(pval,data%Equipments%UnityInputs%JointConnectionPossible) call json%get(p,'IsKellyBushingSetInTable',pval) call json%get(pval,data%Equipments%UnityInputs%IsKellyBushingSetInTable) call json%get(p,'ElevatorPickup',pval) call json%get(pval,data%Equipments%UnityInputs%ElevatorPickup) call json%get(p,'NearFloorPosition',pval) call json%get(pval,data%Equipments%UnityInputs%NearFloorPosition) call json%get(p,'SingleSetInMouseHole',pval) call json%get(pval,data%Equipments%UnityInputs%SingleSetInMouseHole) call json%get(p,'TdsConnectionPossible',pval) call json%get(pval,data%Equipments%UnityInputs%TdsConnectionPossible) call json%get(p,'TdsStemIn',pval) call json%get(pval,data%Equipments%UnityInputs%TdsStemIn) end subroutine subroutine UnityOutputsToJson(parent) type(json_value),pointer :: parent type(json_core) :: json type(json_value),pointer :: p ! 1. create new node call json%create_object(p,'Unity') ! 2. add member of data type to new node call json%add(p,"KellyHoseVibrationRate",data%Equipments%UnityOutputs%KellyHoseVibrationRate) call json%add(p,"BlowoutFromStringPercent",data%Equipments%UnityOutputs%BlowoutFromStringPercent) call json%add(p,"Pedal",data%Equipments%UnityOutputs%Pedal) call json%add(p,"FlowRate",data%Equipments%UnityOutputs%FlowRate) call json%add(p,"RotaryRpm",data%Equipments%UnityOutputs%RotaryRpm) call json%add(p,"BlowoutFromString",data%Equipments%UnityOutputs%BlowoutFromString) call json%add(p,"BlowoutFromAnnular",data%Equipments%UnityOutputs%BlowoutFromAnnular) call json%add(p,"FlowFromReturnLine",data%Equipments%UnityOutputs%FlowFromReturnLine) call json%add(p,"FlowFromKelly",data%Equipments%UnityOutputs%FlowFromKelly) call json%add(p,"FlowFromFillupHead",data%Equipments%UnityOutputs%FlowFromFillupHead) call json%add(p,"FlowKellyDisconnect",data%Equipments%UnityOutputs%FlowKellyDisconnect) call json%add(p,"FlowPipeDisconnect",data%Equipments%UnityOutputs%FlowPipeDisconnect) ! 3. add new node to parent call json%add(parent,p) end subroutine logical function Get_ElevatorPickup() Get_ElevatorPickup = data%Equipments%UnityInputs%ElevatorPickup end function logical function Get_IsKellyBushingSetInTable() Get_IsKellyBushingSetInTable = data%Equipments%UnityInputs%IsKellyBushingSetInTable end function logical function Get_JointConnectionPossible() Get_JointConnectionPossible = data%Equipments%UnityInputs%JointConnectionPossible end function logical function Get_ElevatorConnectionPossible() implicit none Get_ElevatorConnectionPossible = data%Equipments%UnityInputs%ElevatorConnectionPossible end function logical function Get_NearFloorPosition() Get_NearFloorPosition = data%Equipments%UnityInputs%NearFloorPosition end function subroutine Set_NearFloorPosition(v) implicit none logical, intent(in) :: v ! #ifdef ExcludeExtraChanges ! if(data%Equipments%UnityInputs%NearFloorPosition == v) return ! #endif data%Equipments%UnityInputs%NearFloorPosition = v !**call data%Equipments%UnityInputs%OnNearFloorPositionChange%RunAll() if(log_level>4) then print*, 'NearFloorPosition =', data%Equipments%UnityInputs%NearFloorPosition endif end subroutine logical function Get_SingleSetInMouseHole() Get_SingleSetInMouseHole = data%Equipments%UnityInputs%SingleSetInMouseHole end function logical function Get_TdsConnectionPossible() Get_TdsConnectionPossible = data%Equipments%UnityInputs%TdsConnectionPossible end function logical function Get_TdsStemIn() Get_TdsStemIn = data%Equipments%UnityInputs%TdsStemIn end function subroutine Set_BlowoutFromString(v) implicit none logical, intent (in) :: v data%Equipments%UnityOutputs%BlowoutFromString = v # 105 end subroutine logical function Get_BlowoutFromString() implicit none Get_BlowoutFromString = data%Equipments%UnityOutputs%BlowoutFromString end function subroutine Set_BlowoutFromAnnular(v) implicit none logical, intent (in) :: v data%Equipments%UnityOutputs%BlowoutFromAnnular = v # 119 end subroutine logical function Get_BlowoutFromAnnular() implicit none Get_BlowoutFromAnnular = data%Equipments%UnityOutputs%BlowoutFromAnnular end function subroutine Set_FlowFromReturnLine(v) implicit none logical, intent (in) :: v data%Equipments%UnityOutputs%FlowFromReturnLine = v # 137 end subroutine logical function Get_FlowFromReturnLine() implicit none Get_FlowFromReturnLine = data%Equipments%UnityOutputs%FlowFromReturnLine end function subroutine Set_FlowFromKelly(v) implicit none real, intent (in) :: v data%Equipments%UnityOutputs%FlowFromKelly = v # 153 end subroutine real function Get_FlowFromKelly() implicit none Get_FlowFromKelly = data%Equipments%UnityOutputs%FlowFromKelly end function subroutine Set_FlowFromFillupHead(v) implicit none real, intent (in) :: v data%Equipments%UnityOutputs%FlowFromFillupHead = v # 171 end subroutine real function Get_FlowFromFillupHead() implicit none Get_FlowFromFillupHead = data%Equipments%UnityOutputs%FlowFromFillupHead end function subroutine Set_FlowKellyDisconnect(v) implicit none logical, intent (in) :: v data%Equipments%UnityOutputs%FlowKellyDisconnect = v # 190 end subroutine logical function Get_FlowKellyDisconnect() implicit none Get_FlowKellyDisconnect = data%Equipments%UnityOutputs%FlowKellyDisconnect end function subroutine Set_FlowPipeDisconnect(v) implicit none logical, intent (in) :: v data%Equipments%UnityOutputs%FlowPipeDisconnect = v # 207 end subroutine logical function Get_FlowPipeDisconnect() implicit none Get_FlowPipeDisconnect = data%Equipments%UnityOutputs%FlowPipeDisconnect end function subroutine Set_BlowoutFromStringPercent(v) implicit none real(8), intent (in) :: v data%Equipments%UnityOutputs%BlowoutFromStringPercent = v # 221 end subroutine real(8) function GetBlowoutFromStringPercent() implicit none GetBlowoutFromStringPercent = data%Equipments%UnityOutputs%BlowoutFromStringPercent end function subroutine Calc_KellyHoseVibrationRate(spm1, spm2) use CScaleRange implicit none real(8), intent (in) :: spm1, spm2 real :: total total = (spm1 + spm2)/2 data%Equipments%UnityOutputs%KellyHoseVibrationRate = ScaleRange(total, 0.0, 10.0, 0.0, 120.0) # 238 end subroutine real(8) function GetKellyHoseVibrationRate() implicit none GetKellyHoseVibrationRate = data%Equipments%UnityOutputs%KellyHoseVibrationRate end function subroutine Set_Pedal(v) implicit none real(8), intent (in) :: v data%Equipments%UnityOutputs%Pedal = v # 252 end subroutine real(8) function GetPedal() implicit none GetPedal = data%Equipments%UnityOutputs%Pedal end function subroutine Set_FlowRate(v) implicit none real(8), intent (in) :: v data%Equipments%UnityOutputs%FlowRate = v # 266 end subroutine real(8) function GetFlowRate() implicit none GetFlowRate = data%Equipments%UnityOutputs%FlowRate end function subroutine Set_RotaryRpm(v) implicit none real(8), intent (in) :: v data%Equipments%UnityOutputs%RotaryRpm = v # 280 end subroutine real(8) function GetRotaryRpm() implicit none GetRotaryRpm = data%Equipments%UnityOutputs%RotaryRpm end function end module UnityModule