module CUnityOutputs
    implicit none    
    type :: UnityOutputsType    
        real(8) :: KellyHoseVibrationRate
        real(8) :: BlowoutFromStringPercent
        real(8) :: Pedal
        real(8) :: FlowRate
        real(8) :: RotaryRpm
        logical :: BlowoutFromString    
        logical :: BlowoutFromAnnular
        logical :: FlowFromReturnLine
        real :: FlowFromKelly
        real :: FlowFromFillupHead
        logical :: FlowKellyDisconnect
        logical :: FlowPipeDisconnect
    end type UnityOutputsType
    type(UnityOutputsType):: UnityOutputs

    contains

    ! subroutine Setup()
    !     use CDataDisplayConsole
    ! use ConfigurationVariables
    !     implicit none
    !     ! PumpsSpmChanges => Calc_KellyHoseVibrationRate
    !     ! call data%EquipmentControl%DataDisplayConsole%OnRotaryRpmChange%Add(Set_RotaryRpm)
    ! end subroutine
    
    
    
    
    
    
    
    
    
    
    subroutine Set_BlowoutFromString(v)
        implicit none
        logical, intent (in) :: v
        UnityOutputs%BlowoutFromString = v
#ifdef deb
        print*, 'BlowoutFromString=', v
#endif
    end subroutine
    
    logical function Get_BlowoutFromString()
        implicit none
        Get_BlowoutFromString = UnityOutputs%BlowoutFromString
    end function
    
    subroutine Set_BlowoutFromString_WN(v)
    !DEC$ ATTRIBUTES DLLEXPORT :: Set_BlowoutFromString_WN
    !DEC$ ATTRIBUTES ALIAS: 'Set_BlowoutFromString_WN' :: Set_BlowoutFromString_WN
        implicit none
        logical, intent (in) :: v
        call Set_BlowoutFromString(v)
    end subroutine
    
    logical function Get_BlowoutFromString_WN()
    !DEC$ ATTRIBUTES DLLEXPORT :: Get_BlowoutFromString_WN
    !DEC$ ATTRIBUTES ALIAS: 'Get_BlowoutFromString_WN' :: Get_BlowoutFromString_WN
        implicit none
        Get_BlowoutFromString_WN = UnityOutputs%BlowoutFromString
        !Get_BlowoutFromString = .TRUE.
    end function
    
    
    
    subroutine Set_BlowoutFromAnnular(v)
        implicit none
        logical, intent (in) :: v
        UnityOutputs%BlowoutFromAnnular = v
#ifdef deb
        print*, 'BlowoutFromAnnular=', v
#endif
    end subroutine
    
    logical function Get_BlowoutFromAnnular()
        implicit none
        Get_BlowoutFromAnnular = UnityOutputs%BlowoutFromAnnular
    end function
    
    subroutine Set_BlowoutFromAnnular_WN(v)
    !DEC$ ATTRIBUTES DLLEXPORT :: Set_BlowoutFromAnnular_WN
    !DEC$ ATTRIBUTES ALIAS: 'Set_BlowoutFromAnnular_WN' :: Set_BlowoutFromAnnular_WN
        implicit none
        logical, intent (in) :: v
        call Set_BlowoutFromAnnular(v)
    end subroutine
    
    logical function Get_BlowoutFromAnnular_WN()
    !DEC$ ATTRIBUTES DLLEXPORT :: Get_BlowoutFromAnnular_WN
    !DEC$ ATTRIBUTES ALIAS: 'Get_BlowoutFromAnnular_WN' :: Get_BlowoutFromAnnular_WN
        implicit none
        Get_BlowoutFromAnnular_WN = UnityOutputs%BlowoutFromAnnular
    end function
    
    
    
    
    
    subroutine Set_FlowFromReturnLine(v)
        implicit none
        logical, intent (in) :: v
        UnityOutputs%FlowFromReturnLine = v
#ifdef deb
        print*, 'FlowFromReturnLine=', v
