Table of Contents
qc_stop_model
Stops a model in normal simulation or external mode.
result = qc_stop_model(model, name) % Stop model NAME on the target associated with MODEL result = qc_stop_model(config_set, name) % Stop model NAME on the target associated with the configuration set result = qc_stop_model(target_uri, name) % Stop model NAME on the target specified by the target URI result = qc_stop_model(name) % Stop model NAME result = qc_stop_model % Stop current model
Stops a model. If MODEL is specified, then the target URI associated with the active configuration set of that model is used to identify the target. If a configuration set is specified then its associated target URI is used. If a target URI is specified then it is used directly to access the target. In any of the above cases, qc_stop_model always accesses the target to stop the model and ignores the state of the Simulink diagram.
If only a model NAME is specified, then the action of qc_stop_model depends on the state of the Simulink diagram for the model. If the model is running a normal simulation, then the simulation is stopped. Otherwise, it connects to the associated target and stops the model on the target. The target is identified by the settings for the active configuration for the model. The model will also disconnect.
If NAME is a cell array of model names, then each model in the cell array is stopped. This functionality may be used with the qc_get_loaded_models function to stop all the models running on the target.
If no model is specified then it behaves as if the currently selected model, as returned by
MATLAB Command Line
Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:
doc('bdroot')Note that this function will stop the model on the target even if the model is not currently connected in external mode.
Note that qc_stop_model does not update the Simulink diagram graphics when it stops the model directly on the target. Hence, the Simulink diagram toolbar may still indicate that the model is running, even though it is not and the plots have stopped. To update the Simulink diagram graphics, execute the
MATLAB Command Line
Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:
doc('drawnow')Also, if the model is loaded but has not been started then on some targets the model will have to be started before it receives the stop signal.
Closing a model after stopping it
The Simulink external mode interface is not fully functional when a MATLAB script is running. Hence, it is not possible to close a model using
MATLAB Command Line
Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:
doc('close_system')model
A string indicating the name of the model from which to identify the target eg. 'q_a_lpbk
'.
name
A string indicating the name of the model to stop eg. 'test_model
'.
config_set
A Simulink.ConfigSet
configuration set from which to identify the target (see
MATLAB Command Line
Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:
doc('getConfigSet')target_uri
A string containing the URI used for communicating with the QUARC Target Manager on the target.
result
Returns 0 on success and a negative error code on failure. See qc_error and qc_get_error_message for handling error codes. If no result output is assigned it issues an error on failure.
result = qc_stop_model('q_a_lpbk'); % Stops the 'q_a_lpbk' model
See Also
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.