Opened 12 years ago

Closed 11 years ago

#2098 closed defect (fixed)

MAT v. CSV output providing different simulation results

Reported by: klenk@… Owned by: Martin Sjölund
Priority: normal Milestone: 1.9.1
Component: Run-time Version: trunk
Keywords: Cc:

Description (last modified by Martin Sjölund)

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 by Martin Sjölund, 12 years ago

Component: BackendRun-time
Owner: changed from probably noone to Lennart Ochel
Status: newassigned

comment:2 by Martin Sjölund, 11 years ago

Description: modified (diff)

comment:3 by Martin Sjölund, 11 years ago

Milestone: 1.9.01.9.1

Postponed until 1.9.1

comment:4 by Martin Sjölund, 11 years ago

Owner: changed from Lennart Ochel to Martin Sjölund

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

comment:5 by Martin Sjölund, 11 years ago

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

comment:6 by Martin Sjölund, 11 years ago

Resolution: fixed
Status: assignedclosed

Fixed in r18480.

Note: See TracTickets for help on using tickets.