Next: , Up: Executing a Multinode Model   [Contents][Index]


4.3.1 Incrementing Time and Spur

Use the following function to convey to the instance of a multinode model information about passing a continuous time period.

Function: int qsmm_time_delta (qsmm_t model, double time_delta)

This function increments by time_delta continuous time tracked by the environment state identification engine and instruction emitting engine of a multinode model.

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 tracked by an engine would be negative.

QSMM_ERR_INFIN

Incremented continuous time tracked by an engine would be positive infinity.

QSMM_ERR_UNTIMELY

The model instance does not exist.

If the environment state identification engine is a small actor, spur types supported by a multinode model have zero-based indices. By default, spur type 0 is the automatic spur, and only the environment state identification engine (not the instruction emitting engine) uses it. Ordinarily, you do not increment the automatic spur directly.

If the environment state identification engine is a large actor, the model supports special spur type -1 for the automatic spur of a small actor associated with the large actor. Ordinarily, you do not increment that automatic spur directly.

Spur type i of a multinode model corresponds to spur type i of the environment state identification engine. The instruction emitting engine has the number of supported spur types equal to the number of spur types specified when creating the model minus 1. If i>0, spur type i of the model corresponds to spur type i-1 of the instruction emitting engine.

Use the following function to increment spur with a specific type for a model instance.

Function: int qsmm_spur_delta (qsmm_t model, int spur_type, double spur_delta)

This function increments by spur_delta spur with type spur_type associated with a multinode model. The argument spur_delta can be negative.

If spur_type is 0 or -1, the function only increments spur with type spur_type tracked by the environment state identification engine. If spur_type is equal to i>0, the function increments spur with type i tracked by the environment state identification engine and spur with type i-1 tracked by the instruction emitting engine.

Spur type 0 is for the automatic spur of the environment state identification engine. If it is a large actor (specified by the field is_large_env of qsmm_desc_s structure when creating the model), spur type -1 corresponds to the automatic spur of a small actor associated with the large actor. The function qsmm_get_nspur returns the number of spur types supported by a multinode model excluding that special spur type -1.

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

One of the following conditions is true:

  • – the environment state identification engine is the small actor, and spur_type is negative;
  • – the environment state identification engine is the large actor, and spur_type is less than -1;
  • spur_type is greater than or equal to the number of spur types specified in the field nspur of qsmm_desc_s structure when creating the multinode model;
  • spur_delta is not finite.
QSMM_ERR_INFIN

Incremented spur tracked by an engine would be infinite.

QSMM_ERR_UNTIMELY

The model instance does not exist.

Use the function qsmm_actor_time_delta to increment continuous time tracked by either the environment state identification engine or instruction emitting engine. Use the function qsmm_actor_spur_delta to increment spur with a specific type tracked by either the environment state identification engine or instruction emitting engine. You can obtain the handles of those engines by the functions qsmm_get_actpair_actor_env and qsmm_get_actpair_actor_opt.


Next: , Up: Executing a Multinode Model   [Contents][Index]