M-Systems

Top  Previous  Next

TimeLike provides a robust mechanism for incorporating routines written in Matlab's m-file language as simple systems. Such systems are called m-systems.

 

Example of M-System

As an example, following is an implementation of system GainM from BasicMath Component Library:

function [y] = GainM(k, u)

% Usage: [y] = GainM(k, u)

% Timelike: [double] = GainM(parameter double, input double)

% Behavior: output-driven

y=k*u

 

Creating M-System

 

To create an m-system, use The Available Subsystems Explorer. Right-click on a "Local Systems" node or an a library to which you want to add new m-system to and select New > Matlab System.

Libraries_CreateMatlabSystem

 

The M-System Editor window will pop up:

Use this window to define your M-System

Use this window to define your M-System

 

Use this window to enter m-function name, define input arguments, output arguments and behavior (input-driven, output-driven or event-driven) and enter the m-function itself. The first four lines of an m-function are locked because they are automatically generated (and then read in by TimeLike framework) from user-defined inputs,outputs and selected behaviors.  See M-System Editor for the detailed explanation.