modelGpsPy

A GPS module spontaneously pushes its position frames; the microcontroller counts them without ever asking for anything

Extends from Modelica.Icons.Example (Icon for runnable examples).

Information

The mirror of Examples.Uart.Sensor: here the device speaks first and waits for no question.

Consequence on the embedded program side: reception never wakes it up (no uart.irq()), so it must poll its input with uart.any() in a loop, sleeping between two passes. A program that forgot to sleep would prevent simulated time from moving forward; a program that slept too long would miss frames — both defects show up immediately when running, which makes it a useful test bench to validate a polling strategy before porting it to the target.

The module is in Script mode (gps.behaviour = Script): Device/gps.py produces complete NMEA RMC sentences — UTC time, hemispheres, checksum —, which the command table cannot do. The microcontroller program checks each checksum, exactly like the embedded code of a real receiver. The script also keeps a counter of transmitted sentences, published on gps.valueOut[1].

The latitude is a ramp: successive sentences differ, which lets you check at a glance in the log that the stream is really alive and not repeated.

Components

TypeNameDefaultDescription
MCUmcuscriptPath = Resources/Scripts/MCU/uart_gps.py
MicroPythonMCU.Peripherals.UartGpsModulegpsTransmits an NMEA RMC sentence every 100 ms, without being asked - behaviour described by Resources/Scripts/Device/gps.py
Modelica.Blocks.Sources.RamplatitudeThe position changes: successive frames are not identical
Modelica.Blocks.Sources.Constantlongitude
Modelica.Blocks.Sources.Constantspeed
Modelica.Electrical.Analog.Basic.Groundground