#endif
    end subroutine
    
    logical function Get_FlowFromReturnLine()
        implicit none
        Get_FlowFromReturnLine = UnityOutputs%FlowFromReturnLine
    end function
    
    
    subroutine Set_FlowFromReturnLine_WN(v)
    !DEC$ ATTRIBUTES DLLEXPORT :: Set_FlowFromReturnLine_WN
    !DEC$ ATTRIBUTES ALIAS: 'Set_FlowFromReturnLine_WN' :: Set_FlowFromReturnLine_WN
        implicit none
        logical, intent (in) :: v
        call Set_FlowFromReturnLine(v)
    end subroutine
    
    logical function Get_FlowFromReturnLine_WN()
    !DEC$ ATTRIBUTES DLLEXPORT :: Get_FlowFromReturnLine_WN
    !DEC$ ATTRIBUTES ALIAS: 'Get_FlowFromReturnLine_WN' :: Get_FlowFromReturnLine_WN
        implicit none
        Get_FlowFromReturnLine_WN = UnityOutputs%FlowFromReturnLine
        !Get_FlowFromReturnLine_WN = .FALSE.
    end function
    
    
    
    subroutine Set_FlowFromKelly(v)
        implicit none
        real, intent (in) :: v
        UnityOutputs%FlowFromKelly = v
#ifdef deb
        print*, 'FlowFromKelly=', v
#endif
    end subroutine
    
    real function Get_FlowFromKelly()
        implicit none
        Get_FlowFromKelly = UnityOutputs%FlowFromKelly
    end function
    
    
    subroutine Set_FlowFromKelly_WN(v)
    !DEC$ ATTRIBUTES DLLEXPORT :: Set_FlowFromKelly_WN
    !DEC$ ATTRIBUTES ALIAS: 'Set_FlowFromKelly_WN' :: Set_FlowFromKelly_WN
        implicit none
        real, intent (in) :: v
        call Set_FlowFromKelly(v)
    end subroutine
    
    real function Get_FlowFromKelly_WN()
    !DEC$ ATTRIBUTES DLLEXPORT :: Get_FlowFromKelly_WN
    !DEC$ ATTRIBUTES ALIAS: 'Get_FlowFromKelly_WN' :: Get_FlowFromKelly_WN
        implicit none
#ifdef deb
        print*, 'FlowFromKellyR=', UnityOutputs%FlowFromKelly
#endif
        Get_FlowFromKelly_WN = UnityOutputs%FlowFromKelly
        !Get_FlowFromKelly = .FALSE.
    end function
    
    
    
    
    subroutine Set_FlowFromFillupHead(v)
        implicit none
        real, intent (in) :: v
        UnityOutputs%FlowFromFillupHead = v
#ifdef deb
        print*, 'FlowFromFillupHead=', v
#endif
    end subroutine
    
    real function Get_FlowFromFillupHead()
        implicit none
        Get_FlowFromFillupHead = UnityOutputs%FlowFromFillupHead
    end function
    
    
    subroutine Set_FlowFromFillupHead_WN(v)
    !DEC$ ATTRIBUTES DLLEXPORT :: Set_FlowFromFillupHead_WN
    !DEC$ ATTRIBUTES ALIAS: 'Set_FlowFromFillupHead_WN' :: Set_FlowFromFillupHead_WN
        implicit none
        real, intent (in) :: v
        call Set_FlowFromFillupHead(v)
    end subroutine
    
    real function Get_FlowFromFillupHead_WN()
    !DEC$ ATTRIBUTES DLLEXPORT :: Get_FlowFromFillupHead_WN
    !DEC$ ATTRIBUTES ALIAS: 'Get_FlowFromFillupHead_WN' :: Get_FlowFromFillupHead_WN
        implicit none
#ifdef deb
        print*, 'FlowFromFillupHeadR=', UnityOutputs%FlowFromFillupHead
#endif
        Get_FlowFromFillupHead_WN = UnityOutputs%FlowFromFillupHead
        !Get_FlowFromFillupHead = .FALSE.
    end function
    
    
    
    
    
    subroutine Set_FlowKellyDisconnect(v)
        implicit none
        logical, intent (in) :: v
        UnityOutputs%FlowKellyDisconnect = v
