Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Another try : Failed to deduce dimension 1 of conc due to missing bind

Another try : Failed to deduce dimension 1 of conc due to missing bind

I try to connect a component with know parameters with one with variable dimension array : error message " Failed to deduce dimension 1 of conc due to missing bind"

The idea behind is that a connector could propagate all the data I need but failed.

package TestCharge2
  //
  type Conc = Real(final quantity = "Concentration", final unit = "mol/L", min = 0.0);
  //

  package Interfaces "Connectors to connect the Streams and Unit Operations"
    extends Modelica.Icons.InterfacesPackage;

    connector port_solution
      parameter Integer nbr_espece;
      Conc conc[nbr_espece];
      flow Real debit(unit = "L/h");
      annotation(
        Icon(coordinateSystem(initialScale = 0.1), graphics = {Rectangle(lineColor = {0, 70, 70}, fillColor = {0, 70, 70}, fillPattern = FillPattern.Solid, extent = {{-50, 50}, {50, -50}})}));
    end port_solution;

     connector port_in
      Conc conc[:] "Array";
      flow Real debit(unit = "L/h");
      annotation(
        Icon(coordinateSystem(initialScale = 0.1), graphics = {Rectangle(lineColor = {0, 70, 70}, fillColor = {0, 70, 70}, fillPattern = FillPattern.Solid, extent = {{-50, 50}, {50, -50}})}));
    end port_in;
  end Interfaces;

  //

  model Charge_aq_1 "Définitions des charges  "
    parameter Real Q = 1.;
    parameter Conc C1 = 0.5;
    parameter Conc C2 = 1.45;
    parameter Conc C3 = 3.;
   
    Interfaces.port_solution outlet_aq(nbr_espece = 3) annotation(
      Placement(visible = true, transformation(origin = {-110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-110, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
     
  equation
    outlet_aq.debit = - Q "Débit sortant >0";
//
    outlet_aq.conc[:] = {C1, C2, C3};
  end Charge_aq_1;

  model App
    Interfaces.port_in inlet_aq "Inlet" annotation(
      Placement(visible = true, transformation(origin = {-110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, 110}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
    Real C1;
  equation
    C1 = inlet_aq.conc[1];
  end App;

model Essai
  TestCharge2.Charge_aq_1 c1 annotation(
    Placement(visible = true, transformation(origin = {32, 32}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
App app annotation(
    Placement(visible = true, transformation(origin = {-22, 6}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(c1.outlet_aq, app.inlet_aq) annotation(
  Line(points = {{22, 32}, {-10, 32}, {-10, 18}}, color = {0, 70, 70}));

end Essai;
end TestCharge2;

Re: Another try : Failed to deduce dimension 1 of conc due to missing bind

JPG84 wrote:


The idea behind is that a connector could propagate all the data I need but failed.

It doesn't work like that, connections just create equations. The dimensions of an array needs to be specified directly or deduced from the arrays binding equation, it can't be deduced from a normal equation.

There are 0 guests and 0 other users also viewing this topic
You are here: