Message Boards Message Boards

3
|
16058 Views
|
3 Replies
|
5 Total Likes
View groups...
Share
Share this post:

SystemModeler Failed to reduce the DAE index. What do I do now?

Posted 11 years ago
I'm trying out the features of systemmodeler so I thought I would try to model a system a lot of people (especially in the UK) are familar with, a central heating system.   The concept is simple:  a heat source (gas flame etc.) transfers heat to water which circulates through the syetem and transfers the heat back out to air in the various rooms using radiators.  The heat flow into each room is controlled by a valve on the radiator which limits the flow, this may be thermostatically controlled.

Walking before I can run...
I experimented with the FluidHeatFlow heatedpipe element and eventually got to the point where I had a closed loop running where heat was transferred into one pipe and out of the other one by water flowing round the loop due to a "pump" which was a fixed pressure increase.  This works fine and seems to do what I would expect.

Adding some control...
I added a valve into the water loop and set it to a fixed amount open, it controlled the amount of heat transferred as expected.

Adding more control...
I added a very simple feedback where the valve opening was controlled by the difference between the radiator temperature and a fixed value.  It is at this point where the model refused to build with an error " Failed to reduce the DAE index".

I am assuming (but hoping it is not the case) that SystemModeler is not sophisticated enough to build models of this complexity (heat flow controlled by varying water flow). It seems to be trying to simplify the model beyond the level it can achieve rather than applying a numerical solver to it.   Am I missing something fundamental?  I have torn down and rebuilt this model several times and used different feedback methods but they all fail to build when feedback is closed. (I have run the model successfully with the feedback loop broken).  



Link to model (in dropbox):  here
3 Replies
So now I have a solution!  And it was simpler than I thought.  Thats what you get for learning a new tool, frustration followed by enlightenment.

I should have read the log more carefully.  before the error message comes a warning that an equation cannot be differentiated.  It's the relationship between the "radiator" (lossy pipe) and the thermal capacitor which is connected to it.  On reflection this is always going to be tricky as there is no built in resistance to heat conduction within the pipe.  I can see why this will create a potential for step changes especially during initialisation which might be tricky.

The solution is to put a thermal conductor between the pipe and the thermal capacitor then everything is fine.  

Thanks again to Johan for giving me hope and setting me on the path to tinkering which eventually revealed a solution.
Johan,
   Thanks for your response. (I forgot to mention I am using SystemModeler version 3.0.2 ) : 

By "typical package structure"  I assume you mean the hierarchy used in the example you link to.   I started with that type of structure assuming modelling would be easy having watched the tutorial in your link  You may have seen the unused Boiler and Radiator components in my model?  I reverted to a test bed because I realised there was a lot to know about building a successful model which you don't pick up from the tutorials and can't find in the documentation so I needed to experiment in baby steps.  And as this seems to be a system problem rather than a component problem I fould it easier to add, remove and move components to test the effect if the model was flat.

   I have successfully run your modification to the model emoticon however it does not  do what I was hoping for emoticon .  The radiator temperature is not controlled by the loop (even after spotting that the set point of 250C in the loop was never going to cause the vavle to close). A constant flow rate element is less like a real pump than a constant pressure change; It does not stall, no matter what valve setting you have the same flow rate and the energy transfer from boiler to radiator remains the same.  The replacement of the costant pressure with a constant flow element has the same effect as disconnecting the temperature feedback loop.  

