Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions BESMod/Resources/Scripts/ConvertBESMod_from_0.7.0_to_0.8.0.mos
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Conversion script for BESMod library
// Converts user models from BESMod 0.7.0 to 0.8.0
//
// Changes in 0.8.0:
// - Added new parameter for resetting integral KPIs at a specific time.
// The default value is 0, which reproduces the previous behavior,
// so no modifications to existing user models are required.
//
// This script is intentionally a no-op with respect to model content;
// it exists so that the Modelica tool recognizes the version transition
// and does not warn the user about an unknown source version.

clear
22 changes: 15 additions & 7 deletions BESMod/Systems/BaseClasses/PartialBuildingEnergySystem.mo
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ partial model PartialBuildingEnergySystem "Partial BES"
parameter Boolean use_openModelica=false
"=true to disable features which
are not available in open modelica" annotation(Dialog(tab="Advanced"));
parameter Modelica.Units.SI.Time resetTimeKPIs = 0
"Simulation time where KPI integrals are reset to zero"
annotation(Dialog(tab="Advanced"));

// Replaceable packages
replaceable package MediumHyd = IBPSA.Media.Water constrainedby
Expand Down Expand Up @@ -45,7 +48,8 @@ partial model PartialBuildingEnergySystem "Partial BES"
final TSetZone_nominal=systemParameters.TSetZone_nominal,
final use_hydraulic=systemParameters.use_hydraulic,
final use_ventilation=systemParameters.use_ventilation,
final use_openModelica=use_openModelica) annotation (
final use_openModelica=use_openModelica,
final resetTimeKPIs=resetTimeKPIs) annotation (
choicesAllMatching=true, Placement(transformation(extent={{2,2},{76,78}})));
replaceable BESMod.Systems.UserProfiles.BaseClasses.PartialUserProfiles
userProfiles constrainedby UserProfiles.BaseClasses.PartialUserProfiles(
Expand All @@ -62,8 +66,8 @@ partial model PartialBuildingEnergySystem "Partial BES"
final TDHW_nominal=systemParameters.TSetDHW,
final dpDHW_nominal=hydraulic.distribution.dpDHW_nominal,
final TDHWCold_nominal=systemParameters.TDHWWaterCold,
final subsystemDisabled=not systemParameters.use_dhw)
annotation (choicesAllMatching=true, Placement(
final subsystemDisabled=not systemParameters.use_dhw,
final resetTimeKPIs=resetTimeKPIs) annotation (choicesAllMatching=true, Placement(
transformation(extent={{2,-118},{78,-42}})));
replaceable Electrical.BaseClasses.PartialElectricalSystem electrical
constrainedby Electrical.BaseClasses.PartialElectricalSystem(
Expand All @@ -83,7 +87,8 @@ partial model PartialBuildingEnergySystem "Partial BES"
final ABui=building.ABui,
final ARoo=building.ARoo,
final hBui=building.hBui),
final use_openModelica=use_openModelica) annotation (Placement(
final use_openModelica=use_openModelica,
final resetTimeKPIs=resetTimeKPIs) annotation (Placement(
transformation(extent={{-198,40},{-42,136}})), choicesAllMatching=true);
replaceable BESMod.Systems.Hydraulical.BaseClasses.PartialHydraulicSystem hydraulic
if systemParameters.use_hydraulic constrainedby
Expand Down Expand Up @@ -115,7 +120,8 @@ partial model PartialBuildingEnergySystem "Partial BES"
final TDHWCold_nominal=DHW.TDHWCold_nominal,
final QDHW_flow_nominal=DHW.QDHW_flow_nominal,
final VDHWDayAt60=DHW.VDHWDayAt60),
final use_openModelica=use_openModelica)
final use_openModelica=use_openModelica,
final resetTimeKPIs=resetTimeKPIs)
annotation (choicesAllMatching=true, Placement(transformation(extent={{-198,
-98},{-42,-2}})));

Expand All @@ -139,7 +145,8 @@ partial model PartialBuildingEnergySystem "Partial BES"
final ABui=building.ABui,
final ARoo=building.ARoo,
final hBui=building.hBui),
final use_openModelica=use_openModelica) annotation (choicesAllMatching=true,
final use_openModelica=use_openModelica,
final resetTimeKPIs=resetTimeKPIs) annotation (choicesAllMatching=true,
Placement(transformation(extent={{122,2},{196,78}})));

// Outputs
Expand All @@ -152,7 +159,8 @@ partial model PartialBuildingEnergySystem "Partial BES"

