SimulationPage¶
class nmeasim::app::SimulationPage · Applications
Settings tab for the simulation mode, the profile name, the clock, the vessel seed values, their drift and the steering model.
Inherits QWidget
Declared in src/app/dialogs/simulation_page.hpp (line 47)
SettingsDialog calls load once with its copy of the profile, validate when the operator presses OK, and store into the same copy when every page is valid. The page keeps no profile of its own: the widgets are the only state, and store writes only the fields listed at the widget members, so the rest of the profile passes through unchanged.
Each widget enforces a range, given at its member. load clamps a profile value outside that range to the nearest limit and rounds it to the number of decimals shown, so a value that has more precision than the widget comes back rounded from store.
Every widget is created in the constructor as a descendant of the page and is deleted with it; the widget pointers are never null and stay valid for the lifetime of the page. The widgets are laid out in two columns inside a scroll area, so the page fits a small dialog. The class declares no signals or slots of its own.
See also
Summary¶
Public member functions
| Name | Description |
|---|---|
SimulationPage() |
Creates the page with every widget in its initial state, the destination fields and the start time disabled and the group boxes enabled for delta mode. |
load() |
Shows the simulation settings of a profile in the widgets. |
store() |
Writes the widget values into the simulation fields of a profile. |
validate() |
Checks that the chosen mode has the file it needs. |
Public data members
| Name | Description |
|---|---|
mode_combo |
Chooses what drives the vessel, io::Profile::mode. |
track_path_edit |
Track file to follow, io::TrackSettings::path; a GPX or KML file, trimmed by store. |
track_browse_button |
Opens a file dialog for a .gpx or .kml track and puts the chosen path into track_path_edit; cancelling leaves the field unchanged. |
track_speed_spin |
Speed along legs whose points carry neither timestamps nor a recorded speed, io::TrackSettings::speed_kn; [0.1, 999.9] knots with one decimal. |
track_timestamps_check |
Whether the track's own timestamps set the pace, io::TrackSettings::use_timestamps. |
track_loop_check |
Whether the track starts again at its first point, io::TrackSettings::loop. |
replay_path_edit |
Log file to replay, io::ReplaySettings::path; trimmed by store. |
replay_browse_button |
Opens a file dialog for a .log, .nmea or .txt file and puts the chosen path into replay_path_edit; cancelling leaves the field unchanged. |
replay_loop_check |
Whether the log starts again at its first entry, io::ReplaySettings::loop. |
replay_interval_spin |
Spacing of the entries when the log carries no time information, io::ReplaySettings::fixed_interval_ms; [1, 60000] ms, the range the profile accepts. |
name_edit |
Display name of the profile, io::Profile::name; store writes Untitled for an empty or blank name. |
tick_spin |
Length of one simulation step, io::Profile::tick_ms; [10, 10000] ms, the range the profile accepts. |
fixed_start_check |
Whether the run starts at start_time_edit rather than at the wall-clock time; unticked means io::Profile::start_time is std::nullopt. |
start_time_edit |
Simulated start time in UTC, io::Profile::start_time, shown as yyyy-MM-dd HH:mm:ss; enabled only while fixed_start_check is ticked. |
random_seed_spin |
Seed of the pseudo-random generator of the drift, core::simulation::DeltaConfig::random_seed; a whole number in [0, 4294967295], the whole range of the 32-bit seed, so every seed a profile can hold survives the page. |
latitude_spin |
Seed latitude, positive north, the latitude of core::model::Navigation::position; [-90, 90] degrees with six decimals. |
longitude_spin |
Seed longitude, positive east, the longitude of core::model::Navigation::position; [-180, 180] degrees with six decimals. |
altitude_spin |
Antenna altitude above mean sea level, core::model::Navigation::altitude_m; [-500, 20000] m with one decimal. |
heading_spin |
Seed heading, core::model::Navigation::heading_true_deg; [0, 359.9] degrees true with one decimal. |
speed_spin |
Seed speed over ground, core::model::Navigation::speed_over_ground_kn; [0, 999.9] knots with one decimal. |
variation_spin |
Magnetic variation, positive east, core::model::Navigation::magnetic_variation_deg; [-180, 180] degrees with one decimal. |
deviation_spin |
Compass deviation, positive east, core::model::Navigation::magnetic_deviation_deg; [-180, 180] degrees with one decimal. |
depth_spin |
Seed depth below the transducer, core::model::Water::depth_below_transducer_m; [0, 99999.9] m with one decimal. |
transducer_offset_spin |
Transducer offset, core::model::Water::transducer_offset_m, positive up to the water line and negative down to the keel; [-50, 50] m with two decimals. |
water_temperature_spin |
Seed water temperature, core::model::Water::temperature_c; [-5, 60] degrees Celsius with one decimal. |
wind_direction_spin |
Direction the true wind blows from, core::model::Wind::true_direction_deg; [0, 359.9] degrees true with one decimal. |
wind_speed_spin |
True wind speed, core::model::Wind::true_speed_kn; [0, 200] knots with one decimal. |
fix_check |
Whether the receiver has a position fix, core::model::GnssFix::has_fix. |
quality_combo |
Fix quality, core::model::GnssFix::quality. |
satellites_in_use_spin |
Satellites used in the solution, core::model::GnssFix::satellites_in_use; [0, 12], the range the NMEA encoders report. |
satellites_in_view_spin |
Satellites in view, core::model::GnssFix::satellites_in_view; [0, 12], the size of the synthetic constellation. |
hdop_spin |
Horizontal dilution of precision, core::model::GnssFix::hdop; [0, 99.9] with one decimal. |
pdop_spin |
Position dilution of precision, core::model::GnssFix::pdop; [0, 99.9] with one decimal. |
vdop_spin |
Vertical dilution of precision, core::model::GnssFix::vdop; [0, 99.9] with one decimal. |
geoid_spin |
Height of the geoid above the WGS 84 ellipsoid, core::model::GnssFix::geoid_separation_m; [-200, 200] m with one decimal. |
amplitude_spins |
Drift amplitudes, core::simulation::Variation::amplitude of the heading, speed, depth, water temperature, wind direction and wind speed variations of core::simulation::DeltaConfig, in that order. |
step_spins |
Largest random change per second, core::simulation::Variation::step_per_second, of the same six variations in the same order as amplitude_spins. |
turn_rate_spin |
Gain of the steering model, core::simulation::DeltaConfig::turn_rate_per_rudder_deg; [0, 100] degrees per minute of rate of turn per degree of rudder, with two decimals. |
max_rudder_spin |
Largest rudder angle either side, core::simulation::DeltaConfig::max_rudder_angle_deg; [1, 90] whole degrees. |
destination_check |
Whether the vessel has a destination; unticked means the seed destination core::model::VesselState::destination is std::nullopt. |
destination_name_edit |
Waypoint id, core::model::Destination::name; at most 16 characters, the length core::model::kMaxWaypointNameLength that the encoders send. |
destination_latitude_spin |
Latitude of the waypoint, positive north; [-90, 90] degrees with six decimals. |
destination_longitude_spin |
Longitude of the waypoint, positive east; [-180, 180] degrees with six decimals. |
arrival_radius_spin |
Radius of the arrival circle, core::model::Destination::arrival_radius_m; [1, 100000] whole metres. |
Private member functions
| Name | Description |
|---|---|
update_mode_widgets() |
Enables the track group in track mode, the replay group in replay mode and the drift group in delta mode, after the current index of mode_combo. |
browse_track() |
Asks the operator for a track file and puts the chosen path into track_path_edit. |
browse_log() |
Asks the operator for a log file and puts the chosen path into replay_path_edit. |
Private data members
| Name | Description |
|---|---|
track_box_ |
The Track group, enabled only in track mode; owned by the page. |
replay_box_ |
The Log replay group, enabled only in replay mode; owned by the page. |
drift_box_ |
The Drift around the initial values group, enabled only in delta mode; owned by the page. |
profile_directory_ |
Directory of the loaded profile's file, io::Profile::base_directory, against which the file dialogs resolve a relative track or log path; empty for a profile without a file. |
Public member functions¶
SimulationPage()¶
explicit SimulationPage(QWidget* parent = nullptr)
Creates the page with every widget in its initial state, the destination fields and the start time disabled and the group boxes enabled for delta mode.
The widgets show no profile until load is called.
Parameters
| Name | Type | Description |
|---|---|---|
parent |
QWidget* |
The owner of the page, normally the SettingsDialog; when null, the caller owns the page. |
Declared in src/app/dialogs/simulation_page.hpp:58 · defined in src/app/dialogs/simulation_page.cpp:97
load()¶
void load(const io::Profile& profile)
Shows the simulation settings of a profile in the widgets.
Sets every widget from the field named at its member and enables the group boxes for the profile's mode. Without a fixed start time, the start time field shows the current UTC time rounded down to the second, as the value to start from when the operator ticks Fixed start time. Without a destination, the destination fields show an empty id, the seed position and a radius of 100 m.
Parameters
| Name | Type | Description |
|---|---|---|
profile |
const io::Profile& |
The profile to show; only read during the call. |
Declared in src/app/dialogs/simulation_page.hpp:69 · defined in src/app/dialogs/simulation_page.cpp:321
store()¶
void store(io::Profile& profile) const
Writes the widget values into the simulation fields of a profile.
Only the fields named at the widget members are written; the rest of profile, including the seed engines and AIS data that VesselPage edits, is left as it is. The track and replay settings are written in every mode, so switching modes keeps them. The paths and the name are trimmed, and an empty name becomes Untitled. An unticked Fixed start time resets io::Profile::start_time and an unticked destination resets the seed destination.
A ticked destination is written with the id WPT when the id field is empty. When the latitude and longitude fields still show the profile's destination, rounded to their six decimals, the destination keeps its stored coordinates, with all their decimals, and its leg origin; otherwise the leg starts at the seed position written by this call. The seed latitude and longitude likewise keep their stored values when their fields were not changed.
Parameters
| Name | Type | Description |
|---|---|---|
profile |
io::Profile& |
The profile to update, normally the dialog's copy. |
Note
store does not validate: it writes an empty track or replay path as it is. SettingsDialog calls it only after validate returned an empty string.
Declared in src/app/dialogs/simulation_page.hpp:89 · defined in src/app/dialogs/simulation_page.cpp:392
validate()¶
QString validate() const
Checks that the chosen mode has the file it needs.
Returns QString: A message for the operator, Choose the track file to follow. in track mode or Choose the log file to replay. in replay mode when the path is empty after trimming; an empty string when the settings are valid. Whether the file exists is not checked here.
Declared in src/app/dialogs/simulation_page.hpp:96 · defined in src/app/dialogs/simulation_page.cpp:310
Public data members¶
mode_combo¶
QComboBox* mode_combo
Chooses what drives the vessel, io::Profile::mode.
The items are delta simulation, follow a track and replay a log, in the order of the io::SimulationMode enumerators, so the current index is the enumerator's value. Changing it enables the track group in track mode, the replay group in replay mode and the drift group in delta mode.
Declared in src/app/dialogs/simulation_page.hpp:106
track_path_edit¶
QLineEdit* track_path_edit
Track file to follow, io::TrackSettings::path; a GPX or KML file, trimmed by store.
Declared in src/app/dialogs/simulation_page.hpp:108
track_browse_button¶
QPushButton* track_browse_button
Opens a file dialog for a .gpx or .kml track and puts the chosen path into track_path_edit; cancelling leaves the field unchanged.
Declared in src/app/dialogs/simulation_page.hpp:111
track_speed_spin¶
QDoubleSpinBox* track_speed_spin
Speed along legs whose points carry neither timestamps nor a recorded speed, io::TrackSettings::speed_kn; [0.1, 999.9] knots with one decimal.
The minimum keeps the value positive, which the profile requires.
Declared in src/app/dialogs/simulation_page.hpp:116
track_timestamps_check¶
QCheckBox* track_timestamps_check
Whether the track's own timestamps set the pace, io::TrackSettings::use_timestamps.
Declared in src/app/dialogs/simulation_page.hpp:118
track_loop_check¶
QCheckBox* track_loop_check
Whether the track starts again at its first point, io::TrackSettings::loop.
Declared in src/app/dialogs/simulation_page.hpp:120
replay_path_edit¶
QLineEdit* replay_path_edit
Log file to replay, io::ReplaySettings::path; trimmed by store.
Declared in src/app/dialogs/simulation_page.hpp:122
replay_browse_button¶
QPushButton* replay_browse_button
Opens a file dialog for a .log, .nmea or .txt file and puts the chosen path into replay_path_edit; cancelling leaves the field unchanged.
Declared in src/app/dialogs/simulation_page.hpp:125
replay_loop_check¶
QCheckBox* replay_loop_check
Whether the log starts again at its first entry, io::ReplaySettings::loop.
Declared in src/app/dialogs/simulation_page.hpp:127
replay_interval_spin¶
QSpinBox* replay_interval_spin
Spacing of the entries when the log carries no time information, io::ReplaySettings::fixed_interval_ms; [1, 60000] ms, the range the profile accepts.
Declared in src/app/dialogs/simulation_page.hpp:130
name_edit¶
QLineEdit* name_edit
Display name of the profile, io::Profile::name; store writes Untitled for an empty or blank name.
Declared in src/app/dialogs/simulation_page.hpp:134
tick_spin¶
QSpinBox* tick_spin
Length of one simulation step, io::Profile::tick_ms; [10, 10000] ms, the range the profile accepts.
Declared in src/app/dialogs/simulation_page.hpp:137
fixed_start_check¶
QCheckBox* fixed_start_check
Whether the run starts at start_time_edit rather than at the wall-clock time; unticked means io::Profile::start_time is std::nullopt.
Toggling it enables or disables start_time_edit.
Declared in src/app/dialogs/simulation_page.hpp:142
start_time_edit¶
QDateTimeEdit* start_time_edit
Simulated start time in UTC, io::Profile::start_time, shown as yyyy-MM-dd HH:mm:ss; enabled only while fixed_start_check is ticked.
Declared in src/app/dialogs/simulation_page.hpp:145
random_seed_spin¶
QDoubleSpinBox* random_seed_spin
Seed of the pseudo-random generator of the drift, core::simulation::DeltaConfig::random_seed; a whole number in [0, 4294967295], the whole range of the 32-bit seed, so every seed a profile can hold survives the page.
A double spin box without decimals, because a QSpinBox holds an int only; a double represents every 32-bit value exactly.
Declared in src/app/dialogs/simulation_page.hpp:152
latitude_spin¶
QDoubleSpinBox* latitude_spin
Seed latitude, positive north, the latitude of core::model::Navigation::position; [-90, 90] degrees with six decimals.
Declared in src/app/dialogs/simulation_page.hpp:156
longitude_spin¶
QDoubleSpinBox* longitude_spin
Seed longitude, positive east, the longitude of core::model::Navigation::position; [-180, 180] degrees with six decimals.
Declared in src/app/dialogs/simulation_page.hpp:159
altitude_spin¶
QDoubleSpinBox* altitude_spin
Antenna altitude above mean sea level, core::model::Navigation::altitude_m; [-500, 20000] m with one decimal.
Declared in src/app/dialogs/simulation_page.hpp:162
heading_spin¶
QDoubleSpinBox* heading_spin
Seed heading, core::model::Navigation::heading_true_deg; [0, 359.9] degrees true with one decimal.
Declared in src/app/dialogs/simulation_page.hpp:165
speed_spin¶
QDoubleSpinBox* speed_spin
Seed speed over ground, core::model::Navigation::speed_over_ground_kn; [0, 999.9] knots with one decimal.
Declared in src/app/dialogs/simulation_page.hpp:168
variation_spin¶
QDoubleSpinBox* variation_spin
Magnetic variation, positive east, core::model::Navigation::magnetic_variation_deg; [-180, 180] degrees with one decimal.
Declared in src/app/dialogs/simulation_page.hpp:171
deviation_spin¶
QDoubleSpinBox* deviation_spin
Compass deviation, positive east, core::model::Navigation::magnetic_deviation_deg; [-180, 180] degrees with one decimal.
Declared in src/app/dialogs/simulation_page.hpp:174
depth_spin¶
QDoubleSpinBox* depth_spin
Seed depth below the transducer, core::model::Water::depth_below_transducer_m; [0, 99999.9] m with one decimal.
Declared in src/app/dialogs/simulation_page.hpp:177
transducer_offset_spin¶
QDoubleSpinBox* transducer_offset_spin
Transducer offset, core::model::Water::transducer_offset_m, positive up to the water line and negative down to the keel; [-50, 50] m with two decimals.
Declared in src/app/dialogs/simulation_page.hpp:180
water_temperature_spin¶
QDoubleSpinBox* water_temperature_spin
Seed water temperature, core::model::Water::temperature_c; [-5, 60] degrees Celsius with one decimal.
Declared in src/app/dialogs/simulation_page.hpp:183
wind_direction_spin¶
QDoubleSpinBox* wind_direction_spin
Direction the true wind blows from, core::model::Wind::true_direction_deg; [0, 359.9] degrees true with one decimal.
Declared in src/app/dialogs/simulation_page.hpp:186
wind_speed_spin¶
QDoubleSpinBox* wind_speed_spin
True wind speed, core::model::Wind::true_speed_kn; [0, 200] knots with one decimal.
Declared in src/app/dialogs/simulation_page.hpp:188
fix_check¶
QCheckBox* fix_check
Whether the receiver has a position fix, core::model::GnssFix::has_fix.
Declared in src/app/dialogs/simulation_page.hpp:191
quality_combo¶
QComboBox* quality_combo
Fix quality, core::model::GnssFix::quality.
The items are invalid, GPS and differential, in the order of the core::model::FixQuality enumerators, so the current index is the enumerator's value.
Declared in src/app/dialogs/simulation_page.hpp:196
satellites_in_use_spin¶
QSpinBox* satellites_in_use_spin
Satellites used in the solution, core::model::GnssFix::satellites_in_use; [0, 12], the range the NMEA encoders report.
Declared in src/app/dialogs/simulation_page.hpp:199
satellites_in_view_spin¶
QSpinBox* satellites_in_view_spin
Satellites in view, core::model::GnssFix::satellites_in_view; [0, 12], the size of the synthetic constellation.
The page does not keep it at or above the satellites in use; the encoders do.
Declared in src/app/dialogs/simulation_page.hpp:204
hdop_spin¶
QDoubleSpinBox* hdop_spin
Horizontal dilution of precision, core::model::GnssFix::hdop; [0, 99.9] with one decimal.
Declared in src/app/dialogs/simulation_page.hpp:207
pdop_spin¶
QDoubleSpinBox* pdop_spin
Position dilution of precision, core::model::GnssFix::pdop; [0, 99.9] with one decimal.
Declared in src/app/dialogs/simulation_page.hpp:210
vdop_spin¶
QDoubleSpinBox* vdop_spin
Vertical dilution of precision, core::model::GnssFix::vdop; [0, 99.9] with one decimal.
Declared in src/app/dialogs/simulation_page.hpp:213
geoid_spin¶
QDoubleSpinBox* geoid_spin
Height of the geoid above the WGS 84 ellipsoid, core::model::GnssFix::geoid_separation_m; [-200, 200] m with one decimal.
Declared in src/app/dialogs/simulation_page.hpp:216
amplitude_spins¶
std::array<QDoubleSpinBox* , 6> amplitude_spins{}
Drift amplitudes, core::simulation::Variation::amplitude of the heading, speed, depth, water temperature, wind direction and wind speed variations of core::simulation::DeltaConfig, in that order.
Each is in the unit of its value (degrees, knots, metres, degrees Celsius, degrees, knots), [0, 1000] with two decimals; 0 freezes the value. The group is enabled only in delta mode, the only mode that uses the variations.
Declared in src/app/dialogs/simulation_page.hpp:225
step_spins¶
std::array<QDoubleSpinBox* , 6> step_spins{}
Largest random change per second, core::simulation::Variation::step_per_second, of the same six variations in the same order as amplitude_spins.
Each is in the unit of its value per second, [0, 1000] with three decimals; 0 freezes the value.
Declared in src/app/dialogs/simulation_page.hpp:231
turn_rate_spin¶
QDoubleSpinBox* turn_rate_spin
Gain of the steering model, core::simulation::DeltaConfig::turn_rate_per_rudder_deg; [0, 100] degrees per minute of rate of turn per degree of rudder, with two decimals.
Declared in src/app/dialogs/simulation_page.hpp:235
max_rudder_spin¶
QDoubleSpinBox* max_rudder_spin
Largest rudder angle either side, core::simulation::DeltaConfig::max_rudder_angle_deg; [1, 90] whole degrees.
Declared in src/app/dialogs/simulation_page.hpp:238
destination_check¶
QCheckBox* destination_check
Whether the vessel has a destination; unticked means the seed destination core::model::VesselState::destination is std::nullopt.
Toggling it enables or disables the other four destination widgets.
Declared in src/app/dialogs/simulation_page.hpp:244
destination_name_edit¶
QLineEdit* destination_name_edit
Waypoint id, core::model::Destination::name; at most 16 characters, the length core::model::kMaxWaypointNameLength that the encoders send.
Empty is stored as WPT.
Declared in src/app/dialogs/simulation_page.hpp:247
destination_latitude_spin¶
QDoubleSpinBox* destination_latitude_spin
Latitude of the waypoint, positive north; [-90, 90] degrees with six decimals.
Declared in src/app/dialogs/simulation_page.hpp:249
destination_longitude_spin¶
QDoubleSpinBox* destination_longitude_spin
Longitude of the waypoint, positive east; [-180, 180] degrees with six decimals.
Declared in src/app/dialogs/simulation_page.hpp:251
arrival_radius_spin¶
QDoubleSpinBox* arrival_radius_spin
Radius of the arrival circle, core::model::Destination::arrival_radius_m; [1, 100000] whole metres.
Declared in src/app/dialogs/simulation_page.hpp:254
Private member functions¶
update_mode_widgets()¶
void update_mode_widgets()
Enables the track group in track mode, the replay group in replay mode and the drift group in delta mode, after the current index of mode_combo.
Connected to QComboBox::currentIndexChanged of mode_combo, and called by the constructor and by load.
Declared in src/app/dialogs/simulation_page.hpp:262 · defined in src/app/dialogs/simulation_page.cpp:283
browse_track()¶
void browse_track()
Asks the operator for a track file and puts the chosen path into track_path_edit.
The file dialog starts in the directory of the current path, a relative path taken from the profile's directory (AppSettings::dialog_directory), or in the documents folder when the field is empty, and offers *.gpx and *.kml files. Cancelling leaves the field unchanged. Connected to QPushButton::clicked of track_browse_button.
Declared in src/app/dialogs/simulation_page.hpp:269 · defined in src/app/dialogs/simulation_page.cpp:290
browse_log()¶
void browse_log()
Asks the operator for a log file and puts the chosen path into replay_path_edit.
The file dialog starts in the directory of the current path, a relative path taken from the profile's directory (AppSettings::dialog_directory), or in the documents folder when the field is empty, and offers *.log, *.nmea and *.txt files. Cancelling leaves the field unchanged. Connected to QPushButton::clicked of replay_browse_button.
Declared in src/app/dialogs/simulation_page.hpp:277 · defined in src/app/dialogs/simulation_page.cpp:300
Private data members¶
track_box_¶
QGroupBox* track_box_
The Track group, enabled only in track mode; owned by the page.
Declared in src/app/dialogs/simulation_page.hpp:280
replay_box_¶
QGroupBox* replay_box_
The Log replay group, enabled only in replay mode; owned by the page.
Declared in src/app/dialogs/simulation_page.hpp:282
drift_box_¶
QGroupBox* drift_box_
The Drift around the initial values group, enabled only in delta mode; owned by the page.
Declared in src/app/dialogs/simulation_page.hpp:285
profile_directory_¶
QString profile_directory_
Directory of the loaded profile's file, io::Profile::base_directory, against which the file dialogs resolve a relative track or log path; empty for a profile without a file.
Declared in src/app/dialogs/simulation_page.hpp:289