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.
- Given an OpenMETA component assembly, locates GenericDomainModels within Components with domain
simulinkand 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.
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 fromtestbench_manifest.jsonat runtime (required to support running under a PET, because the interpreter is only run once for a PET).python/ComputeMetrics.py- Support script forTB_HierarchyWithOutputtest 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 forTB_HierarchyWithOutputtest bench; used as the SimulinkStopFcnand converts Simulink's.matfile output to CSV for consumption by Python.simulink/my_library.slx- Example Simulink model, used as a referenced model in thePIDControllerReferencemodel, and as a user library in theUserComponentmodel.