# LGF_GpsDDToGps (FC / 3.0.2)

Overview

Author: Siemens Digital Industry

## Short description

This function converts a given GPS-DD data type (decimal degrees) into a GPS data type (direction, degrees, minutes, and seconds).

GPS decimal degree to GPS "native".

### Block Interface

| LGF_GpsDDToGps (FC) |
--- | --- | ---
LGF_typeGPS_DD |  |  | gps |  | Ret_Val |  |  | LGF_typeGPS
|  |  |  |  | error |  |  | Bool
|  |  |  |  | status |  |  | Word

### Input parameter

Identifier | Data type | Description
--- | --- | ---
gps | LGF_typeGPS_DD | GPS-Data to be converted (decimal degrees), e.g. 52.520817 13.40945

### Output parameter

Identifier | Data type | Description
--- | --- | ---
Ret_Val | LGF_typeGPS | Converted GPS-Data (direction, degrees, minutes, and seconds), e.g. N52° 31′ 14.941″ E13° 24′ 34.020″
error | Bool | FALSE: No error TRUE: An error occurred during the execution of the FB
status | Word | 16#0000-16#7FFF: Status of the FB 16#8000-16#FFFF: Error identification (see following Table)

### Status & Error codes

Code / Value | Identifier / Description
--- | ---
16#0000 | STATUS_EXECUTION_FINISHED_NO_ERROR Execution finished without errors
16#8201 | ERR_LATITUDE_VALUE Error: Latitude Value
16#8203 | ERR_LONGITUDE_VALUE Error: Longitude Value

## User defined datatype(s)

### LGF_typeGPS_DD (UDT / V3.0.1)

Datatype for GPS Coordinates in decimal degrees.
For latitude and longitude.
Datatype for a whole GPS Data set.

Identifier | Data type | Default value | Description
--- | --- | --- | ---
latitude | Real | 0.0 | Degrees latitude with decimal places (Unit: degree decimal), North = positive; South = negative) valid value range [-90.00000..90.00000]
longitude | Real | 0.0 | Degrees longitude in degrees with decimal places (Unit: degree decimal), East = positive; West = negative) valid range [-180.0000..180.0000]

### LGF_typeGPS (UDT / V3.0.1)

Datatype for GPS Coordinates Latitude and Longitude.
Child Datatypes in Degree, Minutes, Seconds and the Direction.
Datatype for a whole GPS Data set.

Identifier | Data type | Default value | Description
--- | --- | --- | ---
latitude | LGF_typeGPS_DMS | --- | Latitude child element
longitude | LGF_typeGPS_DMS | --- | Longitude child element

### LGF_typeGPS_DMS (UDT / V3.0.1)

Datatype for GPS Coordinates in Degree, Minutes, Seconds and the Direction.
Can be used for latitude and as well for longitude.
The Datatype is used e.g. in `LGF_typeGPS`.

Identifier | Data type | Default value | Description
--- | --- | --- | ---
dir | Char | '' | Direction [N, S, E, W, n, s, e, w]
deg | UInt | 0 | Degrees, Latitude [-89..+ 89]; Longitude [-179..+179]
min | UInt | 0 | Minutes [0..+59]
sec | UInt | 0 | Seconds [0..+59]

## Change log

Version & Date | Change description
--- | ---
| 1.0.0 | SIMATIC Systems Support
| 2019.09.11 | First released version
| 3.0.0 | Siemens Industry Support
| 2019.04.23 | Set version to V3.0.0 harmonize the version of the whole library
| 3.0.2 | Simatic Systems Support
| 20.01.2021 | Fix `tempStatus` initialization Insert documentation