|
Modifying a compound model
To modify a compound model, follow these basic steps:
To edit the model
The Model Editor.
Adding elements to the Compound Model The Model Editor used to create Compound Models is the same as the Model Editor for Equation Models. Into the Model Editor you can drag Compound Model Elements, Equation Models and other Compound Models. First it will be explained how to create a model from (Basic) Compound Model Elements only. In this short tutorial you will try to create a simple model, in which we are going to create a model to calculate the value of the formula result = (a * b + c) / d.
Dragging elements from the library to the Model Editor.
Creating links between elements Now we have to create links between the different model elements. There are two basic rules for linking elements together:
To create a link:
Repeat the above four steps and try to create the model that is displayed below: Creating links in the Compound Model.
In this model, you can see that multiplicand1 and multiplicand2 are input for the Multiply element. The resulting output is their product (multiplicand1 · multiplicand2). This product is subsequently one of the inputs for the Add element. It will be added to the value of summand2, the other input. So now we have (multiplicand1 · multiplicand2) + summand2. Finally, the output value of the Add element is used as input for the Divide element. This element will then divide this input value (the numerator of the fraction) by the value of its other input, argument2 (the denumerator of the fraction). Effectively, we have now created a model that calculates the value of ((multiplicand1 · multiplicand2) + summand2) / argument 2. Except for the variable names, this formula is identical to the formula we specified above.
Changing variable names Now, change the standard names of the variables to the ones we chose in our formula: a, b, c and d respectively.
The Model Editor with the new variable names.
Specifying initial values You will have seen that some of the names of the variables are red. This indicates that no initial values were yet specified for those specific variables. You can specify initial values as follows:
Changing initial values of variables in the Model Editor.
This model is now complete, and can be used in a SimQuest application. If you want, you can now create an interface for this simple model. For instance, add four Numerical Input elements for the inputs (a, b, c and d) and one Value field for the output (result). For more help on the topic of interfaces, you can follow step 2 of the Getting Started tutorial. Also step 3 (Assignments) and step 4 (Explanations) remain unchanged for applications with compound models.
Another example For this second example we will try to create a Compound Model of exponential decay. For this we will have to reproduce the following equation using a Compound Model.
dx/dt = -k*x
The compound model for this equation looks like this:
Compound model for exponential decay.
In this model, the output of the integrator, X, is multiplied with a constant (multiplicand2). This product is then again input for the integrator, so that a closed loop system is formed. When you create this model, you will see that the variable t does not appear in the top list of variables. This is because t is currently an internal variable, which automatically means that it will not be accessible in an interface. To make t an accessible variable, you have to export it. This is done as follows:
Exporting an internal variable.
|