FREEDM DGI
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
freedm::broker::vvc::VVCAgent Class Reference

#include <VoltVarCtrl.hpp>

Inheritance diagram for freedm::broker::vvc::VVCAgent:
freedm::broker::IDGIModule

Public Member Functions

 VVCAgent ()
 
 ~VVCAgent ()
 
int Run ()
 

Protected Member Functions

CPeerNode GetMe ()
 Gets a CPeerNode representing this process. More...
 
std::string GetUUID () const
 Gets the UUID of this process. More...
 

Private Member Functions

void FirstRound (const boost::system::error_code &err)
 The code that runs the firtst round of the LB phase. More...
 
ModuleMessage Gradient (arma::mat grad)
 
void HandleGradient (const GradientMessage &m, CPeerNode peer)
 
void HandleIncomingMessage (boost::shared_ptr< const ModuleMessage > msg, CPeerNode peer)
 First handler for an incoming message. More...
 
void HandleLineReadings (const LineReadingsMessage &m, CPeerNode peer)
 
void HandlePeerList (const gm::PeerListMessage &m, CPeerNode peer)
 
void HandleVoltageDelta (const VoltageDeltaMessage &m, CPeerNode peer)
 
ModuleMessage LineReadings (std::vector< float > vals)
 
ModuleMessage PrepareForSending (const VoltVarMessage &message, std::string recipient)
 
void ReadDevices ()
 Updates the state from the devices. More...
 
void ScheduleNextRound ()
 Schedules the LoadManage that runs next round. More...
 
ModuleMessage VoltageDelta (unsigned int cf, float pm, std::string loc)
 
void vvc_main ()
 Updates the node's state. More...
 
void vvc_Manage (const boost::system::error_code &err)
 
void VVCManage (const boost::system::error_code &err)
 The code that the supply nodes use to start doing migrations. More...
 

Private Attributes

float m_Gateway
 The gateway of this node. More...
 
std::string m_leader
 
std::string m_Leader
 The coordinator of the group. More...
 
float m_MigrationStep
 The amount to migrate. More...
 
float m_NetGeneration
 The amount of generation created by attached devices. More...
 
PeerSet m_peers
 
float m_PowerDifferential
 The powerflow used by the physical invariant. More...
 
float m_PredictedGateway
 The gateway that we predict will be met by the devices. More...
 
CBroker::TimerHandle m_RoundTimer
 Timer handle for the round timer. More...
 
bool m_Synchronized
 If the system is synchronized with the physical system. More...
 
CBroker::TimerHandle m_WaitTimer
 Timer handle for the request timer. More...
 
const boost::posix_time::time_duration REQUEST_TIMEOUT
 The time it takes to get a draftrequest response. More...
 
const boost::posix_time::time_duration ROUND_TIME
 The amount of time it takes to do an VVC round. More...
 

Detailed Description

class VVCAgent

Description:
Declaration

Constructor & Destructor Documentation

freedm::broker::vvc::VVCAgent::VVCAgent ( )

VVCAgent

Description:
: Constructor for the VVC module
Precondition:
: Posix Main should register read handler and invoke this module
Postcondition:
: Object is initialized and ready to run
Parameters
uuid_This object's uuid
brokerThe Broker
Limitations:
: None
freedm::broker::vvc::VVCAgent::~VVCAgent ( )

Member Function Documentation

void freedm::broker::vvc::VVCAgent::FirstRound ( const boost::system::error_code &  err)
private

FirstRound

Description:
The code that is executed as part of the first VVC each round.
Precondition:
None
Postcondition:
if the timer wasn't cancelled this function calls the first VVC.
Parameters
errorThe reason this function was called.
CPeerNode IDGIModule::GetMe ( )
protectedinherited

GetMe

Description:
Gets a CPeerNode that refers to this process.
Returns
A CPeerNode referring to this process.
std::string IDGIModule::GetUUID ( ) const
protectedinherited

GetUUID

