24 #ifndef LOAD_BALANCE_HPP 25 #define LOAD_BALANCE_HPP 32 #include "messages/ModuleMessage.pb.h" 37 #include <boost/shared_ptr.hpp> 38 #include <boost/date_time/posix_time/posix_time_types.hpp> 71 ModuleMessage
PrepareForSending(
const LoadBalancingMessage & m, std::string recipient =
"lb");
100 void LoadManage(
const boost::system::error_code & error);
102 void FirstRound(
const boost::system::error_code & error);
181 #endif // LOAD_BALANCE_HPP void SetDESD(float desd)
Sets DESD value to the specified level.
Definition: LoadBalance.cpp:1038
void SendDraftAge(CPeerNode peer)
Sends draftage to the specified peer.
Definition: LoadBalance.cpp:688
Definition: LoadBalance.hpp:44
bool m_Synchronized
If the system is synchronized with the physical system.
Definition: LoadBalance.hpp:169
void SendTooLate(CPeerNode peer, float step)
Sends too late to the specified peer.
void HandleDraftAccept(const DraftAcceptMessage &m, CPeerNode peer)
Handles the draft accept message coming from the demand node.
Definition: LoadBalance.cpp:932
Definition: LoadBalance.hpp:51
void HandleStateChange(const StateChangeMessage &m, CPeerNode peer)
Handles a node announcing its state change.
Definition: LoadBalance.cpp:557
float m_NetGeneration
The amount of generation created by attached devices.
Definition: LoadBalance.hpp:160
ModuleMessage MessageDraftRequest()
Generates message supply nodes send to demand nodes.
Definition: LoadBalance.cpp:595
void LoadTable()
Displays the load table to show DGI state.
Definition: LoadBalance.cpp:454
ModuleMessage MessageTooLate(float amount)
Generates the message sent by the demand node to refuse migration.
Definition: LoadBalance.cpp:910
ModuleMessage MessageStateCollection()
Generates the message used to request a state collection.
Definition: LoadBalance.cpp:1106
void HandleIncomingMessage(boost::shared_ptr< const ModuleMessage > m, CPeerNode peer)
First handler for an incoming message.
Definition: LoadBalance.cpp:137
void SetPStar(float pstar)
Sets PStar to the specified level.
Definition: LoadBalance.cpp:1000
void DraftStandard(const boost::system::error_code &error)
The code that runs after the draft request replies have arrived.
Definition: LoadBalance.cpp:749
CBroker::TimerHandle m_RoundTimer
Timer handle for the round timer.
Definition: LoadBalance.hpp:141
void SendDraftRequest()
Sends Draft request to all the demand peers.
Definition: LoadBalance.cpp:609
Base interface for agents/broker modules.
Definition: CPeerNode.hpp:37
void Synchronize(float k)
Synchronizes the Fast-Style Loadbalance with the physical system.
Definition: LoadBalance.cpp:1217
const boost::posix_time::time_duration REQUEST_TIMEOUT
The time it takes to get a draftrequest response.
Definition: LoadBalance.hpp:138
void SendToPeerSet(const PeerSet &ps, const ModuleMessage &m)
Sends a message to all peers in a peerset.
Definition: LoadBalance.cpp:238
ModuleMessage MessageStateChange(std::string state)
Generates the message announcing current node state.
Definition: LoadBalance.cpp:536
void HandleCollectedState(const sc::CollectedStateMessage &m)
Handles the collected state coming from state collection.
Definition: LoadBalance.cpp:1160
float m_Gateway
The gateway of this node.
Definition: LoadBalance.hpp:158
const boost::posix_time::time_duration ROUND_TIME
The amount of time it takes to do an LB round.
Definition: LoadBalance.hpp:136
ModuleMessage MessageDraftSelect(float amount)
Generates the message that the supply node uses to select a demand node.
Definition: LoadBalance.cpp:805
void MoveToPeerSet(PeerSet &ps, CPeerNode peer)
Moves a peer to the specified peerset.
Definition: LoadBalance.cpp:220
ModuleMessage MessageDraftAge(float age)
Generates message demand nodes send in response to DraftRequest.
Definition: LoadBalance.cpp:671
bool InvariantCheck()
Check the invariant prior to starting a new migration.
Definition: LoadBalance.cpp:1237
void HandleDraftRequest(const DraftRequestMessage &m, CPeerNode peer)
Handles the draft request originating from the supply node.
Definition: LoadBalance.cpp:649
CBroker::TimerHandle m_WaitTimer
Timer handle for the request timer.
Definition: LoadBalance.hpp:143
int Run()
Definition: LoadBalance.cpp:118
State
Definition: LoadBalance.hpp:51
void ScheduleStateCollection()
Sends the request to perform state collection.
Definition: LoadBalance.cpp:1130
unsigned int TimerHandle
Definition: CBroker.hpp:66
std::map< std::string, float > m_DraftAge
Pending migrations.
Definition: LoadBalance.hpp:174
void ReadDevices()
Updates the state from the devices.
Definition: LoadBalance.cpp:382
LBAgent()
Definition: LoadBalance.cpp:87
An interface for an object which can handle recieving incoming messages.
Definition: IDGIModule.hpp:36
PeerSet m_InSupply
Peers in the supply state.
Definition: LoadBalance.hpp:148
void FirstRound(const boost::system::error_code &error)
The code that runs the firtst round of the LB phase.
Definition: LoadBalance.cpp:265
ModuleMessage PrepareForSending(const LoadBalancingMessage &m, std::string recipient="lb")
Boilerplate for preparing a message.
Definition: LoadBalance.cpp:1090
ModuleMessage MessageCollectedState(float state)
Definition: LoadBalance.cpp:1182
void SendDraftSelect(CPeerNode peer, float step)
Sends a draft select to the specified peer.
Definition: LoadBalance.cpp:820
float m_PowerDifferential
The powerflow used by the physical invariant.
Definition: LoadBalance.hpp:166
General FREEDM Namespace.
Definition: CBroker.cpp:53
void HandlePeerList(const gm::PeerListMessage &m, CPeerNode peer)
Handles the peerlist coming from the group leader.
Definition: LoadBalance.cpp:969
float m_MigrationStep
The amount to migrate.
Definition: LoadBalance.hpp:164
std::string m_Leader
The coordinator of the group.
Definition: LoadBalance.hpp:172
State m_State
The current state of this peer.
Definition: LoadBalance.hpp:155
PeerSet m_AllPeers
All peers in group.
Definition: LoadBalance.hpp:146
float m_PredictedGateway
The gateway that we predict will be met by the devices.
Definition: LoadBalance.hpp:162
void UpdateState()
Updates the node's state.
Definition: LoadBalance.cpp:412
PeerSet m_InDemand
Peers in the demand state.
Definition: LoadBalance.hpp:150
PeerSet m_InNormal
Peers in the normal state.
Definition: LoadBalance.hpp:152
void ScheduleNextRound()
Schedules the LoadManage that runs next round.
Definition: LoadBalance.cpp:358
void SendDraftAccept(CPeerNode peer, float step)
Sends draft accept to the specified peer.
ModuleMessage MessageDraftAccept(float amount)
Generates the message that the demand node uses to confirm the migration.
Definition: LoadBalance.cpp:895
void HandleTooLate(const TooLateMessage &m)
Handles the draft reject message coming from the demand node.
Definition: LoadBalance.cpp:951
void LoadManage(const boost::system::error_code &error)
The code that the supply nodes use to start doing migrations.
Definition: LoadBalance.cpp:299
void HandleDraftSelect(const DraftSelectMessage &m, CPeerNode peer)
Handles the draft select message coming from the supply node.
Definition: LoadBalance.cpp:854
std::map< std::string, CPeerNode > PeerSet
Provides a PeerSet type for a module templated on T.
Definition: PeerSets.hpp:35
Definition: LoadBalance.hpp:51
void HandleDraftAge(const DraftAgeMessage &m, CPeerNode peer)
Handles the draft age message coming from the demand node.
Definition: LoadBalance.cpp:726
Definition: LoadBalance.hpp:51