Skip to content

Commit

Permalink
openmodelica compatibility fixes for #1254
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathadon committed May 24, 2022
1 parent 22ff283 commit 0c0bba3
Show file tree
Hide file tree
Showing 14 changed files with 142 additions and 61 deletions.
11 changes: 9 additions & 2 deletions IDEAS/BoundaryConditions/SolarIrradiation/RadSolData.mo
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public
annotation (Placement(transformation(extent={{96,-150},{116,-130}})));
Modelica.Blocks.Interfaces.RealOutput Tdes "Design tempearture"
annotation (Placement(transformation(extent={{96,-170},{116,-150}})));
parameter Boolean solDataInBus = numMatches==1
"True if the {inc,azi} combination is found in incAndAziInBus" annotation(Evaluate=true);
protected
final parameter Integer numMatches=
sum( {if IDEAS.Utilities.Math.Functions.isAngle(sim.incAndAziInBus[i,1],inc)
Expand All @@ -49,8 +51,7 @@ protected
then 1
else 0 for i in 1:sim.numIncAndAziInBus})
annotation(Evaluate=true);
final parameter Boolean solDataInBus = numMatches==1
"True if the {inc,azi} combination is found in incAndAziInBus" annotation(Evaluate=true);

final parameter Integer solDataIndex=
sum( {if IDEAS.Utilities.Math.Functions.isAngle(sim.incAndAziInBus[i,1],inc)
and (IDEAS.Utilities.Math.Functions.isAngle(sim.incAndAziInBus[i,2],azi)
Expand Down Expand Up @@ -190,6 +191,12 @@ If the correct data is not contained by the bus, custom solar data is calculated
</html>", revisions="<html>
<ul>
<li>
May 22, 2022, by Filip Jorissen:<br/>
Fixed Modelica specification compatibility issue.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1254\">
#1254</a>
</li>
<li>
August 12, 2020, by Filip Jorissen:<br/>
Using precomputed data for ceilings/floors even if azimuth angle mismatches.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1160\">
Expand Down
24 changes: 12 additions & 12 deletions IDEAS/Buildings/Components/Window.mo
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,6 @@ model Window "Multipane window"
Modelica.Blocks.Math.Gain gainDif(k=A*(1 - frac))
"Gain for diffuse solar irradiation"
annotation (Placement(transformation(extent={{-36,-50},{-32,-46}})));
protected
final parameter Real U_value=glazing.U_value*(1-frac)+fraType.U_value*frac
"Average window U-value";
final parameter Boolean addCapGla = windowDynamicsType == IDEAS.Buildings.Components.Interfaces.WindowDynamicsType.Two and not energyDynamics == Modelica.Fluid.Types.Dynamics.SteadyState
"Add lumped thermal capacitor for window glazing";
final parameter Boolean addCapFra = fraType.present and not energyDynamics == Modelica.Fluid.Types.Dynamics.SteadyState
"Added lumped thermal capacitor for window frame";
final parameter Modelica.Units.SI.HeatCapacity Cgla=layMul.C
"Heat capacity of glazing state";
final parameter Modelica.Units.SI.HeatCapacity Cfra=layMul.C*fraC
"Heat capacity of frame state";
final parameter Modelica.Units.SI.Area A_glass=A*(1 - frac);

IDEAS.Airflow.Multizone.TrickleVent trickleVent(
redeclare package Medium = Medium,
Expand Down Expand Up @@ -171,6 +159,18 @@ protected
inc=incInt,
azi=aziInt)
annotation (Placement(transformation(extent={{-100,-60},{-80,-40}})));
protected
final parameter Real U_value=glazing.U_value*(1-frac)+fraType.U_value*frac
"Average window U-value";
final parameter Boolean addCapGla = windowDynamicsType == IDEAS.Buildings.Components.Interfaces.WindowDynamicsType.Two and not energyDynamics == Modelica.Fluid.Types.Dynamics.SteadyState
"Add lumped thermal capacitor for window glazing";
final parameter Boolean addCapFra = fraType.present and not energyDynamics == Modelica.Fluid.Types.Dynamics.SteadyState
"Added lumped thermal capacitor for window frame";
final parameter Modelica.Units.SI.HeatCapacity Cgla=layMul.C
"Heat capacity of glazing state";
final parameter Modelica.Units.SI.HeatCapacity Cfra=layMul.C*fraC
"Heat capacity of frame state";
final parameter Modelica.Units.SI.Area A_glass=A*(1 - frac);
Modelica.Blocks.Routing.RealPassThrough Tdes
"Design temperature passthrough since propsBus variables cannot be addressed directly";
Modelica.Thermal.HeatTransfer.Components.HeatCapacitor heaCapGlaInt(C=Cgla/2,
Expand Down
9 changes: 9 additions & 0 deletions IDEAS/Buildings/Examples/OpenDoorComparison.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ within IDEAS.Buildings.Examples;
model OpenDoorComparison
"Comparison of two-zones models with and without an open door/cavity model"
extends Modelica.Icons.Example;
inner BoundaryConditions.SimInfoManager sim
annotation (Placement(transformation(extent={{-100,82},{-80,102}})));
Validation.Cases.Case900Template zone1_a(bouTypB=IDEAS.Buildings.Components.Interfaces.BoundaryType.InternalWall)
"Zone with an internal wall without cavity"
annotation (Placement(transformation(extent={{-40,40},{-20,60}})));
Expand All @@ -17,6 +19,7 @@ model OpenDoorComparison
Validation.Cases.Case900Template zone2_b(bouTypD=IDEAS.Buildings.Components.Interfaces.BoundaryType.External,
hasWinA=false) "Zone with a connection to internal wall of zone1_b"
annotation (Placement(transformation(extent={{20,-60},{40,-40}})));

equation
connect(zone2_a.proBusD[1], zone1_a.proBusB[1]) annotation (Line(
points={{20.4,43},{0,43},{0,56},{-21,56}},
Expand All @@ -41,6 +44,12 @@ equation
Documentation(revisions="<html>
<ul>
<li>
May 22, 2022, by Filip Jorissen:<br/>
Fixed Modelica specification compatibility issue.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1254\">
#1254</a>
</li>
<li>
May 23, 2018 by Filip Jorissen:<br/>
First implementation
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ equation
end when;
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,
-100},{100,100}}), graphics),
experiment(StopTime=864000),
__Dymola_experimentSetupOutput,
Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}),
graphics={
Expand All @@ -68,6 +67,12 @@ equation
Documentation(revisions="<html>
<ul>
<li>
May 22, 2022, by Filip Jorissen:<br/>
Fixed Modelica specification compatibility issue.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1254\">
#1254</a>
</li>
<li>
April 17, 2018, by Damien Picard:<br/>
Add t_start in sample to compute correctly for non zero initial time.<br/>
Use sim.Te as initialization instead of an arbitrary value of 283.15K.
Expand Down
9 changes: 9 additions & 0 deletions IDEAS/Examples/Benchmark/ScalingComponents.mo
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ model ScalingComponents
extent={{-5.5,-9.49999},{5.5,9.49997}},
rotation=90,
origin={8.5,-16.5})));
inner BoundaryConditions.SimInfoManager sim
annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
equation
connect(roof.propsBus_a, gF.propsBus[1]) annotation (Line(
points={{-83.4,-11.9167},{-83.4,28},{40,28}},
Expand All @@ -77,6 +79,13 @@ equation
experiment(StopTime=3.15e+07),
Documentation(revisions="<html>
<ul>
<li>
May 22, 2022, by Filip Jorissen:<br/>
Fixed Modelica specification compatibility issue.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1254\">
#1254</a>
</li>
<li>
March 10, 2017 by Filip Jorissen:<br/>
First implementation.
Expand Down
17 changes: 10 additions & 7 deletions IDEAS/Examples/TwinHouses/Interfaces/PartialTwinHouse.mo
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,14 @@ equation

annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)),
experiment(
StartTime=1.5e+007,
StopTime=2.35872e+007,
Interval=900,
Tolerance=1e-006),
__Dymola_Commands(file="Resources/Scripts/Dymola/Examples/Twinhouses/BuildingN2_Exp1.mos"
"Simulate and plot"));
Documentation(revisions="<html>
<ul>
<li>
May 22, 2022, by Filip Jorissen:<br/>
Removed experiment annotation to avoid failing OMC tests.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1254\">
#1254</a>
</li>
</ul>
</html>"));
end PartialTwinHouse;
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@ equation
annotation (
Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{
100,100}}),
graphics),
experiment(StopTime=1.2096e+006, Interval=600),
__Dymola_experimentSetupOutput);
graphics), Documentation(revisions="<html>
<ul>
<li>
May 22, 2022, by Filip Jorissen:<br/>
Removed experiment annotation to avoid failing OMC tests.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1254\">
#1254</a>
</li>
</ul>
</html>"));
end TestGridGeneral1PEq;
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
within IDEAS.Experimental.Electric.Distribution.AC.Examples;
model TestGridGeneral3P
import IDEAS;
extends Modelica.Icons.Example;
IDEAS.Experimental.Electric.Distribution.AC.Examples.Components.SinePower
risingflankSingle1[3](amplitude=4000)
Expand All @@ -24,7 +23,14 @@ equation
annotation (
Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{
100,100}}),
graphics),
experiment(StopTime=1.2096e+006, Interval=600),
__Dymola_experimentSetupOutput);
graphics), Documentation(revisions="<html>
<ul>
<li>
May 22, 2022, by Filip Jorissen:<br/>
Removed experiment annotation to avoid failing OMC tests.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1254\">
#1254</a>
</li>
</ul>
</html>"));
end TestGridGeneral3P;
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,14 @@ equation
color={85,170,255},
smooth=Smooth.None));
annotation (
Diagram(graphics),
experiment(StopTime=1.2096e+006, Interval=600),
__Dymola_experimentSetupOutput,
uses(IDEAS(version="1.0.0")));
Documentation(revisions="<html>
<ul>
<li>
May 22, 2022, by Filip Jorissen:<br/>
Removed experiment annotation to avoid failing OMC tests.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1254\">
#1254</a>
</li>
</ul>
</html>"));
end TestGridGeneral;
17 changes: 10 additions & 7 deletions IDEAS/Experimental/Electric/Examples/TestGridAndPVFromFile.mo
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ equation
points={{-39.8,74},{-30,74},{-30,10},{-40,10}},
color={85,170,255},
smooth=Smooth.None));
annotation (
Diagram(graphics),
experiment(
StartTime=1.8144e+007,
StopTime=1.93536e+007,
Interval=600),
__Dymola_experimentSetupOutput);
annotation (Documentation(revisions="<html>
<ul>
<li>
May 22, 2022, by Filip Jorissen:<br/>
Removed experiment annotation to avoid failing OMC tests.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1254\">
#1254</a>
</li>
</ul>
</html>"));
end TestGridAndPVFromFile;
16 changes: 10 additions & 6 deletions IDEAS/Experimental/Electric/Examples/TestGridAndPVSystemGeneral.mo
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ equation
points={{-39.8,74},{-30,74},{-30,10},{-40,10}},
color={85,170,255},
smooth=Smooth.None));
annotation (
experiment(
StartTime=1.8144e+007,
StopTime=1.93536e+007,
Interval=600),
__Dymola_experimentSetupOutput);
annotation (Documentation(revisions="<html>
<ul>
<li>
May 22, 2022, by Filip Jorissen:<br/>
Removed experiment annotation to avoid failing OMC tests.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1254\">
#1254</a>
</li>
</ul>
</html>"));
end TestGridAndPVSystemGeneral;
13 changes: 10 additions & 3 deletions IDEAS/Experimental/Electric/Photovoltaics/Examples/UsePVGeneral.mo
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,14 @@ equation
color={85,170,255},
smooth=Smooth.None));
annotation (
Diagram(graphics),
experiment(StopTime=3.1536e+007, Interval=600),
__Dymola_experimentSetupOutput);
Documentation(revisions="<html>
<ul>
<li>
May 22, 2022, by Filip Jorissen:<br/>
Removed experiment annotation to avoid failing OMC tests.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1254\">
#1254</a>
</li>
</ul>
</html>"));
end UsePVGeneral;
16 changes: 8 additions & 8 deletions IDEAS/Templates/Interfaces/BaseClasses/HeatingSystem.mo
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ partial model HeatingSystem "Partial heating/cooling system"

// --- Sensor
Modelica.Blocks.Interfaces.RealInput[nTemSen] TSensor(
final quantity="ThermodynamicTemperature",
unit="K",
displayUnit="degC",
min=0) "Sensor temperature" annotation (Placement(transformation(
each final quantity="ThermodynamicTemperature",
each unit="K",
each displayUnit="degC",
each min=0) "Sensor temperature" annotation (Placement(transformation(
extent={{10,-10},{-10,10}},
rotation=180,
origin={-204,-60})));

Modelica.Blocks.Interfaces.RealInput[nZones] TSet(
final quantity="ThermodynamicTemperature",
unit="K",
displayUnit="degC",
min=0) "Setpoint temperature for the zones" annotation (Placement(
each final quantity="ThermodynamicTemperature",
each unit="K",
each displayUnit="degC",
each min=0) "Setpoint temperature for the zones" annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
rotation=90,
Expand Down
23 changes: 19 additions & 4 deletions IDEAS/Templates/Interfaces/BaseClasses/VentilationSystem.mo
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@ partial model VentilationSystem

parameter Modelica.Units.SI.Power[nZones] Q_design=zeros(nZones)
"Design heat loss due to ventilation";//must be calculated depending on the case
Modelica.Blocks.Interfaces.RealInput[nZones] TSensor(final quantity="ThermodynamicTemperature",unit="K",displayUnit="degC", min=0)
Modelica.Blocks.Interfaces.RealInput[nZones] TSensor(
each final quantity="ThermodynamicTemperature",
each unit="K",
each displayUnit="degC")
"Sensor temperature of the zones" annotation (Placement(transformation(
extent={{10,-10},{-10,10}},
rotation=180,
origin={-204,-60})));
Modelica.Fluid.Interfaces.FluidPort_b[nZones] port_b(redeclare package Medium = Medium)
Modelica.Fluid.Interfaces.FluidPort_b[nZones] port_b(
redeclare each package Medium = Medium)
annotation (Placement(transformation(extent={{-210,-30},{-190,-10}})));
Modelica.Fluid.Interfaces.FluidPort_a[nZones] port_a(redeclare package Medium = Medium)
Modelica.Fluid.Interfaces.FluidPort_a[nZones] port_a(
redeclare each package Medium = Medium)
annotation (Placement(transformation(extent={{-210,10},{-190,30}})));

annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-200,
Expand Down Expand Up @@ -50,5 +55,15 @@ partial model VentilationSystem
color={85,170,255},
smooth=Smooth.None)}), Diagram(coordinateSystem(preserveAspectRatio=false,
extent={{-200,-100},{200,100}}),
graphics));
graphics),
Documentation(revisions="<html>
<ul>
<li>
May 22, 2022, by Filip Jorissen:<br/>
Fixed Modelica specification compatibility issue.
See <a href=\"https://github.com/open-ideas/IDEAS/issues/1254\">
#1254</a>
</li>
</ul>
</html>"));
end VentilationSystem;

0 comments on commit 0c0bba3

Please sign in to comment.