OpenModelica


Forgot password? | Forgot username? | Register

model RCseriesLinear

model RCseriesLinear

model RCseriesLinear
  "Series connection of several linear dependent resistance and capacitance combinations"
  extends BasicImpedance;
  parameter Modelica_EnergyStorages.CellRecords.Components.RCelement RC[:]
    "Transient response resistance and capacitance parameters";
  final parameter Integer num(min=1)=size(RC,1) "Number of serial RC elements";

  RClinear rclinear[num](final RC=RC)
     annotation (Placement(transformation(extent={{-20,-20},{20,20}},
                      rotation=0)));
  Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPort
    annotation (Placement(transformation(extent={{-10,90},{10,110}},
          rotation=0)));

  Modelica.Blocks.Interfaces.RealOutput Z  annotation (Placement(
        transformation(
        extent={{-10,-10},{10,10}},
        rotation=90,
        origin={60,110})));

  Modelica.Blocks.Math.Sum sum1(final nin=num) annotation (Placement(
        transformation(
        extent={{-10,-10},{10,10}},
        rotation=90,
        origin={60,70})));
equation

// real connection
for k in 1:num loop
   connect(rclinear[k].t, t) annotation (Line(
      points={{-12,-18},{-12,-40},{-60,-40},{-60,-90}},
      color={0,0,127},
      smooth=Smooth.None));
  connect(rclinear[k].SOC, SOC) annotation (Line(
      points={{0,-18},{0,-90}},
      color={0,0,127},
      smooth=Smooth.None));
  connect(rclinear[k].i, i) annotation (Line(
      points={{12,-18},{12,-40},{60,-40},{60,-90}},
      color={0,0,127},
      smooth=Smooth.None));
end for;

//serial connection
  connect(p, rclinear[1].p) annotation (Line(
      points={{-100,0},{-20,0}},
      color={0,0,255},
      smooth=Smooth.None));
  for k in 1:(num-1) loop
    connect(rclinear[k].n,rclinear[k+1].p);
  end for;
  connect(rclinear[num].n, n) annotation (Line(
      points={{20,0},{100,0}},
      color={0,0,255},
      smooth=Smooth.None));

//temp connection
  for k in 1:num loop
     connect(heatPort, rclinear[k].heatPort) annotation (Line(points={{0,100},{0,20}},
                     color={191,0,0}));
  end for;
  connect(sum1.y, Z) annotation (Line(
      points={{60,81},{60,110}},
      color={0,0,127},
      smooth=Smooth.None));
  connect(rclinear.Z, sum1.u) annotation (Line(
      points={{12,22},{12,40},{60,40},{60,58}},
      color={0,0,127},
      smooth=Smooth.None));

                                                                               annotation(Dialog(enable = num>0),
              Diagram(graphics),
                       Icon(graphics={
        Line(
          points={{-56,-8},{-56,-48}},
          color={0,0,255},
          thickness=0.5),
        Line(
          points={{-44,-8},{-44,-48}},
          color={0,0,255},
          thickness=0.5),
        Line(points={{-90,0},{-80,0}}),
        Rectangle(
          extent={{-70,40},{-30,20}},
          lineColor={0,0,255},
          fillColor={255,255,255},
          fillPattern=FillPattern.Solid),
        Line(points={{-56,-30},{-80,-30},{-80,30},{-70,30}}, color={0,0,
              255}),
        Line(points={{-44,-30},{-20,-30},{-20,30},{-30,30}}, color={0,0,
              255}),
        Line(
          points={{-20,0},{20,0}},
          color={0,0,255},
          pattern=LinePattern.Dot),
        Line(
          points={{44,-10},{44,-50}},
          color={0,0,255},
          pattern=LinePattern.Dot,
          thickness=0.5),
        Line(
          points={{56,-10},{56,-50}},
          color={0,0,255},
          pattern=LinePattern.Dot,
          thickness=0.5),
        Rectangle(
          extent={{30,40},{70,20}},
          lineColor={0,0,255},
          pattern=LinePattern.Dot,
          fillColor={255,255,255},
          fillPattern=FillPattern.Solid),
        Line(
          points={{44,-30},{20,-30},{20,30},{30,30}},
          color={0,0,255},
          pattern=LinePattern.Dot),
        Line(
          points={{56,-30},{80,-30},{80,30},{70,30}},
          color={0,0,255},
          pattern=LinePattern.Dot),
        Text(
          extent={{22,-12},{82,14}},
          lineColor={0,0,255},
          pattern=LinePattern.Dot,
          textString =                    "num"),
        Text(extent={{-80,-10},{-20,16}}, textString=
                                            "1"),
        Line(points={{-20,0},{0,0},{0,0},{0,0}}, color={0,0,255}),
        Line(points={{-50,40},{-50,68},{0,68},{0,90}}, color={188,0,0}),
        Line(
          points={{50,40},{50,68},{0,68},{0,88}},
          color={188,0,0},
          pattern=LinePattern.Dash),
        Text(
          extent={{20,96},{100,76}},
          lineColor={0,0,127},
          fillColor={122,255,107},
          fillPattern=FillPattern.Solid,
          textString="Z"),
        Text(
          extent={{-180,140},{-40,80}},
          lineColor={0,0,255},
          fillColor={122,255,107},
          fillPattern=FillPattern.Solid,
          textString=
               "%name")}));
end RCseriesLinear;

what is the error?
Check of Modelica_EnergyStorages.Batteries.Components.Impedances.RCseriesLinear:

Unspecified size for array of records RC; using default size for check. This must be specified before using the model.

Current version of the Modelica translator can only handle
array of components with fixed size.
But component rclinear had non-fixed array dimensions [num].
Modelica Text: line 8
All variables used in size expressions must be declared as constants or parameters.

Unspecified size for array of records rclinear; using default size for check. This must be specified before using the model.

Administrator has disabled public posting. Please login or register in order to proceed.
There are 0 guests and 0 other users also viewing this topic