Skip to content
Snippets Groups Projects
modelInst.lus 799 B
-- Un modele simple
-------------------
model m1
  needs 
    type t;
	
	provides
    node n ( init, in : t ) returns ( ok : t );
	
	body

		node n(init, in: t) returns (ok: t);
			let
  			ok = init -> pre in;
			tel
	end

		package Pint is m1( int );
	  package Pbool is m1( bool );
	  package Preal is m1( real );

-- le package principale definit une instance de "m1" localement
---------------------------------------------------------------- 
package main
	
	provides node main(i: int; ray : real) returns (oint: int; obool: bool; oreal: real);

	body
	
		
		const pi = 3.14159;

		node main(i: int; ray : real) returns (oint: int; obool: bool; oreal: real);
			let
   			oint = Pint::n(0, i);
				obool = Pbool::n(true, i < 50);
				oreal = Preal::n(0., 0. -> pi * ray * ray);
			tel 

	end