helics 3.7.0
Loading...
Searching...
No Matches
ForwardingTimeCoordinator.hpp
1/*
2Copyright (c) 2017-2026,
3Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Energy
4Innovation LLC. See the top-level NOTICE for additional details. All rights reserved.
5SPDX-License-Identifier: BSD-3-Clause
6*/
7#pragma once
8
9#include "ActionMessage.hpp"
10#include "BaseTimeCoordinator.hpp"
11#include "CoreFederateInfo.hpp"
12#include "TimeDependencies.hpp"
13
14#include <atomic>
15#include <functional>
16#include <nlohmann/json_fwd.hpp>
17#include <string>
18#include <utility>
19#include <vector>
20
21namespace helics {
22
28 private:
29 // the variables for time coordination
30 DependencyInfo upstream;
31 DependencyInfo downstream;
32 static constexpr std::int32_t mSequenceIncrement{100};
33
34 protected:
35 bool iterating{false};
36 bool ignoreMinFed{false};
37 std::int32_t sequenceModifier{0};
38
39 public:
40 ForwardingTimeCoordinator() = default;
41
45 virtual bool updateTimeFactors() override;
46
47 private:
48 void transmitTimingMessagesUpstream(ActionMessage& msg) const;
49 void transmitTimingMessagesDownstream(ActionMessage& msg,
50 GlobalFederateId skipFed = GlobalFederateId{}) const;
51
52 public:
53 virtual TimeProcessingResult processTimeMessage(const ActionMessage& cmd) override;
56 checkExecEntry(GlobalFederateId triggerFed = GlobalFederateId{}) override;
57
59 virtual std::string printTimeStatus() const override;
61 virtual void generateDebuggingTimeInfo(nlohmann::json& base) const override;
62
64 virtual Time getNextTime() const override { return downstream.next; }
65};
66} // namespace helics
Definition BaseTimeCoordinator.hpp:27
Definition TimeDependencies.hpp:98
Definition ForwardingTimeCoordinator.hpp:27
virtual MessageProcessingResult checkExecEntry(GlobalFederateId triggerFed=GlobalFederateId{}) override
Definition ForwardingTimeCoordinator.cpp:163
virtual bool updateTimeFactors() override
Definition ForwardingTimeCoordinator.cpp:47
bool ignoreMinFed
flag indicating that minFed Controls should not be used
Definition ForwardingTimeCoordinator.hpp:36
bool iterating
flag indicating that the min dependency is iterating
Definition ForwardingTimeCoordinator.hpp:35
virtual void generateDebuggingTimeInfo(nlohmann::json &base) const override
Definition ForwardingTimeCoordinator.cpp:128
virtual std::string printTimeStatus() const override
Definition ForwardingTimeCoordinator.cpp:141
virtual Time getNextTime() const override
Definition ForwardingTimeCoordinator.hpp:64
virtual TimeProcessingResult processTimeMessage(const ActionMessage &cmd) override
Definition ForwardingTimeCoordinator.cpp:149
Time next
next possible message or value
Definition TimeDependencies.hpp:64
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition AsyncFedCallInfo.hpp:14
MessageProcessingResult
Definition CoreTypes.hpp:75
TimeProcessingResult
Definition TimeDependencies.hpp:42
TimeRepresentation< count_time< 9 > > Time
Definition helicsTime.hpp:27