RapidNet
Fast Stochastic MPC for Drinking Water Networks
 All Classes Files Functions Variables Typedefs Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SmpcController Class Reference
Collaboration diagram for SmpcController:
Collaboration graph
[legend]

Public Member Functions

 SmpcController (Forecaster *myForecaster, Engine *myEngine, SmpcConfiguration *mySmpcConfig)
 
 SmpcController (string pathToConfigFile)
 
void initialiseSmpcController ()
 
void controllerSmpc ()
 
uint_t controlAction (real_t *u)
 
uint_t controlAction (fstream &controlOutputJson)
 
DwnNetworkgetDwnNetwork ()
 
ScenarioTreegetScenarioTree ()
 
SmpcConfigurationgetSmpcConfiguration ()
 
ForecastergetForecaster ()
 
EnginegetEngine ()
 
void moveForewardInTime ()
 
real_t getEconomicKpi (uint_t simulationTime)
 
real_t getSmoothKpi (uint_t simulationTime)
 
real_t getNetworkKpi (uint_t simulationTime)
 
real_t getSafetyKpi (uint_t simulationTime)
 
void updateKpi (real_t *state, real_t *control)
 
 ~SmpcController ()
 

Protected Member Functions

void dualExtrapolationStep (real_t lambda)
 
void solveStep ()
 
void proximalFunG ()
 
void dualUpdate ()
 
uint_t algorithmApg ()
 
void updateSmpcConfiguration (real_t *updateState, real_t *control, real_t *demand)
 

Protected Attributes

EngineptrMyEngine
 
ForecasterptrMyForecaster
 
SmpcConfigurationptrMySmpcConfig
 
real_tdevVecX
 
real_tdevVecU
 
real_tdevVecV
 
real_tdevVecXi
 
real_tdevVecPsi
 
real_tdevVecAcceleratedXi
 
real_tdevVecAcceleratedPsi
 
real_tdevVecPrimalXi
 
real_tdevVecPrimalPsi
 
real_tdevVecDualXi
 
real_tdevVecDualPsi
 
real_tdevVecUpdateXi
 
real_tdevVecUpdatePsi
 
real_t ** devPtrVecX
 
real_t ** devPtrVecU
 
real_t ** devPtrVecV
 
real_t ** devPtrVecAcceleratedPsi
 
real_t ** devPtrVecAcceleratedXi
 
real_t ** devPtrVecPrimalPsi
 
real_t ** devPtrVecPrimalXi
 
real_tdevVecPrimalInfeasibilty
 
real_tdevVecQ
 
real_tdevVecR
 
real_t ** devPtrVecQ
 
real_t ** devPtrVecR
 
real_tdevControlAction
 
real_tdevStateUpdate
 
real_t stepSize
 
bool factorStepFlag
 
bool simulatorFlag
 
real_tvecPrimalInfs
 
real_t economicKpi
 
real_t smoothKpi
 
real_t safeKpi
 
real_t networkKpi
 

Detailed Description

GPU-based stochastic model predictive controller for management of the drinking water water network. This method is used dual proximal gradient method to solve the optimisation problem resulted from the stochastic mpc controller. This algorithm is completely parallelisable takes full advantage of parallel computational capability of the GPU devices.

The object initiates the controller object. This contains

Constructor & Destructor Documentation

SmpcController::SmpcController ( Forecaster myForecaster,
Engine myEngine,
SmpcConfiguration mySmpcConfig 
)

Construct a new Controller with a given engine.

Parameters
myForecasterAn instance of the Forecaster object
myEngineAn instance of Engine object
mySmpcConfigAn instance of the Smpc controller configuration object

Here is the call graph for this function:

SmpcController::SmpcController ( string  pathToConfigFile)

Construct a new Controller with a given engine.

Parameters
pathToConfigFilepath to the controller configuration file

Here is the call graph for this function:

SmpcController::~SmpcController ( )

Destructor. Frees allocated memory.

Member Function Documentation

uint_t SmpcController::algorithmApg ( )
protected

This method executes the APG algorithm and returns the primal infeasibility.

Returns
primalInfeasibilty;

Here is the call graph for this function:

Here is the caller graph for this function:

uint_t SmpcController::controlAction ( real_t u)

Computes a control action and returns a status code which is an integer (1 = success).

Parameters
upointer to computed control action (CPU variable)
Returns
status code

Here is the call graph for this function:

Here is the caller graph for this function:

uint_t SmpcController::controlAction ( fstream &  controlOutputJson)

Compute the control action, stores in the json file provided to it and returns a status code (1 = success).

Parameters
controlJsonfile pointer to the output json file
Returns
status code

Here is the call graph for this function:

void SmpcController::controllerSmpc ( )

Invoke the SMPC controller on the current state of the network. This method invokes #updateStateControl, eliminateInputDistubanceCoupling and finally algorithmApg.

Here is the call graph for this function:

void SmpcController::dualExtrapolationStep ( real_t  lambda)
protected

Performs the dual extrapolation step with given parameter.

Parameters
extrapolationparameter.

Here is the call graph for this function:

Here is the caller graph for this function:

void SmpcController::dualUpdate ( )
protected

Performs the update of the dual vector.

Here is the call graph for this function:

Here is the caller graph for this function:

DwnNetwork * SmpcController::getDwnNetwork ( )

Get's the network object

Returns
DwnNetwork

Here is the call graph for this function:

Here is the caller graph for this function:

real_t SmpcController::getEconomicKpi ( uint_t  simulationTime)

Here is the caller graph for this function:

Engine * SmpcController::getEngine ( )

Get's the Engine object

