helics
3.5.1
|
#include <BaseTimeCoordinator.hpp>
Public Member Functions | |
BaseTimeCoordinator (std::function< void(const ActionMessage &)> userSendMessageFunction) | |
void | setMessageSender (std::function< void(const ActionMessage &)> userSendMessageFunction) |
void | setRestrictivePolicy (bool policy) |
std::vector< GlobalFederateId > | getDependencies () const |
std::vector< GlobalFederateId > | getDependents () const |
Time | getLastGrant (GlobalFederateId fedId) const |
void | setSourceId (GlobalFederateId sourceId) |
GlobalFederateId | sourceId () const |
virtual bool | updateTimeFactors ()=0 |
const DependencyInfo * | getDependencyInfo (GlobalFederateId ofed) const |
bool | isDependency (GlobalFederateId ofed) const |
bool | empty () const |
virtual TimeProcessingResult | processTimeMessage (const ActionMessage &cmd) |
void | processDependencyUpdateMessage (const ActionMessage &cmd) |
virtual bool | addDependency (GlobalFederateId fedID) |
virtual bool | addDependent (GlobalFederateId fedID) |
virtual void | removeDependency (GlobalFederateId fedID) |
virtual void | removeDependent (GlobalFederateId fedID) |
virtual void | resetDependency (GlobalFederateId fedID) |
void | setAsChild (GlobalFederateId fedID) |
void | setAsParent (GlobalFederateId fedID) |
void | setVersion (GlobalFederateId fedID, std::int8_t version) |
GlobalFederateId | getParent () const |
void | disconnect () |
virtual MessageProcessingResult | checkExecEntry (GlobalFederateId triggerFed=GlobalFederateId{})=0 |
virtual void | enteringExecMode (IterationRequest mode=IterationRequest::NO_ITERATIONS) |
virtual std::string | printTimeStatus () const =0 |
virtual void | generateDebuggingTimeInfo (Json::Value &base) const |
bool | hasActiveTimeDependencies () const |
int | dependencyCount () const |
GlobalFederateId | getMinDependency () const |
Json::Value | grantTimeoutCheck (const ActionMessage &cmd) |
virtual Time | getNextTime () const =0 |
Static Public Attributes | |
static constexpr std::int32_t | TIME_COORDINATOR_VERSION {1} |
Protected Member Functions | |
ActionMessage | generateTimeRequest (const TimeData &dep, GlobalFederateId fed, std::int32_t responseCode) const |
void | sendTimingInfo () |
Protected Attributes | |
TimeDependencies | dependencies |
std::function< void(const ActionMessage &)> | sendMessageFunction |
callback used to send the messages | |
GlobalFederateId | mSourceId {0} |
the identifier for inserting into the source id field of any generated messages; | |
std::int32_t | sequenceCounter {0} |
storage for sequence counter | |
bool | noParent {true} |
indicator that the coordinator does not have parents | |
bool | federatesOnly {false} |
indicator that the forwarder only operates with federates | |
bool | checkingExec {false} |
bool | executionMode {false} |
bool | restrictive_time_policy {false} |
flag indicating that a restrictive time policy should be used | |
bool | nonGranting {false} |
bool | delayedTiming {false} |
bool | disconnected {false} |
a virtual class defining a time coordinator. The base class implements some common data and operations that are common to all the time coordinators
|
virtual |
add a federate dependency
Reimplemented in helics::TimeCoordinator.
Referenced by helics::TimeCoordinator::addDependency().
|
virtual |
add a dependent federate
Reimplemented in helics::TimeCoordinator.
Referenced by helics::TimeCoordinator::addDependent().
|
pure virtual |
check if entry to the executing state can be granted
Implemented in helics::TimeCoordinator, helics::GlobalTimeCoordinator, helics::ForwardingTimeCoordinator, and helics::AsyncTimeCoordinator.
int helics::BaseTimeCoordinator::dependencyCount | ( | ) | const |
get a count of the active dependencies
void helics::BaseTimeCoordinator::disconnect | ( | ) |
disconnect
References helics::appendMessage(), helics::ActionMessage::dest_id, and helics::ActionMessage::source_id.
Referenced by helics::TimeCoordinator::checkTimeGrant().
|
inline |
check whether a timeCoordinator has any dependencies or dependents
References dependencies, and helics::TimeDependencies::empty().
|
virtual |
function to enter the exec Mode
mode | the mode of iteration_request (NO_ITERATIONS, FORCE_ITERATION, ITERATE_IF_NEEDED) |
Reimplemented in helics::TimeCoordinator.
References helics::parent_broker_id.
|
virtual |
generate debugging time information
Reimplemented in helics::TimeCoordinator, helics::GlobalTimeCoordinator, helics::ForwardingTimeCoordinator, and helics::AsyncTimeCoordinator.
Referenced by helics::AsyncTimeCoordinator::generateDebuggingTimeInfo(), helics::ForwardingTimeCoordinator::generateDebuggingTimeInfo(), helics::GlobalTimeCoordinator::generateDebuggingTimeInfo(), and helics::TimeCoordinator::generateDebuggingTimeInfo().
|
protected |
generate a timeRequest message based on the dependency info data
References helics::ActionMessage::actionTime, helics::GlobalFederateId::baseValue(), helics::ActionMessage::counter, helics::ActionMessage::dest_id, FORCE_ITERATION, helics::TimeData::interrupted, helics::interrupted_flag, ITERATE_IF_NEEDED, helics::TimeData::minDe, helics::TimeData::minFed, helics::TimeData::next, helics::TimeData::responseSequenceCounter, helics::ActionMessage::setAction(), helics::setActionFlag(), helics::ActionMessage::setExtraData(), helics::ActionMessage::setExtraDestData(), helics::setIterationFlags(), helics::ActionMessage::source_id, helics::ActionMessage::Tdemin, helics::ActionMessage::Te, and helics::TimeData::Te.
std::vector< GlobalFederateId > helics::BaseTimeCoordinator::getDependencies | ( | ) | const |
get a list of actual dependencies
const DependencyInfo * helics::BaseTimeCoordinator::getDependencyInfo | ( | GlobalFederateId | ofed | ) | const |
take a global id and get a pointer to the dependencyInfo for the other fed will be nullptr if it doesn't exist
std::vector< GlobalFederateId > helics::BaseTimeCoordinator::getDependents | ( | ) | const |
get a reference to the dependents vector
Time helics::BaseTimeCoordinator::getLastGrant | ( | GlobalFederateId | fedId | ) | const |
get the last time grant from a federate
References helics::timeZero.
GlobalFederateId helics::BaseTimeCoordinator::getMinDependency | ( | ) | const |
get a count of the active dependencies
|
pure virtual |
get the current next time
Implemented in helics::TimeCoordinator, helics::GlobalTimeCoordinator, helics::ForwardingTimeCoordinator, and helics::AsyncTimeCoordinator.
Json::Value helics::BaseTimeCoordinator::grantTimeoutCheck | ( | const ActionMessage & | cmd | ) |
grant timeout check
References helics::ActionMessage::counter, and helics::ActionMessage::source_id.
bool helics::BaseTimeCoordinator::hasActiveTimeDependencies | ( | ) | const |
check if there are any active Time dependencies
bool helics::BaseTimeCoordinator::isDependency | ( | GlobalFederateId | ofed | ) | const |
check whether a federate is a dependency
|
pure virtual |
generate a string with the current time status
Implemented in helics::TimeCoordinator, helics::GlobalTimeCoordinator, helics::ForwardingTimeCoordinator, and helics::AsyncTimeCoordinator.
void helics::BaseTimeCoordinator::processDependencyUpdateMessage | ( | const ActionMessage & | cmd | ) |
process a dependency update message
References helics::ActionMessage::action(), helics::checkActionFlag(), helics::child_flag, helics::ActionMessage::counter, helics::parent_flag, and helics::ActionMessage::source_id.
|
virtual |
process a message related to time
Reimplemented in helics::TimeCoordinator, helics::GlobalTimeCoordinator, and helics::ForwardingTimeCoordinator.
References helics::ActionMessage::action(), helics::parent_broker_id, and helics::ActionMessage::source_id.
Referenced by helics::ForwardingTimeCoordinator::processTimeMessage(), and helics::GlobalTimeCoordinator::processTimeMessage().
|
virtual |
remove a dependency
fedID | the identifier of the federate to remove |
Reimplemented in helics::TimeCoordinator.
|
virtual |
remove a dependent
fedID | the identifier of the federate to remove |
Reimplemented in helics::TimeCoordinator.
|
virtual |
reset a dependency that has been reintroduced
fedID | the identifier of the federate to reset |
|
protected |
send the timing info to dependents
References helics::delayed_timing_flag, helics::ActionMessage::dest_id, helics::non_granting_flag, helics::setActionFlag(), helics::ActionMessage::setExtraData(), and helics::ActionMessage::source_id.
Referenced by helics::TimeCoordinator::enteringExecMode().
void helics::BaseTimeCoordinator::setMessageSender | ( | std::function< void(const ActionMessage &)> | userSendMessageFunction | ) |
set the callback function used for the sending messages
|
inline |
set the source id for the time coordinator
References mSourceId.
|
pure virtual |
compute updates to time values and send an update if needed
Implemented in helics::TimeCoordinator, helics::GlobalTimeCoordinator, helics::ForwardingTimeCoordinator, and helics::AsyncTimeCoordinator.
|
protected |
federates which this Federate is temporally dependent on
Referenced by helics::ForwardingTimeCoordinator::checkExecEntry(), helics::GlobalTimeCoordinator::checkExecEntry(), helics::TimeCoordinator::checkExecEntry(), helics::TimeCoordinator::checkTimeGrant(), empty(), helics::TimeCoordinator::enteringExecMode(), helics::TimeCoordinator::enterInitialization(), helics::TimeCoordinator::getMinGrantedDependency(), helics::TimeCoordinator::localError(), helics::TimeCoordinator::removeDependency(), helics::TimeCoordinator::removeDependent(), helics::TimeCoordinator::requestTimeCheck(), helics::TimeCoordinator::sendUpdatedExecRequest(), helics::TimeCoordinator::timeRequest(), helics::AsyncTimeCoordinator::updateTimeFactors(), helics::ForwardingTimeCoordinator::updateTimeFactors(), helics::GlobalTimeCoordinator::updateTimeFactors(), and helics::TimeCoordinator::updateTimeFactors().
|
protected |
flag that the coordinator has entered the execution Mode
Referenced by helics::AsyncTimeCoordinator::checkExecEntry(), helics::TimeCoordinator::enteringExecMode(), helics::GlobalTimeCoordinator::generateDebuggingTimeInfo(), helics::TimeCoordinator::updateMessageTime(), and helics::TimeCoordinator::updateValueTime().
|
protected |
specify that the timeCoordinator should not grant times and instead operate in a continuous manner until completion
Referenced by helics::TimeCoordinator::checkTimeGrant().