Establishing a DDE Connection with DymosimThis section describes how to establish a DDE connection between a client and the Dymosim application using the WM_DDE_INITIATE message. MATLAB example: channel=ddeinit('dymosim', 'any topic here') After the simulation finishes or is stopped, Dymosim will send a WM_DDE_TERMINATE message to all connected clients. A client can terminate the connection by sending the same message. MATLAB example: ddeterm(channel) Simulator CommandsThis section lists the commands which can be sent to Dymosim using WM_DDE_EXECUTE messages.
MATLAB example: ddeexec(channel, 'run') Setting ParametersThis section lists the parameters which can be set in Dymosim using WM_DDE_POKE messages. The WM_DDE_POKE message includes the name of the parameter and its new value (the string representation of a number). There are four special variables (see table below). When a simulation is started, simulation parameters, auxiliary variables and states may also be set. However, these are not set immediately, but only at certain points in the simulation that allow for updates. Hence, when a client makes a request (for example for a variable), an update from another or the same client may be pending. Any such pending update value will be reported in the response.
Requesting ParametersThis section lists the parameters which can be requested from Dymosim using WM_DDE_REQUEST messages. When a WM_DDE_REQUEST message with the name of a parameter is received by Dymosim it responds by returning the current value of the variable (the string representation of a number), or zero if no such variable exists. In addition to the four special variables listed in Setting Parameters, there are another three variables that can be requested (see table below). When a simulation is started, simulation parameters, auxiliary variables and states may also be requested. The value returned is the current value at the last accepted output point.
MATLAB example: ddereq(channel, 'time_') Hot-linking VariablesThis section describes how variables can be hot-linked using WM_DDE_ADVISE messages. When a variable is hot-linked, it will be sent to the client at output points when a significant change its value has occurred. A significant change of a variable is determined from absolute and relative tolerances (which can be set by the DDE client) as follows: where x0 = value last sent to client and x = current value The variable is sent to the client when changed is true at an output point. The variable is also sent at the first output point following the hot-link operation. Dymosim counts the number of links to a variable, and any corresponding "unlink" messages. Updates for the variable are sent while the link count is greater than zero. MATLAB example: ddeadv(channel, 'time_', 't=[t x];', 'x') DDE LimitationsThis section describes the limitations of the Dynamic Behavior Modeling workbench with regard to DDE.
|