Motorcortex Core  version: 2.7.6
drive_cia402_fsm_impl.h
1 /*
2  * Developer : Alexey Zakharov (alexey.zakharov@vectioneer.com)
3  * All rights reserved. Copyright (c) 2018 VECTIONEER.
4  */
5 
6 #ifndef MOTORCORTEX_CORE_DRIVE_CIA402_FSM_IMPL_H
7 #define MOTORCORTEX_CORE_DRIVE_CIA402_FSM_IMPL_H
8 
9 #include "drive_cia402_fsm_base.h"
10 
11 namespace mcx {
12 
13 namespace drive {
14 
15 struct Cia402FsmData;
16 
17 /*
18  * Drive not ready to switch on, there is no operational readiness
19  * (BTB/RTO) signaled from the controller program.
20  */
22 public:
23  explicit NotReadyToSwitchOn(Cia402FsmData& data);
24 
25  void enter() override;
26 
27  state_machine::EventStatus faultAcknowledge() override;
28 };
29 
30 /*
31  * Drive is ready to switch on, parameters can be transferred,
32  * the DC-link voltage can be switched on, motion functions cannot
33  * be carried out yet.
34  */
36 public:
37  explicit SwitchOnDisabled(Cia402FsmData& data);
38 
39  void enter() override;
40 
41  void iterate(double time) override;
42 
43  // user input commands
44  state_machine::EventStatus gotoDisengage() override;
45 
46  state_machine::EventStatus gotoEngage() override;
47 };
48 
49 /*
50  * DC-link voltage must be switched on, parameters can be transferred, motion
51  * functions cannot be carried out yet, output stage is switched on (enabled).
52  */
53 class SwitchOn : public Cia402FsmBase {
54 public:
55  explicit SwitchOn(Cia402FsmData& data);
56 
57  void enter() override;
58 
59  // user input commands
60  state_machine::EventStatus gotoOff() override;
61 
62  state_machine::EventStatus gotoEngage() override;
63 };
64 
65 /*
66  * No fault present, output stage is enabled, motion functions are enabled.
67  */
69 public:
70  explicit OperationEnable(Cia402FsmData& data);
71 
72  void enter() override;
73 
74  void leave() override;
75 
76  void iterate(double dt) override;
77 
78 
79  // user input commands
80  state_machine::EventStatus gotoOff() override;
81 
82  state_machine::EventStatus gotoDisengage() override;
83 
84  state_machine::EventStatus gotoQuickStop() override;
85 
86  state_machine::EventStatus gotoModeAction() override;
87 
88  state_machine::EventStatus gotoEngage() override;
89 
90 };
91 
92 /*
93  * Drive has been stopped with the emergency ramp, output stage is enabled, motion
94  * functions are enabled, response depends on Object 605Ah ( 6.3)
95  */
97 public:
98  explicit QuickStopActive(Cia402FsmData& data);
99 
100  void enter() override;
101 
102  void iterate(double dt) override;
103 
104  // user input commands
105  state_machine::EventStatus gotoOff() override;
106 
107  state_machine::EventStatus gotoDisengage() override;
108 
109  state_machine::EventStatus gotoEngage() override;
110 };
111 
112 /*
113  * Drive error is active, DC-Voltage is disabled
114  */
115 class Fault : public Cia402FsmBase {
116 public:
117  explicit Fault(Cia402FsmData& data);
118 
119  void enter() override;
120 
121  void iterate(double dt) override;
122 
123  void leave() override;
124 
125  state_machine::EventStatus faultAcknowledge() override;
126 
127 private:
128  double upload_error_code_timer_{};
129 
130 };
131 
132 } // namespace drive
133 
134 } // namespace mcx
135 
136 #endif //MOTORCORTEX_CORE_DRIVE_CIA402_FSM_IMPL_H
mcx::drive::Cia402FsmData
Definition: drive_cia402_fsm_data.h:68
mcx::drive::Fault
Definition: drive_cia402_fsm_impl.h:115
mcx::drive::SwitchOnDisabled
Definition: drive_cia402_fsm_impl.h:35
mcx::drive::Cia402FsmBase
Definition: drive_cia402_fsm_base.h:18
mcx::drive::OperationEnable
Definition: drive_cia402_fsm_impl.h:68
mcx::drive::NotReadyToSwitchOn
Definition: drive_cia402_fsm_impl.h:21
mcx::drive::SwitchOn
Definition: drive_cia402_fsm_impl.h:53
mcx::drive::QuickStopActive
Definition: drive_cia402_fsm_impl.h:96