replaceable Control.BaseClasses.PartialControl control constrainedby
Control.BaseClasses.PartialControl(
final use_openModelica=use_openModelica) annotation (Placement(transformation(
final use_openModelica=use_openModelica,
final resetTimeKPIs=resetTimeKPIs) annotation (Placement(transformation(
extent={{2,124},{78,198}})), choicesAllMatching=true);

Electrical.Interfaces.ExternalElectricalPin electricalGrid annotation (
Expand Down
3 changes: 3 additions & 0 deletions BESMod/Systems/BaseClasses/PartialFluidSubsystem.mo
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ model PartialFluidSubsystem
parameter Boolean use_openModelica=false
"=true to disable features which
are not available in open modelica" annotation(Dialog(tab="Advanced"));
parameter Modelica.Units.SI.Time resetTimeKPIs = 0
"Simulation time where KPI integrals are reset to zero"
annotation(Dialog(tab="Advanced"));

parameter Boolean allowFlowReversal=true
"= false to simplify equations, assuming, but not enforcing, no flow reversal"
Expand Down
3 changes: 3 additions & 0 deletions BESMod/Systems/Control/BaseClasses/PartialControl.mo
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ partial model PartialControl "Model for a partial HEMS control"
parameter Boolean use_openModelica=false
"=true to disable features which
are not available in open modelica" annotation(Dialog(tab="Advanced"));
parameter Modelica.Units.SI.Time resetTimeKPIs = 0
"Simulation time where KPI integrals are reset to zero"
annotation(Dialog(tab="Advanced"));
BESMod.Systems.Hydraulical.Interfaces.SystemControlBus sigBusHyd annotation (Placement(
transformation(extent={{-94,-114},{-64,-88}}), iconTransformation(
extent={{-94,-114},{-64,-88}})));
Expand Down
3 changes: 3 additions & 0 deletions BESMod/Systems/Demand/Building/BaseClasses/PartialDemand.mo
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ partial model PartialDemand "Partial demand model for HPS"
parameter Boolean use_openModelica=false
"=true to disable features which
are not available in open modelica" annotation(Dialog(tab="Advanced"));
parameter Modelica.Units.SI.Time resetTimeKPIs = 0
"Simulation time where KPI integrals are reset to zero"
annotation(Dialog(tab="Advanced"));
parameter Integer nZones(min=1) "Number of zones /rooms";
parameter Modelica.Units.SI.Temperature TSetZone_nominal[nZones]=fill(293.15,
nZones) "Nominal room set temperature"
Expand Down
6 changes: 4 additions & 2 deletions BESMod/Systems/Demand/Building/BuildingsRoomCase600FF.mo
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,12 @@ model BuildingsRoomCase600FF
extent={{-10,-10},{10,10}},
rotation=180,
origin={108,-92})));
BESMod.Utilities.KPIs.ComfortCalculator comfortCalculatorHea[nZones](TComBou=
BESMod.Utilities.KPIs.ComfortCalculator comfortCalculatorHea[nZones](
final resetTimeKPIs=resetTimeKPIs, TComBou=
TSetZone_nominal .- dTComfort, each for_heating=true)
annotation (Placement(transformation(extent={{66,0},{80,14}})));
BESMod.Utilities.KPIs.ComfortCalculator comfortCalculatorCool[nZones](TComBou=
BESMod.Utilities.KPIs.ComfortCalculator comfortCalculatorCool[nZones](
final resetTimeKPIs=resetTimeKPIs, TComBou=
TSetZone_nominal .+ dTComfort, each for_heating=false)
annotation (Placement(transformation(extent={{66,-18},{80,-4}})));
Modelica.Blocks.Routing.RealPassThrough reaPasThrTMea[nZones]
Expand Down
9 changes: 6 additions & 3 deletions BESMod/Systems/Demand/Building/TEASERThermalZone.mo
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ model TEASERThermalZone
origin={30,-120})));
Utilities.KPIs.ZoneEnergyBalance zoneEneBal[nZones](each final
with_ventilation=use_ventilation, each final with_floor=zoneParam[1].AFloor
> 0)
> 0,
each final resetTimeKPIs=resetTimeKPIs)
if use_verboseEnergyBalanceInternal "Zone energy balance"
annotation (Placement(transformation(extent={{-60,-200},{-22,-140}})));
Modelica.Blocks.Sources.RealExpression QExtWall_flow[nZones](y=thermalZone.ROM.extWall.Q_flow)
Expand All @@ -125,11 +126,13 @@ model TEASERThermalZone
rotation=0,
origin={-90,-110})));
Utilities.KPIs.ZoneTemperature zonTem[nZones](each final dTComfort=dTComfort,
final TSetZone_nominal=TSetZone_nominal)
final TSetZone_nominal=TSetZone_nominal,
each final resetTimeKPIs=resetTimeKPIs)
"Zone temperature KPIs for air temperature"
annotation (Placement(transformation(extent={{0,-50},{20,-30}})));
Utilities.KPIs.ZoneTemperature zonTemOpe[nZones](each final dTComfort=
dTComfort, final TSetZone_nominal=TSetZone_nominal)
dTComfort, final TSetZone_nominal=TSetZone_nominal,
each final resetTimeKPIs=resetTimeKPIs)
"Zone temperature KPIs for operative temperature"
annotation (Placement(transformation(extent={{0,-80},{20,-60}})));
Modelica.Blocks.Sources.RealExpression QRoof_flow[nZones](y=thermalZone.ROM.roof.Q_flow)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ Modelica.Blocks.Math.UnitConversions.From_degC fromDegC
extent={{10,-10},{-10,10}},
rotation=0,
origin={30,-10})));
Utilities.KPIs.EnergyKPICalculator integralKPICalculator(use_inpCon=false, y=
Utilities.KPIs.EnergyKPICalculator integralKPICalculator(use_inpCon=false,
final resetTimeKPIs=resetTimeKPIs, y=
-port_b.m_flow*cp*(TIs.y - TDHWCold_nominal))
annotation (Placement(transformation(extent={{60,-60},{80,-40}})));
IBPSA.Fluid.Movers.Preconfigured.FlowControlled_m_flow pump(
Expand Down
11 changes: 9 additions & 2 deletions BESMod/Systems/Electrical/BaseClasses/PartialElectricalSystem.mo
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ partial model PartialElectricalSystem "Partial model for electrical system"
parameter Boolean use_openModelica=false
"=true to disable features which
are not available in open modelica" annotation(Dialog(tab="Advanced"));
parameter Modelica.Units.SI.Time resetTimeKPIs = 0
"Simulation time where KPI integrals are reset to zero"
annotation(Dialog(tab="Advanced"));
parameter Integer nLoadsExtSubSys(min=1) = 4 "Number of external subsystems which result in electrical load / generation";
parameter Boolean use_elecHeating=true "=false to disable electric heating";
replaceable parameter RecordsCollection.ElectricalSystemBaseDataDefinition
Expand All @@ -13,27 +16,31 @@ partial model PartialElectricalSystem "Partial model for electrical system"
constrainedby
BESMod.Systems.Electrical.Generation.BaseClasses.PartialGeneration(
ARoo=electricalSystemParameters.ARoo,
final use_openModelica=use_openModelica)
final use_openModelica=use_openModelica,
final resetTimeKPIs=resetTimeKPIs)
annotation (choicesAllMatching=true, Placement(transformation(extent={{-148,
-102},{-62,36}})));
replaceable Distribution.BaseClasses.PartialDistribution distribution
constrainedby Distribution.BaseClasses.PartialDistribution(
final nSubSys=nLoadsExtSubSys + 2,
final use_openModelica=use_openModelica)
final use_openModelica=use_openModelica,
final resetTimeKPIs=resetTimeKPIs)
annotation (choicesAllMatching=true, Placement(transformation(extent={{-40,
-102},{52,36}})));

replaceable Transfer.BaseClasses.PartialTransfer transfer if use_elecHeating
constrainedby Transfer.BaseClasses.PartialTransfer(
final nParallelDem=electricalSystemParameters.nZones,
final use_openModelica=use_openModelica,
final resetTimeKPIs=resetTimeKPIs,
final Q_flow_nominal=electricalSystemParameters.Q_flow_nominal)
annotation (choicesAllMatching=true, Placement(transformation(extent={{68,-102},
{144,36}})));
replaceable Control.BaseClasses.PartialControl control constrainedby
BESMod.Systems.Electrical.Control.BaseClasses.PartialControl(
final nParallelDem=electricalSystemParameters.nZones,
final use_openModelica=use_openModelica,
final resetTimeKPIs=resetTimeKPIs,
final Q_flow_nominal=electricalSystemParameters.Q_flow_nominal)
annotation (choicesAllMatching=true, Placement(transformation(extent={{-146,
56},{142,106}})));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ partial model PartialControl "Partial electrical control model"
parameter Boolean use_openModelica=false
"=true to disable features which
are not available in open modelica" annotation(Dialog(tab="Advanced"));
parameter Modelica.Units.SI.Time resetTimeKPIs = 0
"Simulation time where KPI integrals are reset to zero"
annotation(Dialog(tab="Advanced"));
parameter Integer nParallelDem(min=1)
"Number of parallel demand systems of this system" annotation (Dialog(group=
"Design - Top Down: Parameters are given by the parent system"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ partial model PartialDistribution
parameter Boolean use_openModelica=false
"=true to disable features which
are not available in open modelica" annotation(Dialog(tab="Advanced"));
parameter Modelica.Units.SI.Time resetTimeKPIs = 0
"Simulation time where KPI integrals are reset to zero"
annotation(Dialog(tab="Advanced"));
parameter Integer nSubSys(min=2)
"Number of subsystems with electrical load / generation";
Interfaces.DistributionOutputs OutputDistr if not use_openModelica
Expand All @@ -16,14 +19,14 @@ partial model PartialDistribution
annotation (Placement(transformation(extent={{40,90},{60,110}})));
Interfaces.ExternalElectricalPin externalElectricalPin
annotation (Placement(transformation(extent={{40,-108},{60,-88}})));
Utilities.KPIs.EnergyKPICalculator eneKPILoa(final use_inpCon=true)
"Load on grid" annotation (Placement(
Utilities.KPIs.EnergyKPICalculator eneKPILoa(final use_inpCon=true, final
resetTimeKPIs=resetTimeKPIs) "Load on grid" annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={-30,-50})));
Utilities.KPIs.EnergyKPICalculator eneKPIGen(final use_inpCon=true)
"Load on grid" annotation (Placement(
Utilities.KPIs.EnergyKPICalculator eneKPIGen(final use_inpCon=true, final
resetTimeKPIs=resetTimeKPIs) "Load on grid" annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
rotation=0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ partial model PartialGeneration
parameter Boolean use_openModelica=false
"=true to disable features which
are not available in open modelica" annotation(Dialog(tab="Advanced"));
parameter Modelica.Units.SI.Time resetTimeKPIs = 0
"Simulation time where KPI integrals are reset to zero"
annotation(Dialog(tab="Advanced"));
parameter Integer numGenUnits(min=1) "Number of generation (e.g. PV module) units"
annotation(Dialog(group="Design - Bottom Up: Parameters are defined by the subsystem"));
parameter Real f_design[numGenUnits]=
Expand Down
3 changes: 2 additions & 1 deletion BESMod/Systems/Electrical/Generation/PVSystemMultiSub.mo
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ model PVSystemMultiSub
rotation=90,
origin={50,58})));

BESMod.Utilities.KPIs.EnergyKPICalculator intKPICalPElePV(use_inpCon=true)
BESMod.Utilities.KPIs.EnergyKPICalculator intKPICalPElePV(use_inpCon=true, final
resetTimeKPIs=resetTimeKPIs)
annotation (Placement(transformation(extent={{60,-60},{80,-40}})));
equation
for i in 1:numGenUnits loop
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
within BESMod.Systems.Electrical.Transfer.BaseClasses;
within BESMod.Systems.Electrical.Transfer.BaseClasses;
partial model PartialTransfer "Partial model for transfer subsystems"
parameter Boolean use_openModelica=false
"=true to disable features which
are not available in open modelica" annotation(Dialog(tab="Advanced"));
parameter Modelica.Units.SI.Time resetTimeKPIs = 0
"Simulation time where KPI integrals are reset to zero"
annotation(Dialog(tab="Advanced"));
parameter Integer nParallelDem(min=1)
"Number of parallel demand systems of this system" annotation (Dialog(group=
"Design - Top Down: Parameters are given by the parent system"));
Expand Down
3 changes: 2 additions & 1 deletion BESMod/Systems/Electrical/Transfer/IdealHeater.mo
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ model IdealHeater "Ideal heater as in reduced order model"
each final Q_flow=0)
annotation (Placement(transformation(extent={{40,-40},{60,-20}})));
Utilities.KPIs.EnergyKPICalculator heaKPI[nParallelDem](each final use_inpCon=
true) "Heating power KPI" annotation (Placement(transformation(
true, each final resetTimeKPIs=resetTimeKPIs)
"Heating power KPI" annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={0,-40})));
Expand Down
3 changes: 2 additions & 1 deletion BESMod/Systems/Electrical/Transfer/IdealHeaterFraRad.mo
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ model IdealHeaterFraRad
true) "Heating active"
annotation (Placement(transformation(extent={{-82,-80},{-62,-60}})));
BESMod.Utilities.KPIs.EnergyKPICalculator heaKPI[nParallelDem](each final
use_inpCon=true) "Heating power KPI" annotation (Placement(transformation(
use_inpCon=true, each final resetTimeKPIs=resetTimeKPIs)
"Heating power KPI" annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={0,-40})));
Expand Down
10 changes: 7 additions & 3 deletions BESMod/Systems/Hydraulical/BaseClasses/PartialHydraulicSystem.mo
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ partial model PartialHydraulicSystem
final show_T=show_T,
final rho=rho,
final cp=cp,
final use_openModelica=use_openModelica) annotation (choicesAllMatching=true,
final use_openModelica=use_openModelica,
final resetTimeKPIs=resetTimeKPIs) annotation (choicesAllMatching=true,
Placement(transformation(extent={{-140,-104},{-24,28}})));

