gridiq.simulation
Class SimulationController

java.lang.Object
  extended by gridiq.simulation.SimulationController

public class SimulationController
extends java.lang.Object

This component provides a single interface to the GridIQ system by implementing the Facade design pattern. The SimulationController maintains the current time step of the simulation and interacts with other components in the system to load project and configuration files, execute simulations for the appropriate number of steps, and persist simulation results.


Constructor Summary
SimulationController()
          Creates a new simulation controller, instantiating default classes of NetworkParser, PowerFlowSolver, AgentManager, ResultsWriter, and DisturbanceSet to be used for the simulation.
 
Method Summary
 void close()
          Terminates the agent platform and ends the simulation.
 int executeNextTimeStep()
          Runs a single time step, executing both power analysis and agent execution phases.
 Network getNetwork()
          Gets the current network model for the simulation.
 java.lang.String getOctavePath()
          Gets the Octave path used for the simulation.
 java.lang.String getPsatPath()
          Gets the path to the PSAT library.
 void initialise(Project proj)
          Initialises the simulation according to the given project configuration.
 void run()
          Runs all remaining time steps in the simulation.
 void runAgents()
          Notifies agents of the most recent simulation results.
 SimResults runPowerAnalysis()
          Runs a power flow analysis.
 void setDisturbanceSet(DisturbanceSet disturbanceSet)
          Sets the DisturbanceSet class to use for the simulation.
 void setDisturbanceSet(java.lang.String name)
          Sets the DisturbanceSet class to use for the simulation.
 void setOctavePath(java.lang.String octavePath)
          Sets the Octave path used for the simulation.
 void setPsatPath(java.lang.String psatPath)
          Sets the path to the PSAT library used for the simulation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimulationController

public SimulationController()
                     throws java.io.IOException
Creates a new simulation controller, instantiating default classes of NetworkParser, PowerFlowSolver, AgentManager, ResultsWriter, and DisturbanceSet to be used for the simulation.

Throws:
java.io.IOException
Method Detail

initialise

public void initialise(Project proj)
                throws java.io.IOException,
                       jade.wrapper.StaleProxyException,
                       java.lang.ClassNotFoundException,
                       java.lang.InstantiationException,
                       java.lang.IllegalAccessException
Initialises the simulation according to the given project configuration.

Parameters:
proj - The project configuration.
Throws:
java.io.IOException
jade.wrapper.StaleProxyException
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException

getNetwork

public Network getNetwork()
Gets the current network model for the simulation.

Returns:
The network model.

run

public void run()
         throws java.lang.Exception
Runs all remaining time steps in the simulation.

Throws:
java.lang.Exception

executeNextTimeStep

public int executeNextTimeStep()
                        throws java.lang.Exception
Runs a single time step, executing both power analysis and agent execution phases.

Returns:
The time step number executed.
Throws:
java.lang.Exception

runPowerAnalysis

public SimResults runPowerAnalysis()
                            throws java.lang.Exception
Runs a power flow analysis.

Returns:
The power flow simulation results.
Throws:
java.lang.Exception

runAgents

public void runAgents()
               throws jade.wrapper.StaleProxyException,
                      java.lang.InterruptedException
Notifies agents of the most recent simulation results.

Throws:
jade.wrapper.StaleProxyException
java.lang.InterruptedException

close

public void close()
Terminates the agent platform and ends the simulation.


getPsatPath

public java.lang.String getPsatPath()
Gets the path to the PSAT library.

Returns:
the path to the PSAT library.

setPsatPath

public void setPsatPath(java.lang.String psatPath)
Sets the path to the PSAT library used for the simulation.

Parameters:
psatPath -

getOctavePath

public java.lang.String getOctavePath()
Gets the Octave path used for the simulation.

Returns:
the Octave path.

setOctavePath

public void setOctavePath(java.lang.String octavePath)
Sets the Octave path used for the simulation.

Parameters:
octavePath -

setDisturbanceSet

public void setDisturbanceSet(java.lang.String name)
                       throws java.lang.ClassNotFoundException,
                              java.lang.InstantiationException,
                              java.lang.IllegalAccessException
Sets the DisturbanceSet class to use for the simulation.

Parameters:
name - The name of the class of the DisturbanceSet to instantiate.
Throws:
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException

setDisturbanceSet

public void setDisturbanceSet(DisturbanceSet disturbanceSet)
Sets the DisturbanceSet class to use for the simulation.

Parameters:
disturbanceSet - The DisturbanceSet instance to use.