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

examples3

parent 310885de
No related branches found
No related tags found
No related merge requests found
......@@ -65,7 +65,7 @@ package GPS_pw_modeling
Modelica.StateGraph.Transition get_ephemeris_data(enableTimer = true, waitTime = time_to_get_ephemeris) annotation(
Placement(visible = true, transformation(origin = {40, 58}, extent = {{-10, 10}, {10, -10}}, rotation = 0)));
Modelica.StateGraph.Transition update_ephemeris_data(enableTimer = true, waitTime = time_to_get_ephemeris) annotation(
Placement(visible = true, transformation(origin = {156, 58}, extent = {{-10, 10}, {10, -10}}, rotation = 0)));
Placement(visible = true, transformation(origin = {154, 58}, extent = {{-10, 10}, {10, -10}}, rotation = 0)));
Modelica.StateGraph.Transition lose_hot_start(enableTimer = true, waitTime = time_lose_hot_start) annotation(
Placement(visible = true, transformation(origin = {128, -78}, extent = {{-10, 10}, {10, -10}}, rotation = -90)));
Modelica.StateGraph.Transition ephemeris_data_expire_1(condition = time > expiration_time) annotation(
......@@ -93,6 +93,10 @@ package GPS_pw_modeling
Modelica.StateGraph.TransitionWithSignal turn_off_antenna5 annotation(
Placement(visible = true, transformation(origin = {66, -60}, extent = {{-10, 10}, {10, -10}}, rotation = -90)));
equation
connect(update_ephemeris_data.inPort, position_available.outPort[2]) annotation(
Line(points = {{150, 58}, {131.25, 58}, {131.25, 56}, {110.5, 56}}));
connect(update_ephemeris_data.outPort, position_available.inPort[2]) annotation(
Line(points = {{155.5, 58}, {185.5, 58}, {185.5, 88}, {75.5, 88}, {75.5, 56}, {89, 56}}));
connect(turn_off_antenna5.condition, not1.y) annotation(
Line(points = {{78, -60}, {200, -60}, {200, 98}, {34, 98}, {34, 94}, {34, 94}}, color = {255, 0, 255}));
connect(turn_off_antenna5.outPort, warm_start_available.inPort[2]) annotation(
......@@ -155,14 +159,10 @@ package GPS_pw_modeling
Line(points = {{70, 26}, {70, 26}, {70, 58}, {90, 58}, {90, 58}}));
connect(get_ephemeris_data.outPort, position_available.inPort[1]) annotation(
Line(points = {{41.5, 58}, {65.25, 58}, {65.25, 56}, {89, 56}}));
connect(update_ephemeris_data.outPort, position_available.inPort[2]) annotation(
Line(points = {{157.5, 58}, {185.5, 58}, {185.5, 88}, {75.5, 88}, {75.5, 56}, {89, 56}}));
connect(lock_freq_and_phase_1.outPort, position_available.inPort[4]) annotation(
Line(points = {{34, 25.5}, {34, 39.5}, {72, 39.5}, {72, 56}, {89, 56}}));
connect(turn_off_antenna.inPort, position_available.outPort[1]) annotation(
Line(points = {{130, 22}, {130, 56}, {110.5, 56}}));
connect(update_ephemeris_data.inPort, position_available.outPort[2]) annotation(
Line(points = {{152, 58}, {131.25, 58}, {131.25, 56}, {110.5, 56}}));
connect(get_ephemeris_data.inPort, freq_and_phase.outPort[1]) annotation(
Line(points = {{36, 58}, {6.5, 58}}));
connect(lock_freq_and_phase.outPort, freq_and_phase.inPort[1]) annotation(
......@@ -201,7 +201,7 @@ package GPS_pw_modeling
sv_ephemeris := pre(visible_satellites);
end when;
when {pre(get_ephemeris_data.fire), pre(update_ephemeris_data.fire)} then
sv_ephemeris := pre(visible_satellites);
sv_ephemeris := visible_satellites;
expiration_time := pre(time + ephemeris_duration);
end when;
when {time > pre(expiration_time)} then
......@@ -215,28 +215,36 @@ package GPS_pw_modeling
end GPS_pw_simulator;
model test_GPS
GPS_pw_modeling.GPS_pw_simulator gps annotation(
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(
Placement(visible = true, transformation(origin = {-90, 50}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
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 = {-90, 88}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.BooleanTable slow_and_fast(table = {20, 85, 90, 91, 100, 101, 110, 111, 120, 121, 1850, 1851, 1860, 1861, 1870, 1871, 1880, 1881, 1890, 1891, 1900, 1901, 1910, 1971, 1980, 1981, 1990, 1991, 2000, 2001}) annotation(
Placement(visible = true, transformation(origin = {-68, -12}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Placement(visible = true, transformation(origin = {50, 80}, 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)));
Placement(visible = true, transformation(origin = {52, 48}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.BooleanTable general_example annotation(
Placement(visible = true, transformation(origin = {-90, 88}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.BooleanTable const_on(table = {10}) annotation(
Placement(visible = true, transformation(origin = {-30, -20}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.IntegerTable satellite_outage(table = [0, 8; 110, 3; 120, 12]) annotation(
Placement(visible = true, transformation(origin = {-30, -60}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(constant_number.y, gps.visible_satellites) annotation(
Line(points = {{-24, -60}, {22, -60}, {22, -60}, {22, -60}}, color = {255, 127, 0}));
connect(slow_and_fast.y, gps.on_signal) annotation(
Line(points = {{-56, -12}, {28, -12}, {28, -50}, {28, -50}}, color = {255, 0, 255}));
connect(const_on.y, gps.on_signal) annotation(
Line(points = {{-19, -20}, {28, -20}, {28, -50}}, color = {255, 0, 255}));
connect(satellite_outage.y, gps.visible_satellites) annotation(
Line(points = {{-19, -60}, {22, -60}}, color = {255, 127, 0}));
annotation(
experiment(StartTime = 0, StopTime = 2100, Tolerance = 1e-6, Interval = 0.0042),
experiment(StartTime = 0, StopTime = 400, Tolerance = 1e-6, Interval = 0.0008),
__OpenModelica_simulationFlags(lv = "LOG_STATS", s = "dassl"));
end test_GPS;
annotation(
uses(Modelica(version = "3.2.1")));
end GPS_pw_modeling;
\ No newline at end of file
......@@ -27,7 +27,7 @@ This event is diffucult to be defined for the same reasons discussed for the eve
\subsection{Model execution examples}
In this section will be presented through the simulation of different scenarios which kind of considerations we can make on how GPS sensors work according to the retrieved model. Such considerations are related to (i) the presence of two different dynamcs in the retrieval of the position, one that is slow, the other that is fast, (ii) the different delays the system can present , (iii) the different ways we can duty-cycle the sensor and (iv) how variations on the number of visible satellites can affect the availability of the position.
%first two examples use the boolead table called slow_and_fast
%first two examples use the boolead table called slow_and_fast with a constant and sufficient number of visible satellites
\subsubsection{Start up of the sensor}
In the first simulation we want to show the existance of two dynamics in the sensor: a slow one related to the ascquisition and validity of the ephemeris data, and a fast one related to the acquisition of the ranging data. This simulation points also out what is the difference between warm and cold start. To do so we turn on the antenna first for a long time in order to be sure to acuire the ephemeris data of the visible satellies and then start to duty cycle the sensor to acquire the position at different points in time. A example of a turn on signal doing so is given in figure~\ref{fig:control1}.In figure~\ref{fig:position1} instead we can see the availability of the position measure given the input above described. We can see how at the first turn on of the sensor it takes a minute before the position becomes actually available, while afterward the position is available after only milliseconds(recall that the antenna is turned on and consumes powerexactly completely cohordinated to the turn\_on signal).
......@@ -72,7 +72,7 @@ In this second simulation we show an outage of the position measure availability
\end{figure}
\subsubsection{Visible satellites}
In this third scenario it is shown a possible way the number of visible satellites can influence the availability of the position
In this third scenario it is shown a possible way the number of visible satellites can influence the availability of the position.
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment