1

I got PID controller, I want to add a block so that the PID output signal would keep steady and unchanged at some timepoint, and after 100 seconds, the PID output signal would begin to work normally again. Is there a block component like this in MSL?

Jonas
  • 121,568
  • 97
  • 310
  • 388
Jack
  • 1,094
  • 6
  • 16

2 Answers2

4

Not in MSL. As far as I recall, only the integrator block has a reset/tracking option.

If you use a PID from 'Modelica Buildings Library' or from the 'Industrial Control Systems' library it has a Boolean and an analogue tracking/reset input. Connect the analogue input to the controller output and the output will 'pause' when the Bolan input is 'true'

Rene Just Nielsen
  • 3,023
  • 12
  • 15
2

You can can sample and hold the output. For example, here I used a sine wave in place of the PID, and a timetable to indicate when to hold and when to use that output:

model Hold_test
  Modelica.Blocks.Discrete.TriggeredSampler triggeredSampler annotation(
    Placement(visible = true, transformation(origin = {2, 8}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Sources.Sine PIDPlaceholder(f = 0.01, phase = 0.5235987755982988)  annotation(
    Placement(visible = true, transformation(origin = {-74, 6}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Logical.Switch switch1 annotation(
    Placement(visible = true, transformation(origin = {8, 58}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Sources.TimeTable timeTable(table = [0, 0; 50, 0; 51, 1; 150, 1; 151, 0; 200, 0])  annotation(
    Placement(visible = true, transformation(origin = {-70, -82}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Logical.LessThreshold lessThreshold(threshold = 1)  annotation(
    Placement(visible = true, transformation(origin = {-24, -80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Logical.Not not1 annotation(
    Placement(visible = true, transformation(origin = {26, -78}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(timeTable.y, lessThreshold.u) annotation(
    Line(points = {{-58, -82}, {-47, -82}, {-47, -80}, {-36, -80}}, color = {0, 0, 127}));
  connect(lessThreshold.y, not1.u) annotation(
    Line(points = {{-12, -80}, {12, -80}, {12, -78}, {14, -78}}, color = {255, 0, 255}));
  connect(not1.y, triggeredSampler.trigger) annotation(
    Line(points = {{38, -78}, {48, -78}, {48, -24}, {2, -24}, {2, -4}, {2, -4}, {2, -4}}, color = {255, 0, 255}));
  connect(lessThreshold.y, switch1.u2) annotation(
    Line(points = {{-12, -80}, {-6, -80}, {-6, -30}, {-34, -30}, {-34, 58}, {-4, 58}, {-4, 58}, {-4, 58}}, color = {255, 0, 255}));
  connect(PIDPlaceholder.y, triggeredSampler.u) annotation(
    Line(points = {{-62, 6}, {-10, 6}, {-10, 8}, {-10, 8}}, color = {0, 0, 127}));
  connect(triggeredSampler.y, switch1.u3) annotation(
    Line(points = {{14, 8}, {28, 8}, {28, 38}, {-18, 38}, {-18, 50}, {-4, 50}, {-4, 50}}, color = {0, 0, 127}));
  connect(PIDPlaceholder.y, switch1.u1) annotation(
    Line(points = {{-62, 6}, {-48, 6}, {-48, 66}, {-4, 66}, {-4, 66}}, color = {0, 0, 127}));

annotation(
    uses(Modelica(version = "4.0.0")),
    experiment(StartTime = 0, StopTime = 200, Tolerance = 1e-6, Interval = 0.4));
end Hold_test;
Adam
  • 742
  • 1
  • 6
  • 23
  • If the controller uses integral action I will not recommend that you just sample and hold the output as this will cause integral windup. – Rene Just Nielsen Jul 22 '20 at 21:03