#ifdef deb
        print*, 'FlowKellyDisconnect=', v
#endif
    end subroutine
    
    logical function Get_FlowKellyDisconnect()
        implicit none
        Get_FlowKellyDisconnect = UnityOutputs%FlowKellyDisconnect
    end function
    
    
    subroutine Set_FlowKellyDisconnect_WN(v)
    !DEC$ ATTRIBUTES DLLEXPORT :: Set_FlowKellyDisconnect_WN
    !DEC$ ATTRIBUTES ALIAS: 'Set_FlowKellyDisconnect_WN' :: Set_FlowKellyDisconnect_WN
        implicit none
        logical, intent (in) :: v
        call Set_FlowKellyDisconnect(v)
    end subroutine
    
    logical function Get_FlowKellyDisconnect_WN()
    !DEC$ ATTRIBUTES DLLEXPORT :: Get_FlowKellyDisconnect_WN
    !DEC$ ATTRIBUTES ALIAS: 'Get_FlowKellyDisconnect_WN' :: Get_FlowKellyDisconnect_WN
        implicit none
        Get_FlowKellyDisconnect_WN = UnityOutputs%FlowKellyDisconnect
        !Get_FlowKellyDisconnect_WN = .false.
    end function
    
    
    
    
    subroutine Set_FlowPipeDisconnect(v)
        implicit none
        logical, intent (in) :: v
        UnityOutputs%FlowPipeDisconnect = v
#ifdef deb
        print*, 'FlowPipeDisconnect=', v
#endif
    end subroutine
    
    logical function Get_FlowPipeDisconnect()
        implicit none
        Get_FlowPipeDisconnect = UnityOutputs%FlowPipeDisconnect
    end function
    
    
    subroutine Set_FlowPipeDisconnect_WN(v)
    !DEC$ ATTRIBUTES DLLEXPORT :: Set_FlowPipeDisconnect_WN
    !DEC$ ATTRIBUTES ALIAS: 'Set_FlowPipeDisconnect_WN' :: Set_FlowPipeDisconnect_WN
        implicit none
        logical, intent (in) :: v
        call Set_FlowPipeDisconnect(v)
    end subroutine
    
    logical function Get_FlowPipeDisconnect_WN()
    !DEC$ ATTRIBUTES DLLEXPORT :: Get_FlowPipeDisconnect_WN
    !DEC$ ATTRIBUTES ALIAS: 'Get_FlowPipeDisconnect_WN' :: Get_FlowPipeDisconnect_WN
        implicit none
        Get_FlowPipeDisconnect_WN = UnityOutputs%FlowPipeDisconnect
        !Get_FlowPipeDisconnect_WN = .false.
    end function
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    subroutine Set_BlowoutFromStringPercent(v)
        implicit none
        real(8), intent (in) :: v
        UnityOutputs%BlowoutFromStringPercent = v
#ifdef deb
        print*, 'BlowoutFromStringPercent=', v
#endif
    end subroutine
    
    real(8) function GetBlowoutFromStringPercent()
	    implicit none
	    GetBlowoutFromStringPercent = UnityOutputs%BlowoutFromStringPercent
    end function
    
    
    
    subroutine Set_BlowoutFromStringPercent_WN(v)
    !DEC$ ATTRIBUTES DLLEXPORT :: Set_BlowoutFromStringPercent_WN
    !DEC$ ATTRIBUTES ALIAS: 'Set_BlowoutFromStringPercent_WN' :: Set_BlowoutFromStringPercent_WN
        implicit none
        real(8), intent (in) :: v
        call Set_BlowoutFromStringPercent(v)
    end subroutine
    
    real(8) function GetBlowoutFromStringPercent_WN()
    !DEC$ ATTRIBUTES DLLEXPORT :: GetBlowoutFromStringPercent_WN
    !DEC$ ATTRIBUTES ALIAS: 'GetBlowoutFromStringPercent_WN' :: GetBlowoutFromStringPercent_WN
	    implicit none
	    GetBlowoutFromStringPercent_WN = UnityOutputs%BlowoutFromStringPercent
	    !GetBlowoutFromStringPercent_WN = 0d0
    end function
    
    
    
    
    
    
    
    
    subroutine Calc_KellyHoseVibrationRate(spm1, spm2)
        use CScaleRange
        implicit none
        real(8), intent (in) :: spm1, spm2
        real :: total
        total = (spm1 + spm2)/2
        UnityOutputs%KellyHoseVibrationRate = ScaleRange(total, 0.0, 10.0, 0.0, 120.0)
