Respiration Cycle

Hello everyone!
I perform a Respiration Cycle experiment and i would like to control few parameters :
1) Where can I define the FRC values? I have tried in the patient files.
2) How can I determine measuring points in the model?

Thanks for the helpers!
Have a good day.


  • coolwebbcoolwebb Entry Level
    avivshamsian, thank you for the interest in using BioGears for your application. I will answer your two posted questions along with another you directly emailed to our team:

    1) How can I change the values of FRC?
    The Functional Residual Capacity can be modified in several ways:
    a. The FRC is calculated based on the initial weight parameter in the patient file using the equation double FunctionalResidualCapacity_L = 30.0 * PatientWeight_kg / 1000.0;. However, modifying the patient weight will have other consequences throughout other systems.
    b. You can directly set the FRC in BioGearsCircuits.cpp by modifying the line patient.GetFunctionalResidualCapacity().SetValue(FunctionalResidualCapacity_L, VolumeUnit::L);.
    c. You can change the FRC on the fly inside the Respiratory PreProcess function using m_Patient.GetFunctionalResidualCapacity().SetValue(<FunctionalResidualCapacity_L>, VolumeUnit::L);.
    d. (THIS IS NOT SAFE NOR RECOMMENDED) You can use the API to cast off the const patient object to modify the FunctionalResidualCapacity parameter. We intentionally don't expose patient parameters. After initialization, patients should only be modified directly by systems or via actions.

    2) How can I define measuring points in the model?
    You can get data out of BioGears in several ways:
    a. If you are running via the API, ScenarioDriver.exe, or the developer GUI look at "What can BioGears do" and "What kind of data can I get from BioGears" in our documentation at
    b. If you are compiling and executing the code via your own ScenarioDriver.exe, you can add Probes for any data to be added to the output .csv file by using the line m_data.GetDataTrack().Probe(“<NameYourData>”, <double>);

    3) How can I change the resistor's values in the Anesthesia Machine electric model?
    All circuits are created and initialized the BioGearsCircuits.cpp file (you'd probably want to change the baseline values). You may also change resistor values in the PreProcess function in the AnesthesiaMachine.cpp file - see the CalculateValveResistances function for examples.
  • edited October 2016
    Thank you for your quick response but I cant find the BioGearsCircuits.cpp file you have talked about.
    can you direct me to this file?
    do I need to download the source code BioGear?
    Best regards.
  • abrayabray Entry Level
    In order to accomplish the solution outlined in option 1, you will need to download the BioGears source code, perform the modifications and create new binaries.
  • coolwebbcoolwebb Entry Level
    I'd like to note that our next release will have Functional Residual Capacity added as a modifiable patient parameter. You'll be able to change it without recompiling. Our latest estimate is for that deployment to happen sometime in December.
  • Thanks again to you both.
    Abray I have tried to download the BioGears source code and look for the BioGearsCircuits.cpp file but I didn't find it. Can you guide me please?
  • abrayabray Entry Level
    The file is located here: BioGears_5.1.0-beta-src\src\engine\cpp\Controller
    When you change this file, in order to see how your change affects BioGears, you will need to recompile the code base. You can find information on compiling here :
  • Ok I have figured out how to change the respiratory values, thank you!
    Maybe you can help me with two other things I'm trying to do:
    1) To put an additional resistor between the mouth and the environment.
    2) To put a measurment point between the mouth and the resistor, which I'm trying to add.
    Can you guide me how to do it?

    Best regards.
  • coolwebbcoolwebb Entry Level
    edited October 2016
    1) In the 5.1.0 release, you can add a resistor between the mouth and environment by going to the ConfigureCircuit method in BioGearsCircuits.cpp and adding
    ExternalEnvironmentToMouth->GetFlowResistanceBaseline()->SetValue(<ResistanceValue>, SEScalarFlowResistance::<units>);
    after the following existing line that creates the path
    SECircuitPath* ExternalEnvironmentToMouth = m_PulmonaryCircuit->CreatePath("ExternalEnvironmentToMouth", CDM::enumBioGearsPath::ExternalEnvironmentToMouth, AmbientEnvironmentNode, MouthNode);
    where <ResistanceValue> is the double you want to set and <units> are any of the resistance units we've provided in the Common Data Model library. You can then edit that resistance value while running via feedback or by adding an Action to access through the API. I'd recommend looking at AirwayObstruction as an example (Respiratory::AirwayObstruction method). That action merely updates the MouthToCarina resistance based on a 0 to 1 scaled severity. Note that you'll always want to modify the Next resistance value for the circuit solver to use - e.g.,
    m_data.GetCircuits().GetPath(CDM::enumBioGearsPath::ExternalEnvironmentToMouth)->GetNextFlowResistanceB()->SetValue(<NewResistanceValue>, SEScalarFlowResistance::<units>);

    2) You can use Data Requests to get the flow, pressure, or substance values on your newly created resistor in several ways:
    a) You can add new system data - see SERespiratorySystem.h for examples that you actively set.
    b) You can add/modify a compartment to get data - see the Trachea compartment in BioGearsCircuits.cpp for an example. Compartments can then be accessed to get things like InFlow, OutFlow, Pressure, O2 Volume Fraction, etc.
    c) You can use a Probe to write it out any values to the scenario results file - e.g.,
    m_data.GetDataTrack().Probe("NewResistorFlow_L_Per_min", ExternalEnvironmentToMouth->GetNextFlow()->GetValue(SEScalarVolumePerTime::L_Per_min));
    We generally only use Probes for debugging purposes.
  • After I did the changes in the source code, how do I run the BioGear GUI in order to check if the changes I have made are valid? Do I need to compile it in a JAVA program? And if so, how should I do it?
  • abrayabray Entry Level
    If you only added a Probe and did not modify the SERespiratorySystem or created a new Compartment, you can just drop your new binaries in the ./release directory of the toolkit and your changes should be seen.

    If you changed the SERespiratorySystem or added a new Compartment you would have to also change the corresponding SERespiratorySystem and Comparment listing in the Java Library and recompile the Java libraries with the latest JDK.

    The easiest/quickest way to see the results of your code changes is to also build the BioGearsScenarioDriver executable along with your code and run it directly.

    Our source documentation has an example on how to configure the BioGearsScenarioDriver in visual studio

    If it executes without issue, you will find an ASCII *.txt file containing Comma Separated Values in the bin/Scenario depending on the scenario that you execute. Most generic data views can open (such as DPLOT) and view the data in it.

    We also provide a GraphResults.bat file in the bin directory of the toolkit, when you run it via a command window, simply provide the relative path to the Results file and it will create *jpg files of the data in the results file.
  • coolwebbcoolwebb Entry Level
    I just wanted to circle back on this thread about updates with the new 6.0.1 release.

    There is new and improved patient variability in the Engine now, which includes being able to optionally set the Functional Residual Capacity. You can now set-up the patient with a specific FRC by either setting it through the API, or adding something like this to a patient file: <Functional Residual Capacity="2.3" unit="L"/>.

    See the methodology reports for more detail:
Sign In or Register to comment.