MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/processing/logic/SoftSwitch.hh
2024-06-07 11:12:56 +03:00

70 lines
1.5 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* SoftSwitch.hh
*
* Created on: 30 июн. 2020 г.
* Author: LeonidTitov
*/
#ifndef UMLIBRARY_PROCESSING_LOGIC_SOFTSWITCH_HH_
#define UMLIBRARY_PROCESSING_LOGIC_SOFTSWITCH_HH_
#include "../../systemic/ISignal.hh"
#include "../../systemic/IStatus.hh"
#include "../../systemic/IProcess.hh"
namespace processing { namespace logic {
class SoftSwitch : public systemic::IProcess {
public:
struct Setting {
float toggle_time = -1.0f; //!<Время переключения, c.
bool isValid();
};
public:
SoftSwitch( systemic::ISignal & a_signal, systemic::IStatus & a_valid, systemic::ISignal & b_signal, systemic::IStatus & b_valid );
void configure( Setting & setting );
void setSampleTime( float ts_in_second );
void process();
const float & summary() const { return output; }
const bool & activeSignalA() const;
const bool & activeSignalB() const;
private:
float output;
struct ValidSignal {
systemic::ISignal & signal;
systemic::IStatus & valid;
float value;
bool correctness;
bool active;
void update_correctness();
bool invalcheck();
void select();
ValidSignal(systemic::ISignal & s, systemic::IStatus & v, bool active) : signal(s), valid(v), value(s), active(active), correctness(v) {}
} a, b;
float delta;
float d_delta;
float dpart_dt;
float _Tp;
float _Ts;
};
}}
#endif /* UMLIBRARY_PROCESSING_LOGIC_SOFTSWITCH_HH_ */