MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/processing/acs/PiControllerProcess.cpp
2024-06-07 11:12:56 +03:00

91 lines
1.8 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.

/*
* PiControllerProcess.cpp
*
* Created on: 5 июн. 2020 г.
* Author: LeonidTitov
*/
#include "PiControllerProcess.hh"
void processing::acs::PiControllerProcess::set( TypeInput setpoint ) {
value_error = setpoint;
if( isConnected() and not(proc_enable) ) {
regulator.recalculate(value_error, current_value);
proc_enable = true;
}
}
processing::acs::PiControllerProcess::TypeOutput processing::acs::PiControllerProcess::get() const {
return current_value;
}
void processing::acs::PiControllerProcess::set_output(
SetInterface * output_interface ) {
if( not output_interface ) proc_enable = false;
output = output_interface;
}
vector::ITechValue & processing::acs::PiControllerProcess::getLimit() {
return limit;
}
void processing::acs::PiControllerProcess::setSampleTime( float ts_in_second ) {
regulator.setTime(ts_in_second);
}
void processing::acs::PiControllerProcess::process() {
if( not proc_enable )
return;
// value_error.update();
// tracking.value.update();
value_output = regulator( value_error, tracking.value );
output->set(value_output);
}
void processing::acs::PiControllerProcess::reset() {
proc_enable = false;
value_error = 0.0f;
tracking.value = current_value;
regulator.reset();
}
vector::ITechValue & processing::acs::PiControllerProcess::getTrackingTract() {
return tracking;
}
processing::acs::PiControllerProcess::PiControllerProcess(
Regulator & regulator, systemic::ISignal & current_value ) : regulator(regulator), current_value(current_value),
value_error(0.0f), tracking(), limit(regulator),
proc_enable(false), output(nullptr), value_output(0.0f) {}
bool processing::acs::PiControllerProcess::isConnected() const {
return output;
}