Description:
Gets this process's UUID.
Returns
This process's UUID
ModuleMessage freedm::broker::vvc::VVCAgent::Gradient ( arma::mat  grad)
private
void freedm::broker::vvc::VVCAgent::HandleGradient ( const GradientMessage &  m,
CPeerNode  peer 
)
private
void freedm::broker::vvc::VVCAgent::HandleIncomingMessage ( boost::shared_ptr< const ModuleMessage >  m,
CPeerNode  peer 
)
privatevirtual

HandleIncomingMessage "Downcasts" incoming messages into a specific message type, and passes the message to an appropriate handler.

Precondition:
None
Postcondition:
The message is handled by the target handler or a warning is produced.
Parameters
mthe incoming message
peerthe node that sent this message (could be this DGI)

Implements freedm::broker::IDGIModule.

void freedm::broker::vvc::VVCAgent::HandleLineReadings ( const LineReadingsMessage &  m,
CPeerNode  peer 
)
private
void freedm::broker::vvc::VVCAgent::HandlePeerList ( const gm::PeerListMessage &  m,
CPeerNode  peer 
)
private
void freedm::broker::vvc::VVCAgent::HandleVoltageDelta ( const VoltageDeltaMessage &  m,
CPeerNode  peer 
)
private
ModuleMessage freedm::broker::vvc::VVCAgent::LineReadings ( std::vector< float >  vals)
private
ModuleMessage freedm::broker::vvc::VVCAgent::PrepareForSending ( const VoltVarMessage &  message,
std::string  recipient 
)
private
void freedm::broker::vvc::VVCAgent::ReadDevices ( )
private

ReadDevices

Description:
Reads the device state and updates the appropriate member vars.
Precondition:
None
Postcondition:
int freedm::broker::vvc::VVCAgent::Run ( )

Run

Description:
Main function which initiates the algorithm
Precondition:
: Posix Main should invoke this function
Postcondition:
: Triggers the vvc algorithm by calling VVCManage()
Limitations:
None
void freedm::broker::vvc::VVCAgent::ScheduleNextRound ( )
private

ScheduleNextRound

Description:
Computes how much time is remaining and if there isn't enough requests the VVC that will run next round.
Precondition:
None
Postcondition:
VVCManage is scheduled for this round OR FirstRound is scheduled for next time.
ModuleMessage freedm::broker::vvc::VVCAgent::VoltageDelta ( unsigned int  cf,
float  pm,
std::string  loc 
)
private
void freedm::broker::vvc::VVCAgent::vvc_main ( )
private
void freedm::broker::vvc::VVCAgent::vvc_Manage ( const boost::system::error_code &  err)
private
void freedm::broker::vvc::VVCAgent::VVCManage ( const boost::system::error_code &  err)
private

VVCManage

Description:
: Manages the execution of the VVC algorithm
Precondition:
:
Postcondition:
:
Interaction Peers:
Limitations:

Member Data Documentation

float freedm::broker::vvc::VVCAgent::m_Gateway
private
std::string freedm::broker::vvc::VVCAgent::m_leader
private
std::string freedm::broker::vvc::VVCAgent::m_Leader
private
float freedm::broker::vvc::VVCAgent::m_MigrationStep
private
float freedm::broker::vvc::VVCAgent::m_NetGeneration
private
PeerSet freedm::broker::vvc::VVCAgent::m_peers
private
float freedm::broker::vvc::VVCAgent::m_PowerDifferential
private
float freedm::broker::vvc::VVCAgent::m_PredictedGateway
private
CBroker::TimerHandle freedm::broker::vvc::VVCAgent::m_RoundTimer
private
bool freedm::broker::vvc::VVCAgent::m_Synchronized
private
CBroker::TimerHandle freedm::broker::vvc::VVCAgent::m_WaitTimer
private
const boost::posix_time::time_duration freedm::broker::vvc::VVCAgent::REQUEST_TIMEOUT
private
const boost::posix_time::time_duration freedm::broker::vvc::VVCAgent::ROUND_TIME
private

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