System functions#
GetSecondCounterF#
- GetSecondCounterF(x:=0)#
This function may be used for delays.
- Parameters:
x (INT) –
- Return type:
UDINT
- Returns:
Cumulative seconds counter, 0 seconds is 1.1.1970 00:00:00
GetSystemStatusF#
- GetSystemStatusF(Mode:=Operation, iParameter:=xxx, rParameter:=yyy)#
Return value that is selected with parameters.
Many times you pass these value to user interface using points.
- Example:
Pass GSM signal strength to point.
VAR SignalLevel : REAL; Result : INT; END_VAR SignalLevel := GetSystemStatusF(Mode:=5); Result := SetAnalogPointF(Value:=SignalLevel, LockState:=1, Name:='POINTNAME');
- Parameters:
Mode (INT) –
Selected value to return.
iParameter (INT) – Only use when Mode needs this.
rParameter (REAL) – Only use when Mode needs this.
- Mode=1:
I/O module communication errors.
- iParameter=0:
Returns sum of errors of all modules. Used to generate common alarm for I/O modules.
- iParameter=1..63:
Returns error status of specific module. Used to create separate alarm for each module.
- rParameter=0.0:
Check all ports
- rParameter=1.0..10.0:
Check selected port
- Mode=2:
Sensor errors of measurement points.
If every measurement value is inside range of conversion table returns 0. If any measurement is out of range returns module and point number of last of faulty points. Returned value is in format 100*ModuleNumber+PointNumber.
Note
Error check is made only for points that are in LockState ‘Auto’
- example:
Sensor error alarm
VAR SensorFail : REAL; Alarm : INT; Result : INT; END_VAR (* Returns address of faulty sensor or 0 is everything Ok *) SensorFail := GetSystemStatusF(Mode:=2, iParameter:=0, rParameter:=0.0); (* Convert returned value to value 0/1 *) Alarm := BOOL_TO_INT(SensorFail > 0.0 ); (* Set state of alarm point *) Result := SetDigitalPointF(Value:=Alarm , LockState:=1, Name:='NAME_OF_ALARM_POINT');
- Mode=3:
Amount of free memory in substation (kilobytes).
- Mode=4:
Amount of free disk space in substation (kilobytes).
- Mode=5:
Signal level of GSM modem.
- Mode=6:
Week number.
- Mode=9:
Hardware CPU program version.
- Mode=10:
Battery voltage.
- Mode=11:
Supply voltage.
- Mode=12:
Backup capacitor voltage.
- Mode=20:
CPU frequency (MHz)
- Mode=21:
CPU module temperature.
- Mode=22:
CPU core temperature.
- Mode=23:
GSM modem reset counter. Cleared at start up.
SunClockFB#
- SunClockFB()#
Read sun clock values from substation to iec program.
If you are north from polar circle sun does not rise or set in every day. This is indicated so that “SunRiseMinutes” and “SunsetMinutes” are both 0 and “IsSunUp” tells whether sun is up or not.
- Parameters:
SunRiseMinutes (INT - output) – Sun rise time in minutes since start of day.
SunsetMinutes (INT - output) – Sun set time in minutes since start of day.
IsSunUp (INT - output) – value=1 when sun is up, 0 otherwise
- Example:
Get hours and minutes when sun rise
VAR SunClock : SunClockFB; RiseHours : REAL; RiseMinutes : REAL; END_VAR SunClock(); RiseHours := SunClock.SunRiseMinutes / 60; RiseMinutes := SunClock.SunRiseMinutes mod 60;
SystemTimeFB#
- SystemTimeFB()#
Get time of the substation.
- Parameters:
SystemTic (UDINT - output) – Time in milliseconds since substations was started, Note possible overflow.
Year (INT - output) –
Month (INT - output) –
DayOfMonth (INT - output) –
DayOfWeek (INT - output) –
Hour (INT - output) –
Minute (INT - output) –
Second (INT - output) –