Next: , Previous: , Up: Adaptive Probabilistic Mapping   [Contents][Index]

### 2.4 Incrementing Time

There are two types of time associated with an actor.

The actor tracks discrete time equal to the number of input signals received plus the number of output signals emitted by the actor since the beginning of its operation. The actor normally uses discrete time when calculating probabilities of output signals choice.

The actor can also track continuous time equal to a logical period of time the event history occupies since the start of actor operation. The actor can use continuous time to compute spur increment velocities when calculating probabilities of output signals choice.

Use the function described below to convey information to an actor that a period of continuous time has passed in event history, assuming the actor did not receive input signals during this period. If there are input signals to receive during this period with appropriate output signals to be emitted, split the period into segments containing no input signals to receive and call this function for every such segment in the right order. Between these calls, call appropriate Actor API functions to convey the input signals to the actor and generate output signals.

Function: int qsmm_actor_time_delta (qsmm_actor_t actor, double time_delta)

This function increments by time_delta the value of continuous time associated with an actor specified by handle actor.

On success, the function returns a non-negative value. If time_delta is not a finite number or if the incremented value of continuous time becomes non-finite or negative, then no increment will be performed, and the function will return negative error code `QSMM_ERR_INVAL`.

Use the following function to get the current value of continuous time associated with an actor.

Function: double qsmm_get_actor_continuous_time (qsmm_actor_t actor)

This function returns the value of continuous time associated with an actor specified by handle actor. The returned value is always finite and non-negative.

Use the following functions to get or set the value of discrete time associated with an actor.

Function: long qsmm_get_actor_discrete_time (qsmm_actor_t actor)

This function returns the value of discrete time associated with an actor specified by handle actor.

Function: void qsmm_set_actor_discrete_time (qsmm_actor_t actor, long tmd)

This function sets the value of discrete time associated with an actor specified by handle actor. Argument tmd specifies that value.

The following enumeration specifies a type of time used by a small actor when calculating spur increment velocity.

Enumeration: qsmm_time_e

This enumeration specifies a type of time. It contains the following elements.

`QSMM_TIME_DISCRETE`

Discrete time.

`QSMM_TIME_CONTINUOUS`

Continuous time.

By default, a large actor uses continuous time when calculating spur increment velocities. However, if a small actor associated with the large actor implicitly uses the automatic spur, the small actor calculates its increment velocity based on discrete time by default. See Automatic Spur, for a description of the concept of automatic spur. See Creating an Actor, for a description of structure `qsmm_actor_large_desc_s` containing the field that controls the use of the automatic spur by a small actor associated with the large actor.

Use the following functions to get or set the type of time for calculating the increment velocity of the spur of a particular type by a small actor.

Function: int qsmm_get_actor_spur_time (qsmm_actor_t actor, int spur_type, enum qsmm_time_e *time_type_p)

If time_type_p is not `NULL`, this function sets *time_type_p equal to the type of time used for calculating spur increment velocity by an actor. Argument actor specifies the handle of the actor. Argument spur_type specifies the type of the spur for calculating the increment velocity. Spur types have zero-based indices.

The function returns a non-negative value on success or a negative error code on failure. Currently, the following error codes can be returned.

`QSMM_ERR_INVAL`

The value of spur_type is negative or is greater than or equal to the number of spur types specified when creating the actor.

`QSMM_ERR_NOTSUP`

The actor is the large one.

Function: int qsmm_set_actor_spur_time (qsmm_actor_t actor, int spur_type, enum qsmm_time_e time_type)

This function sets the type of time used for calculating spur increment velocity by an actor. Argument actor specifies the handle of the actor. Argument spur_type specifies the type of the spur for calculating the increment velocity. Spur types have zero-based indices. Argument time_type specifies the type of time. When the value of time_type does not match any valid element of enumeration `qsmm_time_e`, behavior of the actor is undefined.

The function returns a non-negative value on success or a negative error code on failure. Currently, the following error codes can be returned.

`QSMM_ERR_INVAL`

The value of spur_type is negative or is greater than or equal to the number of spur types specified when creating the actor.

`QSMM_ERR_NOTSUP`

The actor is the large one.

The function `qsmm_actor_create` initializes types of time for all spur types of a newly created small actor to `QSMM_TIME_CONTINUOUS`.

Next: , Previous: , Up: Adaptive Probabilistic Mapping   [Contents][Index]