| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102 |
- package Components "Library with models for flow circuits."
- extends Modelica.Icons.Package;
- package Actuators "Package with all the actuators."
- extends Modelica.Icons.Package;
- model Actuator "Time-based linear actuator with stroke time and absolute input position"
- // Import Configuration
- outer Components.Configurations.Configuration config;
- parameter Real delta(min = 0, max = 0.5) = 0.005 "Hysteresis";
- Modelica.Blocks.Sources.RealExpression totalOpeningTime(y = config.total_opening_time) annotation(
- Placement(transformation(origin = {-92, 172}, extent = {{-10, 10}, {10, -10}})));
- Modelica.Blocks.Sources.RealExpression totalClosingTime(y = config.total_closing_time) annotation(
- Placement(transformation(origin = {-93, 24}, extent = {{-10, 10}, {10, -10}})));
- Modelica.Blocks.Sources.RealExpression minMotorPosition(y = config.min_motor_position) annotation(
- Placement(transformation(origin = {-292, 86}, extent = {{-10, -10}, {10, 10}})));
- Modelica.Blocks.Sources.RealExpression maxMotorPosition(y = config.max_motor_position) annotation(
- Placement(transformation(origin = {-252, 70}, extent = {{-10, -10}, {10, 10}})));
- Modelica.Blocks.Sources.RealExpression realOpen(y = 1) annotation(
- Placement(transformation(origin = {-92, 184}, extent = {{-10, -10}, {10, 10}})));
- Modelica.Blocks.Sources.RealExpression realClose(y = -1) annotation(
- Placement(transformation(origin = {-92, 36}, extent = {{-10, -10}, {10, 10}})));
- Modelica.Blocks.Interfaces.RealInput setpoint_motor annotation(
- Placement(transformation(origin = {-338, 110}, extent = {{-20, -20}, {20, 20}}), iconTransformation(origin = {-40, 140}, extent = {{-20, -20}, {20, 20}}, rotation = -90)));
- Modelica.Blocks.Interfaces.RealOutput norm_motor_position annotation(
- Placement(transformation(origin = {251, 103}, extent = {{-11, -11}, {11, 11}}), iconTransformation(origin = {100, 50}, extent = {{-20, -20}, {20, 20}})));
- Modelica.Blocks.Math.Feedback motorRange annotation(
- Placement(transformation(origin = {-222, 70}, extent = {{-10, 10}, {10, -10}})));
- Modelica.Blocks.Math.Feedback nominator annotation(
- Placement(transformation(origin = {-252, 110}, extent = {{-10, -10}, {10, 10}})));
- Modelica.Blocks.Math.Division setpointNorm annotation(
- Placement(transformation(origin = {-192, 104}, extent = {{-10, -10}, {10, 10}})));
- Modelica.Blocks.Math.Division divisionOpen annotation(
- Placement(transformation(origin = {-52, 178}, extent = {{-10, -10}, {10, 10}})));
- Modelica.Blocks.Math.Division divisionClose annotation(
- Placement(transformation(origin = {-52, 30}, extent = {{-10, -10}, {10, 10}})));
- Modelica.Blocks.Logical.Hysteresis uppHys(final pre_y_start = false, uHigh = delta, final uLow = 0) annotation(
- Placement(transformation(origin = {-1, 103}, extent = {{-60, 20}, {-40, 40}})));
- Modelica.Blocks.Logical.Hysteresis lowHys(final pre_y_start = true, final uHigh = 0, uLow = -delta) "Lower hysteresis" annotation(
- Placement(transformation(origin = {-1, 101}, extent = {{-60, -40}, {-40, -20}})));
- Modelica.Blocks.Logical.Switch uppSwi annotation(
- Placement(transformation(origin = {-1, 103}, extent = {{0, 20}, {20, 40}})));
- parameter Real scaled_start_position = (config.start_motor_position - config.min_motor_position)/(config.max_motor_position - config.min_motor_position);
- final parameter Real y_start = if scaled_start_position >= 0.01 then scaled_start_position else 0.01;
- Modelica.Blocks.Continuous.LimIntegrator int(initType = Modelica.Blocks.Types.Init.InitialState, final k = 1, limitsAtInit = true, outMax = 1, outMin = 0, y(stateSelect = StateSelect.always), final y_start = y_start) "Integrator for valve opening position" annotation(
- Placement(transformation(origin = {19, 103}, extent = {{60, -10}, {80, 10}})));
- final Modelica.Blocks.Sources.Constant zer(final k = 0) "Zero signal" annotation(
- Placement(transformation(origin = {-21, 103}, extent = {{-40, -10}, {-20, 10}})));
- Modelica.Blocks.Logical.Switch lowSwi annotation(
- Placement(transformation(origin = {-1, 101}, extent = {{0, -40}, {20, -20}})));
- Modelica.Blocks.Math.Add add annotation(
- Placement(transformation(origin = {7, 103}, extent = {{32, -10}, {52, 10}})));
- Modelica.Blocks.Math.Feedback feedback annotation(
- Placement(transformation(origin = {-132, 104}, extent = {{-10, -10}, {10, 10}})));
- Modelica.Blocks.Math.Max max annotation(
- Placement(transformation(origin = {142, 96}, extent = {{-10, -10}, {10, 10}})));
- Modelica.Blocks.Math.Min min annotation(
- Placement(transformation(origin = {190, 104}, extent = {{-10, -10}, {10, 10}})));
- Modelica.Blocks.Sources.RealExpression clamp_zero annotation(
- Placement(transformation(origin = {100, 68}, extent = {{-10, -10}, {10, 10}})));
- Modelica.Blocks.Sources.RealExpression clamp_one(y = 1) annotation(
- Placement(transformation(origin = {134, 130}, extent = {{-10, -10}, {10, 10}})));
- Modelica.Blocks.Math.Product product annotation(
- Placement(transformation(origin = {116, -16}, extent = {{-10, -10}, {10, 10}})));
- Modelica.Blocks.Math.Add add1 annotation(
- Placement(transformation(origin = {190, -30}, extent = {{-10, -10}, {10, 10}})));
- Modelica.Blocks.Interfaces.RealOutput motor_position annotation(
- Placement(transformation(origin = {248, 52}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {100, -12}, extent = {{-20, -20}, {20, 20}})));
- protected
- equation
- connect(maxMotorPosition.y, motorRange.u1) annotation(
- Line(points = {{-241, 70}, {-230, 70}}, color = {0, 0, 127}));
- connect(setpoint_motor, nominator.u1) annotation(
- Line(points = {{-338, 110}, {-260, 110}}, color = {0, 0, 127}));
- connect(minMotorPosition.y, motorRange.u2) annotation(
- Line(points = {{-281, 86}, {-222, 86}, {-222, 78}}, color = {0, 0, 127}));
- connect(minMotorPosition.y, nominator.u2) annotation(
- Line(points = {{-281, 86}, {-252, 86}, {-252, 102}}, color = {0, 0, 127}));
- connect(nominator.y, setpointNorm.u1) annotation(
- Line(points = {{-243, 110}, {-204, 110}}, color = {0, 0, 127}));
- connect(motorRange.y, setpointNorm.u2) annotation(
- Line(points = {{-213, 70}, {-210, 70}, {-210, 98}, {-204, 98}}, color = {0, 0, 127}));
- connect(realOpen.y, divisionOpen.u1) annotation(
- Line(points = {{-81, 184}, {-64, 184}}, color = {0, 0, 127}));
- connect(totalOpeningTime.y, divisionOpen.u2) annotation(
- Line(points = {{-81, 172}, {-64, 172}}, color = {0, 0, 127}));
- connect(realClose.y, divisionClose.u1) annotation(
- Line(points = {{-81, 36}, {-64, 36}}, color = {0, 0, 127}));
- connect(totalClosingTime.y, divisionClose.u2) annotation(
- Line(points = {{-82, 24}, {-64, 24}}, color = {0, 0, 127}));
- connect(uppHys.y, uppSwi.u2) annotation(
- Line(points = {{-40, 133}, {-3, 133}}, color = {255, 0, 255}));
- connect(lowHys.y, lowSwi.u2) annotation(
- Line(points = {{-40, 71}, {-3, 71}}, color = {255, 0, 255}));
- connect(zer.y, uppSwi.u3) annotation(
- Line(points = {{-40, 103}, {-20, 103}, {-20, 124}, {-3, 124}}, color = {0, 0, 127}));
- connect(zer.y, lowSwi.u1) annotation(
- Line(points = {{-40, 103}, {-20, 103}, {-20, 78}, {-3, 78}}, color = {0, 0, 127}));
- connect(lowSwi.y, add.u2) annotation(
- Line(points = {{20, 71}, {28, 71}, {28, 97}, {37, 97}}, color = {0, 0, 127}));
- connect(uppSwi.y, add.u1) annotation(
- Line(points = {{20, 133}, {28, 133}, {28, 109}, {37, 109}}, color = {0, 0, 127}));
- connect(add.y, int.u) annotation(
- Line(points = {{60, 103}, {77, 103}}, color = {0, 0, 127}));
- connect(divisionOpen.y, uppSwi.u1) annotation(
- Line(points = {{-41, 178}, {-23, 178}, {-23, 142}, {-3, 142}}, color = {0, 0, 127}));
- connect(divisionClose.y, lowSwi.u3) annotation(
- Line(points = {{-41, 30}, {-23, 30}, {-23, 64}, {-3, 64}}, color = {0, 0, 127}));
- connect(feedback.y, uppHys.u) annotation(
- Line(points = {{-123, 104}, {-93, 104}, {-93, 133}, {-64, 133}}, color = {0, 0, 127}));
- connect(feedback.y, lowHys.u) annotation(
- Line(points = {{-123, 104}, {-93, 104}, {-93, 71}, {-64, 71}}, color = {0, 0, 127}));
- connect(setpointNorm.y, feedback.u1) annotation(
- Line(points = {{-181, 104}, {-140, 104}}, color = {0, 0, 127}));
- connect(int.y, max.u1) annotation(
- Line(points = {{100, 104}, {112, 104}, {112, 102}, {130, 102}}, color = {0, 0, 127}));
- connect(clamp_zero.y, max.u2) annotation(
- Line(points = {{112, 68}, {118, 68}, {118, 90}, {130, 90}}, color = {0, 0, 127}));
- connect(clamp_one.y, min.u1) annotation(
- Line(points = {{146, 130}, {162, 130}, {162, 110}, {178, 110}}, color = {0, 0, 127}));
- connect(max.y, min.u2) annotation(
- Line(points = {{154, 96}, {164, 96}, {164, 98}, {178, 98}}, color = {0, 0, 127}));
- connect(min.y, norm_motor_position) annotation(
- Line(points = {{202, 104}, {252, 104}}, color = {0, 0, 127}));
- connect(min.y, feedback.u2) annotation(
- Line(points = {{202, 104}, {210, 104}, {210, 0}, {-132, 0}, {-132, 96}}, color = {0, 0, 127}));
- connect(min.y, product.u1) annotation(
- Line(points = {{202, 104}, {210, 104}, {210, 0}, {58, 0}, {58, -10}, {104, -10}}, color = {0, 0, 127}));
- connect(motorRange.y, product.u2) annotation(
- Line(points = {{-212, 70}, {-174, 70}, {-174, -22}, {104, -22}}, color = {0, 0, 127}));
- connect(product.y, add1.u1) annotation(
- Line(points = {{128, -16}, {144, -16}, {144, -24}, {178, -24}}, color = {0, 0, 127}));
- connect(minMotorPosition.y, add1.u2) annotation(
- Line(points = {{-280, 86}, {-272, 86}, {-272, -36}, {178, -36}}, color = {0, 0, 127}));
- connect(add1.y, motor_position) annotation(
- Line(points = {{202, -30}, {226, -30}, {226, 52}, {248, 52}}, color = {0, 0, 127}));
- annotation(
- Diagram(coordinateSystem(extent = {{-360, 200}, {260, -60}}), graphics),
- Icon(graphics = {Polygon(origin = {-10, 10}, fillColor = {119, 118, 123}, fillPattern = FillPattern.Sphere, points = {{-110, 70}, {30, 70}, {50, 30}, {70, 30}, {70, 60}, {90, 60}, {90, -42}, {70, -42}, {70, -10}, {50, -10}, {30, -70}, {-80, -70}, {-110, -10}, {-110, -10}, {-110, 70}}), Polygon(origin = {-37, 100}, fillColor = {119, 118, 123}, fillPattern = FillPattern.HorizontalCylinder, points = {{17, 0}, {-13, 0}, {-43, 0}, {-43, 20}, {37, 20}, {37, 0}, {17, 0}}), Rectangle(origin = {-40, 90}, fillColor = {119, 118, 123}, fillPattern = FillPattern.VerticalCylinder, extent = {{-10, 10}, {10, -10}}), Polygon(origin = {-36, 8}, lineColor = {255, 255, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, points = {{30, 10}, {10, 10}, {20, 50}, {-30, -10}, {-10, -10}, {-30, -50}, {-30, -50}, {30, 10}}), Text(origin = {-42, 56}, textColor = {0, 0, 255}, extent = {{-149, -114}, {151, -154}}, textString = "%name")}, coordinateSystem(extent = {{-120, 160}, {120, -60}})),
- Documentation(info = "<html>
- <p>The Actuator model represents a standard linear actuator. In addition to the config-
- urable parameters of the Confgiration model from the Configuration package, the actuator features one input and
- two outputs:
- <ul>
- <li>input: setpoint_motor</li>
- <li>output: norm_motor_position</li>
- <li>output: motor_position</li>
- </ul>
- </p>
- <p>
- Given a motor setpoint, the actuator adjusts its position over time
- to reach the desired value. This motion is governed by two timing parameters: mo-
- tor_opening_time and motor_closing_time. When the actuator is at a given position and
- receives a new setpoint, it transitions to the new position at a rate proportional to these
- timing parameters. Since the valve models expect the motor position to be normalized between 0 and 1,
- the input setpoint must be normalized using:
- </p>
- <p>setpoint_norm = (setpoint_motor - min_motor_position)/(max_motor_position - min_motor_position)</p>
- <p>
- From this normalized value, the actuator computes a new normalized motor position, norm_motor_position,
- which serves as the input to the valve models. To recover the denormalized motor position, motor_position,
- the following denormalization is applied:
- </p>
- <p>motor_position = norm_motor_position·(max_motor_position − min_motor_position) + min_motor_position</p>
- </html>"));
- end Actuator;
- end Actuators;
- package Valves "Package with all the valves."
- extends Modelica.Icons.Package;
- model LinearValve "Valve with a linear characteristic"
- extends Components.BaseComponents.FluidBase;
- // Import Configuration
- outer Configurations.Configuration config;
- Modelica.Blocks.Interfaces.RealInput motor_position annotation(
- Placement(transformation(origin = {-100, 49}, extent = {{-20, -20}, {20, 20}}), iconTransformation(origin = {0, 59}, extent = {{-20, -20}, {20, 20}}, rotation = -90)));
- Pipes.Pipe pipe(length = 50, diameter = config.valve_diameter, redeclare package Medium = Medium) annotation(
- Placement(transformation(origin = {-30, 0}, extent = {{-10, -10}, {10, 10}})));
- Modelica.Fluid.Valves.ValveIncompressible valveIncompressible(redeclare package Medium = Medium, dp(start = config.pump_pressure), dp_nominal = config.pump_pressure, filteredOpening = false, m_flow(start = config.max_valve_flow_rate), m_flow_nominal = config.max_valve_flow_rate, m_flow_small = system.m_flow_small, m_flow_start = system.m_flow_start, show_T = false, redeclare function valveCharacteristic = Modelica.Fluid.Valves.BaseClasses.ValveCharacteristics.linear) annotation(
- Placement(transformation(origin = {36, 1}, extent = {{-10, -10}, {10, 10}})));
- equation
- connect(port_a, pipe.port_a) annotation(
- Line(points = {{-100, 0}, {-40, 0}}));
- connect(pipe.port_b, valveIncompressible.port_a) annotation(
- Line(points = {{-20, 0}, {1, 0}, {1, 1}, {26, 1}}, color = {0, 127, 255}));
- connect(valveIncompressible.port_b, port_b) annotation(
- Line(points = {{46, 1}, {100, 1}, {100, 0}}, color = {0, 127, 255}));
- connect(motor_position, valveIncompressible.opening) annotation(
- Line(points = {{-100, 50}, {36, 50}, {36, 10}}, color = {0, 0, 127}));
- annotation(
- Icon(graphics = {Polygon(origin = {-50, 0}, lineThickness = 0.5, points = {{50, 0}, {-50, 60}, {-50, -60}, {50, 0}, {50, 0}}), Polygon(origin = {50, 0}, rotation = 180, lineThickness = 0.5, points = {{50, 0}, {-50, 60}, {-50, -60}, {50, 0}, {50, 0}}), Line(origin = {0, 25.5}, points = {{0, -25.5}, {0, 26.5}, {0, 24.5}}, thickness = 0.5), Polygon(origin = {40, -70}, lineColor = {53, 132, 228}, fillColor = {53, 132, 228}, fillPattern = FillPattern.Solid, points = {{20, 0}, {-20, 10}, {-20, -10}, {-20, -10}, {20, 0}}), Line(origin = {-20, -70}, points = {{40, 0}, {-40, 0}, {-40, 0}}, color = {53, 132, 228}, thickness = 0.75), Text(origin = {-2, 22}, textColor = {0, 0, 255}, extent = {{-149, -114}, {151, -154}}, textString = "%name")}),
- Diagram(graphics),
- Documentation(info = "<html>
- <p>The LinearValve model serves primarly as a wrapper around the TwoWayEqualPercentage
- model from the Buildings.Fluid.Actuators library. This abstraction simplifies integration
- by pre-configuring all relevant parameters, allowing the linear valve to be easily added
- to flow models without additional setup.</p>
-
- <p>In addition to the configurable parameters of the Confgiration model from the Configuration package, the linear valve features two inputs and one output:
- <ul>
- <li>input: motor_position</li>
- <li>input: port_a</li>
- <li>output: port_b</li>
- </ul>
- </p>
-
- <p>
- The motor position receives the normalized_motor_position from the actuator, port_a
- and port_b are the ends of the fluid connection constructing the flow path.
- </p>
-
- </html>"));
- end LinearValve;
- model EqualpercentageValve "Valve with a equal percentage characteristic"
- extends Components.BaseComponents.FluidBase;
- // Import Configuration
- outer Configurations.Configuration config;
- BaseComponents.TwoWayEqualPercentageBase.TwoWayEqualPercentage twoWayEqualPercentage(redeclare package Medium = Medium, m_flow_nominal = config.max_valve_flow_rate, m_flow(start = system.m_flow_start), dpValve_nominal = config.pump_pressure, CvData = Buildings.Fluid.Types.CvTypes.OpPoint, allowFlowReversal = system.allowFlowReversal, deltaM = config.deltaM, l = config.leakage, R = config.R, delta0 = config.delta0) annotation(
- Placement(transformation(origin = {30, 0}, extent = {{-10, -10}, {10, 10}})));
- Modelica.Blocks.Interfaces.RealInput motor_position annotation(
- Placement(transformation(origin = {-99, 49}, extent = {{-20, -20}, {20, 20}}), iconTransformation(origin = {0, 60}, extent = {{-19, -19}, {19, 19}}, rotation = -90)));
- Components.Pipes.Pipe pipe(redeclare package Medium = Medium, diameter = config.valve_diameter, length = 50) annotation(
- Placement(transformation(origin = {-30, 0}, extent = {{-11, -11}, {11, 11}})));
- equation
- connect(motor_position, twoWayEqualPercentage.opening) annotation(
- Line(points = {{-98, 50}, {30, 50}, {30, 4}}, color = {0, 0, 127}));
- connect(pipe.port_b, twoWayEqualPercentage.port_a) annotation(
- Line(points = {{-19, 0}, {20, 0}}, color = {0, 127, 255}));
- connect(port_a, pipe.port_a) annotation(
- Line(points = {{-100, 0}, {-41, 0}}));
- connect(twoWayEqualPercentage.port_b, port_b) annotation(
- Line(points = {{40, 0}, {100, 0}}, color = {0, 127, 255}));
- annotation(
- Diagram(graphics),
- Icon(graphics = {Polygon(origin = {-50, 0}, lineThickness = 0.5, points = {{50, 0}, {-50, 60}, {-50, -60}, {50, 0}, {50, 0}}), Polygon(origin = {50, 0}, rotation = 180, lineThickness = 0.5, points = {{50, 0}, {-50, 60}, {-50, -60}, {50, 0}, {50, 0}}), Line(origin = {0, 25.5}, points = {{0, -25.5}, {0, 26.5}, {0, 24.5}}, thickness = 0.5), Polygon(origin = {40, -70}, lineColor = {53, 132, 228}, fillColor = {53, 132, 228}, fillPattern = FillPattern.Solid, points = {{20, 0}, {-20, 10}, {-20, -10}, {-20, -10}, {20, 0}}), Line(origin = {-20, -70}, points = {{40, 0}, {-40, 0}, {-40, 0}}, color = {53, 132, 228}, thickness = 0.75), Text(origin = {-2, 22}, textColor = {0, 0, 255}, extent = {{-149, -114}, {151, -154}}, textString = "%name"), Ellipse(origin = {-68, 12}, lineThickness = 0.75, extent = {{-6, 6}, {6, -6}}), Ellipse(origin = {-48, -8}, lineThickness = 0.75, extent = {{-6, 6}, {6, -6}}), Line(origin = {-58, 2}, points = {{-14, -14}, {14, 14}, {14, 14}}, thickness = 0.75)}),
- Documentation(info = "<html>
- <p>The EqualPercentageValve model serves primarly as a wrapper around the ValveIncompressible
- model from the Modelica.Fluid.Valves library. This abstraction simplifies integration
- by pre-configuring all relevant parameters, allowing the linear valve to be easily added
- to flow models without additional setup.</p>
-
- <p>In addition to the configurable parameters of the Confgiration model from the Configuration package, the linear valve features two inputs and one output:
- <ul>
- <li>input: motor_position</li>
- <li>input: port_a</li>
- <li>output: port_b</li>
- </ul>
- </p>
-
- <p>
- The motor position receives the normalized_motor_position from the actuator, port_a
- and port_b are the ends of the fluid connection constructing the flow path.
- </p>
-
- </html>"));
- end EqualpercentageValve;
- end Valves;
- package Pumps "Package with all the pumps."
- extends Modelica.Icons.Package;
- model PressurePump "Pressure pump with pressure parameter"
- extends Components.BaseComponents.FluidBase;
- outer Components.Configurations.Configuration config;
- Buildings.Fluid.Sources.Boundary_pT source(redeclare package Medium = Medium, nPorts = 1) annotation(
- Placement(transformation(origin = {-91, -50}, extent = {{-10, -10}, {10, 10}})));
- Buildings.Fluid.Movers.FlowControlled_dp pump_dp(redeclare package Medium = Medium, addPowerToMedium = true, allowFlowReversal = system.allowFlowReversal, constantHead = config.pump_pressure, dp_nominal = config.pump_pressure, dp_start = 0, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, heads = {0, 0.5, 1}*130000, init = Modelica.Blocks.Types.Init.NoInit, inputType = Buildings.Fluid.Types.InputType.Constant, m_flow_nominal = config.max_valve_flow_rate, redeclare Buildings.Fluid.Movers.Data.Generic per, show_T = false, use_riseTime = false, nominalValuesDefineDefaultPressureCurve = true, m_flow_small = system.m_flow_small) annotation(
- Placement(transformation(origin = {1, 80}, extent = {{-10, -90}, {10, -70}})));
- equation
- connect(source.ports[1], pump_dp.port_a) annotation(
- Line(points = {{-80, -50}, {-40, -50}, {-40, 0}, {-9, 0}}, color = {0, 127, 255}));
- connect(port_a, pump_dp.port_a) annotation(
- Line(points = {{-100, 0}, {-8, 0}}));
- connect(pump_dp.port_b, port_b) annotation(
- Line(points = {{12, 0}, {100, 0}}, color = {0, 127, 255}));
- annotation(
- Diagram(graphics),
- Icon(graphics = {Rectangle(fillColor = {0, 127, 255}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100, 16}, {100, -16}}), Ellipse(fillColor = {0, 100, 199}, fillPattern = FillPattern.Sphere, extent = {{-58, 58}, {58, -58}}), Polygon(origin = {40, -80}, lineColor = {53, 132, 228}, fillColor = {53, 132, 228}, fillPattern = FillPattern.Solid, points = {{20, 0}, {-20, 10}, {-20, -10}, {-20, -10}, {20, 0}}), Line(origin = {-20, -80}, points = {{40, 0}, {-40, 0}, {-40, 0}}, color = {53, 132, 228}, thickness = 0.75), Text(origin = {-2, 22}, textColor = {0, 0, 255}, extent = {{-149, -114}, {151, -154}}, textString = "%name")}),
- Documentation(info = "<html>
- <p>The PressurePump model serves primarly as a wrapper around the FlowControlled_dp model from the Buildings.Fluid.Movers library. This abstraction simplifies integration by pre-configuring all relevant parameters, allowing the pressure pump to be easily added to flow models without additional setup.</p>
-
- <p>In addition to the configurable parameters of the Confgiration model from the Configuration package, the pressure pump features one input and one output:
- <ul>
- <li>input: port_a</li>
- <li>output: port_b</li>
- </ul>
- </p>
-
- <p>
- Port_a and port_b are the ends of the fluid connection constructing the flow path.
- </p>
-
- </html>"));
- end PressurePump;
- end Pumps;
- package Sensors "Package with all the sensors."
- extends Modelica.Icons.Package;
- model FlowSensor "A flow rate measurement tool in m3/h"
- extends Components.BaseComponents.FluidBase;
- extends Modelica.Icons.RoundSensor;
- outer Components.Configurations.Configuration config;
- Modelica.Fluid.Sensors.VolumeFlowRate volumeFlowRate(redeclare package Medium = Medium, allowFlowReversal = system.allowFlowReversal, m_flow_nominal = system.m_flow_nominal, m_flow_small = system.m_flow_small) annotation(
- Placement(transformation(extent = {{-10, -10}, {10, 10}})));
- Modelica.Blocks.Math.Product product annotation(
- Placement(transformation(origin = {30, 51}, extent = {{-10, -10}, {10, 10}})));
- Modelica.Blocks.Sources.RealExpression realExpression1(y = 3600) annotation(
- Placement(transformation(origin = {-30, 57}, extent = {{10, -10}, {-10, 10}}, rotation = -180)));
- Modelica.Blocks.Interfaces.RealOutput flow_rate annotation(
- Placement(transformation(origin = {93, 51}, extent = {{-9, -9}, {9, 9}}), iconTransformation(origin = {0, 110}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
- equation
- connect(volumeFlowRate.V_flow, product.u2) annotation(
- Line(points = {{0, 12}, {0, 45}, {18, 45}}, color = {0, 0, 127}));
- connect(realExpression1.y, product.u1) annotation(
- Line(points = {{-19, 57}, {18, 57}}, color = {0, 0, 127}));
- connect(product.y, flow_rate) annotation(
- Line(points = {{41, 51}, {93, 51}}, color = {0, 0, 127}));
- connect(port_a, volumeFlowRate.port_a) annotation(
- Line(points = {{-100, 0}, {-10, 0}}));
- connect(volumeFlowRate.port_b, port_b) annotation(
- Line(points = {{10, 0}, {100, 0}}, color = {0, 127, 255}));
- annotation(
- Icon(graphics = {Line(origin = {-80, 0}, points = {{-10, 0}, {10, 0}}, color = {53, 132, 228}, thickness = 0.5), Line(origin = {80, 0}, points = {{-10, 0}, {10, 0}}, color = {53, 132, 228}, thickness = 0.5), Line(origin = {0, 75}, points = {{0, -5}, {0, 5}, {0, 25}}, thickness = 0.5), Polygon(origin = {40, -100}, lineColor = {53, 132, 228}, fillColor = {53, 132, 228}, fillPattern = FillPattern.Solid, points = {{20, 0}, {-20, 10}, {-20, -10}, {-20, -10}, {20, 0}}), Line(origin = {-20, -100}, points = {{40, 0}, {-40, 0}, {-40, 0}}, color = {53, 132, 228}, thickness = 0.75), Text(origin = {0, 2}, textColor = {0, 0, 255}, extent = {{-149, -114}, {151, -154}}, textString = "%name")}),
- Diagram(graphics),
- Documentation(info = "<html>
- <p>The FlowSensor model serves also primarily as a wrapper around the VolumeFlowRate model from the
- Modelica.Fluid.Sensors library. This abstraction simplifies integration by pre-configuring all relevant pa-
- rameters, allowing the flow sensor to be easily added to flow models without additional setup.</p>
- <p>Furthermore, since the VolumeFlowRate model provides its output in cubic meters per second (m3 /s), the
- value is multiplied by 3600 to convert it to cubic meters per hour.</p>
-
- <p>In addition to the configurable parameters of the Confgiration model from the Configuration package, the flow sensor features one input and two outputs:
- <ul>
- <li>input: port_a</li>
- <li>output: flow_rate</li>
- <li>output: port_b</li>
- </ul>
- </p>
-
- <p>
- The flow_rate is the measured flow and port_a and port_b are the ends of the fluid connection
- constructing the flow path.</p>
-
- </html>"));
- end FlowSensor;
- end Sensors;
- package Pipes "Package with all the models related to pipes."
- extends Modelica.Icons.Package;
- model Pipe "Basic pipe flow model without storage of mass or energy"
- extends Components.BaseComponents.FluidBase;
- outer Components.Configurations.Configuration config;
- parameter Real length "Length (mm)";
- parameter Real diameter "Diameter of circular pipe (mm)";
- parameter Real height_ab = 0 "Height(port_b) - Height(port_a) (mm)";
- Modelica.Fluid.Pipes.StaticPipe pipe(redeclare package Medium = Medium, allowFlowReversal = system.allowFlowReversal, diameter = diameter/1000, height_ab = height_ab/1000, length = length/1000, m_flow_start = system.m_flow_start, p_a_start = start_pressure_pipe) annotation(
- Placement(transformation(extent = {{11, 11}, {-11, -11}}, rotation = 180)));
- equation
- connect(port_a, pipe.port_a) annotation(
- Line(points = {{-100, 0}, {-10, 0}}));
- connect(pipe.port_b, port_b) annotation(
- Line(points = {{12, 0}, {100, 0}}, color = {0, 127, 255}));
- annotation(
- Diagram(graphics),
- Icon(graphics = {Polygon(origin = {40, -70}, lineColor = {53, 132, 228}, fillColor = {53, 132, 228}, fillPattern = FillPattern.Solid, points = {{20, 0}, {-20, 10}, {-20, -10}, {-20, -10}, {20, 0}}), Line(origin = {-20, -70}, points = {{40, 0}, {-40, 0}, {-40, 0}}, color = {53, 132, 228}, thickness = 0.75), Rectangle(fillColor = {53, 132, 228}, fillPattern = FillPattern.HorizontalCylinder, lineThickness = 0.5, extent = {{-100, 40}, {100, -40}}), Text(origin = {-2, 22}, textColor = {0, 0, 255}, extent = {{-149, -114}, {151, -154}}, textString = "%name")}),
- Documentation(info = "<html>
- <p>The Pipe model serves primarily as a wrapper around the StaticPipe model from the Modelica.Fluid.Pipes
- library. This abstraction simplifies integration by pre-configuring all relevant parameters, allowing the pipe
- to be easily added to flow models without additional setup.</p>
-
- <p>
- The pipe contains three parameters:
- <ul>
- <li>height - mm</li>
- <li>diameter - mm</li>
- <li>height_ab - mm</li>
- </ul>
- </p>
-
- <p>In addition to the configurable parameters of the Confgiration model from the Configuration package, the pipe features one input and one output:
- <ul>
- <li>input: port_a</li>
- <li>output: port_b</li>
- </ul>
- </p>
-
- <p>
- Port_a and port_b are the ends of the fluid connection constructing the flow path.
- </p>
-
- </html>"));
- end Pipe;
- model Bend "Edged bend flow model"
- extends Components.BaseComponents.FluidBase;
- outer Components.Configurations.Configuration config;
- parameter Real angle "Angle of the bend (degrees)";
- parameter Real pipe_diameter "Diameter of the pipe (mm)";
- protected
- parameter Real angle_rad = angle*(Modelica.Constants.pi/180);
- Modelica.Fluid.Fittings.Bends.EdgedBend bend(redeclare package Medium = Medium, geometry(d_hyd = pipe_diameter / 1000, delta = angle_rad), m_flow_small = system.m_flow_small, show_T = false, dp(start = config.pump_pressure), m_flow(start = system.m_flow_start)) annotation(
- Placement(transformation(origin = {1, 0}, extent = {{9, -9}, {-9, 9}}, rotation = 180)));
- public
- equation
- connect(port_a, bend.port_a) annotation(
- Line(points = {{-100, 0}, {-8, 0}}));
- connect(bend.port_b, port_b) annotation(
- Line(points = {{10, 0}, {100, 0}}, color = {0, 127, 255}));
- annotation(
- Diagram(graphics),
- Icon(graphics = {Polygon(origin = {40, -70}, lineColor = {53, 132, 228}, fillColor = {53, 132, 228}, fillPattern = FillPattern.Solid, points = {{20, 0}, {-20, 10}, {-20, -10}, {-20, -10}, {20, 0}}), Line(origin = {-20, -70}, points = {{40, 0}, {-40, 0}, {-40, 0}}, color = {53, 132, 228}, thickness = 0.75), Text(origin = {-2, 22}, textColor = {0, 0, 255}, extent = {{-149, -114}, {151, -154}}, textString = "%name"), Polygon(origin = {-1, 0}, fillColor = {53, 132, 228}, fillPattern = FillPattern.HorizontalCylinder, points = {{15, 30}, {45, 30}, {45, -30}, {-45, -30}, {15, 30}, {15, 30}}), Polygon(origin = {-16, 15}, fillColor = {53, 132, 228}, fillPattern = FillPattern.VerticalCylinder, points = {{-30, -45}, {-30, 45}, {30, 45}, {30, 15}, {-30, -45}, {-30, -45}}), Ellipse(origin = {-16, 60}, fillColor = {26, 95, 180}, fillPattern = FillPattern.Sphere, extent = {{-30, 10}, {30, -10}}), Ellipse(origin = {44, 0}, rotation = -90, fillColor = {26, 95, 180}, fillPattern = FillPattern.Sphere, extent = {{-30, 10}, {30, -10}}), Line(origin = {-74, 0}, points = {{-24, 0}, {24, 0}, {24, 0}}, color = {53, 132, 228}, thickness = 0.5), Line(origin = {74, 0}, points = {{-26, 0}, {26, 0}, {26, 0}}, color = {53, 132, 228}, thickness = 0.5)}, coordinateSystem(extent = {{-160, 80}, {160, -140}})),
- Documentation(info = "<html>
- <p>The Bend model serves primarily as a wrapper around the EdgedBend model from the Modelica.Fluid.Fittings.Bends library. This abstraction simplifies integration by pre-configuring all relevant parameters, allowing the bend to be easily added to flow models without additional setup.</p>
-
- <p>
- The bend contains two parameters:
- <ul>
- <li>angle - degrees</li>
- <li>pipe_diameter - m</li>
- </ul>
- </p>
-
- <p>In addition to the configurable parameters of the Confgiration model from the Configuration package, the bend features one input and one output:
- <ul>
- <li>input: port_a</li>
- <li>output: port_b</li>
- </ul>
- </p>
-
- <p>
- Port_a and port_b are the ends of the fluid connection constructing the flow path.
- </p>
-
- </html>"));
- end Bend;
- end Pipes;
- package Configurations "Package with all the configuarations."
- extends Modelica.Icons.Package;
- model Configuration
- // Dynamx - Actuator settings
- parameter Real min_motor_position = 0 "The minimum position of the actuator" annotation(
- Dialog(tab = "Dynamx settings", group = "Actuator"));
- parameter Real max_motor_position = 10 "The maximum position of the actuator" annotation(
- Dialog(tab = "Dynamx settings", group = "Actuator"));
- parameter Real start_motor_position = 5 "Start position of the actuator" annotation(
- Dialog(tab = "Dynamx settings", group = "Actuator"));
- parameter Real total_opening_time = 120 "Time it takes to reach the maximum position of the actuator" annotation(
- Dialog(tab = "Dynamx settings", group = "Actuator"));
- parameter Real total_closing_time = 120 "Time it takes to reach the minimum position of the actuator" annotation(
- Dialog(tab = "Dynamx settings", group = "Actuator"));
- // Dynamx - Valve settings
- parameter Real valve_diameter = 20 "Diameter of the pipe in the valve (mm)" annotation(
- Dialog(tab = "Dynamx settings", group = "Valve"));
- parameter Real max_valve_flow_rate = 1 "Maximum flow rate of the valve at full opening (kg/s)" annotation(
- Dialog(tab = "Dynamx settings", group = "Valve"));
- parameter Boolean has_equal_percentage_characteristic = false "Use equal percentage characteristic" annotation(
- Dialog(tab = "Dynamx settings", group = "Valve"));
- // These are enabled only if the checkbox is selected
- parameter Real leakage = 0.00001 "Valve leakage" annotation(
- Dialog(tab = "Dynamx settings", group = "Valve", enable = has_equal_percentage_characteristic));
- parameter Real R = 50 "Rangeability, R=50...100 typically" annotation(
- Dialog(tab = "Dynamx settings", group = "Valve", enable = has_equal_percentage_characteristic));
- parameter Real delta0 = 0.01 "Range of significant deviation from equal percentage law" annotation(
- Dialog(tab = "Dynamx settings", group = "Valve", enable = has_equal_percentage_characteristic));
- parameter Real deltaM = 0.02 "Fraction of nominal flow rate where linearization starts, if y=1" annotation(
- Dialog(tab = "Dynamx settings", group = "Valve", enable = has_equal_percentage_characteristic));
- // Pump settings
- parameter Real pump_pressure = 130000 "The pressure of the pump" annotation(
- Dialog(tab = "Pump settings"));
- annotation(
- Diagram(graphics),
- Icon(graphics = {Text(origin = {-2, 12}, textColor = {0, 0, 255}, extent = {{-149, -114}, {151, -154}}, textString = "%name"), Rectangle(extent = {{-100, 100}, {100, -100}})}),
- defaultComponentName = "config");
- end Configuration;
- end Configurations;
- package Dynamx
- extends Modelica.Icons.Package;
- model LinearDefaultActuator "A dynamx component that combines the functionalities of a linear actuator, linear valve, and a flow sensor."
- extends Components.BaseComponents.DynamxBase;
- Valves.LinearValve linearValve(redeclare package Medium = Medium) annotation(
- Placement(transformation(origin = {-30, 0}, extent = {{-10, -10}, {10, 10}})));
- Actuators.Actuator actuator annotation(
- Placement(transformation(origin = {-58, 40}, extent = {{-12, -11}, {12, 11}})));
- equation
- connect(port_a, linearValve.port_a) annotation(
- Line(points = {{-100, 0}, {-40, 0}}));
- connect(linearValve.port_b, flowSensor.port_a) annotation(
- Line(points = {{-20, 0}, {20, 0}}, color = {0, 127, 255}));
- connect(setpoint_motor, actuator.setpoint_motor) annotation(
- Line(points = {{0, 100}, {0, 58}, {-62, 58}, {-62, 50}}, color = {0, 0, 127}));
- connect(actuator.norm_motor_position, linearValve.motor_position) annotation(
- Line(points = {{-48, 40}, {-30, 40}, {-30, 6}}, color = {0, 0, 127}));
- connect(actuator.motor_position, motor_position) annotation(
- Line(points = {{-48, 34}, {-40, 34}, {-40, 14}, {-54, 14}, {-54, -18}, {-30, -18}, {-30, -92}, {-28, -92}}, color = {0, 0, 127}));
- end LinearDefaultActuator;
- model EqualPercentageDefaultActuator "A dynamx component that combines the functionalities of a linear actuator, equal percentage valve, and a flow sensor."
- extends BaseComponents.DynamxBase;
- Actuators.Actuator actuator annotation(
- Placement(transformation(origin = {-50, 50}, extent = {{-12, -11}, {12, 11}})));
- Valves.EqualpercentageValve equalpercentageValve(redeclare package Medium = Medium) annotation(
- Placement(transformation(origin = {-30, 0}, extent = {{-10, -10}, {10, 10}})));
- equation
- connect(setpoint_motor, actuator.setpoint_motor) annotation(
- Line(points = {{0, 100}, {0, 72}, {-54, 72}, {-54, 59}}, color = {0, 0, 127}));
- connect(port_a, equalpercentageValve.port_a) annotation(
- Line(points = {{-100, 0}, {-40, 0}}));
- connect(actuator.norm_motor_position, equalpercentageValve.motor_position) annotation(
- Line(points = {{-40, 50}, {-30, 50}, {-30, 6}}, color = {0, 0, 127}));
- connect(actuator.motor_position, motor_position) annotation(
- Line(points = {{-40, 44}, {-34, 44}, {-34, 14}, {-54, 14}, {-54, -46}, {-28, -46}, {-28, -92}}, color = {0, 0, 127}));
- connect(equalpercentageValve.port_b, flowSensor.port_a) annotation(
- Line(points = {{-20, 0}, {20, 0}}, color = {0, 127, 255}));
- end EqualPercentageDefaultActuator;
- end Dynamx;
- package PipeNetworks
- extends Modelica.Icons.Package;
- model SimpleNetwork "A simple pipe network"
- extends Components.BaseComponents.PipeNetworksBase;
- Pipes.Pipe pipe(length = 100, diameter = 20) annotation(
- Placement(transformation(origin = {0, 68}, extent = {{-10, -10}, {10, 10}})));
- equation
- connect(output_pump, input_valve) annotation(
- Line(points = {{-210, 150}, {60, 150}, {60, -112}, {210, -112}}));
- connect(output_valve, pipe.port_a) annotation(
- Line(points = {{-210, -112}, {-82, -112}, {-82, 68}, {-10, 68}}));
- connect(pipe.port_b, input_pump) annotation(
- Line(points = {{10, 68}, {146, 68}, {146, 148}, {210, 148}}, color = {0, 127, 255}));
- connect(output_valve, pipe.port_a) annotation(
- Line(points = {{-210, -112}, {-112, -112}, {-112, 118}, {-8, 118}}));
- connect(pipe.port_b, input_pump) annotation(
- Line(points = {{12, 118}, {210, 118}, {210, 148}}, color = {0, 127, 255}));
- end SimpleNetwork;
- model TestSetupNetwork
- extends Components.BaseComponents.PipeNetworksBase;
- Pipes.Pipe pipe(length = 900, diameter = 25, height_ab = -900) annotation(
- Placement(transformation(origin = {-210, -136}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
- Components.Pipes.Pipe pipe1(length = 1780, diameter = 25, height_ab = 0) annotation(
- Placement(transformation(origin = {-210, -198}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
- Components.Pipes.Pipe pipe2(length = 235, diameter = 25, height_ab = 235) annotation(
- Placement(transformation(origin = {-156, -213}, extent = {{-10, -10}, {10, 10}})));
- Components.Pipes.Pipe pipe3(length = 125, diameter = 25, height_ab = 0) annotation(
- Placement(transformation(origin = {-87, -213}, extent = {{-10, -10}, {10, 10}})));
- Components.Pipes.Pipe pipe4(length = 180, diameter = 25, height_ab = -180) annotation(
- Placement(transformation(origin = {-17, -213}, extent = {{-10, -10}, {10, 10}})));
- Components.Pipes.Pipe pipe5(length = 41, diameter = 35, height_ab = 0) annotation(
- Placement(transformation(origin = {48, -212}, extent = {{-10, -10}, {10, 10}})));
- Components.Pipes.Pipe pipe6(length = 1720, diameter = 35, height_ab = 0) annotation(
- Placement(transformation(origin = {114, -211}, extent = {{-10, -10}, {10, 10}})));
- Components.Pipes.Pipe pipe7(length = 150, diameter = 35, height_ab = 150) annotation(
- Placement(transformation(origin = {186, -210}, extent = {{-10, -10}, {10, 10}})));
- Components.Pipes.Pipe pipe8(length = 200, diameter = 35, height_ab = 0) annotation(
- Placement(transformation(origin = {233, -157}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
- Components.Pipes.Pipe pipe9(length = 900, diameter = 35, height_ab = 0) annotation(
- Placement(transformation(origin = {234, -91}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
- Components.Pipes.Pipe pipe10(length = 330, diameter = 35, height_ab = 330) annotation(
- Placement(transformation(origin = {232, -25}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
- Components.Pipes.Pipe pipe11(length = 140, diameter = 35, height_ab = 0) annotation(
- Placement(transformation(origin = {232, 35}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
- Components.Pipes.Pipe pipe21(length = 1370, diameter = 35, height_ab = 1370) annotation(
- Placement(transformation(origin = {232, 94}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
- Components.Pipes.Pipe pipe31(length = 1050, diameter = 20, height_ab = 0) annotation(
- Placement(transformation(origin = {233, 150}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
- Components.Pipes.Pipe pipe41(length = 150, diameter = 20, height_ab = 150) annotation(
- Placement(transformation(origin = {223, 202}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
- Components.Pipes.Pipe pipe51(length = 440, diameter = 20, height_ab = 0) annotation(
- Placement(transformation(origin = {-184, 151}, extent = {{-10, -10}, {10, 10}})));
- Components.Pipes.Pipe pipe61(length = 1440, diameter = 35, height_ab = -1440) annotation(
- Placement(transformation(origin = {-126, 152}, extent = {{-10, -10}, {10, 10}})));
- Components.Pipes.Pipe pipe71(length = 120, diameter = 35, height_ab = 0) annotation(
- Placement(transformation(origin = {-62, 151}, extent = {{-10, -10}, {10, 10}})));
- Components.Pipes.Pipe pipe81(diameter = 35, length = 360, height_ab = 0) annotation(
- Placement(transformation(origin = {5, 152}, extent = {{-10, -10}, {10, 10}})));
- Components.Pipes.Pipe pipe91(length = 910, diameter = 35, height_ab = 0) annotation(
- Placement(transformation(origin = {70, 150}, extent = {{-10, -10}, {10, 10}})));
- Components.Pipes.Pipe pipe13(length = 1500, diameter = 35, height_ab = 0) annotation(
- Placement(transformation(origin = {100, 105}, extent = {{-10, 10}, {10, -10}}, rotation = -90)));
- Components.Pipes.Pipe pipe12(length = 130, diameter = 35, height_ab = 92) annotation(
- Placement(transformation(origin = {58, 87}, extent = {{10, -10}, {-10, 10}})));
- Components.Pipes.Pipe pipe22(length = 170, diameter = 35, height_ab = 0) annotation(
- Placement(transformation(origin = {-2, 88}, extent = {{10, -10}, {-10, 10}})));
- Components.Pipes.Pipe pipe32(length = 180, diameter = 68, height_ab = -180) annotation(
- Placement(transformation(origin = {-57, 88}, extent = {{10, -10}, {-10, 10}})));
- Components.Pipes.Pipe pipe42(length = 360, diameter = 20) annotation(
- Placement(transformation(origin = {-107, 78}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
- Components.Pipes.Pipe pipe52(length = 1340, diameter = 20, height_ab = 0) annotation(
- Placement(transformation(origin = {-108, 21}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
- Components.Pipes.Pipe pipe62(length = 120, diameter = 20, height_ab = 120) annotation(
- Placement(transformation(origin = {-108, -40}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
- Components.Pipes.Pipe pipe72(length = 548.4, diameter = 20) annotation(
- Placement(transformation(origin = {-94, -105}, extent = {{-10, -10}, {10, 10}})));
- Components.Pipes.Pipe pipe82(diameter = 20, height_ab = 70.7, length = 100) annotation(
- Placement(transformation(origin = {-29, -106}, extent = {{-10, -10}, {10, 10}})));
- Components.Pipes.Pipe pipe92(length = 1200, diameter = 25, height_ab = 1200) annotation(
- Placement(transformation(origin = {28, -106}, extent = {{-10, -10}, {10, 10}})));
- Pipes.Bend bend(angle = 90, pipe_diameter = 25) annotation(
- Placement(transformation(origin = {-213, -165.455}, extent = {{-17.4545, -12}, {17.4545, 12}}, rotation = -90)));
- Components.Pipes.Bend bend1(angle = 90, pipe_diameter = 25) annotation(
- Placement(transformation(origin = {-187, -216.312}, extent = {{-17, -11.6875}, {17, 11.6875}})));
- Components.Pipes.Bend bend2(angle = 90, pipe_diameter = 25) annotation(
- Placement(transformation(origin = {-125.545, -215}, extent = {{-16.5455, -11.375}, {16.5455, 11.375}})));
- Components.Pipes.Bend bend3(angle = 90, pipe_diameter = 25) annotation(
- Placement(transformation(origin = {-50, -216}, extent = {{-16, -11}, {16, 11}})));
- Components.Pipes.Bend bend4(angle = 90, pipe_diameter = 25) annotation(
- Placement(transformation(origin = {15, -216}, extent = {{-16, -11}, {16, 11}})));
- Components.Pipes.Bend bend5(angle = 90, pipe_diameter = 35) annotation(
- Placement(transformation(origin = {80, -215}, extent = {{-16, -11}, {16, 11}})));
- Components.Pipes.Bend bend11(angle = 35, pipe_diameter = 90) annotation(
- Placement(transformation(origin = {148, -214}, extent = {{-16, -11}, {16, 11}})));
- Components.Pipes.Bend bend21(angle = 90, pipe_diameter = 35) annotation(
- Placement(transformation(origin = {237, -123}, extent = {{-16, -11}, {16, 11}}, rotation = 90)));
- Components.Pipes.Bend bend31(angle = 90, pipe_diameter = 35) annotation(
- Placement(transformation(origin = {236, -57}, extent = {{-16, -11}, {16, 11}}, rotation = 90)));
- Components.Pipes.Bend bend41(angle = 90, pipe_diameter = 35) annotation(
- Placement(transformation(origin = {235, 5}, extent = {{-16, -11}, {16, 11}}, rotation = 90)));
- Components.Pipes.Bend bend6(angle = 90, pipe_diameter = 35) annotation(
- Placement(transformation(origin = {236, -192}, extent = {{-16, -11}, {16, 11}}, rotation = 90)));
- Components.Pipes.Bend bend12(angle = 90, pipe_diameter = 35) annotation(
- Placement(transformation(origin = {236, 63}, extent = {{-16, -11}, {16, 11}}, rotation = 90)));
- Components.Pipes.Bend bend22(angle = 90, pipe_diameter = 35) annotation(
- Placement(transformation(origin = {235, 120}, extent = {{-16, -11}, {16, 11}}, rotation = 90)));
- Components.Pipes.Bend bend32(angle = 90, pipe_diameter = 20) annotation(
- Placement(transformation(origin = {236, 178}, extent = {{-16, -11}, {16, 11}}, rotation = 90)));
- Components.Pipes.Bend bend42(angle = 90, pipe_diameter = 20) annotation(
- Placement(transformation(origin = {213, 176}, extent = {{-16, 11}, {16, -11}}, rotation = -90)));
- Components.Pipes.Bend bend51(angle = 90, pipe_diameter = 35) annotation(
- Placement(transformation(origin = {-156, 149}, extent = {{-16, -11}, {16, 11}})));
- Components.Pipes.Bend bend111(angle = 90, pipe_diameter = 35) annotation(
- Placement(transformation(origin = {-94, 148}, extent = {{-16, -11}, {16, 11}})));
- Components.Pipes.Bend bend211(angle = 90, pipe_diameter = 35) annotation(
- Placement(transformation(origin = {-29, 149}, extent = {{-16, -11}, {16, 11}})));
- Components.Pipes.Bend bend311(angle = 90, pipe_diameter = 35) annotation(
- Placement(transformation(origin = {36, 149}, extent = {{-16, -11}, {16, 11}})));
- Components.Pipes.Bend bend411(angle = 90, pipe_diameter = 35) annotation(
- Placement(transformation(origin = {103, 133}, extent = {{-16, 11}, {16, -11}}, rotation = -90)));
- Components.Pipes.Bend bend7(angle = 90, pipe_diameter = 35) annotation(
- Placement(transformation(origin = {85, 84}, extent = {{16, -11}, {-16, 11}})));
- Components.Pipes.Bend bend13(angle = 90, pipe_diameter = 35) annotation(
- Placement(transformation(origin = {31, 85}, extent = {{16, -11}, {-16, 11}})));
- Components.Pipes.Bend bend23(angle = 90, pipe_diameter = 35) annotation(
- Placement(transformation(origin = {-30, 88}, extent = {{16, -11}, {-16, 11}})));
- Components.Pipes.Bend bend33(angle = 90, pipe_diameter = 20) annotation(
- Placement(transformation(origin = {-83, 86}, extent = {{16, -11}, {-16, 11}})));
- Components.Pipes.Bend bend43(angle = 90, pipe_diameter = 25) annotation(
- Placement(transformation(origin = {-112, -8}, extent = {{-16, -11}, {16, 11}}, rotation = -90)));
- Components.Pipes.Bend bend52(angle = 90, pipe_diameter = 20) annotation(
- Placement(transformation(origin = {-111, 51}, extent = {{-16, -11}, {16, 11}}, rotation = -90)));
- Components.Pipes.Bend bend112(angle = 90, pipe_diameter = 20) annotation(
- Placement(transformation(origin = {-111, -72}, extent = {{-16, -11}, {16, 11}}, rotation = -90)));
- Components.Pipes.Bend bend212(angle = 90, pipe_diameter = 20) annotation(
- Placement(transformation(origin = {-60, -109}, extent = {{-16, -11}, {16, 11}})));
- Components.Pipes.Bend bend312(angle = 45, pipe_diameter = 25) annotation(
- Placement(transformation(origin = {-1, -109}, extent = {{-16, -11}, {16, 11}})));
- Components.Pipes.Bend bend412(angle = 90, pipe_diameter = 25) annotation(
- Placement(transformation(origin = {58, -109}, extent = {{-16, -11}, {16, 11}})));
- Components.Pipes.Pipe pipe521(length = 231, diameter = 25, height_ab = 0) annotation(
- Placement(transformation(origin = {88, -107}, extent = {{-10, -10}, {10, 10}})));
- Components.Pipes.Pipe pipe621(length = 455, diameter = 20, height_ab = -455) annotation(
- Placement(transformation(origin = {154, -110}, extent = {{-10, -10}, {10, 10}})));
- Components.Pipes.Bend bend4121(angle = 90, pipe_diameter = 25) annotation(
- Placement(transformation(origin = {122, -111}, extent = {{-16, -11}, {16, 11}})));
- Actuators.Actuator actuator annotation(
- Placement(transformation(origin = {-402, 76}, extent = {{-12, -11}, {12, 11}})));
- equation
- connect(output_valve, pipe.port_a) annotation(
- Line(points = {{-210, -112}, {-210, -126}}));
- connect(pipe.port_b, bend.port_a) annotation(
- Line(points = {{-210, -146}, {-210, -155}}, color = {0, 127, 255}));
- connect(bend.port_b, pipe1.port_a) annotation(
- Line(points = {{-210, -176}, {-210, -188}}, color = {0, 127, 255}));
- connect(pipe1.port_b, bend1.port_a) annotation(
- Line(points = {{-210, -208}, {-210, -213}, {-198, -213}}, color = {0, 127, 255}));
- connect(bend1.port_b, pipe2.port_a) annotation(
- Line(points = {{-176, -213}, {-166, -213}}, color = {0, 127, 255}));
- connect(pipe2.port_b, bend2.port_a) annotation(
- Line(points = {{-146, -213}, {-136, -213}, {-136, -212}}, color = {0, 127, 255}));
- connect(bend2.port_b, pipe3.port_a) annotation(
- Line(points = {{-115, -212}, {-104.5, -212}, {-104.5, -213}, {-97, -213}}, color = {0, 127, 255}));
- connect(pipe3.port_b, bend3.port_a) annotation(
- Line(points = {{-77, -213}, {-60, -213}}, color = {0, 127, 255}));
- connect(bend3.port_b, pipe4.port_a) annotation(
- Line(points = {{-40, -213}, {-27, -213}}, color = {0, 127, 255}));
- connect(pipe4.port_b, bend4.port_a) annotation(
- Line(points = {{-7, -213}, {5, -213}}, color = {0, 127, 255}));
- connect(pipe5.port_b, bend5.port_a) annotation(
- Line(points = {{58, -212}, {70, -212}}, color = {0, 127, 255}));
- connect(pipe6.port_b, bend11.port_a) annotation(
- Line(points = {{124, -211}, {138, -211}}, color = {0, 127, 255}));
- connect(pipe7.port_b, bend6.port_a) annotation(
- Line(points = {{196, -210}, {233, -210}, {233, -202}}, color = {0, 127, 255}));
- connect(bend6.port_b, pipe8.port_a) annotation(
- Line(points = {{233, -182}, {233, -167}}, color = {0, 127, 255}));
- connect(pipe8.port_b, bend21.port_a) annotation(
- Line(points = {{233, -147}, {234, -147}, {234, -133}}, color = {0, 127, 255}));
- connect(bend21.port_b, pipe9.port_a) annotation(
- Line(points = {{234, -113}, {234, -101}}, color = {0, 127, 255}));
- connect(pipe10.port_b, bend41.port_a) annotation(
- Line(points = {{232, -15}, {232, -5}}, color = {0, 127, 255}));
- connect(bend41.port_b, pipe11.port_a) annotation(
- Line(points = {{232, 15}, {232, 24}}, color = {0, 127, 255}));
- connect(bend12.port_b, pipe21.port_a) annotation(
- Line(points = {{233, 73}, {232, 73}, {232, 84}}, color = {0, 127, 255}));
- connect(pipe21.port_b, bend22.port_a) annotation(
- Line(points = {{232, 104}, {232, 110}}, color = {0, 127, 255}));
- connect(bend22.port_b, pipe31.port_a) annotation(
- Line(points = {{232, 130}, {233, 130}, {233, 140}}, color = {0, 127, 255}));
- connect(pipe31.port_b, bend32.port_a) annotation(
- Line(points = {{233, 160}, {233, 168}}, color = {0, 127, 255}));
- connect(bend32.port_b, pipe41.port_a) annotation(
- Line(points = {{233, 188}, {233, 202}}, color = {0, 127, 255}));
- connect(pipe41.port_b, bend42.port_a) annotation(
- Line(points = {{213, 202}, {210, 202}, {210, 186}}, color = {0, 127, 255}));
- connect(bend42.port_b, input_pump) annotation(
- Line(points = {{210, 166}, {210, 148}}, color = {0, 127, 255}));
- connect(bend4.port_b, pipe5.port_a) annotation(
- Line(points = {{26, -212}, {38, -212}}, color = {0, 127, 255}));
- connect(bend5.port_b, pipe6.port_a) annotation(
- Line(points = {{90, -212}, {100, -212}, {100, -211}, {104, -211}}, color = {0, 127, 255}));
- connect(bend11.port_b, pipe7.port_a) annotation(
- Line(points = {{158, -210}, {176, -210}}, color = {0, 127, 255}));
- connect(pipe9.port_b, bend31.port_a) annotation(
- Line(points = {{234, -80}, {234, -66}}, color = {0, 127, 255}));
- connect(bend31.port_b, pipe10.port_a) annotation(
- Line(points = {{234, -46}, {232, -46}, {232, -34}}, color = {0, 127, 255}));
- connect(pipe11.port_b, bend12.port_a) annotation(
- Line(points = {{232, 46}, {233, 46}, {233, 53}}, color = {0, 127, 255}));
- connect(output_pump, pipe51.port_a) annotation(
- Line(points = {{-210, 150}, {-194, 150}, {-194, 152}}));
- connect(pipe51.port_b, bend51.port_a) annotation(
- Line(points = {{-174, 151}, {-167, 151}, {-167, 152}, {-166, 152}}, color = {0, 127, 255}));
- connect(bend51.port_b, pipe61.port_a) annotation(
- Line(points = {{-146, 152}, {-136, 152}}, color = {0, 127, 255}));
- connect(pipe61.port_b, bend111.port_a) annotation(
- Line(points = {{-116, 152}, {-104, 152}, {-104, 151}}, color = {0, 127, 255}));
- connect(bend111.port_b, pipe71.port_a) annotation(
- Line(points = {{-84, 151}, {-72, 151}}, color = {0, 127, 255}));
- connect(pipe71.port_b, bend211.port_a) annotation(
- Line(points = {{-52, 151}, {-39, 151}, {-39, 152}}, color = {0, 127, 255}));
- connect(bend211.port_b, pipe81.port_a) annotation(
- Line(points = {{-19, 152}, {-5, 152}}, color = {0, 127, 255}));
- connect(pipe81.port_b, bend311.port_a) annotation(
- Line(points = {{15, 152}, {26, 152}}, color = {0, 127, 255}));
- connect(bend311.port_b, pipe91.port_a) annotation(
- Line(points = {{46, 152}, {60, 152}, {60, 150}}, color = {0, 127, 255}));
- connect(bend411.port_b, pipe13.port_a) annotation(
- Line(points = {{100, 123}, {100, 115}}, color = {0, 127, 255}));
- connect(bend7.port_b, pipe12.port_a) annotation(
- Line(points = {{75, 87}, {68, 87}}, color = {0, 127, 255}));
- connect(pipe12.port_b, bend13.port_a) annotation(
- Line(points = {{48, 87}, {41, 87}, {41, 88}}, color = {0, 127, 255}));
- connect(bend13.port_b, pipe22.port_a) annotation(
- Line(points = {{21, 88}, {8, 88}}, color = {0, 127, 255}));
- connect(pipe22.port_b, bend23.port_a) annotation(
- Line(points = {{-12, 88}, {-20, 88}, {-20, 91}}, color = {0, 127, 255}));
- connect(pipe32.port_b, bend33.port_a) annotation(
- Line(points = {{-67, 88}, {-67, 89}, {-73, 89}}, color = {0, 127, 255}));
- connect(bend33.port_b, pipe42.port_a) annotation(
- Line(points = {{-93, 89}, {-106, 89}, {-106, 88}}, color = {0, 127, 255}));
- connect(pipe42.port_b, bend52.port_a) annotation(
- Line(points = {{-106, 68}, {-108, 68}, {-108, 62}}, color = {0, 127, 255}));
- connect(bend52.port_b, pipe52.port_a) annotation(
- Line(points = {{-108, 42}, {-108, 32}}, color = {0, 127, 255}));
- connect(pipe52.port_b, bend43.port_a) annotation(
- Line(points = {{-108, 12}, {-108, 6}, {-109, 6}, {-109, 2}}, color = {0, 127, 255}));
- connect(bend43.port_b, pipe62.port_a) annotation(
- Line(points = {{-109, -18}, {-109, -26}, {-108, -26}, {-108, -30}}, color = {0, 127, 255}));
- connect(pipe62.port_b, bend112.port_a) annotation(
- Line(points = {{-108, -50}, {-108, -62}}, color = {0, 127, 255}));
- connect(bend112.port_b, pipe72.port_a) annotation(
- Line(points = {{-108, -82}, {-108, -105}, {-104, -105}}, color = {0, 127, 255}));
- connect(pipe72.port_b, bend212.port_a) annotation(
- Line(points = {{-84, -105}, {-75, -105}, {-75, -106}, {-70, -106}}, color = {0, 127, 255}));
- connect(bend212.port_b, pipe82.port_a) annotation(
- Line(points = {{-50, -106}, {-39, -106}}, color = {0, 127, 255}));
- connect(pipe82.port_b, bend312.port_a) annotation(
- Line(points = {{-19, -106}, {-11, -106}}, color = {0, 127, 255}));
- connect(bend312.port_b, pipe92.port_a) annotation(
- Line(points = {{9, -106}, {18, -106}}, color = {0, 127, 255}));
- connect(pipe92.port_b, bend412.port_a) annotation(
- Line(points = {{38, -106}, {48, -106}}, color = {0, 127, 255}));
- connect(pipe521.port_b, bend4121.port_a) annotation(
- Line(points = {{98, -107}, {112, -107}, {112, -108}}, color = {0, 127, 255}));
- connect(bend4121.port_b, pipe621.port_a) annotation(
- Line(points = {{132, -108}, {144, -108}, {144, -110}}, color = {0, 127, 255}));
- connect(pipe621.port_b, input_valve) annotation(
- Line(points = {{164, -110}, {210, -110}, {210, -112}}, color = {0, 127, 255}));
- connect(pipe91.port_b, bend411.port_a) annotation(
- Line(points = {{80, 150}, {100, 150}, {100, 144}}, color = {0, 127, 255}));
- connect(pipe32.port_a, bend23.port_b) annotation(
- Line(points = {{-46, 88}, {-43, 88}, {-43, 91}, {-40, 91}}, color = {0, 127, 255}));
- connect(pipe13.port_b, bend7.port_a) annotation(
- Line(points = {{100, 96}, {100, 88}, {96, 88}}, color = {0, 127, 255}));
- connect(bend412.port_b, pipe521.port_a) annotation(
- Line(points = {{68, -106}, {73, -106}, {73, -107}, {78, -107}}, color = {0, 127, 255}));
- annotation(
- Diagram(coordinateSystem(extent = {{-420, 220}, {260, -240}})));
- end TestSetupNetwork;
- end PipeNetworks;
- package BaseComponents
- extends Modelica.Icons.Package;
- partial model FluidBase
- extends Components.BaseComponents.MediumBase;
- outer Modelica.Fluid.System system;
- // Define flow values -- will be constant
- constant Medium.AbsolutePressure start_pressure_pipe = 1 "Start value of pressure at a port";
- Modelica.Fluid.Interfaces.FluidPort_a port_a(redeclare package Medium = Medium) annotation(
- Placement(transformation(origin = {-100, 0}, extent = {{-11, -11}, {11, 11}}), iconTransformation(origin = {-100, 0}, extent = {{-9, -9}, {9, 9}})));
- Modelica.Fluid.Interfaces.FluidPort_b port_b(redeclare package Medium = Medium) annotation(
- Placement(transformation(origin = {100, 0}, extent = {{-11, -11}, {11, 11}}), iconTransformation(origin = {100, 0}, extent = {{-9, -9}, {9, 9}})));
- end FluidBase;
- package TwoWayEqualPercentageBase
- partial model PartialTwoWayValve "Partial model for a two way valve"
- extends Buildings.Fluid.BaseClasses.PartialResistance(final dp_nominal = dpValve_nominal + dpFixed_nominal, dp(nominal = 6000), final m_flow_turbulent = deltaM*abs(m_flow_nominal));
- extends Buildings.Fluid.Actuators.BaseClasses.ValveParameters(rhoStd = Medium.density_pTX(101325, 273.15 + 4, Medium.X_default));
- parameter Modelica.Units.SI.PressureDifference dpFixed_nominal(displayUnit = "Pa", min = 0) = 0 "Pressure drop of pipe and other resistances that are in series" annotation(
- Dialog(group = "Nominal condition"));
- parameter Real l(min = 1e-10, max = 1) = 0.0001 "Valve leakage, l=Kv(y=0)/Kv(y=1)";
- input Real phi "Ratio actual to nominal mass flow rate of valve, phi=Kv(y)/Kv(y=1)";
- parameter Real kFixed(unit = "", min = 0) = if dpFixed_nominal > Modelica.Constants.eps then m_flow_nominal/sqrt(dpFixed_nominal) else 0 "Flow coefficient of fixed resistance that may be in series with valve, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2).";
- Real kVal(unit = "", min = Modelica.Constants.small) "Flow coefficient of valve, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2).";
- Real k(unit = "", min = Modelica.Constants.small) "Flow coefficient of valve and pipe in series, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2).";
- initial equation
- assert(dpFixed_nominal > -Modelica.Constants.eps, "In " + getInstanceName() + ": Model requires dpFixed_nominal >= 0 but received dpFixed_nominal = " + String(dpFixed_nominal) + " Pa.");
- annotation();
- end PartialTwoWayValve;
- partial model PartialTwoWayValveKv "Partial model for a two way valve using a Kv characteristic"
- extends Components.BaseComponents.TwoWayEqualPercentageBase.PartialTwoWayValve;
- equation
- kVal = phi*Kv_SI;
- if (dpFixed_nominal > Modelica.Constants.eps) then
- k = sqrt(1/(1/kFixed^2 + 1/kVal^2));
- else
- k = kVal;
- end if;
- if linearized then
- // This implementation yields m_flow_nominal = phi*kv_SI * sqrt(dp_nominal)
- // if m_flow = m_flow_nominal and dp = dp_nominal
- m_flow*m_flow_nominal_pos = k^2*dp;
- else
- if homotopyInitialization then
- if from_dp then
- m_flow = homotopy(actual = Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp(dp = dp, k = k, m_flow_turbulent = m_flow_turbulent), simplified = m_flow_nominal_pos*dp/dp_nominal_pos);
- else
- dp = homotopy(actual = Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow(m_flow = m_flow, k = k, m_flow_turbulent = m_flow_turbulent), simplified = dp_nominal_pos*m_flow/m_flow_nominal_pos);
- end if;
- else
- // do not use homotopy
- if from_dp then
- m_flow = Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp(dp = dp, k = k, m_flow_turbulent = m_flow_turbulent);
- else
- dp = Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow(m_flow = m_flow, k = k, m_flow_turbulent = m_flow_turbulent);
- end if;
- end if;
- // homotopyInitialization
- end if;
- // linearized
- annotation(
- Documentation(info = "<html>
- <p>
- Partial model for valves with different opening characteristics,
- such as linear, equal percentage or quick opening. This partial extends from
- <a href=\"modelica://Buildings.Fluid.Actuators.BaseClasses.PartialTwoWayValve\">
- Buildings.Fluid.Actuators.BaseClasses.PartialTwoWayValve</a>
- and also contains the governing equations for these three two way valve models.
- </p>
- <h4>Implementation</h4>
- <p>
- Models that extend this model need to provide a binding equation
- for the flow function <code>phi</code>.
- An example of such a code can be found in
- <a href=\"modelica://Buildings.Fluid.Actuators.Valves.TwoWayLinear\">
- Buildings.Fluid.Actuators.Valves.TwoWayLinear</a>.
- </p>
- </html>", revisions = "<html>
- <ul>
- <li>
- October 25, 2019, by Jianjun Hu:<br/>
- Removed icon graphics annotation. This is for
- <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1225\">#1225</a>.
- </li>
- <li>
- March 24, 2017, by Michael Wetter:<br/>
- Renamed <code>filteredInput</code> to <code>use_inputFilter</code>.<br/>
- This is for
- <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/665\">#665</a>.
- </li>
- <li>
- January 29, 2015 by Filip Jorissen:<br/>
- First implementation.
- </li>
- </ul>
- </html>"));
- end PartialTwoWayValveKv;
- model TwoWayEqualPercentage "Two way valve with equal percentage flow characteristics"
- extends Components.BaseComponents.TwoWayEqualPercentageBase.PartialTwoWayValveKv(phi = max(0.1*l, if homotopyInitialization then homotopy(actual = Buildings.Fluid.Actuators.BaseClasses.equalPercentage(opening, R, l, delta0), simplified = l + opening*(1 - l)) else Buildings.Fluid.Actuators.BaseClasses.equalPercentage(opening, R, l, delta0)));
- parameter Real R = 50 "Rangeability, R=50...100 typically";
- parameter Real delta0 = 0.01 "Range of significant deviation from equal percentage law";
- Modelica.Blocks.Interfaces.RealInput opening annotation(
- Placement(transformation(origin = {0, 100}, extent = {{-20, -20}, {20, 20}}, rotation = -90), iconTransformation(origin = {0, 42}, extent = {{-20, -20}, {20, 20}}, rotation = -90)));
- initial equation
- // Since the flow model Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow computes
- // 1/k^2, the parameter l must not be zero.
- assert(l > 0, "Valve leakage parameter l must be bigger than zero.");
- assert(l < 1/R, "Wrong parameters in valve model.\n" + " Rangeability R = " + String(R) + "\n" + " Leakage flow l = " + String(l) + "\n" + " Must have l < 1/R = " + String(1/R));
- annotation(
- Diagram(graphics),
- Icon(graphics = {Polygon(origin = {-50, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, lineThickness = 0.5, points = {{50, 0}, {-50, 60}, {-50, -60}, {50, 0}, {50, 0}}), Polygon(origin = {50, 0}, rotation = 180, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, lineThickness = 0.5, points = {{50, 0}, {-50, 60}, {-50, -60}, {50, 0}, {50, 0}}), Polygon(origin = {0, 11}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, points = {{-36, 11}, {36, 11}, {0, -11}, {0, -11}, {-36, 11}}), Polygon(origin = {0, -11}, rotation = 180, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, points = {{-40, 13}, {40, 13}, {0, -11}, {0, -11}, {-40, 13}})}));
- end TwoWayEqualPercentage;
- end TwoWayEqualPercentageBase;
- partial model FlowModelBase
- inner Components.Configurations.Configuration config(max_motor_position = 100, start_motor_position = 50) annotation(
- Placement(transformation(origin = {-90, 89}, extent = {{-10, -10}, {10, 10}})));
- inner Modelica.Fluid.System system(m_flow_start = system.m_flow_small) annotation(
- Placement(transformation(origin = {-50, 90}, extent = {{-10, -10}, {10, 10}})));
- Modelica.Blocks.Interfaces.RealInput motor_setpoint annotation(
- Placement(transformation(origin = {-100, -1}, extent = {{-20, -20}, {20, 20}}), iconTransformation(origin = {-281, 140}, extent = {{-19, -19}, {19, 19}})));
- Modelica.Blocks.Interfaces.RealOutput current_motor_pos annotation(
- Placement(transformation(origin = {110, 16}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {130, 160}, extent = {{-10, -10}, {10, 10}})));
- Modelica.Blocks.Interfaces.RealOutput current_flow annotation(
- Placement(transformation(origin = {110, -8}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {130, 120}, extent = {{-10, -10}, {10, 10}})));
- annotation(
- Diagram(graphics),
- Icon(graphics = {Rectangle(origin = {22, 52}, fillColor = {0, 127, 255}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-122, 20}, {122, -20}}), Ellipse(origin = {22, 52}, fillColor = {0, 100, 199}, fillPattern = FillPattern.Sphere, extent = {{-58, 58}, {58, -58}}), Rectangle(origin = {-199, 52}, lineColor = {99, 69, 44}, fillColor = {255, 190, 111}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-101, 20}, {101, -20}}), Ellipse(origin = {-148, 54}, fillPattern = FillPattern.Solid, extent = {{-30, 30}, {30, -30}}), Rectangle(origin = {-238, 52}, fillColor = {28, 113, 216}, fillPattern = FillPattern.Solid, lineThickness = 0.5, extent = {{-40, 40}, {40, -40}}, radius = 5), Line(origin = {-253, 116}, points = {{-13, 24}, {13, 24}, {13, -24}, {13, -24}}, thickness = 0.5), Line(origin = {-14, 86}, points = {{-134, -34}, {-134, 34}, {134, 34}, {134, 34}}, thickness = 0.5), Line(origin = {-50, 126}, points = {{-170, -34}, {-170, 34}, {170, 34}, {170, 34}}, thickness = 0.5)}, coordinateSystem(extent = {{-300, 180}, {140, -20}})),
- Documentation(info = "<html>
- <p>When creating a new flow model, it is recommended to extend it from FlowModel-
- Base. This base model automatically provides all required inputs, outputs, and the
- configuration model with the correct predefined names.</p>
-
- <p>
- A flow model contains one input and two outputs:
- <ul>
- <li>input: motor_setpoint</li>
- <li>output: current_motor_pos</li>
- <li>output: current_flow</li>
- </ul>
- </p>
- </html>"));
- end FlowModelBase;
- partial model DynamxBase
- extends Components.BaseComponents.FluidBase;
- outer Components.Configurations.Configuration config;
- Modelica.Blocks.Interfaces.RealInput setpoint_motor annotation(
- Placement(transformation(origin = {0, 100}, extent = {{-21, -21}, {21, 21}}, rotation = -90), iconTransformation(origin = {-40, 76}, extent = {{-19, -19}, {19, 19}}, rotation = -90)));
- Modelica.Blocks.Interfaces.RealOutput motor_position annotation(
- Placement(transformation(origin = {-29, -92}, extent = {{-11, -11}, {11, 11}}, rotation = -90), iconTransformation(origin = {-40, -77}, extent = {{-18, -18}, {18, 18}}, rotation = -90)));
- Modelica.Blocks.Interfaces.RealOutput flow_rate annotation(
- Placement(transformation(origin = {30, -90}, extent = {{-10, -10}, {10, 10}}, rotation = -90), iconTransformation(origin = {82, 80}, extent = {{-18, -18}, {18, 18}})));
- Modelica.Fluid.Interfaces.FluidPort_a port_a(redeclare package Medium = Medium) annotation(
- Placement(transformation(origin = {-100, 0}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {-100, 0}, extent = {{-10, -10}, {10, 10}})));
- Modelica.Fluid.Interfaces.FluidPort_b port_b(redeclare package Medium = Medium) annotation(
- Placement(transformation(origin = {100, 0}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {100, -2}, extent = {{-10, -10}, {10, 10}})));
- Sensors.FlowSensor flowSensor annotation(
- Placement(transformation(origin = {30, 0}, extent = {{-10, 10}, {10, -10}}, rotation = -0)));
- equation
- connect(flowSensor.port_b, port_b) annotation(
- Line(points = {{40, 0}, {100, 0}}, color = {0, 127, 255}));
- connect(flowSensor.flow_rate, flow_rate) annotation(
- Line(points = {{30, -10}, {30, -90}}, color = {0, 0, 127}));
- annotation(
- Icon(graphics = {Rectangle(origin = {-1, 0}, lineColor = {99, 69, 44}, fillColor = {255, 190, 111}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-101, 20}, {101, -20}}), Ellipse(origin = {50, 2}, fillPattern = FillPattern.Solid, extent = {{-30, 30}, {30, -30}}), Line(origin = {50, 40}, points = {{0, 40}, {0, -40}, {0, -40}, {0, -40}}, thickness = 0.5), Line(origin = {90, 80}, rotation = -90, points = {{0, -14}, {0, -40}, {0, -40}, {0, -40}}, thickness = 0.5), Line(origin = {-40, 0}, points = {{0, 58}, {0, -40}, {0, -40}, {0, -60}}, thickness = 0.5), Rectangle(origin = {-40, 0}, fillColor = {28, 113, 216}, fillPattern = FillPattern.Solid, lineThickness = 0.5, extent = {{-40, 40}, {40, -40}}, radius = 5), Polygon(origin = {40, -46}, lineColor = {53, 132, 228}, fillColor = {53, 132, 228}, fillPattern = FillPattern.Solid, points = {{20, 0}, {-20, 10}, {-20, -10}, {-20, -10}, {20, 0}}), Line(origin = {-20, -46}, points = {{40, 0}, {-40, 0}, {-40, 0}}, color = {53, 132, 228}, thickness = 0.75), Text(origin = {-118, 194}, textColor = {0, 0, 255}, extent = {{-149, -114}, {151, -154}}, textString = "%name")}),
- Diagram(graphics),
- Documentation(info = "<html>
- A Dynamx model combines the functionalities of the actuator, valve, and flowsensor into one component.
-
- <p>
- A Dynamx model contains one input and two outputs:
- <ul>
- <li>input: motor_setpoint</li>
- <li>output: current_motor_pos</li>
- <li>output: current_flow</li>
- </ul>
- </p>
- </html>"));
- end DynamxBase;
- partial model PipeNetworksBase
- extends Components.BaseComponents.MediumBase;
- Modelica.Fluid.Interfaces.FluidPort_a input_pump(redeclare package Medium = Medium) annotation(
- Placement(transformation(origin = {210, 148}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {100, 70}, extent = {{-10, -10}, {10, 10}})));
- Modelica.Fluid.Interfaces.FluidPort_a input_valve(redeclare package Medium = Medium) annotation(
- Placement(transformation(origin = {210, -112}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {100, -70}, extent = {{-10, -10}, {10, 10}})));
- Modelica.Fluid.Interfaces.FluidPort_b output_pump(redeclare package Medium = Medium) annotation(
- Placement(transformation(origin = {-210, 150}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {-100, 70}, extent = {{-10, -10}, {10, 10}})));
- Modelica.Fluid.Interfaces.FluidPort_b output_valve(redeclare package Medium = Medium) annotation(
- Placement(transformation(origin = {-210, -112}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {-100, -70}, extent = {{-10, -10}, {10, 10}})));
- annotation(
- Diagram(coordinateSystem(extent = {{-220, 160}, {220, -120}}), graphics),
- Icon(graphics = {Line(origin = {1.17, -1.17}, points = {{-101.174, 71.1738}, {-43.1738, 71.1738}, {-21.1738, 41.1738}, {-21.1738, 1.17382}, {-49.1738, -24.8262}, {-49.1738, -38.8262}, {18.8262, -38.8262}, {46.8262, -12.8262}, {70.8262, -12.8262}, {100.826, -70.8262}, {100.826, -70.8262}}, color = {26, 95, 180}, thickness = 1.5), Line(origin = {0, -1}, points = {{-100, -71}, {-48, -71}, {-48, -59}, {-80, -13}, {-80, 11}, {60, 11}, {60, 21}, {40, 41}, {10, 41}, {10, 71}, {100, 71}, {100, 71}}, color = {26, 95, 180}, thickness = 1.5), Text(origin = {-2, 22}, textColor = {0, 0, 255}, extent = {{-149, -114}, {151, -154}}, textString = "%name")}),
- Documentation(info = "<html>
- A pipe network is a model that encapsulates the whole network of pipes and bends.
-
- <p>
- A pipe network model contains two inputs and two outputs:
- <ul>
- <li>input: input_pump</li>
- <li>input: input_valve</li>
- <li>output: output_pump</li>
- <li>output: output_valve</li>
- </ul>
- </p>
-
- <p>
- These connections are defined such that input pump links to port a of the pump and
- output pump to port b of the pump, with analogous connections for the valve. This
- design ensures that the overall flow model consists of only three main components: a pipe network, a pressure pump, and a Dynamx component.
- </p>
-
- </html>"));
- end PipeNetworksBase;
- model MediumBase
- // Define the medium
- replaceable package Medium = Buildings.Media.Water annotation(
- choicesAllMatching = true);
-
- equation
-
- end MediumBase;
- end BaseComponents;
- package Examples "Library of examples to demonstrate the usage of package Components"
- extends Modelica.Icons.ExamplesPackage;
- model FlowModelLinear
- extends BaseComponents.FlowModelBase;
- Pumps.PressurePump pressurePump annotation(
- Placement(transformation(origin = {-16, 48}, extent = {{10, -10}, {-10, 10}}, rotation = -0)));
- Dynamx.LinearDefaultActuator linearDefaultActuator annotation(
- Placement(transformation(origin = {34, -16}, extent = {{-10, -10}, {10, 10}})));
- PipeNetworks.SimpleNetwork simpleNetwork annotation(
- Placement(transformation(origin = {-16, 18}, extent = {{-10, -10}, {10, 10}})));
- equation
- connect(linearDefaultActuator.flow_rate, current_flow) annotation(
- Line(points = {{42, -8}, {110, -8}}, color = {0, 0, 127}));
- connect(motor_setpoint, linearDefaultActuator.setpoint_motor) annotation(
- Line(points = {{-100, 0}, {30, 0}, {30, -8}}, color = {0, 0, 127}));
- connect(linearDefaultActuator.motor_position, current_motor_pos) annotation(
- Line(points = {{30, -24}, {30, -30}, {64, -30}, {64, 16}, {110, 16}}, color = {0, 0, 127}));
- connect(simpleNetwork.input_pump, pressurePump.port_a) annotation(
- Line(points = {{-6, 26}, {26, 26}, {26, 48}, {-6, 48}}, color = {0, 127, 255}));
- connect(simpleNetwork.output_pump, pressurePump.port_b) annotation(
- Line(points = {{-26, 26}, {-56, 26}, {-56, 48}, {-26, 48}}, color = {0, 127, 255}));
- connect(simpleNetwork.input_valve, linearDefaultActuator.port_a) annotation(
- Line(points = {{-6, 12}, {2, 12}, {2, -16}, {24, -16}}, color = {0, 127, 255}));
- connect(linearDefaultActuator.port_b, simpleNetwork.output_valve) annotation(
- Line(points = {{44, -16}, {52, -16}, {52, -34}, {-56, -34}, {-56, 12}, {-26, 12}}, color = {0, 127, 255}));
- annotation(
- uses(Modelica(version = "4.0.0")),
- Diagram(coordinateSystem(extent = {{-120, 100}, {120, -60}})),
- version = "");
- end FlowModelLinear;
-
- model FlowModelEqualPer
- extends BaseComponents.FlowModelBase(system(allowFlowReversal = true));
- Pumps.PressurePump pressurePump annotation(
- Placement(transformation(origin = {-10, 42}, extent = {{10, -10}, {-10, 10}}, rotation = -0)));
- Dynamx.EqualPercentageDefaultActuator equalPercentageDefaultActuator annotation(
- Placement(transformation(origin = {44, -16}, extent = {{-10, -10}, {10, 10}})));
- PipeNetworks.SimpleNetwork simpleNetwork annotation(
- Placement(transformation(origin = {-10, 14}, extent = {{-10, -10}, {10, 10}})));
- equation
- connect(equalPercentageDefaultActuator.flow_rate, current_flow) annotation(
- Line(points = {{52, -8}, {110, -8}}, color = {0, 0, 127}));
- connect(motor_setpoint, equalPercentageDefaultActuator.setpoint_motor) annotation(
- Line(points = {{-100, 0}, {40, 0}, {40, -8}}, color = {0, 0, 127}));
- connect(equalPercentageDefaultActuator.motor_position, current_motor_pos) annotation(
- Line(points = {{40, -24}, {40, -26}, {68, -26}, {68, 16}, {110, 16}}, color = {0, 0, 127}));
- connect(pressurePump.port_a, simpleNetwork.input_pump) annotation(
- Line(points = {{0, 42}, {22, 42}, {22, 22}, {0, 22}}, color = {0, 127, 255}));
- connect(pressurePump.port_b, simpleNetwork.output_pump) annotation(
- Line(points = {{-20, 42}, {-50, 42}, {-50, 22}, {-20, 22}}, color = {0, 127, 255}));
- connect(simpleNetwork.input_valve, equalPercentageDefaultActuator.port_a) annotation(
- Line(points = {{0, 8}, {14, 8}, {14, -16}, {34, -16}}, color = {0, 127, 255}));
- connect(equalPercentageDefaultActuator.port_b, simpleNetwork.output_valve) annotation(
- Line(points = {{54, -16}, {62, -16}, {62, -32}, {-50, -32}, {-50, 8}, {-20, 8}}, color = {0, 127, 255}));
- annotation(
- uses(Modelica(version = "4.0.0")),
- Diagram(coordinateSystem(extent = {{-120, 100}, {120, -60}})),
- version = "");
- end FlowModelEqualPer;
- end Examples;
- annotation(
- uses(Modelica(version = "4.0.0"), Buildings(version = "12.0.0")));
- end Components;
|