Using vissimRequest() in a custom global optimizer

The vissimRequest() function is a general-purpose function for making requests to Embed. A user-written global optimizer uses vissimRequest() to read and write global optimization information in a block diagram. The general format of vissimRequest() is:

long FAR vissimRequest(long req, long arg2, long arg3 )

The first argument (long req) is a message code describing the action for Embed to take. The list of message codes is defined in the file named VSUSER.H, which is installed in <install-directory>\VSOLVER. The message codes that pertain to writing a global optimizer are as follows.

Message code

Description

VR_GET_GLOBAL_COST

Writes a vector of current cost block input values into a vector pointed at by arg2.

VR_GET_GLOBAL_CONSTRAINTS

Writes a vector of current globalConstraint block input values into a vector pointed at by arg2.

VR_GET_GLOBAL_CONSTRAINT_BOUNDS

Writes a vector of globalConstraint block low bounds into a vector pointed at by arg2, and a vector of globalConstraint block high bounds into a vector pointed at by arg3.

VR_GET_GLOBAL_OPT_INFO

Gets information related to the global optimization settings in the dialog box for the Optimization Setup command. The information provided is a copy of the current optimization state; modifying it will not change Embed’s state. Arg2 should contain a pointer to an OPT_INFO structure, defined in VSUSER.H, which will be filled in by the vissimRequest() call. Arg3 should contain the size of this structure (sizeof(OPT_INFO)) to allow for version compatibility checking.

VR_GET_GLOBAL_UNKNOWNS

Writes a vector of current parameterUnknown block output values into the vector pointed at by arg2. Ordering of the elements vector can be determined by the value of the ID parameter for the parameterUnknown block. Embed sorts in sequential order, from low to high.

VR_GET_GLOBAL_UNKNOWNS_INPUT

Writes a vector of current parameterUnknown block input values into the vector pointed at by arg2. Ordering of the elements vector can be determined by the value of the ID parameter for the parameterUnknown block. Embed sorts in sequential order, from low to high.

VR_GET_GLOBAL_UNKNOWN_BOUNDS

Writes a vector of parameterUnknown block low bounds into a vector pointed at by arg2, and a vector of parameterUnknown block high bounds into a vector pointed at by arg3.

VR_GET_VERSION

Returns the current version of Embed.

VR_GET_VISSIM_STATE

Gets information related to the global state of Embed. The information provided is a copy of the current internal state; modifying it will not change Embed’s state. Arg2 should contain a pointer to a SIM_INFO structure, defined in VSUSER.H, which will be filled in by the vissimRequest() function. Arg3 should contain the size of this structure (sizeof(SIM_INFO)) to allow for version compatibility checking.

VR_RESET_XFERS

For internal use only.

VR_RUN_SIMULATION

Starts a simulation run.

VR_SET_GLOBAL_UNKNOWNS

Sets current parameterUnknown block output values from arg2.