14 #include <dpsim-models/Attribute.h>
15 #include <dpsim-models/Base/Base_Ph1_Switch.h>
16 #include <dpsim-models/Base/Base_Ph3_Switch.h>
17 #include <dpsim-models/Definitions.h>
18 #include <dpsim-models/Logger.h>
19 #include <dpsim-models/PtrFactory.h>
20 #include <dpsim/Config.h>
24 class EventComparator;
36 using Ptr = std::shared_ptr<Event>;
38 virtual void execute() = 0;
40 Event(CPS::Real t) : mTime(t) {}
47 bool operator()(
const Event::Ptr &l,
const Event::Ptr &r) {
48 return l->mTime > r->mTime;
60 :
Event(t), mAttribute(attr), mNewValue(val) {}
62 void execute() { mAttribute->set(mNewValue); }
68 std::shared_ptr<CPS::Base::Ph1::Switch> mSwitch;
74 SwitchEvent(CPS::Real t,
const std::shared_ptr<CPS::Base::Ph1::Switch> &sw,
76 :
Event(t), mSwitch(sw), mNewState(state) {}
89 std::shared_ptr<CPS::Base::Ph3::Switch> mSwitch;
95 SwitchEvent3Ph(CPS::Real t,
const std::shared_ptr<CPS::Base::Ph3::Switch> &sw,
97 :
Event(t), mSwitch(sw), mNewState(state) {}
101 mSwitch->closeSwitch();
103 mSwitch->openSwitch();
110 std::priority_queue<Event::Ptr, std::deque<Event::Ptr>,
EventComparator>
115 void addEvent(Event::Ptr e);
117 void handleEvents(CPS::Real currentTime);