#ifdef deb
        print*, 'KellyHoseVibrationRate=', UnityOutputs%KellyHoseVibrationRate
#endif
    end subroutine
    
    real(8) function GetKellyHoseVibrationRate()
	    implicit none
	    GetKellyHoseVibrationRate = UnityOutputs%KellyHoseVibrationRate
    end function
    
    real(8) function GetKellyHoseVibrationRate_WN()
    !DEC$ ATTRIBUTES DLLEXPORT :: GetKellyHoseVibrationRate_WN
    !DEC$ ATTRIBUTES ALIAS: 'GetKellyHoseVibrationRate_WN' :: GetKellyHoseVibrationRate_WN
	    implicit none
	    GetKellyHoseVibrationRate_WN = UnityOutputs%KellyHoseVibrationRate
    end function
    
    
    
    
    subroutine Set_Pedal(v)
        implicit none
        real(8), intent (in) :: v
        UnityOutputs%Pedal = v
#ifdef deb
        print*, 'Pedal=', v
#endif
    end subroutine
    
    real(8) function GetPedal()
	    implicit none
	    GetPedal = UnityOutputs%Pedal
    end function
    
    subroutine Set_Pedal_WN(v)
    !DEC$ ATTRIBUTES DLLEXPORT :: Set_Pedal_WN
    !DEC$ ATTRIBUTES ALIAS: 'Set_Pedal_WN' :: Set_Pedal_WN
        implicit none
        real(8), intent (in) :: v
        call Set_Pedal(v)
    end subroutine
    
    real(8) function GetPedal_WN()
    !DEC$ ATTRIBUTES DLLEXPORT :: GetPedal_WN
    !DEC$ ATTRIBUTES ALIAS: 'GetPedal_WN' :: GetPedal_WN
	    implicit none
	    GetPedal_WN = UnityOutputs%Pedal
	    !GetPedal = 50d0
    end function
    
    
    
    
    
    subroutine Set_FlowRate(v)
        implicit none
        real(8), intent (in) :: v
        UnityOutputs%FlowRate = v
#ifdef deb
        print*, 'FlowRate=', v
#endif
    end subroutine
    
    
    real(8) function GetFlowRate()
	    implicit none
	    GetFlowRate = UnityOutputs%FlowRate
    end function
    
    
    subroutine Set_FlowRate_WN(v)
    !DEC$ ATTRIBUTES DLLEXPORT :: Set_FlowRate_WN
    !DEC$ ATTRIBUTES ALIAS: 'Set_FlowRate_WN' :: Set_FlowRate_WN
        implicit none
        real(8), intent (in) :: v
        call Set_FlowRate(v)
    end subroutine
    
    real(8) function GetFlowRate_WN()
    !DEC$ ATTRIBUTES DLLEXPORT :: GetFlowRate_WN
    !DEC$ ATTRIBUTES ALIAS: 'GetFlowRate_WN' :: GetFlowRate_WN
	    implicit none
	    GetFlowRate_WN = UnityOutputs%FlowRate
	    !GetFlowRate_WN = 50d0
    end function
    
    
    
    
    subroutine Set_RotaryRpm(v)
        implicit none
        real(8), intent (in) :: v
        UnityOutputs%RotaryRpm = v
#ifdef deb
        print*, 'RotaryRpm=', v
