Xholon - Stupid Model 5 - Parameters and Parameter Displays
What is it
This is the 5th in a series of 16 "Stupid Models". It's intended as a starting point for learning how to develop grid and agent-based models using Xholon. It can also be used to compare Xholon with other agent-based modeling tools that have also implemented the Stupid Model series.
This model shows how to add parameters that can be accessed at runtime by the simulation. Specifically, three parameters are to be added:
- Initial number of bugs (a model parameter),
- Maximum daily food consumption (a bug parameter), and
- Maximum food production (a cell parameter).
The model parameter is set in StupidModel5_CompositeStructureHierarchy.xml, by specifying multiplicity="100" for the Bug class. In Xholon, this is normally how the quantity of some object, such as an agent or grid cell, is specified.
The other two parameters are set in StupidModel5_xhn.xml, where there's a separate param line for each of MaxConsumptionRate and MaxFoodProductionRate. To handle these two parameters, set methods are implemented in AppStupidModel5.java, and variables are defined in BugStupidModel5.java and HabitatCellStupidModel5.java .
By default, all parameters are displayed in the console window when the application starts running. This can be changed by setting ShowParams in StupidModel5_xhn.xml to false.