- Index
- » Users
- » sbar
- » Profile
Posts
Posts
Page Start Prev 1 Next End
Hello!
I'm trying to generate a model that consist of a varying number of thermal resistances. I can create these by:
Code:
model testcase
parameter Integer n_res = 5;
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature fixedTemperature(T(displayUnit = "K") = 298.15) annotation(
Placement(visible = true, transformation(origin = {-76, 8}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow fixedHeatFlow(Q_flow = 1) annotation(
Placement(visible = true, transformation(origin = {60, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Thermal.HeatTransfer.Components.ThermalResistor thermalResistors[n_res](each R=10) annotation(
Placement(visible = true, transformation(origin = {-12, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
for i in 1:(n_res-1) loop
connect(thermalResistors[i].port_a, thermalResistors[i+1].port_b);
end for;
connect(thermalResistors[1].port_b, fixedTemperature.port);
connect(fixedHeatFlow.port, thermalResistors[n_res].port_b)
annotation(
uses(Modelica(version = "4.0.0")));
end testcase;
right now all of these have the same restitance R, that i specify with the "each" command.
I want every of these to have a different R, something like R={1,2,3,4,5}.
When i try to assign these in a for loop in the equation section I have more equations than variables and the model does not compile.
Can someone help me with that?
Thanks you in advance!
Sebastian
Page Start Prev 1 Next End
- Index
- » Users
- » sbar
- » Profile