A simple example model demonstrating some key features of SPIN. Have a look at the ss:computeArea function, the rule attached to ss:Rectangle and the constraint attached to ss:Square.
1.1.0
width
height
Width and height must be equal
Square
1
The area of a Rectangle, defined as the product of width x height.
The height of a Rectangle.
1
1
The width of a Rectangle.
width
height
area
Computes area := width * height
Rectangle
height
width
property
area
compute area
Computes the area of a given rectangle (?arg1) as the product of its width and height.
The rectangle to compute the area of.
width
height
6
7
Test rectangle
9
8
Invalid square
label
property
value
0
must only have positive values, but found
Property
Values of property {?property} must be > 0
The property to constrain (e.g. ss:width or ss:height).
A template that can be used to define a SPIN constraint on a given property (arg:property) to make sure that the values of that property are > 0.
Positive property value constraint