How do I define relations between parameters and retain flexible use? - modelica

How do I define relations between multiple parameters in such a way that I can choose which parameters from the set to define, some equations defining the rest?
For example, I have a model with 3 parameters for the radius, height and volume of a cylinder, and they are related via the equation for volume V=r^2*h.
I want to be able to choose on model instantiation if I define r and h (and V is computed), r, V (and h is computed), or h, V (and r is computed).
In the following minimal example, I have tried the approaches 1-3, but none does what I need. I got the feeling that this has to be a common/solved problem, and I am just missing a certain modelling technique. Can you help?
model test_params "Model for a cylinder"
model Cylinder
parameter Real r;
parameter Real h;
parameter Real V;
//Approach 3: binding equation. Works, but what to do if I have V, h and want to know r??
//parameter Real V=r^2*Modelica.Constants.pi*h;
Real t;
initial equation
//Approach 2, apparently chooses V as 0 before getting to the initialisation equation
//V=r^2*Modelica.Constants.pi*h;
//Parameter cylinder.V has no value, and is fixed during initialization (fixed=true), using available start value (start=0.0) as default value.
// The initial conditions are over specified. The following 1 initial equations are redundant, so they are removed from the initialization sytem:
// cylinder.V = 3.141592653589793 * cylinder.r ^ 2.0 * cylinder.h.
equation
t = V;
// Approach 1
//V=r^2*Modelica.Constants.pi*h; //Leads to: Too many equations, over-determined system.
end Cylinder;
test_params.Cylinder cylinder(h = 1, r = 2) annotation(
Placement(visible = true, transformation(origin = {-44, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
end test_params;
This is on OpenModelica 1.14, if that should be relevant.

This can be done using your mentioned approach 2 if you set the dependent parameter as fixed=false parameter.
model TestParams "Model for a cylinder"
encapsulated model Cylinder
import Modelica.Constants.pi;
parameter Real r;
parameter Real h;
parameter Real V;
initial equation
V = r^2*pi*h "Cylinder volume";
end Cylinder;
TestParams.Cylinder cylinder_1(h=1, r=2, V(fixed=false)) "Compute cylinder V(h, r)"
annotation (Placement(transformation(origin={-70,50}, extent={{-10,-10},{10,10}})));
TestParams.Cylinder cylinder_2(h(start=0, fixed=false), r=2, V=13) "Compute cylinder h(r, V)"
annotation (Placement(transformation(origin={-30,50}, extent={{-10,-10},{10,10}})));
TestParams.Cylinder cylinder_3(h=1, r(start=0, fixed=false), V=13) "Compute cylinder r(h, V)"
annotation (Placement(transformation(origin={10,50}, extent={{-10,-10},{10,10}})));
end TestParams;

I would propose, in order to have a graphical selection, something similar to:
package test_params2 "Model for a cylinder"
type InputChoice = enumeration(rh,rv,hv);
model Cylinder
parameter InputChoice choice;
parameter Real r;
parameter Real h;
parameter Real v;
Real R,H,V;
equation
if choice==InputChoice.rh then
R=r;
H=h;
elseif choice==InputChoice.rv then
R=r;
V=v;
else
H=h;
V=v;
end if;
V=R^2*Modelica.Constants.pi*H;
end Cylinder;
model test_params
Cylinder cylinder(choice = test_params2.InputChoice.rh,h=1,r=2, v = 30) annotation(
Placement(visible = true, transformation(origin = {-44, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
end test_params;
end test_params2;

Related

How to hide result of an interface in modelica?

I have running a model with a block composed of several interfaces (thermal ports).
The dimension of the port is variable and sometime can be up to 20x20...
When I run the simulation, the calculation are performed (slowly) but the worst part is when the simulation is done and has to prepare all the data (results)..
In the list of the result there are 20x20 of each interface ! this take several minutes to appears.
I don't need to know the ports values and I want to hide it.
I tried this :
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a F6[Nw, Nh] annotation(HideResult = true,
Placement(visible = true, transformation(origin = {120, -94}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {150, 120}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
but it is still showing the result...
Also, I can't use "protected" as I need to access the port in a global model, but also to some variables of the block which are calculated.
Do you have any solution ?
Thanks for your help :)
HideResult annotation is exactly for this purpose.
I tried a minimal example in OpenModelica v1.19.2 and that works as expected.
model HideResult
Real public_var = 1;
Real hidden_var = 2 annotation(HideResult=true );
equation
end HideResult;
I guess your issue is related to the array definition of heat ports. You could instead apply the HideResult annotation to single variables inside the connector defintion.
That means, define you own connector class and apply the annotation there.
If you keep everything else unchanged (type and name of variables), your customized connector is 100% compatible.

Boolean frequency in modelica

In the model that I am working on i have a Boolean of that controls the turn ON and OFF of a system, that means during simulation my system turns ON and OFF many times, so I want to calculate the frequency of the ON/OFF, does anyone have an idea, please
thank you
model Boolean_Test
Modelica.Blocks.Sources.BooleanPulse BooleanPulse(period = 20e-3, width = 20) annotation(
Placement(visible = true, transformation(origin = {-66, 6}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Real counter(start=0); // Counter to count the number of sets and resets
Real frequency(start=0);
equation
when Modelica.Math.BooleanVectors.oneTrue([BooleanPulse.y,pre(BooleanPulse.y)]) then
counter =pre(counter)+1;
frequency=0.5*counter/time;
end when;
annotation(
uses(Modelica(version = "3.2.3")));
end Boolean_Test;
You can use the above example to achieve your objective. Here I use xor principle to sense the toggle in the boolen output (BooleanPulse.y). A similar idea can be implemented in your source code. The above code is a simple example where I used to validate the computed frequency. For me the computed is equal to frequency value defined in Modelica.Blocks.Sources.BooleanPulse
Just trying to simplify Akhil Nandan's answer a bit, could result in:
model Boolean_Test2
Modelica.Blocks.Sources.BooleanPulse BooleanPulse(period = 20e-3, width = 20) annotation (
Placement(visible = true, transformation(origin = {-66, 6}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Real counter(start=0); // Counter to count the number of sets and resets
Real frequency(start=0);
equation
when BooleanPulse.y then
counter =pre(counter)+1;
frequency=counter/(max(time,1e-6));
end when;
annotation(uses(Modelica(version="4.0.0")));
end Boolean_Test2;
To calculate the boolean frequency (F) where ON is the boolean in my model, I used the following model:
when ON and ON <> pre(ON) then
F=pre(ON)+1;
end when;

Persisting medium issue after defining Medium in Open Modelica

In Open Modelica Fluid Environment, I´m seeing the Error
"Medium is partial, name lookup is not allowed in partial classes." Which is commonly solved properly defining the media in each element.
I followed the related instruction of the post (How to specify medium in Openmodelica?) Namely I have redeclared the medium in each component of my system but still get this error when I try to simulate, although the check went through just fine.
Now this error is referenced to the Interfaces file, specificaly the line:
"stream Medium.ExtraProperty C_outflow[Medium.nC] "Properties c_i/m close to the connection point if m_flow < 0"; "
Do you understand why this still happens? I guess this C_outflow refers to concentration or other specific property of fluid. However I haven´t set any particular property. I tried turning false the allowFlowReversal option in order to not have m_flow < 0 but it didn´t help.
Do you have any ideas of how to solve this issue? I´d appreciate any help from this dear community.
Here my model code with the first element as an example. Many thanks in advance.
model ####
replaceable package Medium = Modelica.Media.Water.StandardWaterOnePhase constrainedby Modelica.Media.Interfaces.PartialMedium; parameter Real D_p = 0.0254; //Normal Diameter of pipe
Modelica.Fluid.Vessels.ClosedVolume Tank1(redeclare package Medium = Medium, V = 0.05, nPorts = 2 ) annotation( Placement(visible = true, transformation(origin = {-2, 46}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); ...

smooth the curve in Dymola

In Dymola, after plotting the result, how could I smooth the curve?
I don't know a way of doing it in the plot window, but smoothing a curve could be done in multiple ways. You have to be aware that you are manipulating the actual simulation result with that.
I would recommend using a filter yourself and just create a smoothed signal without influencing the actual simulation. I made a small sample model with an original and filtered signal using a Butterworth filter from the MSL.
I just copied and modified an example slightly, please disregard most of the inline comments. You have to fiddle a bit with the f_cut such that it cuts the correct high frequencies for your case.
model FilterTest "Demonstrates the Continuous.Filter block with various options"
extends Modelica.Icons.Example;
Real original = add.y;
Real filtered = Butterworth.y;
protected
parameter Integer order=3;
parameter Modelica.SIunits.Frequency f_cut=2;
parameter Modelica.Blocks.Types.FilterType filterType=Modelica.Blocks.Types.FilterType.LowPass
"Type of filter (LowPass/HighPass)";
parameter Modelica.Blocks.Types.Init init=Modelica.Blocks.Types.Init.SteadyState
"Type of initialization (no init/steady state/initial state/initial output)";
parameter Boolean normalized=true;
Modelica.Blocks.Continuous.Filter Butterworth(
analogFilter = Modelica.Blocks.Types.AnalogFilter.Butterworth,
f_cut= 100,
f_min=1,
filterType=Modelica.Blocks.Types.FilterType.LowPass, gain = 1,
init=init,normalized=normalized,
order=order)
annotation (Placement(visible = true, transformation(extent = {{38, 18}, {58, 38}}, rotation = 0)));
Modelica.Blocks.Sources.Sine sineHigh(freqHz = 200) annotation(
Placement(visible = true, transformation(origin = {-62, 54}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.Sine sineLow(amplitude = 10, freqHz = 3) annotation(
Placement(visible = true, transformation(origin = {-56, 2}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Math.Add add annotation(
Placement(visible = true, transformation(origin = {-8, 28}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(add.u1, sineHigh.y) annotation(
Line(points = {{-20, 34}, {-20, 55}, {-51, 55}, {-51, 54}}, color = {0, 0, 127}));
connect(add.u2, sineLow.y) annotation(
Line(points = {{-20, 22}, {-33.5, 22}, {-33.5, 2}, {-45, 2}}, color = {0, 0, 127}));
connect(Butterworth.u, add.y) annotation(
Line(points = {{36, 28}, {3, 28}}, color = {0, 0, 127}));
annotation(
experiment(StopTime = 0.9),
Documentation(info = "<html>
<p>
This example demonstrates various options of the
Filter block.
A step input starts at 0.1 s with an offset of 0.1, in order to demonstrate
the initialization options. This step input drives 4 filter blocks that
have identical parameters, with the only exception of the used analog filter type
(CriticalDamping, Bessel, Butterworth, Chebyshev of type I). All the main options
can be set via parameters and are then applied to all the 4 filters.
The default setting uses low pass filters of order 3 with a cut-off frequency of
2 Hz resulting in the following outputs:
</p>
<img src=\"modelica://Modelica/Resources/Images/Blocks/Filter1.png\"
alt=\"Filter1.png\">
</html>"),
uses(Modelica(version = "3.2.2")));
end FilterTest;
The plot windows in Dymola feature some signal operators, which you can use for post processing. But they do not feature a smoothing function.
If you want to do it in Dymola, the easiest option is to continuously compute the averaged values during the simulation, like kabdelhak suggested.
An alternative would be to apply signal processing filters in Matlab or in Python on the .mat result file created by Dymola.
I personally find it easier to express the 'amount' of filtering in terms of a time constant than a cutoff frequency.
If you don't want to mind writing a couple of lines of code you could write the equation of a first-order filter to achieve something similar to the answer of kabdelhak, i.e.
model Preheater_Model_Validation
Modelica.SIunits.MassFlowRate m_flow_filtered;
parameter Modelica.SIunits.Time tau=120 "filter time constant" annotation(Evaluate=false);
... (other declarations)
initial equation
der(m_flow_filtered) = 0 "steady-state initialization";
equation
tau*der(m_flow_filtered) = hex.summary.m_flow_in - m_flow_filtered;
end Preheater_Model_Validation;
The Evaluate=false annotation in the code means that you can tweak the time constant in the 'Variable browser' in Dymola without re-translating the code.
Best regards
Rene Just Nielsen

Modeling of a heated pipe in Modelica/Dymola

I'm currently studying chemical engineering and for my Bachelor thesis, I'm supposed to model a heated pipe that can be used in a superheater by connecting two pipes via a heatport together. Even though I made a big effort on understanding how I code correctly in Modelica, my code is still not working and I'm getting pretty desperate.
So the model basically has to be applicable for both fluid water and overheated steam, so just one-phase flow in instationary conditions. Heat transfer is supposed to happen convectively. Also, I neglect pressure losses due to friction in this model.
Here´s my idea of how the model is supposed to work:
I'm pretty much trying to build a model like the one in the MSL, "Dynamic Pipe", just way more easier so that students who work on the same topic are able to understand my code quickly. So I splitted the pipe into a number of nodes n, the first volume being a inlet state, so basically that state does not really belong to the pipe. After that, the balance equations apply. I´m not quite sure about the momentum equations, so any help on them is highly appreciated. Convective heat transfer is defined by the Model "Convection" from the MSL, Thermal.HeatTransfer.Components.
When testing the model with a flow source, a boundary with fixed pressure and a fixed temperature at the wall, I also get the error "Failed to reduce the DAE index" and I have absolutely no idea what that means.
Also, here is my code:
model Pipe_base3
//Import
import Modelica.SIunits.*;
import Modelica.Constants.pi;
replaceable package Medium =
Modelica.Media.Interfaces.PartialTwoPhaseMedium annotation (choicesAllMatching = true);
parameter Integer n=2;
parameter Integer np=1;
// Geometry==================================================================//
parameter Diameter d_pipe = 0.05 "Inner diameter of pipe"
annotation (Dialog(tab="Geometry"));
parameter Length L = 1 "Length of unit"
annotation (Dialog(tab="Geometry"));
parameter Area A_hex = pi * d_pipe * L
"Shell surface of pipe for heat exchange" annotation (Dialog(tab="Geometry"));
parameter Area A_q = (pi/4)*d_pipe^2
annotation (Dialog(tab="Geometry"));
//Initialisation=============================================================//
parameter Medium.Temperature T_start = 403.15 annotation (Dialog(tab="Initialization"));
parameter Medium.SpecificEnthalpy h_start = Medium.specificEnthalpy_pT(p_start, T_start) annotation (Dialog(tab="Initialization"));
parameter AbsolutePressure p_start = Medium.saturationPressure(T_start) annotation (Dialog(tab="Initialization"));
parameter Medium.MassFlowRate m_flow_start = 0.5 annotation (Dialog(tab="Initialization"));
//Temperature, pressure, energy==============================================//
Medium.Temperature T[n+1]( each start=T_start, fixed=false);
Medium.SpecificEnthalpy h[n+1]( each start=h_start, fixed=false);
Medium.AbsolutePressure p[n+1](each start=p_start, fixed=false);
HeatFlowRate Q_flow[n](fixed = false);
Energy U[n](min=0);
Energy KE[n]; //Kinetic Energy
Medium.ThermodynamicState state[n+1];
// Nondimensional Variables + HeatTransfer===================================//
Medium.PrandtlNumber Pr[n](fixed=false);
ReynoldsNumber Re[n](fixed=false);
Real Xi[n];
NusseltNumber Nu[n];
CoefficientOfHeatTransfer alpha[n];
// Thermodynamic properties==================================================//
Medium.SpecificInternalEnergy u[n](fixed=false);
Medium.DynamicViscosity eta[n];
Density rho[n+1];
Medium.SpecificHeatCapacity cp[n];
Medium.ThermalConductivity lambda_fluid[n];
//Segmental properties
Mass ms[n]; //Mass per Segment
MassFlowRate m_flow[n+1]( each start=m_flow_start/np, fixed=false);
Velocity w[n+1](fixed=false);
// Momentum
Force F_p[n];
Momentum I[n];
Force Ib_flow[n];
parameter Boolean init = false;
Modelica.Fluid.Interfaces.FluidPort_a fluidin( redeclare package Medium = Medium, m_flow(start = m_flow_start, min = 0), p(start = p_start))
annotation (Placement(transformation(extent={{-90,-100},{-70,-80}}),
iconTransformation(extent={{-90,-100},{-70,-80}})));
Modelica.Fluid.Interfaces.FluidPort_b fluidout( redeclare package Medium = Medium, m_flow(start = -m_flow_start, max = 0), p(start = p_start), h_outflow(start=h_start))
annotation (Placement(transformation(extent={{70,-100},{90,-80}}),
iconTransformation(extent={{70,-100},{90,-80}})));
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a[n] heatport
annotation (Placement(transformation(extent={{-10,60},{10,80}}),
iconTransformation(extent={{-10,60},{10,80}})));
Modelica.Blocks.Interfaces.RealOutput[n] alpha_output annotation (Placement(
transformation(extent={{-100,38},{-140,78}}), iconTransformation(extent={{-100,
38},{-140,78}})));
protected
parameter Volume vn = (A_q * L) / n; //Volume per segment
parameter Real x[n] = linspace((L/n), L, n);
parameter Length length = L/n;
initial equation
for i in 1:(n+1) loop
//h[i] = Medium.specificEnthalpy_pTX(p_start, T_start, {1});
p[i] = p_start;
end for;
equation
//Port equations=============================================================//
fluidout.p = p[n];
//fluidin.p-fluidout.p=p[1]-p[n+1];
fluidout.h_outflow = h[n];
fluidout.m_flow = -m_flow[n+1];
//===========================================================================//
h[1]=inStream(fluidin.h_outflow);
p[1]=fluidin.p;
state[1]=Medium.setState_ph(p[1],h[1]);
T[1]=Medium.temperature(state[1]);
rho[1]=Medium.density(state[1]);
m_flow[1]=fluidin.m_flow/np;
m_flow[1]=A_q*rho[1]*w[1];
for i in 1:(n) loop
// Heatport equations======================================================//
T[i] = heatport[i].T;
Q_flow[i] = heatport[i].Q_flow;
// Momentum Balance =======================================================//
der(I[i]) = Ib_flow[i] - F_p[i];
I[i]=m_flow[i]*length;
Ib_flow[i] = (p[i+1]*w[i+1]*w[i+1] - p[i]*w[i]*w[i])*A_q*np;
F_p[i] = (A_q*p[i+1]-A_q*p[i]);
// Energy Balance=========================================================//
U[i] = ms[i] * u[i];
KE[i] = 0.5*ms[i]*w[i+1]*w[i+1];
der(U[i]+KE[i])=m_flow[i]*(h[i]+0.5*w[i]) - m_flow[i+1]*(h[i+1]+0.5*w[i+1]) + Q_flow[i];
der(rho[i+1])= -((rho[i+1]-rho[i])*w[i+1] + (w[i+1]-w[i])*rho[i+1]); //Konti
ms[i]=vn*rho[i+1];
T[i+1]=Medium.temperature(state[i+1]);
state[i+1] = Medium.setState_ph(p[i+1], h[i+1], 1); //Sets thermodynamic state from which other properties can be determined
u[i] = Medium.specificInternalEnergy(state[i+1]);
cp[i] = Medium.specificHeatCapacityCp(state[i+1]);
rho[i+1] = Medium.density(state[i+1]);
eta[i] = Medium.dynamicViscosity(state[i+1]);
lambda_fluid[i] = Medium.thermalConductivity(state[i+1]);
Re[i] * eta[i] = (rho[i+1] * abs(w[i+1]) * d_pipe);
Pr[i] *lambda_fluid[i] = (eta[i] * cp[i]);
Xi[i] = (1.8 * log10(abs(Re[i])+1) - 1.5)^(-2);
Nu[i] = ((Xi[i]/8)*Re[i]*Pr[i])/(1+12.7*sqrt(Xi[i]/8)*((Pr[i])^(2/3)-1))*(1+(1/3)*(d_pipe/x[i])^(2/3));
Nu[i] = Modelica.Fluid.Pipes.BaseClasses.CharacteristicNumbers.NusseltNumber(alpha[i], d_pipe, lambda_fluid[i]);
alpha_output[i] = alpha[i] * (A_hex/n);
m_flow[i+1] = A_q * w[i+1] * rho[i+1];
// der(p[i]) = - w[i]*der(w[i]) * rho[i];
// 0 = m_flow[i-1] - m_flow[i];
// der(rho[i]) = -((rho[i]-rho[i-1])*w[i] + (v[i]-v[i-1])*rho[i]);
//m_flow[i] = A_q * w[i] * rho[i]; //Calculation of flow velocity
//ms[i] = vn * rho[i]; //Mass per segment
//Calculation of thermodynamic properties for each segment=================//
//Heat Transfer============================================================//
end for;
fluidin.h_outflow = h[1]; //
annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},
{100,100}}), graphics={Line(
points={{-80,-80},{-80,94},{-80,100},{0,20},{80,100},{80,-80}},
color={0,0,255},
smooth=Smooth.None), Line(
points={{-60,-60},{-60,-48},{-60,0},{60,0},{60,-60},{48,-40},{72,-40},
{60,-60}},
color={0,0,255},
smooth=Smooth.None)}), __Dymola_selections);
end Pipe_base3;
Thank you so much in advance!
I was in the same situation when I started using Modelica: I wanted the features of Modelica.Fluid.Pipes.DynamicPipe but with less complexity (I wanted the code to be more readable and less hierarchical). So, like you, I started building my own pipe model from scratch. However, because I wanted to be able to replace the pressure drop and heat transfer correlations and have great flexibility I ended up with a model of nearly the same complexity as Modelica.Fluid.Pipes.DynamicPipe.
My recommendation to you is to
build your own simple dynamic pipe model without any complex
features. This will only be usable for educational purposes (e.g.
letting other students understand your coding principles)
learn how to use Modelica.Fluid.Pipes.DynamicPipe for problems where you need vary model complexity (number of segment, replaceable pressure drop and heat transfer methods etc.). Modelica.Fluid.Examples.HeatExchanger is an example of how you can use Modelica.Fluid.Pipes.DynamicPipe to model a heat exchanger like the one you request.
Here I've shared an example of a very simple dynamic pipe that can be used as a heat exchanger. The pipe is made from n pipe segments and takes advantage of the fact that you can instantiate an array of components and connect the elements in a for loop.
As for the momentum balance, the correct/complete way is to account for the change in momentum by summing all the forces acting on each control volume (Newton's Second law). However, in most lumped models a steady-state momentum balance is adequate which reduces the equation to a linear or quadratic relation between mass flow rate and pressure drop. Modelica.Fluid.Pipes.DynamicPipe has a number of different presssure/flow correlations to choose from.
Best regards,
Rene Just Nielsen
I have built a small example/test that uses your model. It should be a very simple application of your model. Unfortunately I get the same error message:
Cannot find differentiation function:
Modelica.Media.Water.IF97_Utilities.waterBaseProp_ph(boundary1.p, pipe_base3_1.h[2], 0, 1)
with respect to time
Index reduction basically means that the model contains equations that have no unknown. This is solved by differentiation of these equations with respect to time (which can happen multiple times). For more information you can check
https://www.inf.ethz.ch/personal/cellier/Lect/NSDS/Ppt/nsds_ppt_engl.html
especially lecture 16 and probably the ones before it :)
Therefore the Modelica tool will have to know how to do this differentiation. For equations this is usually done automatically, but for functions it has to be specified by the developer. It seems this is not done for Modelica.Media.Water.IF97_Utilities.waterBaseProp_ph()
which is why you get the error message.
There are basically two possibilities to solve this problem:
You change your model to get rid of or revise the constraint equation (the one which has no unknown). It should be the one shown in the error message: der(pipe_base3_1.rho[2]) = ...
You add the function for differentiation to the medium (I'm not much into the Fluid/Media so I have no idea how complicated that is, so I would try to go with 1. first). How this can be done is shown in https://modelica.org/documents/ModelicaSpec33Revision1.pdf section 12.7
Here is the code of the example:
model PipeTest
Pipe_base3 pipe_base3_1(redeclare package Medium = Modelica.Media.Water.WaterIF97_R1pT)
annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
Modelica.Fluid.Sources.FixedBoundary boundary(
nPorts=1,
p=100000,
redeclare package Medium = Modelica.Media.Water.WaterIF97_R1pT)
annotation (Placement(transformation(extent={{-60,-40},{-40,-20}})));
Modelica.Fluid.Sources.FixedBoundary boundary1(
nPorts=1,
p=100000,
redeclare package Medium = Modelica.Media.Water.WaterIF97_R1pT)
annotation (Placement(transformation(extent={{60,-40},{40,-20}})));
Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow fixedHeatFlow[2](Q_flow={0,0})
annotation (Placement(transformation(extent={{-40,20},{-20,40}})));
equation
connect(boundary.ports[1], pipe_base3_1.fluidin) annotation (Line(points={{-40,-30},{-8,-30},{-8,-9}}, color={0,127,255}));
connect(boundary1.ports[1], pipe_base3_1.fluidout) annotation (Line(points={{40,-30},{8,-30},{8,-9}}, color={0,127,255}));
connect(fixedHeatFlow.port, pipe_base3_1.heatport) annotation (Line(points={{-20,30},{0,30},{0,7}}, color={191,0,0}));
annotation (
Icon(coordinateSystem(preserveAspectRatio=false)),
Diagram(coordinateSystem(preserveAspectRatio=false)),
uses(Modelica(version="3.2.2")));
end PipeTest;
Hope this helps...