126 lines
3.3 KiB
C++
126 lines
3.3 KiB
C++
/*
|
||
* SpeedControlProcess.h
|
||
*
|
||
* Created on: 5 сент. 2019 г.
|
||
* Author: titov
|
||
*/
|
||
|
||
#ifndef SOURCE_PROCESSING_ACS_SPEEDCONTROLPROCESS_H_
|
||
#define SOURCE_PROCESSING_ACS_SPEEDCONTROLPROCESS_H_
|
||
|
||
#include "ControlSystemInterface.hh"
|
||
|
||
#include "../../systemic/ISignal.hh"
|
||
#include "../../systemic/IProcess.hh"
|
||
#include "../../common/ShadowGuard.hh"
|
||
|
||
#include "../../control/regulator/SpeedController.hh"
|
||
|
||
namespace processing { namespace acs {
|
||
|
||
//!
|
||
class SpeedControlProcess : public PhaseSpaceToPhaseSpaceUnitInterface, public systemic::IProcess {
|
||
public:
|
||
void set( TypeInput );
|
||
TypeOutput get() const;
|
||
void set_output( SetInterface * );
|
||
|
||
vector::ITechValue & getTorqueUpLimit();
|
||
vector::ITechValue & getTorqueDownLimit();
|
||
vector::ITechValue & getInertiaValue();
|
||
|
||
void setSampleTime( float ts_in_second );
|
||
void process();
|
||
void reset();
|
||
|
||
vector::IPhaseSpaceValue & getFeedforwardTract();
|
||
|
||
const float & demand() const;
|
||
|
||
SpeedControlProcess( control::regulator::SpeedController & speed_reg, systemic::ISignal & speed_fdb );
|
||
|
||
~SpeedControlProcess() noexcept {}
|
||
private:
|
||
struct TorqueUpLimit : public vector::ITechValue {
|
||
|
||
void set( float torque ) {
|
||
speed_control.setUpperTorque(torque);
|
||
}
|
||
float get() const {
|
||
return speed_control.getUpperTorque();
|
||
}
|
||
|
||
control::regulator::SpeedController & speed_control;
|
||
|
||
TorqueUpLimit( control::regulator::SpeedController & speed_control ) :
|
||
speed_control(speed_control) {}
|
||
|
||
} torque_up_limit;
|
||
|
||
struct TorqueDownLimit : public vector::ITechValue {
|
||
|
||
void set( float torque ) {
|
||
speed_control.setLowerTorque(torque);
|
||
}
|
||
float get() const {
|
||
return speed_control.getLowerTorque();
|
||
}
|
||
|
||
control::regulator::SpeedController & speed_control;
|
||
|
||
TorqueDownLimit( control::regulator::SpeedController & speed_control ) :
|
||
speed_control(speed_control) {}
|
||
|
||
} torque_down_limit;
|
||
|
||
struct InertiaValue : public vector::ITechValue {
|
||
|
||
void set( float moment_of_inertia ) {
|
||
speed_control.setInertia(moment_of_inertia);
|
||
}
|
||
float get() const {
|
||
return speed_control.getInertia();
|
||
}
|
||
|
||
control::regulator::SpeedController & speed_control;
|
||
|
||
InertiaValue( control::regulator::SpeedController & speed_control ) :
|
||
speed_control(speed_control) {}
|
||
|
||
} inertia_value;
|
||
|
||
struct FeedforwardTract : public vector::IPhaseSpaceValue {
|
||
|
||
void set( control::PhaseSpaceValue new_value ) {
|
||
stp = new_value;
|
||
}
|
||
control::PhaseSpaceValue get() const {
|
||
return stp;
|
||
}
|
||
|
||
ShadowGuard< control::PhaseSpaceValue > stp; //!<Вход: задание скорости.
|
||
|
||
FeedforwardTract() : stp( control::PhaseSpaceValue(0.0f, 0.0f) ) {}
|
||
|
||
} feedforward;
|
||
|
||
bool proc_enable;
|
||
|
||
bool isConnected() const;
|
||
|
||
SetInterface * output;
|
||
|
||
ShadowGuard< control::PhaseSpaceValue > speed_stp; //!<Вход: задание скорости.
|
||
control::PhaseSpaceValue torque_stp; //!<Выход: заданное напряжение.
|
||
|
||
control::regulator::SpeedController & speed_control;
|
||
systemic::ISignal & speed_fdb; //!<Cкорость.
|
||
|
||
};
|
||
|
||
}}
|
||
|
||
|
||
|
||
#endif /* SOURCE_PROCESSING_ACS_SPEEDCONTROLPROCESS_H_ */
|