Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat-add_new_conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
ThKindler committed Dec 8, 2023
2 parents 1208be6 + e169e48 commit 5aebb2c
Show file tree
Hide file tree
Showing 38 changed files with 1,062 additions and 405 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-library.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ jobs:
APAX_TOKEN: ${{ secrets.APAX_TOKEN }}
SIMATIC_AX_TOKEN: ${{ secrets.DEPLOY_KEY }}
with:
LOGIN_SIMATIC_AX: true
LOGIN_SIMATIC_AX: true
47 changes: 41 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@

## Description

This library provides some functions to convert Integer values to Strings and Strings to Integer values.
This library provides some functions to convert various data types and formats into other formats that are not covered by the built-in functionalities.

## Install this package tesxt
Currently, there are two categories:

- Converting integer values to Strings and Strings to Integer values
- Converting time formats from different systems

## Install this package

Enter:

Expand All @@ -20,15 +25,16 @@ apax add @simatic-ax/conversion
Simatic.Ax.Conversion;
Simatic.Ax.Conversion.Integer;
Simatic.Ax.Conversion.Strings;
Simatic.Ax.Conversion.Times;
```

## ConversionMode
## ConversionMode for strings

```iecst
NAMESPACE Simatic.Ax.Conversion
TYPE
ConversionMode : WORD (
NONE := WORD#16#0000,
NONE := WORD#16#0000,
FORCE_SIGN := WORD#16#0001
END_TYPE
END_NAMESPACE
Expand Down Expand Up @@ -74,6 +80,14 @@ Strings.ToInt(str : STRING, value => ULINT) : BOOL;

> Values > MAX ULINT will handled as MOD MAX_ULINT (MAX_ULINT = 18446744073709551615);
### Simotion Date and Time of Day <--> LDT

```iecst
LDateAndTimeToSimotionDateToD(SimaticTime : LDATE_AND_TIME, SimotionTime => DWORD, SimotionDate => DWORD);
SimotionDateToDToLDateAndTime(SimotionTime := DWORD, SimotionDate := DWORD) : LDATE_AND_TIME;
```

## Strings

### Strings.ToHex
Expand Down Expand Up @@ -147,20 +161,41 @@ Convert a String "[123, 456, 789]" to an ARRAY[*] OF LINT and returns the number
## TRUNC

TRUNC() round a floating number no the next DINT value downwards zo zero
TRUNC() round a floating number no the next DINT value downwards to zero

```iecst
TRUNC(value : LREAL) : DINT;
TRUNC(value : REAL) : DINT;
```

### Times

Convert the date and time of a SIMOTION system into the data type LDATE_AND_TIME (LDT) and back. The SIMOTION format is a structured data type consisting of two 32-bit values. For the sake of simplicity, they are interpeted as DWORD.

```iecst
NAMESPACE Simatic.Ax.Conversion.Times
TYPE
SimotionDateTime : STRUCT
SimotionTime : DWORD;
SimotionDate : DWORD;
END_STRUCT;
END_TYPE
END_NAMESPACE
```

|||
|-|-|
|SimotionTime : DWORD|Milliseconds that have passed on the current day|
|SimotionDate : DWORD|Days that have passed since 1992-01-01|
|SimaticTime : LDATE_AND_TIME|Nanoseconds that have passed since 1970-01-01-00:00:00.000|

## Contribution

Thanks for your interest in contributing. Anybody is free to report bugs, unclear documentation, and other problems regarding this repository in the Issues section or, even better, is free to propose any changes to this repository using Merge Requests.

## Markdownlint-cli

This workspace will be checked by the [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli) (there is also documented ho to install the tool) tool in the CI workflow automatically.
This workspace will be checked by the [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli) (there is also documented ho to install the tool) tool in the CI workflow automatically.
To avoid, that the CI workflow fails because of the markdown linter, you can check all markdown files locally by running the markdownlint with:

```sh
Expand Down
Loading

0 comments on commit 5aebb2c

Please sign in to comment.