MADS Simulation Framework

Testing MADS & SAGS installation

Now that both MADS and SAGS have been installed, it's time to test the installation. First we will test if the agent server can be run and we will query the service agent database using the MADS Browser Utility web interface. Then we will run a sample simulation, to see if the graphics routines are in place.

Go to the SAGS Personal Agent Server program group, by clicking the Start button and then going to the Programs section. Start the MADS Personal Agent Server by choosing "Start server" from the program group. If successful, a command window should be opened and initialization outputs from all service agents should follow. It should look like the picture below. Remember that the server has to be started whenever a MADS simulation or the Browser Utility needs to be run. No part of MADS will work without the server.

SAGS server start

Now we will start the MADS Browser utility. Remember, leave the server running. Go again to the SAGS Personal Agent Server program group and start the Agent Browser Utility. Depending on your Windows version and on your web browser, security messages may appear.

A Java security message, like the one shown in the picture below, might appear. Choose to "Always trust content from this published", so this box will not be shown every time you start the application, and then click Run.

Java security message

If you use Mozilla or Firefox, something like the following windows security message will appear. Select Unblock to continue.

Mozilla & Firefox, windows security message

If you are an Internet Explorer user, you will first have to click on the yellow bar found in the top on the browser's window. Choose to let the application to run.

IE, security message

A message box will follow. Choose Yes.

IE, security message

Now choose to Unblock Internet Explorer.

IE, unblock

Now that all the security issues have been dealt with, regardless of the browser and windows version, the interface should be displayed as in the picture below.

Browser Utility

Try to search something in the database. In the case of an empty search string, all agents will be displayed. Follow the example shown in the figure below. After writing something in the search box, click the red search button or press enter to start the search. The agents whose descriptions match the search criteria will be displayed in big white box. Click the icon in the top-right of the box to expand. You can see name, description, parameters, time domain and literature references.

Browser Utility

Now close or hide the browser interface and open a new command window (different from the one the server is running in). You can do this by clicking the Start button, choosing Run, typing "cmd" or "command", depending on your version of windows, and the pressing the enter key. A command window should appear. Remember, the server must not be stopped.

Command window

Now type at the command prompt the following command "java jade.Boot -container ag1:mads.samples.Sample5_CogenerationAdoptionSimulation". Let us explain this a little. The first word "java" starts the Java Virtual Machine. This is necessary since we are dealing with a Java application. The Java Virtual Machine will start the class (program) called "jade.Boot". This starts JADE (Java Agent DEvelopment Framework), which is used by MADS and SAGS for agent management and communication. The "-container" options tells JADE that to create a local agent container (a special object where agentes reside) where the simulation agent can be created. JADE then receives the command "ag1:mads.samples.Sample5_CogenerationAdoptionSimulation" which informs it to create a simulation agent called "ag1" of type "Sample5_CogenerationAdoptionSimulation", which is found in the package "mads.samples".

Command window

If all is OK, the sample simulation should run and a graphic should be displayed as output. In this simulation, some factory or industrial installation, who needs both electricity and heat, must decide whether to buy a standard boiler or one with a cogeneration system. In the case of the standard boiler, the firm must buy electricity from the grid and natural gas (to heat the boiler) from some supplier. In the case of the cogeneration system, the firm will start by buying only natural gas. This will be used both for heating and for producing some amount of electricity, using the cogeneration system. If this electricity is enough, none will be bought from the grid. If there is a deficit, the required amount will be bought from the grid. If there is a surplus, the unneeded amount will be sold back to the grid (at some buyback rate). The manager will consider all costs (computed on the lifetime of the system, in this case of 20 years), including investments (investments in cogeneration are substantially bigger than for a standard boiler). If he discovers there is a financial advantage in switching to cogeneration, he will do so at some time in the future when this advantage is maximized. The graph outputted by the system is the profit the manager will get if he swiches to cogeneration at time t. It can be seen that for this scenario, the optimal switching time is 2018.

Command window

Another output is also displayed in the console window, as text.

Command window