MML Example: Translating a Simple STELLA Model

This page displays a simple STELLA Deer model together with the corresponding Modular Modeling Language (MML) objects and configuration commands as generated by the Module Constructor application.


A Simple STELLA Model.

The following diagram illustrates the graphical view of a simple deer model implemented in STELLA.

Figure 4: A Simple STELLA Model.


A Modular Modeling Language Example.

The following is the Modular Modeling Language representation of the STELLA model shown in figure 4 above, as generated by the Module Constructor application.

root Module Globals_module {
	Module DEER_module {}
	Module VEGETATION_module {}
	Connection C0 { 
		Origon = VEGETATION_module::VEGETATION;
		Destination =  DEER_module::VEGETATION;
	}
	Connection C1 { 
		Origon = DEER_module::DEER_POPULATION;
		Destination =  VEGETATION_module::DEER_POPULATION;
	}
}

Module DEER_module {
	state Variable DEER_POPULATION  {
		integrate Command I0 {
			Clamp = 0;
			Method = euler;
			Value = { ( BIRTHS-DEATHS ) };
		 }
		init Command i1 {
			Value = { 100 };
		 }
	}
	aux Variable BIRTHS  {
		update Command u2 {
			Value = { ( DEER_POPULATION*BIRTH_FRACTION ) };
		 }
	}
	aux Variable DEATHS  {
		update Command u3 {
			Value = { ( DEER_POPULATION*DEATH_FRACTION ) };
		 }
	}
	aux Variable BIRTH_FRACTION  {
		update Command u4 {
			Value = { .2 };
		 }
	}
	aux Variable DEATH_FRACTION  {
		update Command u5 {
			Value = { Graph0(VEGETATION) };
		 }
	}
	state input  Variable VEGETATION  {
	}
	LUT Graph0 {
		list Data = (  ( 0.0000E+00, 1.0000E+00 ), ( 1.0000E+02, 8.1500E-01 ), ( 2.0000E+02, 6.1000E-01 ), ( 3.0000E+02, 4.8000E-01 ), 
				( 4.0000E+02, 3.6000E-01 ), ( 5.0000E+02, 2.6000E-01 ), ( 6.0000E+02, 1.6500E-01 ), ( 7.0000E+02, 1.1000E-01 ), 
				( 8.0000E+02, 5.5000E-02 ), ( 9.0000E+02, 3.0000E-02 ), ( 1.0000E+03, 2.0000E-02 )
		);
	}
}

Module VEGETATION_module {
	state Variable VEGETATION  {
		integrate Command I6 {
			Clamp = 0;
			Method = euler;
			Value = { ( REGENERATING-CONSUMING ) };
		 }
		init Command i7 {
			Value = { 3500 };
		 }
	}
	aux Variable REGENERATING  {
		update Command u8 {
			Value = { ( VEGETATION*REGENERATION_PER_PLANT ) };
		 }
	}
	aux Variable CONSUMING  {
		update Command u9 {
			Value = { ( DEER_POPULATION*VEGETATION_PER_DEER ) };
		 }
	}
	aux Variable REGENERATION_PER_PLANT  {
		update Command u10 {
			Value = { .5 };
		 }
	}
	aux Variable VEGETATION_PER_DEER  {
		update Command u11 {
			Value = { 15 };
		 }
	}
	state input  Variable DEER_POPULATION  {
	}
}



A Configuration File example.

The following is the configuration file corresponding to the STELLA model shown in figure 4 above as generated by the Module Constructor application (with some used-supplied configuruation data, see discussion ).

# global                             n(1)  s(4332)  op(0)  OT( 1.000000, 0.000000, 20.000000 )  d(0)  DS(1.00,48) 
$ Globals_module                        g(2D,StudyArea) 
* TIME                              
$ DEER_module                        d(255) 
* BIRTHS                            
* BIRTH_FRACTION                     pm(0.200000) 
* DEATHS                            
* DEATH_FRACTION                    
* DEER_POPULATION                    s(C1C) A(4,1.0,0.0)
* TIME                              
* VEGETATION                         ip(0.0) 
$ VEGETATION_module                  d(255) 
* CONSUMING                         
* REGENERATING                      
* REGENERATION_PER_PLANT             pm(0.500000) 
* TIME                              
* VEGETATION                         s(C1C) d(VegMap.PLM94)	
* VEGETATION_PER_DEER                pm(15) 
* DEER_POPULATION                    ip(0.0)