/* * * MAML TUTORIAL (Model 2) * For full description refer to * http://www.syslab.ceu.hu/maml/tutorial/ * * (c) 1998, CEU Systems Laboratory * */ @model m2 { @agent Counter { @var: int count; @sub: (void) increase { count++; } } @var: Counter counter; @schedule cyclic (1) { // a schedule with a cycle of length 1 0: @to counter increase; // at 0th timestep of each cycle send } // increase message to counter agent @init: @create Counter counter { // initialize counter during creation counter->count = 0; // by assigning value to its variable } } @observe m2 gui as graphical_m2 { @extendAgent Counter { // introduce more functionality to @probe: var "count"; // Counter: add a probe } @init: maxTimeSteps = 100; // set max. length of simulation @buildProbes; @initModel; [counter probe]; }