The vissimRequest() function provides a general, extensible request mechanism for obtaining information from Embed.
EXPORT32 long vissimRequest(long req, arg2, arg3);
The first argument (long req) is a message code describing the action for Embed to take. The message codes that pertain to writing a custom block are as follows:
Message |
Description |
VR_CG_GET_TIMER_FUNC |
Returns name of main interrupt function. |
VR_CG_REWRITE_LOCAL_VAR_STR |
Reserved. |
VR_CHECK_PORT_NAME_SYNTAX |
Reserved. |
VR_CLEAR_BLOCK |
Clears red error state on
block. Uses currently executing block if block handle in arg1 is
null. |
VR_CLEAR_BLOCK_ERR |
Clears red error state on
block. Uses currently executing block if block handle in arg1 is
null. |
VR_CODE_GEN |
Activates code generation on the current diagram. arg2: Pointer to C file name |
VR_DISABLE_BLOCK_TYPE |
Removes block matching name
string from Blocks menu. |
VR_ENABLE_MENU_ITEM |
Enables menu
item. |
VR_EXECUTE |
Runs diagram but does not change time (no integration). |
VR_EXECUTE_CONST_BLOCK |
Reserved. |
VR_EXPAND_PATH_ALIAS |
Returns pointer (LPCSTR) to
expanded path alias. |
VR_EXPAND_ VSMX_PATH |
Returns (LPSTR) expanded
path in VSMX file stored in arg1 buffer. |
VR_GET_BLOCK_FLAGS |
Returns existing block
flags. VBF_* are the flags. OR them together to get the flags you
want. |
VR_GET_BLOCK_ID |
Returns an integer that uniquely identifies the block. |
VR_GET_BLOCK_INPUT |
Returns the pointer to the
input SIGNAL vector. |
VR_GET_BLOCK_OUTPUT |
Returns the pointer to the
output SIGNAL vector. |
VR_GET_BLOCK_PARAMS |
Returns block parameter
pointer. |
VR_GET_BLOCK_POS |
Returns block position. |
VR_GET_CODEGEN_FLAGS |
Returns a bit vector of
three possible flags that are OR’ed together. Flags can be check by
AND’ing the named flag with the returned word. Flag
names: |
VR_GET_CODEGEN_TARGET |
Returns pointer (LPCSTR) to the name of the current code generation target. |
VR_GET_CONNECT_PORT |
Indicates if port is input
or output. |
VR_GET_CONNECTOR_COUNT |
Gets either the input or
the output connector count for the block. |
VR_GET_CONSTRAINTS |
Gets constraint
values |
VR_GET_CUR_BLOCK_HANDLE |
Returns the handle to the current block. |
VR_GET_EXPRESSION_ERROR |
Returns char * string of syntax or semantic error from prior call to VR_GET_EXPRESSION_RESULT |
VR_GET_EXPRESSION_RESULT |
Returns char * result of
expression evaluation |
VR_GET_GLOBAL_CONSTRAINT_BOUNDS |
Gets global constraint
bounds. |
VR_GET_GLOBAL_CONSTRAINTS |
Gets global
constraints. |
VR_GET_GLOBAL COST |
Gets global
cost. |
VR_GET_GLOBAL_OPT_INFO |
Gets global optimization
settings. |
VR_GET_GLOBAL_UNKNOWN_BOUNDS |
Gets global unknown
bounds. |
VR_GET_GLOBAL_UNKNOWNS |
Gets global
unknowns. |
VR_GET_GLOBAL_UNKNOWNS_INPUT |
Gets global unknown
input. |
VR_GET_IMPLICIT_SOLVER_RUNNING |
Returns non-zero if implicit solver is running. |
VR_GET_INTEGRATION_SUBSTEP |
Returns integration substep for multistep methods. Note that 0 means start of new step. |
VR_GET_LOCAL_TIME_STEP |
Assigns local time step to
*arg2 |
VR_GET_OEM_NAME |
Pointer (LPCSTR) to OEM name. |
VR_GET_OPEN_FILE_PATH |
Returns pointer (LPCSTR) to
the file name or file path of the active diagram.
|
VR_GET_OVERPLOT_DATALIST |
Reserved. |
VR_GET_PARAM_STR |
Returns pointer to
parameter string for block handle. |
VR_GET RANDOM_SEED |
Supplies the random seed. |
VR_GET_RUN_STATE |
Indicates if the simulation is running (TRUE) or not running (FALSE). |
VR_GET_SOLVER_INFO |
Gets settings from Implicit
Solver tab in the System Properties dialog. |
VR_GET_STARTUP_DIR |
Returns Embed directory string. |
VR_GET_STARTUP_SCRIPT |
Returns pointer (LPCSTR) to current script file path. |
VR_GET_SUB_VERSION |
Returns version letter suffix. |
VR_GET_TGT_CAPABILITIES |
Returns a 32-bit value that
indicates the capabilities bit mask for the current or given
target. |
VR_GET_UNKNOWNS_INPUT |
Get unknown
inputs. |
VR_GET_VERSION |
Returns major version in
high byte and minor version in low byte. |
VR_GET_VISSIM_STATE |
Gets current simulation state and copy to pointer in arg1. |
VR_GET_WINDOW_HANDLE |
Returns Embed main window handle. Useful for model dialog creation. |
VR_GRAY_MENU_ITEM |
Grays out menu
item. |
VR_MODIFY_BLOCK |
Reserved. |
VR_NEED_DISPLAY_UPDATE |
Returns TRUE if display should be repainted. |
VR_NULL |
Reserved. |
VR_REALLOC_USER_PARAM |
Reallocates parameter
vector and returns newly reallocated pointer. |
VR_RECORD_EVENT |
Records an event in the
Embed event log. |
VR_REPAINT_BLOCK |
Repaints block given by
block handle in arg1. |
VR_REQUEST_PERMISSION |
Reserved. |
VR_REQUEST_PERMISSION2 |
Reserved. |
VR_RESET_XFERS |
For internal use only. |
VR_RESYNC_REALTIME_CLOCK |
Resynchronizes Embed’s real-time clock to the current time. |
VR_RETYPE_CONNECTORS_FROM_SIGS |
Requests retyping of connectors based on signal types. |
VR_ROTATE_BLOCK |
Rotates block
180o. |
VR_RUN_SIMULATION |
Executes the current model. |
VR_SET_BLOCK_CONNECTOR_COUNT |
Sets the connector count on
the block. |
VR_SET_BLOCK_FLAGS |
Sets block flags. VBF_* are
the flags. OR them together to get the flags you
want. |
VR_SET_BLOCK_MENU |
Adds user-defined block to
Blocks menu. |
VR_SET_BLOCK_POS |
Sets position of the
block. |
VR_SET_CONNECTOR_CHAR |
Sets indicator character on
block connector. |
VR_SET_CONNECTOR_LABEL |
For internal use only. |
VR_SET_EXPR_BLOCK_HANDLE |
Sets the currently active C expression block to the block handle passed in arg1. This enables the C expression evaluator to highlight the block in red in the event of an error. |
VR_SET_GLOBAL_UNKNOWNS |
Sets global unknowns from
supplied vector. |
VR_SET_PARAM_STR |
Sets new parameter string
for block handle. Note that the block will always copy arg2, so arg2 can
be freed after the call. |
VR_SET_RANDOM_SEED |
Sets the random seed as an
(unsigned int*). |
VR_SET_STARTUP_SCRIPT |
Sets script
file. |
VR_SET_UNKNOWNS |
Sets unknown values from
user-supplied vector. |
VR_SET_VISSIM_STATE |
Reserved. |
VR_SHOW_HELP |
Reserved. |
VR_SHOW_HELP_ECD |
Reserved. |
VR_SNAP_STATES |
Causes Embed to use current integrator/delay state as initial condition. |
VR_UPDATE_STRING |
Updates stringPtr in arg1 with newStrValue in arg2, reallocating memory if needed. arg1: LPSTR* stringPtr arg2: LPCSTR newStrVal |
VR_WF_GET_CURRENT_VIEW |
Returns a block handle to the currently open compound block. |
VR_WF_GET_SCROLL_INFO |
Returns DWORD: upper 16 bits is Y position of scroll thumb; lower 16 bits is X position of scroll thumb. |
VR_WF_OPEN_COMPOUND |
Sets current view level to
compound block. |