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

Inner outer construction fails with new frontend.

Inner outer construction fails with new frontend.

I'm trying to make the output variable of an object declared within a class, available to the class to use it an output also. I'm using the outer and inner declarations.  What I did works with the old frontend but fails with the new frontend. I don't know what the frontend is, so I don't know whether this is a bug or just a change in the usage specification.

In the outermost class, whose name  is SpringPendulum, the variable readout  is declared as inner, and within the instance sensors1, it is declared as outer.   

With the old frontend, the variable readout appears as an output of SpringPendulum with the correct values. However, the new frontend gives the error below.

Thank you in advance for any advice.

Fabian

Code:


[1] 10:47:19 Symbolic Error
Too few equations, under-determined system. The model has 1437 equation(s) and 1443 variable(s).

[2] 10:47:19 Symbolic Warning
[Sensors: 3:3-4:198]: Variable sensors1.readout[6] does not have any remaining equation to be solved in.
  The original equations were:

[3] 10:47:19 Symbolic Warning
[Sensors: 3:3-4:198]: Variable sensors1.readout[5] does not have any remaining equation to be solved in.
  The original equations were:

[4] 10:47:19 Symbolic Warning
[Sensors: 3:3-4:198]: Variable sensors1.readout[4] does not have any remaining equation to be solved in.
  The original equations were:

[5] 10:47:19 Symbolic Warning
[Sensors: 3:3-4:198]: Variable sensors1.readout[3] does not have any remaining equation to be solved in.
  The original equations were:

[6] 10:47:19 Symbolic Warning
[Sensors: 3:3-4:198]: Variable sensors1.readout[2] does not have any remaining equation to be solved in.
  The original equations were:

[7] 10:47:19 Symbolic Warning
[Sensors: 3:3-4:198]: Variable sensors1.readout[1] does not have any remaining equation to be solved in.
  The original equations were:

Code:


model SpringPendulum
 
  inner Modelica.Blocks.Interfaces.RealOutput readout[6] ;
   
  inner Modelica.Mechanics.MultiBody.World world(label2 = "z", n = {0, 0, -1}) annotation(
    Placement(visible = true, transformation(origin = {-66, -20}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Mechanics.MultiBody.Forces.Spring spring1(c = 10) annotation(
    Placement(visible = true, transformation(origin = {20, -10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Mechanics.MultiBody.Parts.Body body1(m = 0.3, useQuaternions = true) annotation(
    Placement(visible = true, transformation(origin = {72, -12}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Mechanics.Translational.Sources.Position position1 annotation(
    Placement(visible = true, transformation(origin = {-38, 34}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Mechanics.MultiBody.Joints.Prismatic prismatic1(useAxisFlange = true) annotation(
    Placement(visible = true, transformation(origin = {-26, -10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Interfaces.RealInput gnd_in annotation(
    Placement(visible = true, transformation(origin = {-110, 46}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-110, 46}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
  Modelica.Mechanics.MultiBody.Joints.FreeMotionScalarInit freeMotionScalarInit1(r_rel_a_3(fixed = true, start = -0.2943), use_r = true) annotation(
    Placement(visible = true, transformation(origin = {12, -72}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Sensors sensors1 annotation(
    Placement(visible = true, transformation(origin = {83, 79}, extent = {{-11, -11}, {11, 11}}, rotation = 0))); 
  equation
  connect(spring1.frame_b, body1.frame_a) annotation(
    Line(points = {{30, -10}, {62, -10}, {62, -12}}));
  connect(prismatic1.frame_b, spring1.frame_a) annotation(
    Line(points = {{-16, -10}, {10, -10}}));
  connect(position1.flange, prismatic1.axis) annotation(
    Line(points = {{-28, 34}, {-18, 34}, {-18, -4}}, color = {0, 127, 0}));
  connect(world.frame_b, prismatic1.frame_a) annotation(
    Line(points = {{-56, -20}, {-52, -20}, {-52, -10}, {-36, -10}}));
  connect(gnd_in, position1.s_ref) annotation(
    Line(points = {{-110, 46}, {-70, 46}, {-70, 34}, {-50, 34}}, color = {0, 0, 127}));
  connect(freeMotionScalarInit1.frame_a, world.frame_b) annotation(
    Line(points = {{2, -72}, {-28, -72}, {-28, -20}, {-56, -20}}));
  connect(freeMotionScalarInit1.frame_b, body1.frame_a) annotation(
    Line(points = {{22, -72}, {54, -72}, {54, -12}, {62, -12}}, color = {95, 95, 95}));
  connect(body1.frame_a, sensors1.frame_a) annotation(
    Line(points = {{62, -12}, {44, -12}, {44, 79}, {73, 79}}, color = {95, 95, 95}));  protected
  annotation(
    uses(Modelica(version = "4.0.0")));
end SpringPendulum;

Code:


model Sensors 

  outer Modelica.Blocks.Interfaces.RealOutput readout[6] annotation(
    Placement(visible = true, transformation(origin = {-2, 0}, extent = {{10, -10}, {-10, 10}}, rotation = 0), iconTransformation(origin = {108, 6}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));


  Modelica.Mechanics.MultiBody.Interfaces.Frame_a frame_a annotation(
    Placement(visible = true, transformation(origin = {-98, 0}, extent = {{-16, -16}, {16, 16}}, rotation = 0), iconTransformation(origin = {-94, 0}, extent = {{-16, -16}, {16, 16}}, rotation = 0)));
  Modelica.Mechanics.MultiBody.Sensors.AbsolutePosition absolutePosition annotation(
    Placement(visible = true, transformation(origin = {-56, 18}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Mechanics.MultiBody.Sensors.AbsoluteAngles absoluteAngles annotation(
    Placement(visible = true, transformation(origin = {-55, -17}, extent = {{-11, -11}, {11, 11}}, rotation = 0)));


equation
  connect(frame_a, absolutePosition.frame_a) annotation(
    Line(points = {{-98, 0}, {-80, 0}, {-80, 18}, {-66, 18}}));
  connect(absoluteAngles.frame_a, frame_a) annotation(
    Line(points = {{-66, -17}, {-80, -17}, {-80, 0}, {-98, 0}}));
  connect(absolutePosition.r, readout[1:3]) annotation(
    Line(points = {{-44, 18}, {-2, 18}, {-2, 0}}, color = {0, 0, 127}, thickness = 0.5));
  connect(absoluteAngles.angles, readout[4:6]) annotation(
    Line(points = {{-42, -16}, {-2, -16}, {-2, 0}}, color = {0, 0, 127}, thickness = 0.5));
  annotation(
    uses(Modelica(version = "4.0.0")));
end Sensors;

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