Section 1 - Clauses, Types and Rules
true
and the consequent
noConsumers 30
Check that the tick box has been selected. The result should look like this:
To restart the simulation select start simulation from the Simulate menu of the Workbench: intro1-1 window (click no for the save data? dialogue box).
If you look at the Rule Firing Transcript window you should see a line that reads universe is firing the initial eternity rule: consumer parameters (settable model parameters) and if you select the Database page of the Agent: universe window and select noConsumers, you should see the result of the rule you just entered. It should look like this.
Now go back to the universe's type browser and enter a rule called create consumers in the create objects category (the name and category does not effect how the rule works - it is just for convenience and readability). Create a rule very similar to the rule create producers but to use generatedInstance to create instances of type Consumer and use the consumer clause in the consequent.
In SDML you can have as many copies of the browsers as you want. This is especially useful if you want to refer to the Definitions pages while writing rules in the Rules page, or when you want to be able to see the Database page when you are trying something on the Experiment page.
Select the clone browser command from the Browse menu of the Agent: universe window and you will get a duplicate browser, each can now be set on a different page.
To test your rule works copy the antecedent of the rule to the Experiment page of the universe and evaluate it there. The result should look like similar to this:
This is a very useful technique for checking the antecedents of rules. In fact some people always write their rules in the Experiment browser and then copy them into the antecedent of a rule when they are satisfied.
Now run the simulation again from scratch and check to see that a relevant line appears in the rule firing transcript and that the relevant consumer clauses are asserted in the universe's database.
Generated with CERN WebMaker