Timed function extension

The timed function was extended and now provides several new functions:

  • a function to check the function state

  • a function to remove a running timedFunc CtrlModule

  • a function to check two pairs of parameter settings (Schedule + duration) for coincidences within a given period.

  • a function to check the input parameters of the _TimedFunc structure

  • a function to return the number of start events

The new functions are described in the following:

timedFuncStatus

Checks the function state.

Synopsis

int timedFuncStatus(string work_func string func_datapoint);

Parameters

Parameter Meaning
work_func Name of the work function
func_datapoint Data point of type _TimedFunc

Return value

Return value Meaning
0 OK
-1 Initialization error (Parameter, module not found)
-2 Initialization still running (waits for answer of dpConnect)
-3 Data point configuration error
-5 func_datapoint elements not found (active function, internal)
-6 func_datapoint elements not found (maintenance, internal)

Errors

See above

Anmerkung: timedFunc() and timedFuncRemove() have to run in the same CONTROL manager!

Assignment

Miscellaneous functions

Availability

CTRL

timedFuncRemove

A function to remove a running timedFunc CtrlModule.

Synopsis

int timedFuncRemove(funcName, dpName);

Parameters

Parameter Meaning
funcName Name of the work function
dpName _TimedFunc data point

Return value

Return value Meaning
0 The function was executed successfully.
-1 Failure

Errors

See above

Anmerkung: timedFunc() and timedFuncRemove() have to run in the same CONTROL manager!

Assignment

Miscellaneous functions

Availability

CTRL

timedFuncIntersect

This function checks two pairs of parameter settings (data point + duration) for coincidences within a given period. The function returns up to a defined maxCount all coincidences where both WinCC OA ’r;_TimedFunc’ have overlapping periods.

Synopsis

dyn_time timedFuncIntersect(string dpA, int durA, string dpB, int durB, time startTime, time endTime, int maxCount);

Parameters

Parameter Meaning
dpA _TimedFunc data point A
durA Duration A
dpB _TimedFunc data point B
durB Duration B
startTime Start of the check period
endTime End of the check period
maxCount Maximum coincidences

Return value

Up to a defined maxCount all coincidences where both WinCC OA ’r;timedFunc’ have overlapping periods.

Errors

Description

This function only works with values in the future!

In case of very big queries (long period and high maxCount), the CTRL manager could be overloaded. Therefore, consider that you specify a meaningful period as well as maxCount.

example: Input:dpA: validfrom: 01.12.06 00:00

validuntil: 05.12.06 24:00

Interval: 60 minutes

duration_A 120 seconds

dpB validfrom 04.12.06 00:01

validuntil 08.12.06 23:01

Interval: 15 minutes

mode 1

start weekday: -2 (weekdays)

start time 17:01

end weekday -2 (weekdays)

end time 18:01

duration_B 30 seconds

start_Checkperiod 04.12.06 00:00

end_Checkperiod 05.12.06 24:00

maxCount 10

Returns:coincidences 04.12.06 17:01

04.12.06 18:01

05.12.06 17:01

05.12.06 18:01

Assignment

Miscellaneous functions

Availability

CTRL

timedFuncCheckParams

Checks whether a data point is suitable for the use in the timedFunc.

Synopsis

int timedFuncCheckParams(string dp);

Parameters

Parameter Meaning
dp The _TimedFunc data point

Return value

Return value Meaning
0 OK
-1 Initialization error (Parameter, module not found)
-3 Data point configuration error

Errors

Assignment

Miscellaneous functions

Availability

CTRL

timedFuncEventCount

The function checks on the basis of a suitable _TimedFunc data point fictitious how often the timedFunc would release a trigger.

Synopsis

int timedFuncEventCount(string dp);

Parameters

Parameter Meaning
dp Data point of type _TimedFunc

Return value

Return value Meaning
-1 Parameter error (e.g. the dateUntil is not set)
<number> Number of estimated triggers

Errors

See above

This function only works with values in the future!

Assignment

Miscellaneous functions

Availability

CTRL