Next: , Previous: , Up: Repeated Sequence of Operations   [Contents][Index]


2.5.2 Incrementing Time

There are two types of time associated with an actor: discrete time and continuous time.

The actor uses discrete time to calculate the number of output signals emitted within an event history segment. The functions qsmm_actor_shl_sig, qsmm_actor_reg_sig_in, and qsmm_actor_reg_sig_action increment discrete time by 1. The function qsmm_actor_shr_sig decrements discrete time by 1. The functions qsmm_get_actor_naction_per_evt and qsmm_set_actor_naction_per_evt retrieve and set a multiplier for converting discrete time to the number of output signals emitted.

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

Use the function described below to convey to an actor information that a period of continuous time passed in the event history. The actor should not receive input signals during this period. If there are input signals to receive, split the period into segments containing no input signals to receive and call this function for every such segment in consecutive order. Between those calls, call appropriate API functions to convey the input signals to the actor and emit output signals.

Function: int qsmm_actor_time_delta (qsmm_actor_t actor, double time_delta)

This function increments by time_delta continuous time associated with an actor.

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

QSMM_ERR_INVAL

The argument time_delta is not finite, or incremented continuous time would be negative.

QSMM_ERR_INFIN

Incremented continuous time would be positive infinity.

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. A returned value is always finite and non-negative.

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

Function: long qsmm_get_actor_discrete_time (qsmm_actor_t actor)

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

Function: void qsmm_set_actor_discrete_time (qsmm_actor_t actor, long tmd)

This function sets to tmd the value of discrete time associated with an actor.

The following enumeration specifies a type of time used by a small actor for 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, an actor uses continuous time for calculating spur increment velocities, with the exception that a small actor associated with a large actor uses discrete time to calculate the increment velocity of automatic spur. See Automatic Spur, for more information on the concept of automatic spur.

Use the following functions to query or set the type of time for calculating the increment velocity of 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 for calculating the increment velocity of spur of spur_type type by a small actor. Spur types have zero-based indices.

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

QSMM_ERR_INVAL

The argument spur_type is negative or greater than or equal to the number of spur types specified in the field nspur of qsmm_actor_desc_s structure 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 to time_type the type of time for calculating the increment velocity of spur of spur_type type by a small actor. Spur types have zero-based indices. The values of time_type not matching to the elements of qsmm_time_e enumeration lead to undefined actor behavior.

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

QSMM_ERR_INVAL

The argument spur_type is negative or greater than or equal to the number of spur types specified in the field nspur of qsmm_actor_desc_s structure when creating the actor.

QSMM_ERR_NOTSUP

The actor is the large one.

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


Next: , Previous: , Up: Repeated Sequence of Operations   [Contents][Index]