Opened 11 years ago

Closed 10 years ago

#2098 closed defect (fixed)

MAT v. CSV output providing different simulation results

Reported by: klenk@… Owned by: sjoelund.se
Priority: normal Milestone: 1.9.1
Component: Run-time Version: trunk
Keywords: Cc:

Description (last modified by sjoelund.se)

In the following model, I am getting different simulation results depending on the output format (MAT v. CSV). The problematic variable is fixed1.flange.phi. If you simulate with a csv output and plot this variable you get a broken sine wave. If you simulate with a mat output, you get the correct result fixed1.flange.phi=0.

model SimpleController
  Modelica.Blocks.Continuous.LimPID PID(k = 1, Ti = 0.1, yMax = 12, Ni = 0.1, limitsAtInit = false, controllerType = Modelica.Blocks.Types.SimpleController.PI, Td = 0.1) annotation(Placement(visible = true, transformation(origin = {-19.2366,32.3664}, extent = {{-12,-12},{12,12}}, rotation = 0)));
  Modelica.Blocks.Sources.Constant const annotation(Placement(visible = true, transformation(origin = {-74.8092,32.9771}, extent = {{-12,-12},{12,12}}, rotation = 0)));
  Modelica.Mechanics.Rotational.Components.Damper damper1(d = 1, d.fixed = true) annotation(Placement(visible = true, transformation(origin = {35.1145,-21.9847}, extent = {{-12,-12},{12,12}}, rotation = 0)));
  Modelica.Mechanics.Rotational.Components.Fixed fixed1(phi0 = 0, phi0.fixed = true) annotation(Placement(visible = true, transformation(origin = {76.3359,-41.8321}, extent = {{-12,-12},{12,12}}, rotation = 0)));
  Modelica.Mechanics.Rotational.Components.Inertia inertia1 annotation(Placement(visible = true, transformation(origin = {-10.9924,-21.0687}, extent = {{-12,-12},{12,12}}, rotation = 0)));
  Modelica.Mechanics.Rotational.Sources.Torque torque1 annotation(Placement(visible = true, transformation(origin = {-59.542,-20.7634}, extent = {{-12,-12},{12,12}}, rotation = 0)));
  annotation(experiment(StartTime = 0.0, StopTime = 5.0, Tolerance = 0.000001));
  Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedsensor1 annotation(Placement(visible = true, transformation(origin = {18.3206,4.58015}, extent = {{12,-12},{-12,12}}, rotation = -270)));
equation
  connect(speedsensor1.w,PID.u_m) annotation(Line(points = {{18.3206,17.7802},{-19.8473,17.7802},{-19.8473,17.9664},{-19.2366,17.9664}}));
  connect(damper1.flange_a,speedsensor1.flange) annotation(Line(points = {{23.1145,-21.9847},{18.0153,-21.9847},{18.0153,-7.41985},{18.3206,-7.41985}}));
  connect(PID.y,torque1.tau) annotation(Line(points = {{-6.03664,32.3664},{-0.305344,32.3664},{-0.305344,0.916031},{-88.5496,0.916031},{-88.5496,-20.458},{-73.942,-20.458},{-73.942,-20.7634}}));
  connect(torque1.flange,inertia1.flange_a) annotation(Line(points = {{-47.542,-20.7634},{-23.2061,-20.7634},{-23.2061,-21.0687},{-22.9924,-21.0687}}));
  connect(damper1.flange_a,inertia1.flange_b) annotation(Line(points = {{23.1145,-21.9847},{2.74809,-21.9847},{2.74809,-21.0687},{1.00763,-21.0687}}));
  connect(damper1.flange_b,fixed1.flange) annotation(Line(points = {{47.1145,-21.9847},{76.3359,-21.9847},{76.3359,-41.8321},{76.3359,-41.8321}}));
  connect(const.y,PID.u_s) annotation(Line(points = {{-61.6092,32.9771},{-34.8092,32.9771},{-34.8092,32.3664},{-33.6366,32.3664}}));
end SimpleController;

Change History (6)

comment:1 Changed 11 years ago by sjoelund.se

  • Component changed from Backend to Run-time
  • Owner changed from probably noone to lochel
  • Status changed from new to assigned

comment:2 Changed 11 years ago by sjoelund.se

  • Description modified (diff)

comment:3 Changed 11 years ago by sjoelund.se

  • Milestone changed from 1.9.0 to 1.9.1

Postponed until 1.9.1

comment:4 Changed 10 years ago by sjoelund.se

  • Owner changed from lochel to sjoelund.se

The problem is it is an alias of parameter and using the time-variant array for indexing.

comment:5 Changed 10 years ago by sjoelund.se

Oh, and the OpenModelica csv format does not output parameters, so the variable should not be part of the results.

comment:6 Changed 10 years ago by sjoelund.se

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed in r18480.

Note: See TracTickets for help on using tickets.