icub-tech-iit / ventilator-FI5

FI5: Rapidly Manufactured Ventilator System
BSD 3-Clause "New" or "Revised" License
31 stars 4 forks source link

Integrate TV Correction into FW #72

Closed pattacini closed 4 years ago

pattacini commented 4 years ago

Hi @marcoaccame 👋🏻

Because I've developed a new functionality regarding the TV Correction in VCV mode (see #70 and #71), I'd like to ask you to integrate the enclosed generated code (see the archives below) in the latest FW version. This will also allow us to churn out a new overall release.

⚠Be careful since one more parameter (i.e. TV_correction_gain_Value) can be now tuned as the 4th element of the MAP_Transfer_Advanced Map (former MAP_Transfer_AutoTrigger): for details, please look over https://github.com/icub-tech-iit/ventilator-FI5/pull/71/files.

In particular, you have to replace the following snippet https://github.com/icub-tech-iit/ventilator-FI5/blob/37436da61d062aea663ea967e673d40a26284160/application/code/app/fi5app_theController2.cpp#L263-L268 with:

- case MAP_Transfer_AutoTrigger:
+ case MAP_Transfer_Advanced:
   {
       parameters.enable_trigger_Value = (outputs.knobs_out[0] > 0.5);
       parameters.pressure_thres_const = outputs.knobs_out[1];
       parameters.flowby_target_Value = outputs.knobs_out[2];
+      parameters.TV_correction_gain_Value = outputs.knobs_out[3];
   } break;

📦 Generate Code

marcoaccame commented 4 years ago

Hi @pattacini, I am doing it.

I have spotted another change required to make it compile.

I have changed

https://github.com/icub-tech-iit/ventilator-FI5/blob/37436da61d062aea663ea967e673d40a26284160/application/code/app/fi5app_theController2.cpp#L231-L237

with:

            case MAP_Transfer_Standard:
            {
                parameters.respiratory_rate_Value = outputs.knobs_out[0];
                parameters.PIP_Gain = outputs.knobs_out[1];
                parameters.IE_ratio_Value = outputs.knobs_out[2];
-               parameters.TidalVolume_Gain = outputs.knobs_out[3] / 1000.F;
+               parameters.tidal_volume_Value = outputs.knobs_out[3] / 1000.F;
            } break;

Do you reckon it is correct?

pattacini commented 4 years ago

Correct 👍🏻 Nice catch!

marcoaccame commented 4 years ago

ok. i'll commit and push then

marcoaccame commented 4 years ago

pushed in https://github.com/icub-tech-iit/ventilator-FI5/commit/e91e75036b6ee8d9a09b74a20c8f6629de08d1b3

pattacini commented 4 years ago

Thanks!