The Extension timedFuncConflicts()

The timed function extension "timedFuncConflicts()" is designed to discover call conflicts between two or more timed functions. It compares the given parameters to analyze all conflicts and returns the result times.

This function does not check any existing timed function data point but has to be filled with the appropriate parameters.

The function parameters contain:

  1. The parameter data of the timed function to be checked

  2. The duration how long the call of this function in each case could last (e.g. some vocal announcement)

  3. List of parameter data of the timed functions against which the first timed function is checked

  4. The list of durations for these timed functions parameters

For more parameter info see below.

The time stamps where the call of the first timed function would conflict with one of the others is then returned up to max_count.

Synopsis

int timedFuncConflicts(mapping dpValue, unsigned durValue,

dyn_mapping dpValueList, dyn_uint durValueList,

time from, time until, unsigned max_count,

dyn_dyn_time result);

Parameters

Parameter Meaning
dpValue A _TimedFunc parameter. Mapping indexed by _TimedFunc element names. See the documentation of timedFunc().
durValue Duration of one _TimedFunc parameter for intersection (in seconds).
dpValueList List of _TimedFunc parameters to be compared.
durValueList Duration of all events of the dpValueList (in seconds).
from Start searching from
until Search until
max_count Maximum of results counted over all indices.
result An array synchronized with a dpValueList mapping that contains conflicting time stamps per parameter entry.

Return value

0 if the function was executed successfully, otherwise -1.

Errors

EXAMPLE

 main()
{
  int rc;
  dyn_mapping p3;
  mapping p1;
  dyn_uint p4;
  dyn_dyn_time ret;
  /*planned start_times when WinCC OA timedFunc
  would trigger a (start)event that conflicts with one of the
  other _TimedFunc parameters given in the
  dpValueList.*/
  time p5, p6;
  /* set mapping according to element names and types of the data
  point
  type _TimedFunc */
  /* To use the function, use future dates */
  p1["validFrom"] = makeTime(2007, 10, 12, 10, 22);
  p1["validUntil"] = makeTime(2007, 10, 13, 10, 22);
  p1["delay"] = 0;//Delay of the work function = no delay
  p1["mode"] = 1; //Use the
  time periods mode
  p1["time"] = makeDynTime( makeTime(1970, 1, 1, 10, 22),
  makeTime(1970, 
  1, 1, 12, 22));//Time when the work function is called
  p1["weekDay"] = makeDynInt( -2, -2 );//Weekdays
  p1["monthDay"] = makeDynInt(); /* Day of the month. In this
  example 
  no specific day was specified and since the "monthDay" is empty,
  the 
  work functions are launched daily at the set times according to
  the 
  settings in "weekDay" */
  p1["month"] = makeDynInt(); /* The month. In this example no
  specific 
  month was specified and since the "month" is empty, the 
  work functions are launched daily at the set times according to
  the 
  settings in "weekDay" */
  p1["syncTime"] = -1;
  p1["syncWeekDay"] = -1;
  p1["syncDay"] = -1;
  p1["syncMonth"] = -1;
  /* Since the function uses mode 1, meaning time periods,
  synchronization is not used and the syncTime, syncWeekDay,
  syncDay and 
  syncMonth are all -1*/
  p1["interval"] = 10;//the timedFunc is called every 10
  minutes
  /* Changed values for timedFunc. These are the values that are 
  compared. Do the start times of timedFunc conflict with one of
  the 
  following parameters:*/
  p3[1] = p1;
  p3[1]["time"] = makeDynTime( 37320, 37380); // 10:22 - 10:25
  p3[2] = p1;
  p3[2]["time"] = makeDynTime( 37800, 37980); // 10:30 - 10:33
  p4 = makeDynUInt( 50, 100 );
  /*Duration of all events of the
  dpValueList*/
  p5 = makeTime(2007, 10, 5, 10, 22);/* Start searching from
  */
  p6 = makeTime(2007, 11, 6, 10, 22);/*Search until */
  rc = timedFuncConflicts(p1,2,p3,p4,p5,p6,22,ret);
  /* Function call with all parameters specified above. The
  duration of 
  one parameter in the dpValueList (timedFunc parameter list) is
  two 
  seconds */
  DebugN( rc, ret );
} 

Assignment

Miscellaneous functions

Availability

CTRL

Return value

timedFuncIntersect, Timed function extension and timedFuncEvents().