Note: I found the valve has to have a residual flow even when completely closed otherwise there is a divide by zero error in the model.  When the valve is closed all that happens is the pressure increase across the constant flow element becomes incredibly high to maintain the flow rate.  With the high pressure end tied to an ambient pressure the low pressure side actually becomes a "hyper vacuum" with a negative absolute pressure - the simulation does not seem to care that this is a physical impossibility.  

  All is not lost - a real heating system will have a pressure bypass (real pumps don't like to pump against closed valves) so I took your model and added an extra pipe between the output of the constant flow and the input of the boiler heat exchanger.  The flow will then balance out between the two paths depending on the back pressure in each.  Good theory as this now makes the temperature control loop effective again.   No good in practice because I am back with the "Failed to reduce the DAE index" error again!

   I don't understand the steps which take a model to simulation but gut feel is systemmodeler is trying to solve mathematically a system which has no general solution and what it should be doing is solving it numerically but for some reason the logic that says don't solve this at compile time is not triggering (or maybe systemmodeler can't do that?)

  What I think I am looking for is a directive or flag I can embed in the code which says to the model simplification engine - "Beware this is a multidomain model which is too complex to simplify and needs to be solved numerically at run time".  Or some clever restructuring such as you proposed.  I could work through the mathematics and come up with a single block definition that at least approxximates what happens round the water loop but I'd like to see systemmodeler do the work for me.

Thanks once again.  Still looking for advice.

 
Posted 11 years ago
Hi Nick,

I didn't get your system to work by disconnecting the control loop and connecting the constant to the valve.

I restructured your model slightly, and instead of using a constant pressure I use an ambient with constant properties.

And the model code:
 model HouseCH_V2r0
   parameter Modelica.SIunits.Temperature TAmb=293 "Ambient Temperature";
   parameter Modelica.Thermal.FluidHeatFlow.Media.Medium Water=Modelica.Thermal.FluidHeatFlow.Media.Water() "Cooling medium";
   Modelica.Thermal.FluidHeatFlow.Components.HeatedPipe radiator1(dpLaminar=1000, dpNominal=10000, V_flowLaminar=0.0001, V_flowNominal=0.0003, m=1, T0=TAmb, h_g=0, medium=Water) annotation(Placement(visible=true, transformation(origin={40,20}, extent={{-10,10},{10,-10}}, rotation=270)));
   Modelica.Thermal.FluidHeatFlow.Components.HeatedPipe boiler1(dpLaminar=1000, dpNominal=10000, m=1, h_g=0, V_flowLaminar=0.0001, V_flowNominal=0.0003, T0=TAmb, medium=Water) annotation(Placement(visible=true, transformation(origin={-60,20}, extent={{10,-10},{-10,10}}, rotation=270)));
   Modelica.Thermal.HeatTransfer.Components.ThermalConductor thermalConductor1(G=10) annotation(Placement(visible=true, transformation(origin={-90.0,20.0}, extent={{-10.0,-10.0},{10.0,10.0}}, rotation=0)));
   Modelica.Thermal.HeatTransfer.Components.ThermalConductor thermalConductor2(G=20) annotation(Placement(visible=true, transformation(origin={70.0,20.0}, extent={{10.0,-10.0},{-10.0,10.0}}, rotation=0)));
   Modelica.Thermal.HeatTransfer.Celsius.FixedTemperature fixedTemperature1(T=120) annotation(Placement(visible=true, transformation(origin={-125.0,20.0}, extent={{-10.0,-10.0},{10.0,10.0}}, rotation=0)));
   Modelica.Thermal.HeatTransfer.Celsius.FixedTemperature fixedTemperature2(T=5) annotation(Placement(visible=true, transformation(origin={110.0,20.0}, extent={{-10.0,-10.0},{10.0,10.0}}, rotation=-540)));
  Modelica.Thermal.HeatTransfer.Components.HeatCapacitor heatCapacitor1(C=10000) annotation(Placement(visible=true, transformation(origin={36.7477,80.0}, extent={{-10.0,-10.0},{10.0,10.0}}, rotation=0)));
  Modelica.Thermal.HeatTransfer.Celsius.TemperatureSensor BoilerTemp annotation(Placement(visible=true, transformation(origin={-61.5702,65.0}, extent={{-10.0,-10.0},{10.0,10.0}}, rotation=0)));
  Modelica.Thermal.HeatTransfer.Celsius.TemperatureSensor RadTemp annotation(Placement(visible=true, transformation(origin={70.0,-10.0}, extent={{-10.0,-10.0},{10.0,10.0}}, rotation=0)));
  Modelica.Thermal.FluidHeatFlow.Components.Valve valve1(frictionLoss=0, kv0=0, Kv1=0.001, y1=1, T0=TAmb, rho0=996, medium=Water, m=0.1, LinearCharacteristic=true, dp0=100) annotation(Placement(visible=true, transformation(origin={-10.0,0.0}, extent={{-10.0,-10.0},{10.0,10.0}}, rotation=-540)));
  Modelica.Blocks.Sources.Constant const1(k=250) annotation(Placement(visible=true, transformation(origin={-25,-107.5}, extent={{-7.5,-7.5},{7.5,7.5}}, rotation=0)));
  Modelica.Thermal.FluidHeatFlow.Sources.VolumeFlow volumeFlow(m=1, T0=293, constantVolumeFlow=0.3, medium=Water) annotation(Placement(visible=true, transformation(origin={-10,40}, extent={{-10,-10},{10,10}}, rotation=0)));
  Modelica.Thermal.FluidHeatFlow.Sources.Ambient ambient(constantAmbientPressure=1000, constantAmbientTemperature=250, medium=Water) annotation(Placement(visible=true, transformation(origin={0,120}, extent={{-10,-10},{10,10}}, rotation=0)));
  Modelica.Blocks.Continuous.LimPID PID(yMax=1, yMin=0.0001, Ti=0.1, Td=0.1, wd=1) annotation(Placement(visible=true, transformation(origin={-10,-45}, extent={{-10,-10},{10,10}}, rotation=90)));
equation
  connect(RadTemp.T,PID.u_m) annotation(Line(visible=true, origin={62,-27.5}, points={{18,17.5},{21,17.5},{21,-17.5},{-60,-17.5}}, color={0,0,127}));
  connect(PID.u_s,const1.y) annotation(Line(visible=true, origin={-12.25,-90.667}, points={{2.25,33.667},{2.25,-16.833},{-4.5,-16.833}}, color={0,0,127}));
  connect(PID.y,valve1.y) annotation(Line(visible=true, origin={-10,-21.5}, points={{0,-12.5},{0,12.5}}, color={0,0,127}));
  connect(ambient.flowPort,radiator1.flowPort_a) annotation(Line(visible=true, origin={1.8,94.2}, points={{-11.8,25.8},{-21.8,25.8},{-21.8,-34.2},{38.2,-34.2},{38.2,-64.2}}, color={255,0,0}));
  connect(volumeFlow.flowPort_b,radiator1.flowPort_a) annotation(Line(visible=true, origin={26.667,36.667}, points={{-26.667,3.333},{13.333,3.333},{13.333,-6.667}}, color={255,0,0}));
  connect(volumeFlow.flowPort_a,boiler1.flowPort_b) annotation(Line(visible=true, origin={-46.667,36.667}, points={{26.667,3.333},{-13.333,3.333},{-13.333,-6.667}}, color={255,0,0}));
  connect(thermalConductor1.port_b,BoilerTemp.port) annotation(Line(visible=true, origin={-75.1777,42.5}, points={{-4.8223,-22.5},{0.6074,-22.5},{0.6074,22.5},{3.6074,22.5}}, color={191,0,0}));
  connect(radiator1.heatPort,RadTemp.port) annotation(Line(visible=true, origin={56,2.5}, points={{-6,17.5},{1,12.5},{1,-12.5},{4,-12.5}}, color={191,0,0}));
  connect(valve1.flowPort_a,radiator1.flowPort_b) annotation(Line(visible=true, origin={26.667,3.333}, points={{-26.667,-3.333},{13.333,-3.333},{13.333,6.667}}, color={255,0,0}));
  connect(radiator1.heatPort,heatCapacitor1.port) annotation(Line(visible=true, origin={45.899,48.8}, points={{4.101,-28.8},{7.101,-28.8},{7.101,18.2},{-9.151,18.2},{-9.151,21.2}}, color={191,0,0}));
  connect(radiator1.heatPort,thermalConductor2.port_b) annotation(Line(visible=true, origin={55,20}, points={{-5,0},{5,0}}, color={191,0,0}));
  connect(valve1.flowPort_b,boiler1.flowPort_a) annotation(Line(visible=true, origin={-46.667,3.333}, points={{26.667,-3.333},{-13.333,-3.333},{-13.333,6.667}}, color={255,0,0}));
  connect(thermalConductor1.port_b,boiler1.heatPort) annotation(Line(visible=true, origin={-75,20}, points={{-5,0},{5,0}}, color={191,0,0}));
  connect(fixedTemperature2.port,thermalConductor2.port_a) annotation(Line(visible=true, origin={90.0,20.0}, points={{10.0,0.0},{-10.0,0.0}}, color={191,0,0}));
  connect(fixedTemperature1.port,thermalConductor1.port_a) annotation(Line(visible=true, origin={-107.5,20.0}, points={{-7.5,0.0},{7.5,0.0}}, color={191,0,0}));
  annotation(__Wolfram(totalModelMain=true, totalModelId="8f2f9f71-0467-463a-a9cf-26d163f29057"), experiment(StopTime=10), Icon(coordinateSystem(extent={{-100.0,-100.0},{100.0,100.0}}, preserveAspectRatio=true, initialScale=0.1, grid={10,10}), graphics), Diagram(coordinateSystem(extent={{-210.0,-148.5},{210.0,148.5}}, preserveAspectRatio=true, initialScale=0.1, grid={5,5})));
end HouseCH_V2r0;

In general I like to see examples which have a typical package structure, for a guide to this see this short tutorial/course: http://www.wolfram.com/training/courses/eng031.html
POSTED BY: Johan Rhodin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract