In this Section: ➢S-Function Interface to Simulink ➢Using Multiple Simulink Models ➢Setting Up for Model Coverage |
Danlaw has developed a nicely integrated Connector Transform that allows you to connect the MxSuite to Simulink. This opens up several opportunities:
•Connect to and test Simulink and Stateflow models from MxVDev.
•Run two Simulink models under the same MxSuite test environment.
•Set up a co-simulation environment between Simulink and another entity (such as a HIL system, or an MxVMC Virtual Micro-Controller).
•A supported version of MATLAB Simulink must be installed. See Compatibility. •The Simulink model must compile successfully. |
Tests are run in the usual way, by creating/loading Scenarios and clicking the Run button. A few things to note: •When an MxVDev project configured for Simulink Co-Simulation is opened, Matlab is launched and the Matlab Workspace is presented: oUse this command window as you normally would to enter any Matlab commands. oYou could use this window to check the input/output data information of the model after running a Scenario. For example: What is the data of an input MxVDev put into the workspace to run the model? What is the output data generated by running without MxVDev process them? oEvery time you run a Scenario the Matlab Workspace command window is cleared. •Add the Inputs and Outputs available from the Simulink model to the Signal Dictionary. •Prepare Scenarios and TestCases as you would normally. •When you click the Run button, your scenario runs to completion before any results are displayed. •You can keep Simulink loaded while you are running your tests. Between runs, you can edit and save your model. When you select Run in MxVDev the Simulink model is always re-loaded from disk. •Be aware of the model data sample rates and test duration, the amount of data that you transfer between MxVDev and Simulink will affect performance. We note that 10,000 samples will take about 5 seconds to transfer. •Time Tolerance Considerations: oWhen the 'Step Interval' in the Simulink model is the same as that in MxVDev, you do not need to apply time tolerances. There will be one Simulink data point for each MxVDev Test Step. oWhere Simulink may deliver several (or zero) data points per MxVDev Test Step, you must use Time Tolerances. Click the TestCase Properties button Notes:•Co-simulation works with Simulink models that have Stateflow components. You also need Stateflow installed with its own license. •You need Matlab, Simulink, and MxVDev installed on you computer, with licenses available for all three products. •Signal names are used to link the inputs and outputs from your model and entries in the MxVDev Signal Dictionary. Be careful with spelling. Case is important. |
The integration between MxVDev and Simulink offers the following: •All numeric inputs are fed with their initial value (a value defined in the MxVDev Signal Dictionary) at time 0. All array inputs are fed with an initial value of zero for all elements. •MxVDev feeds all inputs (that are defined in the Signal Dictionary) to Simulink, runs the simulation, and reads all outputs (that are defined in the Signal Dictionary). •MxVDev supports messages (one dimensional byte arrays) and message fields (grouping a bunch of bytes in a message to represent a number like speed or rpm). Message fields can be added as individual signals and therefore can be plotted and edited just like numeric signals. •Array signals: oArray transitions are displayed as sticks in the test case very much like messages. Double-clicking a stick displays the array. oWhen creating array transitions, MxVDev allows users to define changing elements only. This means that if you want to change element (4,2) of a 7x8 array, you don't have to specify the values of all 7x8 elements, only specify the value of element (4,2) leaving all other elements empty (empty = no change). oThe same concept works for outputs. MxVDev displays only changed elements of the array (changed elements since the last value/transition). This enables you to quickly figure out which elements of a 7x8 array changed and which ones did not. |
Without a ModuleReset, the Simulink model runs from beginning to end without interruption. A Scenario that uses one or more ModuleReset events will: •Stop the simulation at the point in time that each the ModuleReset is located. •Extract all output data already captured in the workspace, and send it as Actual Values to the MxVDev GUI. •Notes: oAll outputs are cleared when the Simulation is next started. oThe workspace retains the last value set for each input value. •Establish new input data in the Workspace from the current ModuleReset point to either the next ModuleReset point, or the end of the test. •Re-start the simulation, again from the current ModuleReset point to either the next ModuleReset point, or the end of the test. |
Please provide the following when requesting Simulink support from Danlaw: •The log files. Select Help->View Log Files from the MxVDev main menu. Send all the files in the folder. •The <model>MxV336xx.mxform file (if available) It is helpful to zip the files into a single archive. Send e-mail to: mxsupport@danlawinc.com |
S-Function Connector to Simulink
Using Multiple Simulink Models (S-Function)
Simulink Tick Period (S-Function)
Simulink S-Function Video Demonstration
Troubleshooting Simulink Projects
Compatibility (Supported levels)