|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277 |
- # 1 "/mnt/c/Projects/VSIM/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(logging>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
|