Skip to content

Commit

Permalink
Merge branch 'master' into issue1921_organicRankineCycle
Browse files Browse the repository at this point in the history
  • Loading branch information
mwetter committed Oct 17, 2024
2 parents 7e4afa1 + 5136ecf commit 689761b
Show file tree
Hide file tree
Showing 159 changed files with 2,069 additions and 3,361 deletions.
30 changes: 27 additions & 3 deletions IBPSA/Electrical/Transmission/BaseClasses/BaseCable.mo
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@ record BaseCable "Record that contains the properties of a generic cable"
"Frequency considered in the definition of cables properties";
output Modelica.Units.SI.Resistance R "Resistance of the cable";
protected
parameter Modelica.Units.SI.AngularVelocity omega=2*Modelica.Constants.pi*f;
Modelica.Units.SI.AngularVelocity omega=2*Modelica.Constants.pi*f;
annotation (Documentation(revisions="<html>
<ul>
<li>
August 30, 2024, by Michael Wetter:<br/>
Removed wrong parameter keyword on protected variable, which is needed for Dymola 2025x.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1930\">IBPSA, #1930</a>.
</li>
<li>
September 23, 2014, by Marco Bonvini:<br/>
Added function and documentation
</li>
Expand All @@ -36,10 +42,16 @@ Added function and documentation
"Frequency considered in the definition of cables properties";
output Modelica.Units.SI.Inductance L "Inductance of the cable";
protected
parameter Modelica.Units.SI.AngularVelocity omega=2*Modelica.Constants.pi*f;
Modelica.Units.SI.AngularVelocity omega=2*Modelica.Constants.pi*f;
annotation (Documentation(revisions="<html>
<ul>
<li>
August 30, 2024, by Michael Wetter:<br/>
Removed wrong parameter keyword on protected variable, which is needed for Dymola 2025x.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1930\">IBPSA, #1930</a>.
</li>
<li>
September 23, 2014, by Marco Bonvini:<br/>
Added function and documentation
</li>
Expand All @@ -55,10 +67,16 @@ Added function and documentation
"Frequency considered in the definition of cables properties";
output Modelica.Units.SI.Capacitance C "Capacitance of the cable";
protected
parameter Modelica.Units.SI.AngularVelocity omega=2*Modelica.Constants.pi*f;
Modelica.Units.SI.AngularVelocity omega=2*Modelica.Constants.pi*f;
annotation (Documentation(revisions="<html>
<ul>
<li>
August 30, 2024, by Michael Wetter:<br/>
Removed wrong parameter keyword on protected variable, which is needed for Dymola 2025x.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1930\">IBPSA, #1930</a>.
</li>
<li>
September 23, 2014, by Marco Bonvini:<br/>
Added function and documentation
</li>
Expand All @@ -69,6 +87,12 @@ Added function and documentation
annotation (Documentation(revisions="<html>
<ul>
<li>
August 30, 2024, by Michael Wetter:<br/>
Removed wrong parameter keyword on protected variable, which is needed for Dymola 2025x.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1930\">IBPSA, #1930</a>.
</li>
<li>
September 24, 2014, by Marco Bonvini:<br/>
Revised structure of the record, now the temperature constant <code>M</code>
is directly specified in the record.
Expand Down
4 changes: 2 additions & 2 deletions IBPSA/Examples/SimpleHouse.mo
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ model SimpleHouse

Fluid.Movers.FlowControlled_m_flow pum(
redeclare package Medium = MediumWater,
use_inputFilter=false,
use_riseTime=false,
m_flow_nominal=mWat_flow_nominal,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
allowFlowReversal=allowFlowReversal,
Expand All @@ -109,7 +109,7 @@ model SimpleHouse
Fluid.Movers.FlowControlled_dp fan(
redeclare package Medium = MediumAir,
dp_nominal=dpAir_nominal,
use_inputFilter=false,
use_riseTime=false,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
nominalValuesDefineDefaultPressureCurve=true,
m_flow_nominal=mAir_flow_nominal,
Expand Down
2 changes: 1 addition & 1 deletion IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse4.mo
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ model SimpleHouse4 "Heating model"

Fluid.Movers.Preconfigured.FlowControlled_m_flow pum(
redeclare package Medium = MediumWater,
use_inputFilter=false,
use_riseTime=false,
m_flow_nominal=mWat_flow_nominal,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
allowFlowReversal=false) "Pump"
Expand Down
8 changes: 3 additions & 5 deletions IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse6.mo
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ model SimpleHouse6 "Free cooling model"
redeclare package Medium = MediumAir,
show_T=true,
dp_nominal=dpAir_nominal,
use_inputFilter=false,
use_riseTime=false,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
m_flow_nominal=mAir_flow_nominal)
"Constant head fan" annotation (Placement(transformation(
extent={{-10,10},{10,-10}},
origin={0,130})));
m_flow_nominal=mAir_flow_nominal) "Constant head fan" annotation (Placement(
transformation(extent={{-10,10},{10,-10}}, origin={0,130})));

IBPSA.Fluid.HeatExchangers.ConstantEffectiveness hexRec(
redeclare package Medium1 = MediumAir,
Expand Down
73 changes: 40 additions & 33 deletions IBPSA/Fluid/Actuators/BaseClasses/ActuatorSignal.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@ within IBPSA.Fluid.Actuators.BaseClasses;
model ActuatorSignal
"Partial model that implements the filtered opening for valves and dampers"

constant Integer order(min=1) = 2 "Order of filter";
parameter Boolean use_strokeTime=true
"Set to true to continuously open and close valve using strokeTime"
annotation(Dialog(tab="Dynamics", group="Actuator position"));

parameter Boolean use_inputFilter=true
"= true, if opening is filtered with a 2nd order CriticalDamping filter"
annotation(Dialog(tab="Dynamics", group="Filtered opening"));
parameter Modelica.Units.SI.Time riseTime=120
"Rise time of the filter (time to reach 99.6 % of an opening step)"
parameter Modelica.Units.SI.Time strokeTime=120
"Time needed to fully open or close actuator"
annotation (Dialog(
tab="Dynamics",
group="Filtered opening",
enable=use_inputFilter));
group="Actuator position",
enable=use_strokeTime));
parameter Modelica.Blocks.Types.Init init=Modelica.Blocks.Types.Init.InitialOutput
"Type of initialization (no init/steady state/initial state/initial output)"
annotation(Dialog(tab="Dynamics", group="Filtered opening",enable=use_inputFilter));
annotation(Dialog(tab="Dynamics", group="Actuator position",
enable=use_strokeTime));
parameter Real y_start=1 "Initial position of actuator"
annotation(Dialog(tab="Dynamics", group="Filtered opening",enable=use_inputFilter));
annotation(Dialog(tab="Dynamics", group="Actuator position",
enable=use_strokeTime));

Modelica.Blocks.Interfaces.RealInput y(min=0, max=1)
"Actuator position (0: closed, 1: open)"
Expand All @@ -33,37 +34,36 @@ model ActuatorSignal
annotation (Placement(transformation(extent={{40,60},{60,80}})));

// Classes used to implement the filtered opening
protected
final parameter Modelica.Units.SI.Frequency fCut=5/(2*Modelica.Constants.pi*
riseTime) "Cut-off frequency of filter";

protected
parameter Boolean casePreInd = false
"In case of PressureIndependent the model I/O is modified"
annotation(Evaluate=true);
Modelica.Blocks.Interfaces.RealOutput y_internal(unit="1")
"Output connector for internal use (= y_actual if not casePreInd)";
Modelica.Blocks.Interfaces.RealOutput y_filtered if use_inputFilter
Modelica.Blocks.Interfaces.RealOutput y_filtered if use_strokeTime
"Filtered valve position in the range 0..1"
annotation (Placement(transformation(extent={{40,78},{60,98}}),
iconTransformation(extent={{60,50},{80,70}})));

IBPSA.Fluid.BaseClasses.ActuatorFilter filter(
final n=order,
final f=fCut,
final normalized=true,
final initType=init,
final y_start=y_start) if use_inputFilter
"Second order filter to approximate actuator opening time, and to improve numerics"
annotation (Placement(transformation(extent={{6,81},{20,95}})));

Modelica.Blocks.Nonlinear.SlewRateLimiter actPos(
Rising=1/strokeTime,
Falling=-1/strokeTime,
Td=0.001*strokeTime,
initType=init,
y_start=y_start,
strict=true) if use_strokeTime "Actuator position"
annotation (Placement(transformation(extent={{14,82},{26,94}})));
equation
connect(filter.y, y_filtered)
annotation (Line(points={{20.7,88},{50,88}}, color={0,0,127}));
if use_inputFilter then
connect(y, filter.u) annotation (Line(points={{1.11022e-15,120},{1.11022e-15,
88},{4.6,88}}, color={0,0,127}));
connect(filter.y, y_internal) annotation (Line(points={{20.7,88},{30,88},{30,
70},{50,70}}, color={0,0,127}));
connect(actPos.y, y_filtered)
annotation (Line(points={{26.6,88},{50,88}},
color={0,0,127}));

if use_strokeTime then
connect(actPos.u, y)
annotation (Line(points={{12.8,88},{0,88},{0,120}}, color={0,0,127}));

connect(y_filtered, y_internal);
else
connect(y, y_internal) annotation (Line(
points={{1.11022e-15,120},{0,120},{0,70},{50,70}},
Expand All @@ -72,26 +72,27 @@ equation
if not casePreInd then
connect(y_internal, y_actual);
end if;

annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
-100},{100,100}}), graphics={
Line(
points={{0,48},{0,108}}),
Line(
points={{0,70},{40,70}}),
Rectangle(
visible=use_inputFilter,
visible=use_strokeTime,
extent={{-32,40},{34,100}},
lineColor={0,0,0},
fillColor={135,135,135},
fillPattern=FillPattern.Solid),
Ellipse(
visible=use_inputFilter,
visible=use_strokeTime,
extent={{-32,100},{34,40}},
lineColor={0,0,0},
fillColor={135,135,135},
fillPattern=FillPattern.Solid),
Text(
visible=use_inputFilter,
visible=use_strokeTime,
extent={{-20,94},{22,48}},
textColor={0,0,0},
fillColor={135,135,135},
Expand Down Expand Up @@ -119,6 +120,12 @@ for a description of the filter.
</html>", revisions="<html>
<ul>
<li>
August 26, 2024, by Michael Wetter:<br/>
Implemented linear actuator travel dynamics.<br/>
This is for <a href=\"https://github.com/lbl-srg/modelica-buildings/issues/3965\">Buildings, #3965</a> and
for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1926\">IBPSA, #1926</a>.
</li>
<li>
June 10, 2021, by Michael Wetter:<br/>
Changed implementation of the filter and changed the parameter <code>order</code> to a constant
as most users need not change this value.<br/>
Expand Down
61 changes: 29 additions & 32 deletions IBPSA/Fluid/Actuators/BaseClasses/PartialThreeWayValve.mo
Original file line number Diff line number Diff line change
@@ -1,36 +1,33 @@
within IBPSA.Fluid.Actuators.BaseClasses;
partial model PartialThreeWayValve "Partial three way valve"
extends IBPSA.Fluid.BaseClasses.PartialThreeWayResistance(
m_flow_small = m_flow_nominal*1e-4,
final mDyn_flow_nominal = m_flow_nominal,
redeclare replaceable
IBPSA.Fluid.Actuators.BaseClasses.PartialTwoWayValve res1
constrainedby IBPSA.Fluid.Actuators.BaseClasses.PartialTwoWayValve(
deltaM=deltaM,
from_dp=from_dp,
final linearized=linearized[1],
final homotopyInitialization=homotopyInitialization,
final CvData=IBPSA.Fluid.Types.CvTypes.OpPoint,
final m_flow_nominal=m_flow_nominal,
final dpValve_nominal=dpValve_nominal,
final dpFixed_nominal=dpFixed_nominal[1],
final use_inputFilter=false,
final riseTime=riseTime),
redeclare FixedResistances.LosslessPipe res2(
m_flow_nominal=m_flow_nominal),
redeclare replaceable
IBPSA.Fluid.Actuators.BaseClasses.PartialTwoWayValve res3
constrainedby IBPSA.Fluid.Actuators.BaseClasses.PartialTwoWayValve(
deltaM=deltaM,
from_dp=from_dp,
final linearized=linearized[2],
final homotopyInitialization=homotopyInitialization,
final CvData=IBPSA.Fluid.Types.CvTypes.OpPoint,
final m_flow_nominal=m_flow_nominal,
final dpValve_nominal=dpValve_nominal/fraK^2,
final dpFixed_nominal=dpFixed_nominal[2],
final use_inputFilter=false,
final riseTime=riseTime));
m_flow_small=m_flow_nominal*1e-4,
final mDyn_flow_nominal=m_flow_nominal,
redeclare replaceable IBPSA.Fluid.Actuators.BaseClasses.PartialTwoWayValve res1
constrainedby IBPSA.Fluid.Actuators.BaseClasses.PartialTwoWayValve(
deltaM=deltaM,
from_dp=from_dp,
final linearized=linearized[1],
final homotopyInitialization=homotopyInitialization,
final CvData=IBPSA.Fluid.Types.CvTypes.OpPoint,
final m_flow_nominal=m_flow_nominal,
final dpValve_nominal=dpValve_nominal,
final dpFixed_nominal=dpFixed_nominal[1],
final use_strokeTime=false,
final strokeTime=strokeTime),
redeclare FixedResistances.LosslessPipe res2(m_flow_nominal=m_flow_nominal),
redeclare replaceable IBPSA.Fluid.Actuators.BaseClasses.PartialTwoWayValve res3
constrainedby IBPSA.Fluid.Actuators.BaseClasses.PartialTwoWayValve(
deltaM=deltaM,
from_dp=from_dp,
final linearized=linearized[2],
final homotopyInitialization=homotopyInitialization,
final CvData=IBPSA.Fluid.Types.CvTypes.OpPoint,
final m_flow_nominal=m_flow_nominal,
final dpValve_nominal=dpValve_nominal/fraK^2,
final dpFixed_nominal=dpFixed_nominal[2],
final use_strokeTime=false,
final strokeTime=strokeTime));
extends IBPSA.Fluid.Actuators.BaseClasses.ActuatorSignal;
extends IBPSA.Fluid.Actuators.BaseClasses.ValveParameters(
rhoStd=Medium.density_pTX(101325, 273.15+4, Medium.X_default));
Expand Down Expand Up @@ -115,12 +112,12 @@ equation
fillColor=DynamicSelect({0,0,0}, (1-y)*{255,255,255}),
fillPattern=FillPattern.Solid),
Line(
visible=use_inputFilter,
visible=use_strokeTime,
points={{-30,40},{30,40}}),
Line(
points={{0,40},{0,0}}),
Line(
visible=not use_inputFilter,
visible=not use_strokeTime,
points={{0,100},{0,40}})}),
Documentation(info="<html>
<p>
Expand Down
4 changes: 2 additions & 2 deletions IBPSA/Fluid/Actuators/BaseClasses/PartialTwoWayValve.mo
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ initial equation
fillColor={255,255,255},
fillPattern=FillPattern.Solid),
Line(
visible=use_inputFilter,
visible=use_strokeTime,
points={{-30,40},{30,40}}),
Line(
points={{0,40},{0,0}}),
Line(
visible=not use_inputFilter,
visible=not use_strokeTime,
points={{0,100},{0,40}})}),
Documentation(info="<html>
<p>
Expand Down
8 changes: 4 additions & 4 deletions IBPSA/Fluid/Actuators/Dampers/Examples/Damper.mo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ model Damper

IBPSA.Fluid.Actuators.Dampers.Exponential res(
redeclare package Medium = Medium,
use_inputFilter=false,
use_strokeTime=false,
dpDamper_nominal=10,
m_flow_nominal=1,
k1=0.45) "A damper with quadratic relationship between m_flow and dp"
Expand All @@ -33,7 +33,7 @@ model Damper
transformation(extent={{94,-10},{74,10}})));

IBPSA.Fluid.Actuators.Dampers.PressureIndependent preIndDpFixed_nominal(
use_inputFilter=false,
use_strokeTime=false,
redeclare package Medium = Medium,
m_flow_nominal=1,
dpFixed_nominal=5,
Expand All @@ -42,7 +42,7 @@ model Damper
annotation (Placement(transformation(extent={{0,-90},{20,-70}})));

IBPSA.Fluid.Actuators.Dampers.PressureIndependent preIndFrom_dp(
use_inputFilter=false,
use_strokeTime=false,
redeclare package Medium = Medium,
m_flow_nominal=1,
dpFixed_nominal=0,
Expand All @@ -55,7 +55,7 @@ model Damper
redeclare package Medium = Medium,
m_flow_nominal=1,
dpDamper_nominal=10,
use_inputFilter=false)
use_strokeTime=false)
"A damper with a mass flow proportional to the input signal"
annotation (Placement(transformation(extent={{0,-10},{20,10}})));

Expand Down
Loading

0 comments on commit 689761b

Please sign in to comment.