Commit 1d57c473 authored by Claudio Mandrioli's avatar Claudio Mandrioli
Browse files

fixed modelica code to have same experiments ready to run as in the paper

parent 3b52d976
package GPS_pw_modeling
model GPS_pw_simulator_old
//prima versione - obsoleta
//
//prima versione - obsoleta
//
//parameters
parameter Integer required_satellites = 4;
//number of satellites required for sufficient accuracy
......@@ -223,26 +223,24 @@ package GPS_pw_modeling
__OpenModelica_simulationFlags(lv = "LOG_STATS", s = "dassl"));
end GPS_pw_simulator_old;
model test_GPS
GPS_pw_modeling.GPS_pw_simulator GPS_pw_simulator1 annotation(
Placement(visible = true, transformation(origin = {70, -30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.BooleanTable const_on(table = {5, 71, 80, 81, 90, 91, 100, 101, 110, 111, 120, 261, 270, 271, 280, 281, 290, 291}) annotation(
Modelica.Blocks.Sources.BooleanTable onCommand_TTFFandEphemerisExpirationExperiment(table = {5, 71, 90, 91, 110, 111, 130, 131, 150, 151, 1840, 1841, 1850, 1851, 1860, 1861, 1870, 1871, 1880, 1881, 1890, 1891, 1900, 1975, 1985, 1986, 1995, 1996}) annotation(
Placement(visible = true, transformation(origin = {-10, -30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.IntegerConstant stellites_constant(k = 5) annotation(
Modelica.Blocks.Sources.IntegerConstant stellites_TTFFandEphemerisExpirationExperiment(k = 5) annotation(
Placement(visible = true, transformation(origin = {-10, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.IntegerTable satellites_visibilityLossExperiment(table = [0, 5; 100, 3; 200, 4]) annotation(
Placement(visible = true, transformation(origin = {-10, 90}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.BooleanTable slow_and_fast(table = {10, 70, 90, 91, 110, 111, 130, 131, 150, 151, 1840, 1841, 1850, 1851, 1860, 1861, 1870, 1871, 1880, 1881, 1890, 1891, 1900, 1971, 1980, 1981, 1990, 1991, 2000, 2001}) annotation(
Modelica.Blocks.Sources.BooleanTable onCommand_visibilityLossExperiment(table = {5, 71, 80, 81, 90, 91, 100, 101, 110, 111, 120, 261, 270, 271, 280, 281, 290, 291}) annotation(
Placement(visible = true, transformation(origin = {-10, 50}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.IntegerTable satellites(table=[0,5;100,3; 200,4]) annotation(
Placement(visible = true, transformation(origin = {-10, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(GPS_pw_simulator1.visible_satellites, satellites.y) annotation(
Line(points = {{70, -20}, {70, -20}, {70, 10}, {2, 10}, {2, 10}}, color = {255, 127, 0}));
connect(const_on.y, GPS_pw_simulator1.on_signal) annotation(
Line(points = {{2, -30}, {58, -30}, {58, -30}, {60, -30}}, color = {255, 0, 255}));
connect(satellites_visibilityLossExperiment.y, GPS_pw_simulator1.visible_satellites) annotation(
Line(points = {{2, 90}, {70, 90}, {70, -20}, {70, -20}}, color = {255, 127, 0}));
connect(GPS_pw_simulator1.on_signal, onCommand_visibilityLossExperiment.y) annotation(
Line(points = {{60, -30}, {30, -30}, {30, 50}, {2, 50}, {2, 50}}, color = {255, 0, 255}));
annotation(
experiment(StartTime = 0, StopTime = 2000, Tolerance = 1e-6, Interval = 0.0006),
experiment(StartTime = 0, StopTime = 2000, Tolerance = 1e-06, Interval = 0.0006),
__OpenModelica_simulationFlags(lv = "LOG_STATS", s = "dassl"));
end test_GPS;
......@@ -251,8 +249,6 @@ package GPS_pw_modeling
model GPS_pw_simulator
// not modeled hot start
/////////////////
......@@ -337,7 +333,7 @@ package GPS_pw_modeling
Placement(visible = true, transformation(origin = {-4, 18}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
Modelica.StateGraph.Transition lose_visibility2(condition = sv_freq_phase < required_satellites) annotation(
Placement(visible = true, transformation(origin = {110, -6}, extent = {{10, -10}, {-10, 10}}, rotation = 90)));
Modelica.Blocks.Interfaces.BooleanOutput position annotation(
Modelica.Blocks.Interfaces.BooleanOutput position annotation(
Placement(visible = true, transformation(origin = {162, 30}, extent = {{10, -10}, {-10, 10}}, rotation = 0), iconTransformation(origin = {95, -27}, extent = {{25, -25}, {-25, 25}}, rotation = 0)));
equation
connect(lose_visibility2.outPort, warm_start.inPort[2]) annotation(
......@@ -441,10 +437,6 @@ package GPS_pw_modeling
Icon(graphics = {Rectangle(fillColor = {115, 210, 22}, fillPattern = FillPattern.Solid, extent = {{-96, 96}, {96, -96}}), Text(origin = {-54, 2}, extent = {{-20, 8}, {20, -8}}, textString = "turn_on"), Text(origin = {-45, 73}, extent = {{-17, 9}, {91, -15}}, textString = "visible_satellites"), Text(origin = {44, 41}, extent = {{-72, 15}, {22, -9}}, textString = "power_consumption"), Text(origin = {20, -27}, extent = {{-50, 11}, {50, -11}}, textString = "position_avaialble"), Text(origin = {11, -80}, extent = {{-97, 32}, {79, -24}}, textString = "GPS device")}, coordinateSystem(initialScale = 0.1)),
experiment(StartTime = 0, StopTime = 400, Tolerance = 1e-6, Interval = 0.0008));
end GPS_pw_simulator;
annotation(
uses(Modelica(version = "3.2.1")));
end GPS_pw_modeling;
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment