OSCAT BASIC Datatypes - RWTH-EBC/AixOCAT GitHub Wiki

3. Data types of the OSCAT Library

Die OSCAT Bibliothek defniert neben den Standard Datentypen weitere
Datentypen. Diese werden innerhalb der Bibliothek verwendet, können
aber jederzeit von Anwender für eigene Deklarationen verwendet werden.
Ein Löschen oder verändern von Datentypen kann dazu führen das Teile
der Bibliothek sich nicht mehr kompilieren lassen.

3.1. CALENDAR

A variable type CALENDAR can be used for to provide modul wide calendar
data. In the section date and time functions are various functions to upda-
te the calendar continuously.
*.UTC: DT Universal world time
*.LDT: DT Local time
*.LDate: DATE Local date
*.LTOD: TOD Local time of day
*.YEAR: INT Local year
*.MONTH: INT Local months
*.DAY: INT Local days
*.WEEKDAY: INT Local weekday
*.OFFSET: INT Ofset of local time to universal time in mi-
nutes
*.DST_EN: BOOL Daylight saving time Enable
*.DST_ON: BOOL Daylight saving time is On
*.NAME: STRING (5) Time zone name
*.LANGUAGE : INT Language (See Language Setup)
*.LONGITUDE: REAL Longitude of the place
*.LATITUDE: REAL Latitude of the place
*.SUN_RISE: TOD Time of sunrise (LTC)
*.SUN_SET: TOD Time of sunset (LTC)
*.SUN_MIDDAY: TOD World time when the Sun stands in the
south (LTC)
*.SUN_HEIGTH: REAL the highest altitude of the sun on the hori-
zon
*.SUN_HOR: REAL Horizontal solar altitude in degrees from
north
*.SUN_VER: REAL Vertical position of the sun above the hori-
zon
*.NIGHT: BOOL TRUE if night
*.HOLIDAY: BOOL TRUE if holiday
*.HOLY_NAME : STRING (30) Name of the holiday
*.WORK_WEEK: _ INT current work week

3.2. COMPLEX

The COMPLEX structure can present complex numbers.
*.RE ( Real part of a complex number)
*.IM Imaginary part of a complex number)

3.3. CONSTANTS_LANGUAGE.

This structure defnes diferent languages as String Constants. The varia-
ble LANGUAGE of the global variables list provides itself in the library.
*. DEFAULT: INT: = 1 defnes the default Language
(1 = English, 2 = German, 3 = French)
The Default Language is always used when the language 0 is called. If the
language setting > 0 then the corresponding language is selected.
Language setting: 0 (the default language specifed in DEFAULTis used
(1 = English, 2 = German 3 = French)
other languages are defned by expanding the structure CONSTANTS_LAN-
GUAGE.
*.LMAX: INT:= 3 specifes how many languages are available
*.WEEKDAYS: ARRAY[13, 17] OF STRING(10):= ' Monday','Tuesday'
'Wednesday','Thursday','Friday','Saturday','Sunday','Monday',
'Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday';
*.WEEKDAYS2: ARRAY[13, 17] OF STRING(2):=
'Mo','Tu','We','Th','Fr','Sa','Su',
'Mo','Di','Mi','Do','Fr','Sa','So';
*.MONTHS: ARRAY[13, 112] OF STRING(10):= 'January','February',
'March','April','May','June','July','August','September','October', 'N
ovember','December',
'January','February','March','April','May','June','July','August',
'September','October','November','December';
*.MONTHS3:ARRAY[13, 112] OF STRING(3):=
'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec',
'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','October','Nov','Dec';
*.DIRS:ARRAY[13,015] OF STRING(3):='N','NNE','NE','ENE','E',
'ESE','SE','SSE','S','SSW','SW','WSW','W','WNW','NW','NNW'
'N','NNE','NO','ENE','O','OSO','SO','SSO','S','SSW','SW','WSW'
'W','WNW','NW','NW';

3.4. CONSTANTS_LOCATION

This structure defnes location-dependent constants. The variable LOCATI-
ON of the global variable list places it in the library.
*.DEFAULT: INT:= 1
(1 = Germany, 2 = Austria, France 3 =, 4 = Belgium-German,
5 = Italy, South Tyrol).
*.LMAX: INT:= 3 indicates how many places are defned.
*.LANGUAGE : ARRAY[15] of INT := 2,2,3,2,2;
for each location, the language is defned.

3.5. CONSTANTS_MATH

This structure defnes mathematical constants. The variable MATH from
the global variables list places it in the library.
*.PI: REAL:= 3.14159265358 Circle number PI
*.PI2: REAL:= 6.28318530717 Circle number PI * 2
*.PI4: REAL:= 12.566370614359 Circle number PI * 4
*.PI05: REAL:= 1.5707963267949 Circle number PI / 2
*.PI025: REAL:= 0.785398163397448 Circle number PI / 4
*.PI_INV: REAL:= 0.318309886183791 1 / PI
*.E: REAL:= 2.718281828459045235 Euler's constant e
*.E_INV:= 0.367879441171442 1 / e
*.SQ2: REAL:= 1.4142135623731 Root of 2
*.FACTS: ARRAY[012] of DINT Faculties 0-12

3.6. CONSTANTS_PHYS

This structure defnes physical constants. The structure PHYS of the global
variable list places it in the library.
*.C: REAL:= 299792458 Speed of light in m/s
*.E: REAL:= 1.60217653E-19 Elementary charge in coulombs = A * s
*.G to REAL:= 9.80665 Gravitational acceleration in m / s ²
*.T0: REAL:= -273.15 absolute zero in °C
*.RU: REAL:= 8.314472 Universal gas constant in J / (mol * K)
*.PN: REAL:= 101325 Normal pressure Pa

3.7. CONSTANTS_SETUP

This structure defnes location-dependent constants. The variable SETUP
the global variables list places it in the library.
*.EXTENDED_ASCII: BOOL:= TRUE extends the ASCII character set to
special characters eg ÄÖÜ
*.CHARNAME[14]: STRING(253) stores Unicode character names
*.MTH_OFS: ARRAY[112] OF INT:= 0, 31, 59, 90, 120, 151, 181, 212,
243, 273, 304, 334;
MTH_OFS is used in various date functions, the array represents the re-
spective current day ofset for the months of the year. The 1 February of a
year eg is the day 31 + 1
*.DECADES: ARRAY[08] OF REAL:= 1,10,100,1000,10000,100000,
1000000,10000000,100000000;

3.8. ESR_DATA

The structure ESR_DATA is used for Error and Status Reporting modules.
*.TYP : BYTE Data Type
*.ADRESS : STRING(10) Adress designation
*.DS : DT Date / time stamp
*.TS : TIME Timestamp in milliseconds
*.DATA : ARRAY[07] OF BYTE Data packet

3.9. FRACTION

The data type FRACTION can be used to represent a fraction.
*.NUMERATOR : INT Numerator of the fraction (numerator)
*.DENOMINATOR : INT Denominator of the fraction (Denumerator)

3.10. HOLIDAY_DATA

The structure HOLIDAY_DATA is used to defne and describe holidays.
*.NAME : STRING(30) Name of the holiday
*.DAY : SINT Day of public holiday
*.MONTH : SINT Month of the holy day
*.USE : SINT activates the holyday (0=of, 1=on)
The structure is used by modules Calendar_calc and HOLYDAY by using a
array of type HOLYDAY_DATA for defnition of the annual holydays
There are 3 diferent types of defnitions:
Day 1-.31, MONTH 112, USE 1 (public holiday on a fxed date)
DAY ±X , MONTH, 0, USE 1 (holiday is X days before or after Easter)
Day 131, MONTH 112, USE -7 - 1 (public holiday on a weekday before
a date, herein is -1 Monday and -7 Sunday.
Examples:
(NAME:= 'New Year', Day:= 1, MONTH:= 1, USE:= 1) holiday with a fxed
date USE = 1 means it is active.
(NAME:= 'New Year', Day:= 1, MONTH:= 1, USE:= 1) holiday with a fxed
date USE = 0 means it is not active.
(NAME:= 'Karfreitag', DAY:= -2, MONTH:= 0, USE: = 1) holiday with a fxed
ofset from Easter Sunday, in this case, the Good Friday 2 days before Eas-
ter Sunday.
(NAME:= 'Buss und Bettag ", DAY:= 23, MONTH:= 11, USE: = -3) holiday
on the last Wednesday before the 23.11.yyyy of a year.
examples of holyday defnitions:
Array of Bavarian Holidays
HOLIDAY_DE: ARRAY [029] OF HOLIDAY_DATA:= (name:= 'New Year', day:= 1, month: = 1, use: = 1).
(Name:= 'Three Kings', Day:= 6, month:= 1 use:= 1),
(Name: = 'Good Friday', day:= -2, month: = 0, use: = 1),
(Name:= 'Easter Sunday', day:= 0, month:= 0, use:= 1),
(Name:= 'Easter Monday', day:= 1, month:= 0, use:= 1),
(Name:= 'Labor Day', day:= 1, month:= 5, use:= 1),
(Name:= 'Ascension', day:= 39, month:= 0, use:= 1),
(Name:= 'Pentecost', day:= 49, month:= 0, use:= 1)
(Name:= 'Easter Sunday', day:= 0, month:= 0, use:= 1)
(Name:= 'Corpus Christi', day:= 60, month:= 0, use:= 1)
(Name:= 'Peace of Augsburg', day:= 8, month:= 8, use:= 0)
(Name:= 'Assumption', day:= 15, month:= 8, use:= 1)
(Name:= 'Day of German Unity', day:= 3, month:= 10, use:= 1)
(Name:= 'Reformation', day:= 31, month:= 10, use:= 0)
(Name:= 'All Saints' Day:= 1, month:= 11, use:= 1)
(Name:= 'Buss und Bettag', day:= 23, month: = 11, use:= 0)
(Name:= '1. Christmas Day', day:= 25, month:= 12, use:= 1)
(Name:= '2. Christmas day ', day:= 26, month: = 12, use:= 1)
Array of Austrian Holidays
HOLIDAY_AT: ARRAY [029] OF HOLIDAY_DATA:= (name:= 'New Year', day:= 1, month:= 1, use:= 1).
(Name:= 'Three Kings', Day:= 6, month:= 1 use:= 1),
(Name: = 'Good Friday', day:= -2, month: = 0, use: = 1),
(Name:= 'Easter Sunday', day:= 0, month:= 0, use:= 1),
(Name:= 'Easter Monday', day:= 1, month:= 0, use:= 1),
(Name:= 'Ascension', day:= 39, month:= 0, use:= 1),
(Name:= 'Pentecost', day:= 49, month:= 0, use:= 1)
(Name:= 'Easter Sunday', day:= 0, month:= 0, use:= 1)
(Name:= 'Corpus Christi', day:= 60, month:= 0, use:= 1)
(Name: ='', day: = 8, month: = 8, use: = 0)
(Name:= 'Assumption', day:= 15, month:= 8, use:= 1)
(Name:='', day:= 3, month:= 10, use:= 0)
(Name:='', day:= 31, month:= 10, use:= 0)
(Name:= 'All Saints' Day:= 1, month:= 11, use:= 1)
(Name:= 'Immaculate Conception', day:= 8, month:= 12, use:= 1)
(Name:= '1. Christmas Day', day:= 25, month:= 12, use:= 1)
(Name:= '2. Christmas day ', day:= 26, month: = 12, use:= 1)
French Holidays
HOLIDAY_FR: ARRAY [029] OF HOLIDAY_DATA := (name: = 'Nouvel an', day:= 1, month:= 1, use:= 1)
(Name:= 'St Valentine', day:= 14, month:= 2, use:= 0)
(Name:= 'Vendredi Saint (alsace)', day:= -2, month:= 0, use:= 0)
(Name:= 'Dimanche de Pâques ", day:= 0, month:= 0, use:= 1)
(Name:= 'Lundi de Pâques', day:= 1, month:= 0, use:= 1)
(Name:= 'Jeudi de Ascension', day:= 39, month:= 0, use:= 1)
(Name:= 'dimanche de Pentecôte', day:= 49, month:= 0, use:= 1)
(Name:= 'jeudi de la Trinité', day:= 60, month:= 0, use:= 0)
(Name:= 'Fête du Travail ", day:= 1 month:= 5, use:= 1)
(Name:= 'Victoire 1945', day:= 8, month:= 5, use:= 1)
(Name:= 'Prise de la Bastille', day:= 14, month:= 7, use:= 1)
(Name:= '15 Août 1944 ', day:= 15, month:= 8, use:= 1)
(Name:= 'Halloween', day:= 31, month:= 10, use:= 0)
(Name:= 'Armistice 1918', day:= 11, month:= 11, use:= 1)
(Name:= 'Noël', day:= 25, month:= 12, use:= 1)
(Name:= 'Saint Etienne (Alsace)', day:= 26, month:= 12, use:= 0)
(Name:= 'Fête de la musique', day:= 21, month:= 6, use:= 0)
Belgium german language
HOLIDAY_BED: ARRAY [029] OF HOLIDAY_DATA:=1) (Name:= 'New Year', day:= 1, month:= 1, use:=
(Name:= 'Easter Sunday', day:= 0, month:= 0, use:= 1),
(Name:= 'Easter Monday', day:= 1, month:= 0, use:= 1),
(Name:= 'Labor Day', day:= 1, month:= 5, use:= 1),
(Name:= 'Ascension', day:= 39, month:= 0, use:= 1),
(Name:= 'Pentecost', day:= 49, month:= 0, use:= 1)
(Name:= 'Easter Sunday', day:= 0, month:= 0, use:= 1)
(Name:= 'national day', day:= 21, month:= 7, use:= 1)
(Name:= 'Assumption', day:= 15, month:= 8, use:= 1)
(Name:= 'All Saints' Day:= 1, month:= 11, use:= 1)
(Name:= 'DG holiday', day:= 15, month:= 11, use:= 1)
(Name:= 'Christmas Eve', day:= 24, month:= 12, use:= 1)
(Name:= '1. Christmas Day', day:= 25, month:= 12, use:= 1)
(Name:= '2. Christmas day ', day:= 26, month: = 12, use:= 1)
(Name:= 'New Year', day:= 31, month:= 12, use:= 1);
South Tyrol, italy
HOLIDAY_DE: ARRAY [029] OF HOLIDAY_DATA:= (name:= 'New Year', day:= 1, month:= 1, use:= 1).
(Name:= 'Three Kings', Day:= 6, month:= 1 use:= 1),
(Name:= 'Easter Sunday', day:= 0, month:= 0, use:= 1),
(Name:= 'Easter Monday', day:= 1, month:= 0, use:= 1),
(Name:= 'tday to be exempted in Italy', day:= 25, month:= 4, use:= 1)
(Name:= 'Labor Day', day:= 1, month:= 5, use:= 1),
(Name:= 'Pentecost', day:= 49, month:= 0, use:= 1)
(Name:= 'Easter Sunday', day:= 0, month:= 0, use:= 1)
(Name:= 'Day of the Republic of Italy', day:= 2, month:= 6, use:= 1)
(Name:= 'Assumption', day:= 15, month:= 8, use:= 1)
(Name:= 'All Saints' Day:= 1, month:= 11, use:= 1)
(Name:= 'Immaculate Conception', day:= 8, month:= 12, use:= 1)
(Name:= 'Christmas Eve', day:= 24, month:= 12, use:= 1)
(Name:= '1. Christmas Day', day:= 25, month:= 12, use:= 1)
(Name:= '2. Stephen day', day:= 26, month:= 12, use:= 1); *)

3.11. REAL2.

The structure of REAL2 simulates on systems without LREAL a foating
point value double precision. but with restrictions and only with special
functions.
*.R1 : REAL Roughly double the number of
*. RX: REAL Fine part of the double number

3.12. SDT.

The structure for SDT defnes a structured time-date format.
*.YEAR: INT Year
*.MONTH: INT Month
*. DAY: IN T Day
WEE *. KDAY: INT Week (1 = Monday, 7 = Sunday)
*. HOUR: INT Hours
*. MINUTE: INT Minutes
*. SECOND: INT Seconds
*. MS: INT Milliseconds

3.13. TIMER_EVENT

The structure TIMER_EVENT defnes and stores defaults for timers and
events.
*.TYP : BYTE Event Type
*.CHANNEL : BYTE Channel
*.DAY : BYTE Day or days
*.START : TOD Start time
*.DURATION : TIME Duration
*.LAND : BYTE Logical AND
*.LOR : BYTE Logical OR
*.LAST : DT last activity of the event

3.14. VECTOR_3.

The Structure VECTOR_3 stores the three vectors of a three-dimensional
vector space.
*.X : REAL component in x direction
*.Y : REAL Component in Y - direction
*.Z : REAL Component in Z - direction