/* * * MAML TUTORIAL (Model 1.2) * For full description refer to * http://www.syslab.ceu.hu/maml/tutorial/ * * (c) 1998, CEU Systems Laboratory * */ @model m1 { @var: int numOfSubscribedAgents; @agent Dumb { @sub: (void) subscribe { model->numOfSubscribedAgents++; } } @var: Dumb dumb, dumber; @init: numOfSubscribedAgents = 0; @create Dumb dumb, dumber; [dumb subscribe]; [dumber subscribe]; } @observe m1 batch as batch_m1 { // batch_m1 is the name of this observation of m1 @var: FILE output; // the output file @init: output = fopen("OUTPUT", "wt"); // opens the output file @initModel; // invokes the initialization of the model fprintf(output, "%d\n", numOfSubscribedAgents); // prints the variable out fclose(output); // closes the output file }