Skip to content
Simulink integration for OpenMETA, built using generic interfaces
Python MATLAB
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
components/0trjlnx3/Spice
matlab
python
simulink
.gitignore
LICENSE
README.md
manifest.project.json
simulink-example.xme

README.md

OpenMETA-Simulink

This example model and accompanying scripts demonstrate integration of an external domain tool into OpenMETA, without requiring OpenMETA metamodel changes or changes to the OpenMETA source code.

Features

  • Given an OpenMETA component assembly, locates GenericDomainModels within Components with domain simulink and constructs corresponding Simulink blocks and connections (based on the models' Type fields).
  • Limited support for hierarchy in the generated models; hierarchy is flattened in the generated models, so component names cannot be duplicated at different levels of hierarchy.
  • Supports passing arbitrary block parameters to Simulink (see Simulink programmatic modeling documentation for details), represented as parameters connected to GenericDomainModelParameters in the model.
  • Supports passing arbitrary simulation parameters to Simulink (see Simulink programmatic simulation documentation for details), represented as unconnected parameters in the TestBench.
  • Supports copying support files (for example, MATLAB .m files) with the CopyFile parameter in the TestBench.
  • Supports incorporating components from user models, with the UserLibrary parameter in the TestBench.
  • Supports Python post-processing scripts with the PostProcessing block in the TestBench.
  • Supports varying test bench parameters under a PET, if those parameters are only connected via Parameter blocks.

Contents

  • simulink-example.xme - OpenMETA model containing example and test models using Simulink components, as well as test benches configured to drive the included OpenMETA to Simulink interpreter.
  • python/CyPhySimulink.py - OpenMETA to Simulink Python interpreter. From the calling OpenMETA model, generates and executes a MATLAB script which constructs and runs a Simulink model.
  • python/PopulateTestBenchParams.py - Preprocessing script executed before running the MATLAB script which constructs the actual Simulink model, to inject parameters loaded from testbench_manifest.json at runtime (required to support running under a PET, because the interpreter is only run once for a PET).
  • python/ComputeMetrics.py - Support script for TB_HierarchyWithOutput test bench; takes CSV output from MATLAB/Simulink, computes metrics from that output, and merges them into the test bench manifest.
  • matlab/CreateOrOverwriteModel.m - MATLAB support function for code generated by the Python interpreter: helper function which creates Simulink models regardless of whether or not they already exist.
  • matlab/convertmat.m - MATLAB support function for TB_HierarchyWithOutput test bench; used as the Simulink StopFcn and converts Simulink's .mat file output to CSV for consumption by Python.
  • simulink/my_library.slx - Example Simulink model, used as a referenced model in the PIDControllerReference model, and as a user library in the UserComponent model.
You can’t perform that action at this time.