Controller Overview

One major part of the framework is the Controller class. This class performs setup operations and executes the simulation. It has a lot of responsibility but for this discussion we will focus on the parts that are important to the sample application. A more detailed discussion of the Controller can be found in the Framework Overview.

The first responsibility of the Controller is to load the file as you see from the command line when you ran the sample application. This file tells the Controller what you want it to do for the simulation. Details of this file will be discussed later when you have a more thorough understanding of what needs to be done in order to build an application that uses the Framework.

For now it is enough to understand this file tells the Controller the following pieces of information:

This may seem like a lot information and it is, but the Framework is extremely flexible and highly configurable, and this file contains all of the information that is needed to run your simulation.

After the Controller loads this information, it starts to process it and see if it can do what it has been instructed it to do. It tries to create, in order, the following for you:

  1. The actual Simulation.
  2. A Physical System that is a collection of Physical Objects
  3. The Physical Objects needed by the Physical System.
  4. The Physical Algorithm needed to perform the Simulation.
  5. The Physical Measurement to be performed.
  6. A Data Source to store Physical Measurement information.
  7. If specified, a Final Report
This again may seem like a lot to create and be responsible for, but the Framework has been developed so that you do not have to develop these mechanisms yourself to perform these tasks.

If the Controller can create all of the items listed above, it then begins executing the Simulation. At any point, if it can not create any of the items listed above, it will produce a detailed error message alerting the user what caused the error. If possible it will try and provide a hint as to how the error can be avoided, but this may not be a feature of early releases of the Framework.

The Controller executes the Simulation by performing the following steps:

  1. Perform an iteration using the Physical Algorithm.
  2. If necessary, perform a Physical Measurement
  3. If necessary, store the Physical Measure to the Data Source
  4. Check if the Simulation should still be executing
  5. If the Simulation is running, then repeat from Step 1.
  6. If the Simulation has completed, then produce a Final Report if necessary and write any remaining data to the Data Source.
The whole process of the Controller can be understood be understood in the next section. A thorough understanding can be obtained by examining the source code. Study the code and when you believe you have a general understanding of it, then you will definitely be ready to go to the Framework Overview section which will explain in detail the guts of the Framework and how it is put together.