- Index
- » Programming
- » Modelica Language
- » Breaking my head on singular problem
Breaking my head on singular problem
Breaking my head on singular problem
Hi, I'm new to Modelica and I am currently breaking my head on something that should be simple, I think.
I am trying to distribute an heat input into different receiver: 1 connector to receive and 2 to send the heat back.
First, I think my syntax could be widely improved so if you have something for me it would be nice.
Second, it doesn't work at all and I don't understand why, I have a singular problem and it says me I got too much equations.
Thank you very much if you can help me, I think it's quite simple (as I didn't do a complicated model), but I can't find the mistake!
Code:
model DispatchSmallScale
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_b port_b
annotation (Placement(transformation(extent={{-20,-18},{0,2}})));
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a port_a
annotation (Placement(transformation(extent={{-68,-6},{-48,14}})));
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_b port_b1
annotation (Placement(transformation(extent={{-20,12},{0,32}})));
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)));
equation
port_b.Q_flow=-0.5*port_a.Q_flow;
port_b1.Q_flow=-0.5*port_a.Q_flow;
port_a.T=100;
port_b.T=port_a.T;
port_b1.T=port_a.T;
end DispatchSmallScale;
When I try to simulate it, that's the error I get:
Translation of NewModel1D.DispatchSmallScale:
The problem is structurally singular.
The model NewModel1D.DispatchSmallScale is structurally singular.
The problem is structurally singular for the element type Real.
Part of the problem for Real elements is overdetermined.
There are 2 scalar equations too many in the set:
port_b1.Q_flow = (-0.5)*port_a.Q_flow;
which was derived from
port_b1.Q_flow = -0.5*port_a.Q_flow;
port_b1.Q_flow = 0.0;
port_a.Q_flow = 0.0;
port_b.Q_flow = (-0.5)*port_a.Q_flow;
which was derived from
port_b.Q_flow = -0.5*port_a.Q_flow;
port_b.Q_flow = 0.0;
WARNINGS have been issued.
ERRORS have been issued.
Re: Breaking my head on singular problem
You need to use connect-statements on connectors. If you manually set them equals, zero-flow equations will automatically be generated for unconnected components.
- sjoelund.se
- 1700 Posts
Re: Breaking my head on singular problem
Okay, thanks for your answer, but so if I connect them together there won't be any "distribution", I want half the energy for one and half for the other, but I'd like to do something more complicated than the half (like 0.3 - 0.7) on more connectors, do you think it's possible or that it would be better to do everything in one code?
Thanks
Re: Breaking my head on singular problem
I don't really know thermal modeling, but these are all physical connectors with potential and flow. So if you want to make the flow different to the different components, don't you simply add the equivalent of a resistor to do this? Then the temperature will naturally flow towards the least resistance.
- sjoelund.se
- 1700 Posts
- Index
- » Programming
- » Modelica Language
- » Breaking my head on singular problem