diff options
author | Siddharth11235 | 2019-09-03 18:09:16 +0530 |
---|---|---|
committer | Siddharth11235 | 2019-09-03 18:09:16 +0530 |
commit | b4b6aa36e3486a3544acc52419149b5671f841e9 (patch) | |
tree | 66c1783158f23e6d21c77324156fc57e18d4ac67 /PID_Practice_Cases/Virtual_PID.mo | |
parent | f5266f634f4fb4fd39933a83551a01cf446256b8 (diff) | |
download | OpenModelica_HIL-master.tar.gz OpenModelica_HIL-master.tar.bz2 OpenModelica_HIL-master.zip |
Diffstat (limited to 'PID_Practice_Cases/Virtual_PID.mo')
-rwxr-xr-x | PID_Practice_Cases/Virtual_PID.mo | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/PID_Practice_Cases/Virtual_PID.mo b/PID_Practice_Cases/Virtual_PID.mo new file mode 100755 index 0000000..e7c1ac7 --- /dev/null +++ b/PID_Practice_Cases/Virtual_PID.mo @@ -0,0 +1,23 @@ +//Provides a virtual PID against which the arduino PID can be compared. +class Virtual_PID + Modelica.Blocks.Math.Feedback feedback1 annotation( + Placement(visible = true, transformation(origin = {-44, 22}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + Modelica.Blocks.Continuous.FirstOrder firstOrder1(T = 1, initType = Modelica.Blocks.Types.Init.NoInit, k = 1, y_start = 1) annotation( + Placement(visible = true, transformation(origin = {54, 22}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + Modelica.Blocks.Sources.Sine sine1(amplitude = 50, freqHz = 0.5, offset = 150) annotation( + Placement(visible = true, transformation(origin = {-88, 22}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + Modelica.Blocks.Continuous.PID PID(Nd = 0.5, Td = 10 ^ 10, Ti = 10 ^ 10, k = 2) annotation( + Placement(visible = true, transformation(origin = {0, 22}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); +equation + connect(PID.y, firstOrder1.u) annotation( + Line(points = {{12, 22}, {42, 22}, {42, 22}, {42, 22}}, color = {0, 0, 127})); + connect(feedback1.y, PID.u) annotation( + Line(points = {{-34, 22}, {-12, 22}, {-12, 22}, {-12, 22}}, color = {0, 0, 127})); + connect(sine1.y, feedback1.u1) annotation( + Line(points = {{-76, 22}, {-52, 22}, {-52, 22}, {-52, 22}}, color = {0, 0, 127})); + connect(firstOrder1.y, feedback1.u2) annotation( + Line(points = {{66, 22}, {80, 22}, {80, 0}, {-46, 0}, {-46, 14}, {-44, 14}, {-44, 14}}, color = {0, 0, 127})); + annotation( + uses(Modelica(version = "3.2.2")), + Diagram); +end Virtual_PID;
\ No newline at end of file |