#endif
    end subroutine
    
    real(8) function GetRotaryRpm()
	    implicit none
	    GetRotaryRpm = UnityOutputs%RotaryRpm
    end function

    
    subroutine Set_RotaryRpm_WN(v)
    !DEC$ ATTRIBUTES DLLEXPORT :: Set_RotaryRpm_WN
    !DEC$ ATTRIBUTES ALIAS: 'Set_RotaryRpm_WN' :: Set_RotaryRpm_WN
        implicit none
        real(8), intent (in) :: v
        call Set_RotaryRpm(v)
    end subroutine
    
    real(8) function GetRotaryRpm_WN()
    !DEC$ ATTRIBUTES DLLEXPORT :: GetRotaryRpm_WN
    !DEC$ ATTRIBUTES ALIAS: 'GetRotaryRpm_WN' :: GetRotaryRpm_WN
	    implicit none
	    GetRotaryRpm_WN = UnityOutputs%RotaryRpm
    end function
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    logical function GetSignal1()
    !DEC$ ATTRIBUTES DLLEXPORT :: GetSignal1
    !DEC$ ATTRIBUTES ALIAS: 'GetSignal1' :: GetSignal1
	    implicit none
	    !GetSignal1 = Signal1
	    GetSignal1 = .false.
    end function

    logical function GetSignal2()
    !DEC$ ATTRIBUTES DLLEXPORT :: GetSignal2
    !DEC$ ATTRIBUTES ALIAS: 'GetSignal2' :: GetSignal2
	    implicit none
	    !GetSignal2 = Signal2
	    GetSignal2 = .false.
    end function

    logical function GetSignal3()
    !DEC$ ATTRIBUTES DLLEXPORT :: GetSignal3
    !DEC$ ATTRIBUTES ALIAS: 'GetSignal3' :: GetSignal3
	    implicit none
	    !GetSignal3 = Signal3
	    GetSignal3 = .false.
    end function

    logical function GetSignal4()
    !DEC$ ATTRIBUTES DLLEXPORT :: GetSignal4
    !DEC$ ATTRIBUTES ALIAS: 'GetSignal4' :: GetSignal4
	    implicit none
	    !GetSignal4 = Signal4
	    GetSignal4 = .false.
    end function

    logical function GetSignal5()
    !DEC$ ATTRIBUTES DLLEXPORT :: GetSignal5
    !DEC$ ATTRIBUTES ALIAS: 'GetSignal5' :: GetSignal5
	    implicit none
	    !GetSignal5 = Signal5
	    GetSignal5 = .false.
    end function

    logical function GetSignal6()
    !DEC$ ATTRIBUTES DLLEXPORT :: GetSignal6
    !DEC$ ATTRIBUTES ALIAS: 'GetSignal6' :: GetSignal6
	    implicit none
	    !GetSignal6 = Signal6
	    GetSignal6 = .false.
    end function

    logical function GetSignal7()
    !DEC$ ATTRIBUTES DLLEXPORT :: GetSignal7
    !DEC$ ATTRIBUTES ALIAS: 'GetSignal7' :: GetSignal7
	    implicit none
	    !GetSignal7 = Signal7
	    GetSignal7 = .false.
    end function

    logical function GetSignal8()
    !DEC$ ATTRIBUTES DLLEXPORT :: GetSignal8
    !DEC$ ATTRIBUTES ALIAS: 'GetSignal8' :: GetSignal8
	    implicit none
	    !GetSignal8 = Signal8
	    GetSignal8 = .false.
    end function

    logical function GetSignal9()
    !DEC$ ATTRIBUTES DLLEXPORT :: GetSignal9
    !DEC$ ATTRIBUTES ALIAS: 'GetSignal9' :: GetSignal9
	    implicit none
	    !GetSignal9 = Signal9
	    GetSignal9 = .false.
    end function

    logical function GetSignal10()
    !DEC$ ATTRIBUTES DLLEXPORT :: GetSignal10
    !DEC$ ATTRIBUTES ALIAS: 'GetSignal10' :: GetSignal10
	    implicit none
	    !GetSignal10 = Signal10
	    GetSignal10 = .false.
    end function

    
    
end module CUnityOutputs
