Skip to content

Commit

Permalink
bringing nested flow-pressure control to fio2 <0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Edwin Chiu authored and martukas committed Jul 6, 2022
1 parent 03727b6 commit ce2f7dc
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions software/controller/lib/core/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,15 @@ std::pair<ActuatorsState, ControllerState> Controller::Run(Time now, const VentP
psol_pid_.reset();

// Calculate blower valve command using calculated gains
float blower_valve = blower_valve_pid_.compute(now, sensor_readings.patient_pressure.kPa(),
desired_state.pressure_setpoint->kPa());
/*float blower_valve =
blower_valve_pid_.Compute(now, sensor_readings.patient_pressure.kPa(),
desired_state.pressure_setpoint->kPa());*/

float flow_cmd = blower_valve_pid_.compute(now, sensor_readings.patient_pressure.kPa(),
desired_state.pressure_setpoint->kPa());
float blower_valve =
air_flow_pid_.compute(now, sensor_readings.air_inflow.liters_per_sec(), flow_cmd);

float fio2_coupling_value =
std::clamp(params.fio2 + fio2_pid_.compute(now, sensor_readings.fio2, params.fio2), 0.0f,
1.0f); // just a little bit of feed-forward
Expand All @@ -109,8 +116,8 @@ std::pair<ActuatorsState, ControllerState> Controller::Run(Time now, const VentP
// experimental shit
/*
float blower_valve =
air_flow_pid_.compute(now, sensor_readings.air_inflow.liters_per_sec(),
dbg_air_flow_setpoint_.get());
air_flow_pid_.Compute(now,
sensor_readings.inflow.liters_per_sec(), dbg_air_flow_setpoint.Get());
*/

float psol_valve = psol_pid_.compute(now, sensor_readings.patient_pressure.kPa(),
Expand Down

0 comments on commit ce2f7dc

Please sign in to comment.