Module vs. package
Since Mosel 5 packages offer similar functionality as modules for the implementation of parameters. The parameter names and types are specified in the parameters block of the package:
parameters "p1":real "p2":integer "p3":string "p4":boolean end-parameters
The access routines for the four parameter types have a fixed format, namely packagename∼get[r|i|s|b]param and packagename∼set[r|i|s|b]param. The access routines must be defined according to the parameter types implemented by a package as shown in the code extract below—the complete example can be found in the Chapter 'Packages' of the Mosel User Guide.
declarations myp1: real ! Entity for storing the current parameter value end-declarations myp1:=0,25 ! Set the default value for the parameter ! Get value of a real parameter public function parpkg~getrparam(p:string):real case p of "p1": returned:=myp1 end-case end-function ! Set value for real parameters public procedure parpkg~setparam(p:string,v:real) case p of "p1": myp1:=v end-case end-procedure
A model using the package will access the package parameters via Mosel's standard getparam and setparam routines.
