Nodes of different colours represent the following:
Solid arrows point from a parent (sub)module to the submodule which is descended from it. Dashed arrows point from a module being used to the module or program unit using it. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | LoadCenterNum |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
SUBROUTINE ManageInverter(LoadCenterNum)
! SUBROUTINE INFORMATION:
! AUTHOR Brent Griffith
! DATE WRITTEN June 2008
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! manage inveter models and fill AC variables
! METHODOLOGY EMPLOYED:
! <description>
! REFERENCES:
! na
! USE STATEMENTS:
USE CurveManager, ONLY: CurveValue
USE ScheduleManager, ONLY: GetCurrentScheduleValue
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: LoadCenterNum ! Load Center number counter
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: NormalizedPower
INTEGER :: InvertNum
INTEGER :: StorNum
REAL(r64) :: tmpEffic
REAL(r64) :: tempACpower
!model inverters
InvertNum = ElecLoadCenter(LoadCenterNum)%InverterModelNum
If (InvertNum <= 0) Return
!first figure DC into inverter
SELECT CASE (ElecLoadCenter(LoadCenterNum)%BussType)
CASE(DCBussInverter, DCBussInverterACStorage)
ElecLoadCenter(LoadCenterNum)%DCElectProdRate = Sum(ElecLoadCenter(LoadCenterNum)%ElecGen%DCElectProdRate)
Inverter(InvertNum)%DCPowerIn = ElecLoadCenter(LoadCenterNum)%DCElectProdRate
Inverter(InvertNum)%DCEnergyIn = Inverter(InvertNum)%DCPowerIn * (TimeStepSys * SecInHour)
CASE(DCBussInverterDCStorage)
StorNum = ElecLoadCenter(LoadCenterNum)%StorageModelNum
IF (StorNum > 0) Then
ElecLoadCenter(LoadCenterNum)%DCElectProdRate = Sum(ElecLoadCenter(LoadCenterNum)%ElecGen%DCElectProdRate)
Inverter(InvertNum)%DCPowerIn = ElecLoadCenter(LoadCenterNum)%DCElectProdRate
Inverter(InvertNum)%DCEnergyIn = Inverter(InvertNum)%DCPowerIn * (TimeStepSys * SecInHour)
ELSE ! throw error
CALL ShowFatalError('Electric load center is not set up properly, check electrical storage object for ' &
//TRIM(ElecLoadCenter(LoadCenterNum)%Name))
ENDIF
END SELECT
! check availability schedule
IF (GetCurrentScheduleValue(Inverter(InvertNum)%AvailSchedPtr) > 0.0d0) THEN
! now calculate Inverter based on model type
SELECT CASE (Inverter(InvertNum)%ModelType)
CASE(CECLookUpTableModel) !interpolation model from test data
! we don't model voltage, so use nominal voltage
NormalizedPower = Inverter(InvertNum)%DCPowerIn / Inverter(InvertNum)%RatedPower
! get efficiency
IF (NormalizedPower <= 0.1D0) THEN
! extrapolate or fix at 10% value? fix it for now
tmpEffic = Inverter(InvertNum)%LUTable%NomVoltEfficiencyARR(1)
ELSEIF ((NormalizedPower > 0.1D0) .and. (NormalizedPower <0.20D0)) THEN
tmpEffic = Inverter(InvertNum)%LUTable%NomVoltEfficiencyARR(1) &
+ ((NormalizedPower - 0.1D0)/(0.2D0 - 0.1D0)) &
* (Inverter(InvertNum)%LUTable%NomVoltEfficiencyARR(2) &
- Inverter(InvertNum)%LUTable%NomVoltEfficiencyARR(1) )
ELSEIF (NormalizedPower == 0.2D0) THEN
tmpEffic = Inverter(InvertNum)%LUTable%NomVoltEfficiencyARR(2)
ELSEIF ((NormalizedPower > 0.2D0) .and. (NormalizedPower <0.30D0)) THEN
tmpEffic = Inverter(InvertNum)%LUTable%NomVoltEfficiencyARR(2) &
+ ((NormalizedPower - 0.2D0)/(0.3D0 - 0.2D0)) &
* (Inverter(InvertNum)%LUTable%NomVoltEfficiencyARR(3) &
- Inverter(InvertNum)%LUTable%NomVoltEfficiencyARR(2) )
ELSEIF (NormalizedPower == 0.3D0) THEN
tmpEffic = Inverter(InvertNum)%LUTable%NomVoltEfficiencyARR(3)
ELSEIF ((NormalizedPower > 0.3D0) .and. (NormalizedPower <0.50D0)) THEN
tmpEffic = Inverter(InvertNum)%LUTable%NomVoltEfficiencyARR(3) &
+ ((NormalizedPower - 0.3D0)/(0.5D0 - 0.3D0)) &
* (Inverter(InvertNum)%LUTable%NomVoltEfficiencyARR(4) &
- Inverter(InvertNum)%LUTable%NomVoltEfficiencyARR(3) )
ELSEIF (NormalizedPower == 0.5D0) THEN
tmpEffic = Inverter(InvertNum)%LUTable%NomVoltEfficiencyARR(4)
ELSEIF ((NormalizedPower > 0.5D0) .and. (NormalizedPower <0.75D0)) THEN
tmpEffic = Inverter(InvertNum)%LUTable%NomVoltEfficiencyARR(4) &
+ ((NormalizedPower - 0.5D0)/(0.75D0 - 0.5D0)) &
* (Inverter(InvertNum)%LUTable%NomVoltEfficiencyARR(5) &
- Inverter(InvertNum)%LUTable%NomVoltEfficiencyARR(4) )
ELSEIF (NormalizedPower == 0.75D0) THEN
tmpEffic = Inverter(InvertNum)%LUTable%NomVoltEfficiencyARR(5)
ELSEIF ((NormalizedPower > 0.75D0) .and. (NormalizedPower <1.0D0)) THEN
tmpEffic = Inverter(InvertNum)%LUTable%NomVoltEfficiencyARR(5) &
+ ((NormalizedPower - 0.75D0)/(1.0D0 - 0.75D0)) &
* (Inverter(InvertNum)%LUTable%NomVoltEfficiencyARR(6) &
- Inverter(InvertNum)%LUTable%NomVoltEfficiencyARR(5) )
ELSEIF (NormalizedPower >= 1.0D0) THEN
tmpEffic = Inverter(InvertNum)%LUTable%NomVoltEfficiencyARR(6)
ENDIF
Inverter(InvertNum)%Efficiency = Max(tmpEffic, 0.0D0)
Inverter(InvertNum)%Efficiency = Min(Inverter(InvertNum)%Efficiency, 1.0D0)
tempACpower = Inverter(InvertNum)%Efficiency * Inverter(InvertNum)%DCPowerIn
CASE(CurveFuncOfPower)
NormalizedPower = Inverter(InvertNum)%DCPowerIn / Inverter(InvertNum)%RatedPower
tmpEffic = CurveValue(Inverter(InvertNum)%CurveNum, NormalizedPower)
Inverter(InvertNum)%Efficiency = Max(tmpEffic, Inverter(InvertNum)%MinEfficiency)
Inverter(InvertNum)%Efficiency = Min(Inverter(InvertNum)%Efficiency, Inverter(InvertNum)%MaxEfficiency)
tempACpower = Inverter(InvertNum)%Efficiency * Inverter(InvertNum)%DCPowerIn
If (tempACpower < Inverter(InvertNum)%MinPower) Then ! not enough to produce any AC power. all lost. also standby mode
tempACpower = 0.0D0
ELSEIF (tempACpower > Inverter(InvertNum)%MaxPower) then ! too much DC for inverter to handle, excess is lost
tempACpower = Inverter(InvertNum)%MaxPower
Inverter(InvertNum)%AncillACuseRate = 0.0D0
Inverter(InvertNum)%AncillACuseEnergy = 0.0D0
ELSE
Inverter(InvertNum)%AncillACuseRate = 0.0D0
Inverter(InvertNum)%AncillACuseEnergy = 0.0D0
ENDIF
CASE(SimpleConstantEff)
tempACpower = Inverter(InvertNum)%Efficiency* Inverter(InvertNum)%DCPowerIn
END SELECT
Inverter(InvertNum)%ACPowerOut = tempACpower
Inverter(InvertNum)%ACEnergyOut = tempACpower * (TimeStepSys * SecInHour)
IF (tempACpower == 0.0D0) THEN
Inverter(InvertNum)%AncillACuseEnergy = Inverter(InvertNum)%StandbyPower * (TimeStepSys * SecInHour)
Inverter(InvertNum)%AncillACuseRate = Inverter(InvertNum)%StandbyPower
ENDIF
ELSE ! not available per schedule, inverter is dead.
! assume thermal shunt for DC in, but no standby electricity
Inverter(InvertNum)%ACPowerOut = 0.0D0
Inverter(InvertNum)%ACEnergyOut = 0.0D0
Inverter(InvertNum)%AncillACuseRate = 0.0D0
Inverter(InvertNum)%AncillACuseEnergy = 0.0D0
ENDIF
!update report variables
Inverter(InvertNum)%ThermLossRate = Inverter(InvertNum)%DCPowerIn - Inverter(InvertNum)%ACPowerOut + &
Inverter(InvertNum)%StandbyPower
Inverter(InvertNum)%ThermLossEnergy = Inverter(InvertNum)%ThermLossRate * (TimeStepSys * SecInHour)
Inverter(InvertNum)%QdotconvZone = Inverter(InvertNum)%ThermLossRate * ( 1.0D0 - Inverter(InvertNum)%ZoneRadFract)
Inverter(InvertNum)%QdotRadZone = Inverter(InvertNum)%ThermLossRate * Inverter(InvertNum)%ZoneRadFract
RETURN
END SUBROUTINE ManageInverter