replaceable BESMod.Systems.Hydraulical.Control.BaseClasses.PartialControl control
Expand Down Expand Up @@ -102,7 +103,8 @@ partial model PartialHydraulicSystem
final dpSup_nominal=transfer.dpSup_nominal,
final mSup_flow_nominal=transfer.mSup_flow_nominal,
final nHeaTra=transfer.nHeaTra),
final use_openModelica=use_openModelica)
final use_openModelica=use_openModelica,
final resetTimeKPIs=resetTimeKPIs)
annotation (choicesAllMatching=true, Placement(transformation(extent={{-132,54},
{154,122}})));
replaceable
Expand Down Expand Up @@ -148,6 +150,7 @@ partial model PartialHydraulicSystem
final tCrit=hydraulicSystemParameters.tCrit,
final QCrit=hydraulicSystemParameters.QCrit,
final use_openModelica=use_openModelica,
final resetTimeKPIs=resetTimeKPIs,
final dpSup_nominal=generation.dp_nominal,
final dpSupOld_design=generation.dpOld_design,
final dpDem_nominal=transfer.dpSup_nominal,
Expand Down Expand Up @@ -187,7 +190,8 @@ partial model PartialHydraulicSystem
final show_T=show_T,
final rho=rho,
final cp=cp,
final use_openModelica=use_openModelica) annotation (choicesAllMatching=true, Placement(transformation(
final use_openModelica=use_openModelica,
final resetTimeKPIs=resetTimeKPIs) annotation (choicesAllMatching=true, Placement(transformation(
extent={{112,-44},{180,28}})));
IBPSA.BoundaryConditions.WeatherData.Bus
weaBus "Weather data bus" annotation (Placement(transformation(extent={{-200,56},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ partial model PartialControl "Partial controller for HPS"
parameter Boolean use_openModelica=false
"=true to disable features which
are not available in open modelica" annotation(Dialog(tab="Advanced"));
parameter Modelica.Units.SI.Time resetTimeKPIs = 0
"Simulation time where KPI integrals are reset to zero"
annotation(Dialog(tab="Advanced"));

BESMod.Systems.Hydraulical.Interfaces.GenerationControlBus
sigBusGen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,11 @@ partial model PartialTwoStorageParallel
final allowFlowReversal_HC2=allowFlowReversal) "DHW storage"
annotation (Placement(transformation(extent={{-50,-70},{-18,-30}})));

BESMod.Utilities.KPIs.EnergyKPICalculator eneKPICalBuf(use_inpCon=false, y=fixTemBuf.port.Q_flow)
BESMod.Utilities.KPIs.EnergyKPICalculator eneKPICalBuf(use_inpCon=false,
final resetTimeKPIs=resetTimeKPIs, y=fixTemBuf.port.Q_flow)
annotation (Placement(transformation(extent={{-80,-160},{-60,-140}})));
BESMod.Utilities.KPIs.EnergyKPICalculator eneKPICalDHW(final use_inpCon=false, y=
BESMod.Utilities.KPIs.EnergyKPICalculator eneKPICalDHW(final use_inpCon=false,
final resetTimeKPIs=resetTimeKPIs, y=
fixTemDHW.port.Q_flow)
annotation (Placement(transformation(extent={{-100,-140},{-80,-120}})));
IBPSA.Fluid.Sensors.TemperatureTwoPort senTBuiSup(
Expand Down
Loading