Signal definition examples for NMEA type¶
In the examples below, signal definitions that convert NMEA data into physical values are registered.
We assume that we have data as shown below, whose address field is GPRMC:
$GPRMC,085120.307,A,3541.1493,N,13945.3994,E,000.0,240.3,181211,,,A*6A
Index |
Value example |
Meaning |
|---|---|---|
0 |
085120.307 |
Time in UTC |
1 |
A |
Status (A = Valid) |
2 |
3541.1493 |
Latitude |
3 |
N |
North/South |
4 |
13945.3994 |
Longitude |
5 |
E |
East/West |
6 |
000.0 |
Speed over ground |
7 |
240.3 |
Course over ground |
8 |
181211 |
Date in UTC |
9 |
(blank) |
Magnetic variation, degrees |
10 |
(blank) |
Magnetic variation, east/west |
11 |
A |
Mode (A = Autonomous) |
12 |
*6A |
Checksum |
In the following sections, we will register signal definitions to retrieve latitude and longitude from data in the above format.
Overview of the signal definitions¶
Item |
Setting contents |
|---|---|
Type of time series data to be converted |
|
Conversion to be applied |
Register signal definitions¶
Create an access object for signal definitions.
import intdash
client = intdash.Client(
url = "https://example.intdash.jp",
edge_token = "your_token",
)
sig = client.signals
Register each signal definition as shown below.
Latitude ( index=2 )
s = sig.create(
label="GNRMC_LAT",
data_type=intdash.DataType.nmea,
data_id='GNRMC',
channel=1,
conversion=intdash.ConversionCSV(
delimiters=[','],
index=2,
value_type='str'
),
display=intdash.Display(
unit='',
min=0,
max=360,
format='%s',
),
)
Longitude ( index=4 )
s = sig.create(
label="GNRMC_LNG",
data_type=intdash.DataType.nmea,
data_id='GNRMC',
channel=1,
conversion=intdash.ConversionCSV(
delimiters=[','],
index=4,
value_type='str'
),
display=intdash.Display(
unit='',
min=0,
max=360,
format='%s',
),
)