|
Read here the Frequently Asked Questions. If you are looking for a question you can't find, please contact us.
You may add a new category by starting from scratch or by modifying an existing category. Either way, it is convenient that you use the Petersen Matrix editor available within the Model Editor which will minimize the amount of msl code that you will have to write manually. In the first instance, i.e. to start from scratch, start the Petersen Matrix editor and chose the New option (Ctrl+N) of the menu: a blank matrix will be displayed in which you will add processes and components. In the second instance, i.e. to modify an existing category, start the Petersen Matrix, select the base category (from the drop-down menu) and chose the Import From Modelbase option in the menu: add (or remove) processes and components on the pre-existing matrix. In both situations, you will also have to define the relevant parameters, state variables and interface variables in the Parameters, Variables and Sensors tabs. It is crucial at this point that you enter the name of the new category. To do so, go to the menu Tools and select the item Options; in the box Categories, add the name of the new category to the list and confirm. Now go back to the Petersen Matrix editor and select the same name from the drop-down menu. Finally, press the Generate MSL Code button in the toolbar: you will be prompted with the list of files that will be added to the modelbase: press OK to confirm. To check that the modified library is consistent and error free, go to the Model Editor, select the new category from the drop-down menu and do the following: 1) Use the Refresh Browser button (F5) on the toolbar to update the tree view of the model structure 2) Use the Check Modelbase button (F9) on the toolbar to check the syntax of the code: if no error is found, a Checking finished successfully message will be displayed in the Info pane. Remark: since the msl code is generated automatically, one would expect that the procedure be error free. Although no error will certainly be present in the newly created msl files written for the new category, some pre-existing #include statements may not be correctly updated throughout the modelbase for the new category. It is very likely that you will have to add some ifdef statements for the new category.
Adding a process unit to the model library entails creating a new process node (and adding it to the node library: see) and implementing a new model (and adding it to the model library as the default model for the new process node: see).
You will first have to draw the icon of the new process node, using a convenient drawing application. Please note that the new process icon will have to be saved as .wmf file and stored in the HemmisWestGraphNodesMetafile folder of the user’s under My Documents folder. It may be convenient, although not mandatory, that the new process icons match the general layout of any process node of the WEST model library, i.e. with green or red arrows to indicate biological or data and control data flows respectively. Once the process icon is available in the Metafile folder, open the Process Node Editor from within the WEST Model Editor and press the Add Node button in the toolbar. You will be prompted with a dialog window in which you will have to enter the following: - Name : it is the name of the process unit that will be displayed in the node library. - Short name : this will be used as default label in the Configuration Builder when a new node of this type will be placed on the canvas. - Class ID : this is the name that uniquely identifies the process node in the model library and that will have to be used to assign a model to this process node. Finally, use the Browse button next to the Graph File Name box to load the icon of the new process node from the Metafile folder. Confirm with the OK button: the new process node will be added to the palette on the left and will be the active node on the canvas. Now, you will have to assign the appropriate Terminal Properties to each in and out terminal. To do so, double-click on the position where the terminal will have to be placed (typically, an arrow) and enter the following information: - Name : this is the name of the terminal; it is recommended that you follow the general convention used throughout the modelbase, i.e. in_1, out_1, etc. The same name will have to be used in the Interface section of each model that will be assigned to the process node. - Type : generic, biological, data or control data types are available (refer to the WEST documentation). - Causality : input or output. - Position X : it indicates the horizontal position (in pixel) of the terminal with reference to the centre of icon. - Position Y : see Position X. - Max no. of connections : it indicates the maximum number of connections that will be allows in the configuration builder. As a convention throughout the modelbase, biological type terminals are given one single connection whereas data or control data type terminals are given unlimited (999) connections. Once you have added all the necessary terminals, you will have to re-compile the node library, by pressing the Build Library button on the toolbar.
Once you have implemented a new model (see) for the new process node, add category = “default” to the CLASS annotation (see the MSL Reference Guide).
A model is a CLASS in the modelbase that is linked to a specific process node, through its Class ID (see) in the CLASS annotation. A model consists of a number of sections, i.e. comments, interface, parameters, initials, state and equations. Refer to the MSL Reference Guide, for extensive documentation on how to implement a model in msl.
|