StategraphSample.mo 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. model StategraphSample
  2. Modelica.Blocks.Interfaces.RealInput u annotation(
  3. Placement(visible = true, transformation(origin = {-100, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-58, 46}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
  4. Modelica.StateGraph.InitialStepWithSignal s1 annotation(
  5. Placement(visible = true, transformation(origin = {-22, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  6. Modelica.StateGraph.Transition t1(condition = u > 0.5, waitTime = 0) annotation(
  7. Placement(visible = true, transformation(origin = {4, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  8. Modelica.StateGraph.Transition t2(enableTimer = true, waitTime = 1) annotation(
  9. Placement(visible = true, transformation(origin = {0, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
  10. inner Modelica.StateGraph.StateGraphRoot stateGraphRoot annotation(
  11. Placement(visible = true, transformation(origin = {-66, 64}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  12. Modelica.Blocks.Logical.Switch switch1 annotation(
  13. Placement(visible = true, transformation(origin = {-22, -40}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  14. Modelica.Blocks.Sources.RealExpression realExpression1(y = 0.0) annotation(
  15. Placement(visible = true, transformation(origin = {14, -24}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
  16. Modelica.Blocks.Sources.RealExpression realExpression2(y = 1) annotation(
  17. Placement(visible = true, transformation(origin = {-54, -24}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  18. Modelica.Blocks.Interfaces.RealOutput y annotation(
  19. Placement(visible = true, transformation(origin = {50, -48}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {56, -30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  20. Modelica.StateGraph.Step step1 annotation(
  21. Placement(visible = true, transformation(origin = {32, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  22. equation
  23. connect(step1.outPort[1], t2.inPort) annotation(
  24. Line(points = {{42, 0}, {48, 0}, {48, 40}, {4, 40}, {4, 40}}));
  25. connect(t1.outPort, step1.inPort[1]) annotation(
  26. Line(points = {{6, 0}, {20, 0}, {20, 0}, {20, 0}}));
  27. connect(switch1.y, y) annotation(
  28. Line(points = {{-22, -52}, {-22, -52}, {-22, -48}, {50, -48}, {50, -48}}, color = {0, 0, 127}));
  29. connect(s1.active, switch1.u2) annotation(
  30. Line(points = {{-22, -12}, {-22, -12}, {-22, -28}, {-22, -28}}, color = {255, 0, 255}));
  31. connect(realExpression1.y, switch1.u1) annotation(
  32. Line(points = {{2, -24}, {-14, -24}, {-14, -28}, {-14, -28}}, color = {0, 0, 127}));
  33. connect(realExpression2.y, switch1.u3) annotation(
  34. Line(points = {{-42, -24}, {-30, -24}, {-30, -28}, {-30, -28}}, color = {0, 0, 127}));
  35. connect(s1.outPort[1], t1.inPort) annotation(
  36. Line(points = {{-12, 0}, {0, 0}, {0, 0}, {0, 0}}));
  37. connect(t2.outPort, s1.inPort[1]) annotation(
  38. Line(points = {{-2, 40}, {-60, 40}, {-60, 0}, {-34, 0}, {-34, 0}}));
  39. annotation(
  40. uses(Modelica(version = "3.2.2")));
  41. end StategraphSample;