Commit 931dd15a by RBO lab

working mass flow controller, but still slightly drifting

parent 3ac7759b
......@@ -39,7 +39,7 @@ namespace AirserverController{
// creates the controller hyteresis
// inflation starts only for pos errors
const float error_threshold_start_inflate= -3*const_inf; // > 0.0 g
const float error_threshold_start_deflate= -3*const_def; // < 0.0 g
const float error_threshold_start_deflate= 3*const_inf; // < 0.0 g
CntrlMassflow::CntrlMassflow(MsgConfigurationControllerMassflow *conf)
......@@ -214,13 +214,8 @@ namespace AirserverController{
mass_flow_leeco = MFLeeCompanyModel( GetData(pressure_supply), P_out, c_leeco_inf);
//mass_flow_psi = MFPSIModel( GetData(pressure_supply), P_out, 1.0);
// combination of above model:
mass_flow = mass_flow_leeco
+ mass_flow_linear
+ P_supply_before_action* c_Psupp_inf // Psupp, supply pressure
+ P_out_before_action * c_Ppre_inf; // Ppre, pre inflation pressure
// Constant error is added once when inflation is started,.
// _before_inf values are definded once when inflation is started.
// see section Start Inflation
mass_flow = mass_flow_leeco + mass_flow_linear;
// Constant error is added once when inflation is started,.
}
// D E F L A T I O N
......@@ -230,13 +225,8 @@ namespace AirserverController{
mass_flow_leeco = MFLeeCompanyModel( P_out, 0.0, c_leeco_def);
//mass_flow_psi = MFPSIModel( P_out, 0.0, -1.0);
// scaled combination of above model:
mass_flow = mass_flow_leeco
+ mass_flow_linear
+ P_supply_before_action* c_Psupp_def // Psupp, supply pressure
+ P_out_before_action * c_Pinf_def; // Pinf, pre inflated pressure
mass_flow = mass_flow_leeco + mass_flow_linear;
// Constant error is added once when deflation is started,.
// _before_action values are definded once when deflation is started.
// see section Start Deflation
}
// C O N S T A N T
......@@ -255,6 +245,11 @@ namespace AirserverController{
// update desired air mass for this time step
this->delta_mass_desired_complete += delta_mass_desired;
// so far the system can not suck air out the actuator
if( this->delta_mass_desired_complete < 0) {
this->delta_mass_desired_complete= 0;
}
// update air mass from last time step with current massflow
this->delta_mass_complete_linear += delta_mass_linear;
this->delta_mass_complete_leeco += delta_mass_leeco;
......@@ -336,23 +331,18 @@ namespace AirserverController{
//S T A R T I N F L A T E
// only when mass desired rises
if(GetData(in_desired) >= 0) {
// substract constant inflation model error when inflation starts
// add constants for inflation model when inflation starts
if(GetData(out_inflate) == 0) {
// Substract constant inflation error at inflation start.
// The controller will catch up witch the offset or
// stop earlier, depending on sign of cont_inf.
this->delta_mass_complete -= const_inf;
// e.g. const_inf is neg.:
// Each inflation inflates less air than the massflow model calculates
// Substracting this neg. constant error at the beginning of inflation increases
// the assumed actuator air mass and lowers the error (pos.) to the
// desired mass. The controller will stop earlier.
this->delta_mass_complete += const_inf;
this->delta_mass_complete += GetData(pressure_supply) * c_Psupp_inf;
this->delta_mass_complete += GetData(pressure_out) * c_Ppre_inf;
// keep pressure values before inlation for massflow model
this->P_supply_before_action= GetData(pressure_supply);
this->P_out_before_action = GetData(pressure_out);
std::cout << "Psupp: " << this->P_supply_before_action <<std::endl
<< "Pout : " << this->P_out_before_action << std::endl;
std::cout << "Psupp: " << GetData(pressure_supply) <<std::endl
<< "Pout : " << GetData(pressure_out) << std::endl;
}
#ifdef MASSFLOW_SWITCH
SetData(out_inflate, 1.0);
......@@ -373,16 +363,16 @@ namespace AirserverController{
//S T A R T D E F L A T E
// only when mass desired falls
if( GetData(in_desired) <= 0) {
// substract constant deflation model error when deflation starts
// add constants deflation model when deflation starts
if(GetData(out_deflate) == 0) {
this->delta_mass_complete -= const_def;
this->delta_mass_complete += const_def;
this->delta_mass_complete += GetData(pressure_supply) * c_Psupp_def;
this->delta_mass_complete += GetData(pressure_out) * c_Pinf_def;
// keep pressure values before inlation for massflow model
this->P_supply_before_action= GetData(pressure_supply);
this->P_out_before_action = GetData(pressure_out);
std::cout << "Psupp: " << this->P_supply_before_action <<std::endl
<< "Pout : " << this->P_out_before_action << std::endl;
}
std::cout << "Psupp: " << GetData(pressure_supply) <<std::endl
<< "Pout : " << GetData(pressure_out) << std::endl;
}
#ifdef MASSFLOW_SWITCH
SetData(out_deflate, 1.0);
SetData(out_inflate, 0.0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment