Skip to content
Snippets Groups Projects
Commit 1fffa6f0 authored by Claudio (xjobb Martina)'s avatar Claudio (xjobb Martina)
Browse files

modelicaExamples1

parent 3b911876
No related branches found
No related tags found
No related merge requests found
...@@ -29,8 +29,7 @@ package GPS_pw_modeling ...@@ -29,8 +29,7 @@ package GPS_pw_modeling
Placement(visible = true, transformation(origin = {-167, 101}, extent = {{-11, -11}, {11, 11}}, rotation = 0), iconTransformation(origin = {-94, 2}, extent = {{-26, -26}, {26, 26}}, rotation = 0))); Placement(visible = true, transformation(origin = {-167, 101}, extent = {{-11, -11}, {11, 11}}, rotation = 0), iconTransformation(origin = {-94, 2}, extent = {{-26, -26}, {26, 26}}, rotation = 0)));
Modelica.Blocks.Interfaces.BooleanInput on_signal annotation( Modelica.Blocks.Interfaces.BooleanInput on_signal annotation(
Placement(visible = true, transformation(origin = {-133, 93}, extent = {{-11, -11}, {11, 11}}, rotation = 0), iconTransformation(origin = {-40, 100}, extent = {{-20, -20}, {20, 20}}, rotation = -90))); Placement(visible = true, transformation(origin = {-133, 93}, extent = {{-11, -11}, {11, 11}}, rotation = 0), iconTransformation(origin = {-40, 100}, extent = {{-20, -20}, {20, 20}}, rotation = -90)));
Modelica.Blocks.Interfaces.BooleanOutput position_out annotation( Modelica.Blocks.Interfaces.BooleanOutput position_out annotation( Placement(visible = true, transformation(origin = {176, 0}, extent = {{10, -10}, {-10, 10}}, rotation = 0), iconTransformation(origin = {95, -15}, extent = {{25, -25}, {-25, 25}}, rotation = 0)));
Placement(visible = true, transformation(origin = {176, 0}, extent = {{10, -10}, {-10, 10}}, rotation = 0), iconTransformation(origin = {95, -15}, extent = {{25, -25}, {-25, 25}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealOutput power_consumption annotation( Modelica.Blocks.Interfaces.RealOutput power_consumption annotation(
Placement(visible = true, transformation(origin = {-160, 84}, extent = {{-8, -8}, {8, 8}}, rotation = 0), iconTransformation(origin = {95, 41}, extent = {{-25, -25}, {25, 25}}, rotation = 180))); Placement(visible = true, transformation(origin = {-160, 84}, extent = {{-8, -8}, {8, 8}}, rotation = 0), iconTransformation(origin = {95, 41}, extent = {{-25, -25}, {25, 25}}, rotation = 180)));
//States //States
...@@ -216,66 +215,24 @@ package GPS_pw_modeling ...@@ -216,66 +215,24 @@ package GPS_pw_modeling
end GPS_pw_simulator; end GPS_pw_simulator;
model test_GPS model test_GPS
GPS_pw_simulator gps annotation( GPS_pw_modeling.GPS_pw_simulator gps annotation(
Placement(visible = true, transformation(origin = {2, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); Placement(visible = true, transformation(origin = {32, -60}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.IntegerTable visible_satellites(table = [0, 8; 100, 7; 500, 12]) annotation( Modelica.Blocks.Sources.IntegerTable visible_satellites(table = [0, 8; 100, 7; 500, 12]) annotation(
Placement(visible = true, transformation(origin = {-72, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); Placement(visible = true, transformation(origin = {-90, 50}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.BooleanExpression turn_on(y = if time > 10 then if time < 500 then true else false else false) annotation( Modelica.Blocks.Sources.BooleanTable general_example(table = {0, 30, 100, 120, 125, 140, 145, 170, 175, 200, 205, 2000, 2010, 2050, 2500, 3000}) annotation(
Placement(visible = true, transformation(origin = {-76, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); Placement(visible = true, transformation(origin = {-90, 88}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.BooleanTable turn_on_table(table = {0, 30, 100, 120, 125, 140, 145, 170, 175, 200, 205, 2000, 2010, 2050, 2500, 3000}) annotation( Modelica.Blocks.Sources.BooleanTable slow_and_fast(table = {20, 85, 90, 91, 100, 101, 110, 111, 120, 121, 1875, 2100}) annotation(
Placement(visible = true, transformation(origin = {-46, 64}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); Placement(visible = true, transformation(origin = {-68, -12}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.IntegerTable constant_number(table = [0, 8]) annotation(
Placement(visible = true, transformation(origin = {-36, -60}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation equation
connect(turn_on_table.y, gps.on_signal) annotation( connect(constant_number.y, gps.visible_satellites) annotation(
Line(points = {{-34, 64}, {-2, 64}, {-2, 10}, {-2, 10}}, color = {255, 0, 255})); Line(points = {{-24, -60}, {22, -60}, {22, -60}, {22, -60}}, color = {255, 127, 0}));
connect(visible_satellites.y, gps.visible_satellites) annotation( connect(slow_and_fast.y, gps.on_signal) annotation(
Line(points = {{-60, 0}, {-8, 0}, {-8, 0}, {-8, 0}}, color = {255, 127, 0})); Line(points = {{-56, -12}, {28, -12}, {28, -50}, {28, -50}}, color = {255, 0, 255}));
annotation( annotation(
experiment(StartTime = 0, StopTime = 1000, Tolerance = 1e-06, Interval = 0.002), experiment(StartTime = 0, StopTime = 2100, Tolerance = 1e-6, Interval = 0.0042),
__OpenModelica_simulationFlags(lv = "LOG_STATS", s = "dassl")); __OpenModelica_simulationFlags(lv = "LOG_STATS", s = "dassl"));
end test_GPS; end test_GPS;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment