94 lines
2.5 KiB
C++
94 lines
2.5 KiB
C++
/*
|
||
* PositionControlProcess.h
|
||
*
|
||
* Created on: 23 сент. 2019 г.
|
||
* Author: titov
|
||
*/
|
||
|
||
#ifndef SOURCE_PROCESSING_ACS_POSITIONCONTROLPROCESS_H_
|
||
#define SOURCE_PROCESSING_ACS_POSITIONCONTROLPROCESS_H_
|
||
|
||
#include "ControlSystemInterface.hh"
|
||
|
||
#include "../../systemic/ISignal.hh"
|
||
#include "../../systemic/IProcess.hh"
|
||
#include "../../common/ShadowGuard.hh"
|
||
|
||
#include "../../control/regulator/ParabolicPositioner.hh"
|
||
|
||
#include <algorithm>
|
||
|
||
namespace processing { namespace acs {
|
||
|
||
class PositionControlProcess : public PhaseSpaceToPhaseSpaceUnitInterface, public systemic::IProcess {
|
||
public:
|
||
typedef control::regulator::ParabolicPositioner PositionRegulator;
|
||
|
||
void set( TypeInput );
|
||
TypeOutput get() const;
|
||
void set_output( SetInterface * );
|
||
|
||
vector::ITechValue & getAccelerationLimit();
|
||
vector::ITechValue & getSpeedLimit();
|
||
|
||
void setSampleTime( float ts_in_second );
|
||
void process();
|
||
void reset();
|
||
|
||
const float & demand() const;
|
||
|
||
PositionControlProcess( PositionRegulator & position_reg, systemic::ISignal & position_fdb, systemic::ISignal & speed_fdb );
|
||
|
||
private:
|
||
struct AccelerationLimit : public vector::ITechValue {
|
||
|
||
void set( float acc ) {
|
||
position_control.setAcceleration(acc);
|
||
position_control.setDeceleration(acc);
|
||
}
|
||
|
||
float get() const {
|
||
return std::max( position_control.getAcceleration(), position_control.getDeceleration() );
|
||
}
|
||
|
||
PositionRegulator & position_control;
|
||
|
||
AccelerationLimit( PositionRegulator & position_control ) :
|
||
position_control(position_control) {}
|
||
|
||
} acc_limit;
|
||
|
||
struct SpeedLimit : public vector::ITechValue {
|
||
|
||
void set( float vel ) {
|
||
position_control.setVelocity(vel);
|
||
}
|
||
|
||
float get() const {
|
||
return position_control.getVelocity();
|
||
}
|
||
|
||
PositionRegulator & position_control;
|
||
|
||
SpeedLimit( PositionRegulator & position_control ) :
|
||
position_control(position_control) {}
|
||
|
||
} speed_limit;
|
||
|
||
bool proc_enable;
|
||
|
||
SetInterface * output;
|
||
|
||
ShadowGuard< control::PhaseSpaceValue > position_stp; //!<Вход: задание положения.
|
||
control::PhaseSpaceValue speed_stp; //!<Выход: задание скорости.
|
||
|
||
PositionRegulator & position_control;
|
||
systemic::ISignal & position_fdb; //!<Cкорость.
|
||
systemic::ISignal & speed_fdb;
|
||
|
||
};
|
||
|
||
}}
|
||
|
||
#endif /* SOURCE_PROCESSING_ACS_POSITIONCONTROLPROCESS_H_ */
|