When solving a constraint that is specified by a mathematical equation, Magic Model Analyst will find a 'target' by evaluating a 'given'. By default, a target is on the left-hand side of the equation and a given on the right-hand side of an equation.
The following figure shows an example of constraint parameters target and given in a mathematical equation.
Evaluating a Mathematical Equation in a SysML Model.
As you can see from the example shown in the preceding figure, the block Circle contains a constraint property typed by the constraint block Circle Area. The constraint block Circle Area has a constraint that is defined by the mathematical expression {area = 3.14159 * (radius ^ 2)}. The target and the given in the equation are the constraint parameters 'area' and 'radius' respectively. These constraint parameters are bound to the value properties of the block Circle. The constraint parameter area of e1 is bound to the value property area of the block Circle, and the constraint parameter radius of e1 is bound to the value property radius of the block Circle. So, the values of the constraint parameters and the value properties bound together are always equal.
If you simulate the block Circle, the parametric evaluator in Magic Model Analyst will create an object Circle and its internal values. It will substitute the value of radius of the block object Circle to the equation and calculate the value of area. Once it obtains the value of area, parametric evaluator will assign it to the area value property of the object Circle. If you change the value of the radius, Magic Model Analyst will automatically calculate and update the value of the area with the result from evaluating the equation.
You can also define a constraint on a UML class to constrain the values of its properties. The following figure shows a constraint on the UML class Circle. The constraint is defined by the same Mathematical expression as in the figure below {area = 3.14159 *** (radius ^ 2)}. If you simulate the class Circle, the parametric evaluator will evaluate the value of radius in the equation. It will then use the value resulting from evaluating the value of radius to update the value of property area.
Evaluating Mathematical Equation on a UML Class.
Related pages