Returns
Engine
Forecaster * SmpcController::getForecaster ( )

Get's the Forecaster object

Returns
Forecaster

Get's the forecaster object

Returns
Forecaster

Here is the caller graph for this function:

real_t SmpcController::getNetworkKpi ( uint_t  simulationTime)

Here is the call graph for this function:

Here is the caller graph for this function:

real_t SmpcController::getSafetyKpi ( uint_t  simulationTime)

Here is the caller graph for this function:

ScenarioTree * SmpcController::getScenarioTree ( )

Get's the scenario tree object

Returns
scenarioTree

Here is the call graph for this function:

real_t SmpcController::getSmoothKpi ( uint_t  simulationTime)

Here is the caller graph for this function:

SmpcConfiguration * SmpcController::getSmpcConfiguration ( )

Get's the Smpc controller configuration object

Returns
SmpcConfiguration
void SmpcController::initialiseSmpcController ( )

Performs the initialise the smpc controller

  • update the current state and previous controls in the device memory
  • perform the factor step

Here is the call graph for this function:

Here is the caller graph for this function:

void SmpcController::moveForewardInTime ( )

Here is the call graph for this function:

Here is the caller graph for this function:

void SmpcController::proximalFunG ( )
protected

Computes the proximal operator of g at the current point and updates (primal psi, primal xi) - Hx, (dual psi, dual xi) - z.

Here is the call graph for this function:

Here is the caller graph for this function:

void SmpcController::solveStep ( )
protected

Computes the dual gradient.This is the main computational algorithm for the proximal gradient algorithm

Here is the call graph for this function:

Here is the caller graph for this function:

void SmpcController::updateKpi ( real_t state,
real_t control 
)

update the KPI at the current time instance

Here is the call graph for this function:

Here is the caller graph for this function:

void SmpcController::updateSmpcConfiguration ( real_t updateState,
real_t control,
real_t demand 
)
protected

When the SIMULATOR FLAG is set to 1, the previousControl, currentState and previousDemand vectors in the smpc controller configuration file are set.

Parameters
updateStateupdate the currentX in the controller configuration json
controlupdate the prevU in the controller configuration json
demandupdate the prevDemand in the controller configuration json

Update tje json file using the commands from rapidJson functions When the SIMULATOR FLAG is set to 1, the previousControl, currentState and previousDemand vectors in the smpc controller configuration file are set.

Here is the call graph for this function:

Member Data Documentation

real_t* SmpcController::devControlAction
protected
real_t** SmpcController::devPtrVecAcceleratedPsi
protected

Pointer array for device pointers of accelerated psi

real_t** SmpcController::devPtrVecAcceleratedXi
protected

Pointer array for device pointers of accelerated xi

real_t** SmpcController::devPtrVecPrimalPsi
protected

Pointer array for device pointers of primal psi

real_t** SmpcController::devPtrVecPrimalXi
protected

Pointer array for device pointer of primal xi

real_t** SmpcController::devPtrVecQ
protected

Pointer array for device pointers of cost Q

real_t** SmpcController::devPtrVecR
protected

Pointer array for device pointers of cost R

real_t** SmpcController::devPtrVecU
protected

Pointer array for device pointers of control

real_t** SmpcController::devPtrVecV
protected

Pointer array for device pointers of reduced decision variable

real_t** SmpcController::devPtrVecX
protected

Pointer array for device pointers of state

real_t* SmpcController::devStateUpdate
protected

Updated state for the simulator

real_t* SmpcController::devVecAcceleratedPsi
protected

Pointer to device accelerated Psi

real_t* SmpcController::devVecAcceleratedXi
protected

Pointer to device accelerated Xi

real_t* SmpcController::devVecDualPsi
protected

Pointer to device dual Psi

real_t* SmpcController::devVecDualXi
protected

Pointer to device dual Xi

real_t* SmpcController::devVecPrimalInfeasibilty
protected

Pointer array for primal infeasibility Hx-z

real_t* SmpcController::devVecPrimalPsi
protected

Pointer to device primal Psi

real_t* SmpcController::devVecPrimalXi
protected

Pointer to device primal Xi

real_t* SmpcController::devVecPsi
protected

Pointer to device Psi

real_t* SmpcController::devVecQ
protected

Pointer for cost Q

real_t* SmpcController::devVecR
protected

Pointer for cost R

real_t* SmpcController::devVecU
protected

Pointer to device control

real_t* SmpcController::devVecUpdatePsi
protected

Pointer to device update psi

real_t* SmpcController::devVecUpdateXi
protected

Pointer to device updated xi

real_t* SmpcController::devVecV
protected

Pointer to device reduced control

real_t* SmpcController::devVecX
protected

Pointer to device state

real_t* SmpcController::devVecXi
protected

Pointer to device Xi

real_t SmpcController::economicKpi
protected
bool SmpcController::factorStepFlag
protected

Flag Factor step

real_t SmpcController::networkKpi
protected
Engine* SmpcController::ptrMyEngine
protected

Pointer to an Engine object. The Engine is responsible for the factor step.

Forecaster* SmpcController::ptrMyForecaster
protected

Pointer to the Forecaster object This contains the forecast of the demand and prices

SmpcConfiguration* SmpcController::ptrMySmpcConfig
protected

Pointer to the Smpc configuration object This contains the configurations for the controller

real_t SmpcController::safeKpi
protected
bool SmpcController::simulatorFlag
protected
real_t SmpcController::smoothKpi
protected
real_t SmpcController::stepSize
protected

Step size

real_t* SmpcController::vecPrimalInfs
protected

The documentation for this class was generated from the following files: