Next: , Previous: , Up: Multinode Model   [Contents][Index]


4.7 Incrementing Time and Spur

To convey to the instance of multinode model information that a period of continuous time has passed, the following function can be used.

Function: int qsmm_time_delta (qsmm_t model, double time_delta)

This function increments the value of continuous time associated with the environment state identification engine and the instruction emitting engine that correspond to the instance of a multinode model specified by handle model. The value of continuous time of every engine is incremented by time_delta.

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 time_delta is not finite, or the incremented value of continuous time associated with one or both engines becomes non-finite or negative.

QSMM_ERR_UNTIMELY

The model instance does not exist.

When the environment state identification engine is represented by a small actor, spur types supported by the model have zero-based indices. Spur type 0 of the model normally corresponds to the automatic spur. This spur is used only by the environment state identification engine of the model. Spur type 0 of the environment state identification engine normally corresponds to the automatic spur. The value of the automatic spur ordinarily not changed by a program that uses the model.

When the environment state identification engine is represented by a large actor, the model supports special spur type -1 that corresponds to the automatic spur of a small actor associated with the large actor. The value of this spur ordinarily not changed by a program that uses the model.

Spur types of the model with indices greater than 0 correspond to user spur supplied by a program that uses the model. Spur types of the environment state identification engine with indices greater than 0 correspond to user spur. 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. All supported spur types of that engine correspond to user spur. Spur type i of the instruction emitting engine corresponds to spur type i+1 of the environment state identification engine and the model.

To increment the value of the spur of given type for a model instance, the following function can be used.

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

This function increments by spur_delta the value of the spur of type spur_type of the environment state identification engine and possibly of the instruction emitting engine associated with the instance of a multinode model specified by handle model. The value of spur_delta can be negative. If spur_type is equal to 0 or -1, then only the value of the spur of type 0 or -1 respectively the environment state identification engine keeps track of will be incremented. If spur_type is equal to j>0, then the value of the spur of type j of the environment state identification engine will be incremented, and the value of the spur of type j-1 of the instruction emitting engine will be incremented.

Spur type 0 corresponds to the automatic spur of the environment state identification engine, the value of which usually not changed by the application program. If the environment state identification engine is represented by a large actor (which is specified using the field is_large_env of structure qsmm_desc_s when creating a multinode model), then spur type -1 will correspond to the automatic spur of a small actor associated with the large actor, the value of which usually not changed by the application program too. The number of spur types supported by a multinode model (excluding that special spur type -1) is returned by the function qsmm_get_nspur.

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

One of the following conditions is met:

  • – the environment state identification engine is represented by a small actor and spur_type is negative;
  • – the environment state identification engine is represented by a large actor and spur_type is less than -1;
  • – the value of spur_type is greater than or equal to the number of spur types specified when creating the multinode model;
  • – the value of spur_delta is not finite;
  • – the incremented value of the spur for one or both engines becomes non-finite.
QSMM_ERR_UNTIMELY

The model instance does not exist.


Next: , Previous: , Up: Multinode Model   [Contents][Index]