Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix battery discharge showing on ABUPS Fuel Fired Power Generation #5263

Closed
wants to merge 7 commits into from
18 changes: 11 additions & 7 deletions src/EnergyPlus/ManageElectricPower.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@ namespace ManageElectricPower {
SetupOutputVariable( "Inverter Thermal Loss Rate [W]", Inverter( InvertNum ).ThermLossRate, "System", "Average", Inverter( InvertNum ).Name );
SetupOutputVariable( "Inverter Thermal Loss Energy [J]", Inverter( InvertNum ).ThermLossEnergy, "System", "Sum", Inverter( InvertNum ).Name );
SetupOutputVariable( "Inverter Ancillary AC Electric Power [W]", Inverter( InvertNum ).AncillACuseRate, "System", "Average", Inverter( InvertNum ).Name );
SetupOutputVariable( "Inverter Ancillary AC Electric Energy [J]", Inverter( InvertNum ).AncillACuseEnergy, "System", "Sum", Inverter( InvertNum ).Name, _, "Electricity", "Cogeneration", _, "Plant" ); // called cogeneration for end use table
SetupOutputVariable( "Inverter Ancillary AC Electric Energy [J]", Inverter( InvertNum ).AncillACuseEnergy, "System", "Sum", Inverter( InvertNum ).Name, _, "Electricity", "Cogeneration", "Inverter", "Plant" ); // called cogeneration for end use table
if ( Inverter( InvertNum ).ZoneNum > 0 ) {
{ auto const SELECT_CASE_var( Inverter( InvertNum ).ModelType );
if ( SELECT_CASE_var == SimpleConstantEff ) {
Expand Down Expand Up @@ -1339,10 +1339,11 @@ namespace ManageElectricPower {
//For any battery
for ( StorNum = 1; StorNum <= NumofSimpleElecStorage + NumofKiBaMElecStorage; ++StorNum ) {
SetupOutputVariable( "Electric Storage Charge Power [W]", ElecStorage( StorNum ).StoredPower, "System", "Average", ElecStorage( StorNum ).Name );
SetupOutputVariable( "Electric Storage Charge Energy [J]", ElecStorage( StorNum ).StoredEnergy, "System", "Sum", ElecStorage( StorNum ).Name );
SetupOutputVariable( "Electric Storage Production Decrement Energy [J]", ElecStorage( StorNum ).DecrementedEnergyStored, "System", "Sum", ElecStorage( StorNum ).Name, _, "ElectricityProduced", "COGENERATION", _, "Plant" );
SetupOutputVariable( "Electric Storage Charge Energy [J]", ElecStorage( StorNum ).StoredEnergy, "System", "Sum", ElecStorage( StorNum ).Name, _, "Electricity", "Cogeneration", "Batteries", "Plant" );
SetupOutputVariable( "Electric Storage Production Decrement Energy [J]", ElecStorage( StorNum ).DecrementedEnergyStored, "System", "Sum", ElecStorage( StorNum ).Name );
SetupOutputVariable( "Electric Storage Discharge Power [W]", ElecStorage( StorNum ).DrawnPower, "System", "Average", ElecStorage( StorNum ).Name );
SetupOutputVariable( "Electric Storage Discharge Energy [J]", ElecStorage( StorNum ).DrawnEnergy, "System", "Sum", ElecStorage( StorNum ).Name, _, "ElectricityProduced", "COGENERATION", _, "Plant" );
SetupOutputVariable( "Electric Storage Discharge Energy [J]", ElecStorage( StorNum ).DrawnEnergy, "System", "Sum", ElecStorage( StorNum ).Name);
SetupOutputVariable( "Electric Storage Discharge Decrement Energy [J]", ElecStorage( StorNum ).DecrementDrawnEnergy, "System", "Sum", ElecStorage( StorNum ).Name, _, "Electricity", "Cogeneration", "Batteries", "Plant" );
SetupOutputVariable( "Electric Storage Thermal Loss Rate [W]", ElecStorage( StorNum ).ThermLossRate, "System", "Average", ElecStorage( StorNum ).Name );
SetupOutputVariable( "Electric Storage Thermal Loss Energy [J]", ElecStorage( StorNum ).ThermLossEnergy, "System", "Sum", ElecStorage( StorNum ).Name );
if ( AnyEnergyManagementSystemInModel ) {
Expand Down Expand Up @@ -1521,7 +1522,7 @@ namespace ManageElectricPower {
SetupOutputVariable( "Transformer Thermal Loss Rate [W]", Transformer( TransfNum ).ThermalLossRate, "System", "Average", Transformer( TransfNum ).Name );
SetupOutputVariable( "Transformer Thermal Loss Energy [J]", Transformer( TransfNum ).ThermalLossEnergy, "System", "Sum", Transformer( TransfNum ).Name );
SetupOutputVariable( "Transformer Distribution Electric Loss Energy [J]", Transformer( TransfNum ).ElecUseUtility, "System", "Sum", Transformer( TransfNum ).Name, _, "Electricity", "ExteriorEquipment", "Transformer", "System" );
SetupOutputVariable( "Transformer Cogeneration Electric Loss Energy [J]", Transformer( TransfNum ).ElecProducedCoGen, "System", "Sum", Transformer( TransfNum ).Name, _, "ElectricityProduced", "COGENERATION", _, "System" );
SetupOutputVariable( "Transformer Cogeneration Electric Loss Energy [J]", Transformer( TransfNum ).ElecProducedCoGen, "System", "Sum", Transformer( TransfNum ).Name, _, "ElectricityProduced", "COGENERATION", "Transformer", "System" );

if ( Transformer( TransfNum ).ZoneNum > 0 ) {
SetupZoneInternalGain( Transformer( TransfNum ).ZoneNum, "ElectricLoadCenter:Transformer", Transformer( TransfNum ).Name, IntGainTypeOf_ElectricLoadCenterTransformer, Transformer( TransfNum ).QdotConvZone, _, Transformer( TransfNum ).QdotRadZone );
Expand Down Expand Up @@ -2672,6 +2673,7 @@ namespace ManageElectricPower {
ElecStorage( ElecStorNum ).DecrementedEnergyStored = 0.0;
ElecStorage( ElecStorNum ).DrawnPower = 0.0;
ElecStorage( ElecStorNum ).DrawnEnergy = 0.0;
ElecStorage( ElecStorNum ).DecrementDrawnEnergy = 0.0;
ElecStorage( ElecStorNum ).ThermLossRate = 0.0;
ElecStorage( ElecStorNum ).ThermLossEnergy = 0.0;

Expand Down Expand Up @@ -3077,6 +3079,7 @@ namespace ManageElectricPower {
ElecStorage( ElecStorNum ).DecrementedEnergyStored = -1.0 * ElecStorage( ElecStorNum ).StoredEnergy;
ElecStorage( ElecStorNum ).DrawnPower = ElecStorage( ElecStorNum ).PelFromStorage;
ElecStorage( ElecStorNum ).DrawnEnergy = ElecStorage( ElecStorNum ).PelFromStorage * TimeStepSys * SecInHour;
ElecStorage( ElecStorNum ).DecrementDrawnEnergy = -1.0 * ElecStorage( ElecStorNum ).DrawnEnergy;
ElecStorage( ElecStorNum ).ThermLossRate = max( ElecStorage( ElecStorNum ).StoredPower * ( 1.0 - ElecStorage( ElecStorNum ).EnergeticEfficCharge ), ElecStorage( ElecStorNum ).DrawnPower * ( 1.0 - ElecStorage( ElecStorNum ).EnergeticEfficDischarge ) );
ElecStorage( ElecStorNum ).ThermLossEnergy = ElecStorage( ElecStorNum ).ThermLossRate * TimeStepSys * SecInHour;

Expand Down Expand Up @@ -3110,8 +3113,8 @@ namespace ManageElectricPower {
//output1
if ( TotalSOC > q0 ) {
ElecStorage( ElecStorNum ).StorageMode = 2;
ElecStorage( ElecStorNum ).StoredPower = Volt * I0 * Numbattery;
ElecStorage( ElecStorNum ).StoredEnergy = Volt * I0 * Numbattery * TimeStepSys * SecInHour;
ElecStorage( ElecStorNum ).StoredPower = -1.0 * Volt * I0 * Numbattery;
ElecStorage( ElecStorNum ).StoredEnergy = -1.0 * Volt * I0 * Numbattery * TimeStepSys * SecInHour;
ElecStorage( ElecStorNum ).DecrementedEnergyStored = -1.0 * ElecStorage( ElecStorNum ).StoredEnergy;
ElecStorage( ElecStorNum ).DrawnPower = 0.0;
ElecStorage( ElecStorNum ).DrawnEnergy = 0.0;
Expand All @@ -3133,6 +3136,7 @@ namespace ManageElectricPower {
ElecStorage( ElecStorNum ).DrawnEnergy = 0.0;
}

ElecStorage( ElecStorNum ).DecrementDrawnEnergy = -1.0 * ElecStorage( ElecStorNum ).DrawnEnergy;
ElecStorage( ElecStorNum ).AbsoluteSOC = TotalSOC * Numbattery;
ElecStorage( ElecStorNum ).FractionSOC = TotalSOC / qmax;
ElecStorage( ElecStorNum ).BatteryCurrent = I0 * Numpar;
Expand Down
4 changes: 4 additions & 0 deletions src/EnergyPlus/ManageElectricPower.hh
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ namespace ManageElectricPower {
Real64 DecrementedEnergyStored; // [J] this is the negative of StoredEnergy
Real64 DrawnPower; // [W]
Real64 DrawnEnergy; // [J]
Real64 DecrementDrawnEnergy; //[J]
Real64 ThermLossRate; // [W]
Real64 ThermLossEnergy; // [J]
int StorageMode; // [ ] mode of operation 0 for idle, 1 for discharging, 2 for charging
Expand Down Expand Up @@ -571,6 +572,7 @@ namespace ManageElectricPower {
DecrementedEnergyStored( 0.0 ),
DrawnPower( 0.0 ),
DrawnEnergy( 0.0 ),
DecrementDrawnEnergy( 0.0 ),
ThermLossRate( 0.0 ),
ThermLossEnergy( 0.0 ),
StorageMode( 0 ),
Expand Down Expand Up @@ -641,6 +643,7 @@ namespace ManageElectricPower {
Real64 const DecrementedEnergyStored, // [J] this is the negative of StoredEnergy
Real64 const DrawnPower, // [W]
Real64 const DrawnEnergy, // [J]
Real64 const DecrementDrawnEnergy, // [J]
Real64 const ThermLossRate, // [W]
Real64 const ThermLossEnergy, // [J]
int const StorageMode, // [ ] mode of operation 0 for idle, 1 for discharging, 2 for charging
Expand Down Expand Up @@ -708,6 +711,7 @@ namespace ManageElectricPower {
DecrementedEnergyStored( DecrementedEnergyStored ),
DrawnPower( DrawnPower ),
DrawnEnergy( DrawnEnergy ),
DecrementDrawnEnergy( DecrementDrawnEnergy ),
ThermLossRate( ThermLossRate ),
ThermLossEnergy( ThermLossEnergy ),
StorageMode( StorageMode ),
Expand Down