I wanted to ask if I want to make sure that a certain parameter is accepted only for a specific range, i.e. length and distances must be always positive. What kind of function should I use ? What I understand so far that assert function is used to generate an error message when the user enters a wrong value. So what about the minimum attribute ? What is the difference between both of them ?
You can use the min and max attributes for parameters, like so:
parameter Modelica.SIunits.Length l1(min=0.4, max=1.5)=1 "A typical length";
If you try to enter a value for l1 that's outside of the range, a warning will appear in Model Center.
Thanks Sean for your reply. I am asking about the Modelica language. The code you are showing is Mathematica code, and I don't think it can be used inside SystemModeler.
I'm not sure I understand what you mean by the "minimum attribute". Can you give an example of what you mean?
I normally do this by defining a pattern to be matched in the definition of the function
f[x_/;x>0] := x+1 (*Only runs if x>0*)
f[___] := Throw["Invalid input to f"] (*Otherwise throw an error*)