Skip to content

Commit

Permalink
Use imports consequently in Examples.DiscreteStateSpace
Browse files Browse the repository at this point in the history
  • Loading branch information
tobolar committed May 14, 2024
1 parent d81f4bd commit 5362fbe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ function analysisTimeResponse
extends Modelica.Icons.Function;

import Modelica_LinearSystems2.DiscreteStateSpace;
import Modelica_LinearSystems2.Utilities.Plot;

input Real u[:,2]=ones(300, 2);
protected
Expand All @@ -30,17 +31,11 @@ algorithm
t := 0:dss.Ts:(samples*dss.Ts - dss.Ts);
(y,x) := DiscreteStateSpace.timeResponse(dss, u, x0);

Modelica_LinearSystems2.Utilities.Plot.diagram(
Modelica_LinearSystems2.Utilities.Plot.Records.Diagram(
Plot.diagram(
Plot.Records.Diagram(
curve={
Modelica_LinearSystems2.Utilities.Plot.Records.Curve(
x=t,
y=y[:,1],
legend="y1"),
Modelica_LinearSystems2.Utilities.Plot.Records.Curve(
x=t,
y=y[:,2],
legend="y2")},
Plot.Records.Curve(x=t, y=y[:,1], legend="y1"),
Plot.Records.Curve(x=t, y=y[:,2], legend="y2")},
heading="Step response to synchronous step of u1 and u2",
xLabel="time [s]",
yLabel="y1, y2"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ function plotBodeSISO "Bode plot of a discrete state space system"
extends Modelica.Icons.Function;

import Modelica_LinearSystems2.DiscreteStateSpace;
input DiscreteStateSpace dss=Modelica_LinearSystems2.DiscreteStateSpace(
input DiscreteStateSpace dss = DiscreteStateSpace(
A=[0.995166584721977,0.0950040833529266,0.0,0.0,0.0,0.0; -0.0950040833529266,
0.90016250136905,0.0,0.0,0.0,0.0; 0.00676921321653657,0.00700084602310958,
0.98598654522888,0.0901824307998049,0.0,0.0; 0.128272800176598,0.135042013393134,
Expand All @@ -28,7 +28,7 @@ algorithm
assert(iy <= size(dss.C, 1) and iy > 0, "index for output is " + String(iy) + " which is not in [1, "
+ String(size(dss.C, 1)) + "].");

Modelica_LinearSystems2.DiscreteStateSpace.Plot.bodeSISO(dss, iu, iy);
DiscreteStateSpace.Plot.bodeSISO(dss, iu, iy);
ok := true;

annotation (__Dymola_interactive=true, Documentation(info="<html>
Expand Down

0 comments on commit 5362fbe

Please sign in to comment.