The Java Simulation 'Sim Village'

Operation.The cycle box accepts 4 digit integers. In this sim they represent months therefore 444 months is a run from 1949 to 1986. The supercycle button merely repeats the whole trial N time. The start log button writes a unicode output to file (in original, this version of the applet does not write files) including basic statistics, mean, standard deviation, max & min values if wanted. The reset button returns all values to default (as defined in the reset() method of each subclass of SimParam).

An analysis of a run of this simulation by Steve Wilson.

SimParam - is the heart of the simulation shell. It is a variable house keeping shell and maintains simulation parameter objects which are subclassed from SimParam placed in the graphical container of SimApp (the AWT applet panel) at design time by linking SimParam subclasses to a DField and associated objects (which provide an AWT data entry field, internal value and label for the field). It keeps track of these objects through the cycles of the simulation and greatly reduces the need for elaborate coding for each new sim. It takes care of initialisation (init()) which happens once in the sim lifecycle; reset(), which occurs at the end of each sim run or at the press of the reset button; graphing , it uses anMGraph object and methods to graph selected variables (via the registerGraph() method). It handles the updating of simulation parameter calculations (calc()) for the two cycles, a major cycle (static instance variable numCycle) and an inner minor cycle (static instance variable theTick); it manages messages between the SimParam objects and logs the results of a sim trial through the PrintFormat (implements printf() functionality) and XFile (a simple AWT file management object) objects and associated methods. SimParam registers the name of every subclass in a static array, which make its possible for different subclasses to reference each other.

Household - The HouseHold class extends SimParam and its instantiation maintains the initial and calculated number of households. As with all SimParam subclasses, it overides the init, reset and calc methods of SimParam. It utilises a number of simple reference objects in its calculation method. HHpop is the number of people in any one household; HHmax is the max allowed people per household and HHNorm is the normal member ship value of the aggregated household. The land object is merely a data container for the amount of land available.MinlandHH is the sensitive object. This determines the threshold at which, given the household conditions, a migrant population will be created.

SimApp - This class extends the basic applet and provides the Java.AWT GUI container for the SimParam subclasses. It takes care of GUI event handling and starts the global cycle mechanism of SimParam

SkPop - This class provides a wrapper for dealing with population variables. The birthrates and deathrates are randomly generated via a normal distribution which is passed a varience value and the population is generated by the interplay of these two. The infant mortality variable was not implemented as for the purposes of this simulation it was not necessary.