# Cosimulation with MATLAB and Simulink

**URL:** https://discourse.kitware.com/t/cosimulation-with-matlab-and-simulink/440
**Category:** Pulse Physiology Engine
**Created:** [April 7, 2020, 1:07pm UTC](https://discourse.kitware.com/t/cosimulation-with-matlab-and-simulink/440 "2020-04-07T13:07:48Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![dhoadley](https://discourse.kitware.com/letter_avatar_proxy/v4/letter/d/e36b37/32.png) [@dhoadley](https://discourse.kitware.com/u/dhoadley)
#### Post date: [April 7, 2020, 1:07pm UTC](https://discourse.kitware.com/t/cosimulation-with-matlab-and-simulink/440/1 "2020-04-07T13:07:49Z")

</div>

I am attempting to connect Pulse with MATLAB and Simulink as part of the COVIDBreathSim project. The howto project seems to be a good place to start, but I am having trouble getting the application to run on Windows 10. I followed the Wiki and (presume) successfully created the Pulse engine static libraries. I then tried to use CMake (first time user) to set up a MSVC 2015 project for the SDK. It did not find the Pulse build directory, so I added those manually. Still, I end up with an inscrutable error from the build process.

I tabled that and created my own MSVC project, added the include paths and libraries, and I eventually got a howto-like build. When I try to run that build within Visual Studio, I end up with an exception at m\_Engine.GetEngineTracker()-\>TrackData(m\_Engine.GetSimulationTime(TimeUnit::s));  
The comes during the HowToMechanicalVentilation() call.

(I did already change the working directory to the \bin of my built Pulse installation to find the config files)

When I run the test exe at the console in the installation directory, I get this output:  
C:\projects\Pulse\builds\install\bin\>PulseTest  
[INFO] : [0(s)] HowToMechanicalVentilation  
[INFO] : [0(s)] Tidal Volume : 527.076mL  
[INFO] : [0(s)] Systolic Pressure : 113.753mmHg  
[INFO] : [0(s)] Diastolic Pressure : 73.0416mmHg  
[INFO] : [0(s)] Heart Rate : 73.1707bpm  
[INFO] : [0(s)] Respiration Rate : 12bpm  
[INFO] : [0(s)] Oxygen Saturation : 0.974336  
FATAL:Unknown Data Request : RespirationMusclePressure :  
[FATAL] : [0.02(s)] Unknown Data Request : RespirationMusclePressure

Are there any related known issues with the 2.3.0 release?

Thanks,  
Dave.

---

<div class="post-metadata">

### Author: ![abray](https://discourse.kitware.com/user_avatar/discourse.kitware.com/abray/32/12_2.png) [@abray](https://discourse.kitware.com/u/abray)
#### Post date: [April 7, 2020, 11:55pm UTC](https://discourse.kitware.com/t/cosimulation-with-matlab-and-simulink/440/2 "2020-04-07T23:55:56Z")

</div>

I believe you are trying to request “RespiratoryMusclePressure”

List of strings for respiratory data requests are here:

[https://pulse.kitware.com/\_c\_d\_m\_tables.html#RespiratorySystemTable](https://pulse.kitware.com/_c_d_m_tables.html#RespiratorySystemTable)

---

<div class="post-metadata">

### Author: ![dhoadley](https://discourse.kitware.com/letter_avatar_proxy/v4/letter/d/e36b37/32.png) [@dhoadley](https://discourse.kitware.com/u/dhoadley)
#### Post date: [April 8, 2020, 11:57am UTC](https://discourse.kitware.com/t/cosimulation-with-matlab-and-simulink/440/3 "2020-04-08T11:57:44Z")

</div>

Indeed, that was the issue! Please note that I was working off your example in HowTo-MechanicalVentilation.cpp. It requests 2 data items that are apparently out of date with this list:  
RespirationMusclePressure (now RespiratoryMusclePressure) and PulmonaryResistance, which now appears separated into Inspiratory and ExpiratoryPulmonaryResistance. I made those updates and was able to simulate.

Thanks,  
Dave.

---

<div class="post-metadata">

### Author: ![abray](https://discourse.kitware.com/user_avatar/discourse.kitware.com/abray/32/12_2.png) [@abray](https://discourse.kitware.com/u/abray)
#### Post date: [April 8, 2020, 12:43pm UTC](https://discourse.kitware.com/t/cosimulation-with-matlab-and-simulink/440/4 "2020-04-08T12:43:57Z")

</div>

Thanks for letting us know!

I would also suggest to checkout the feature/multiplex\_ventilation branch  
(Branched off of 3.x)

This is also a pretty good resource for CMake  
[https://cliutils.gitlab.io/modern-cmake/](https://cliutils.gitlab.io/modern-cmake/)

The 3.x has a much improved CMake system  
You should be able to use the find\_package and set the Pulse\_DIR to the install/lib/cmake/PulseXXX folder to get its CMake interface target for use in your projects

Sorry we were late in responding  
Post Pulse questions here :  
[https://discourse.kitware.com/c/pulse-physiology-engine/](https://discourse.kitware.com/c/pulse-physiology-engine/)

The Pulse teams gets notifications for posts there and respond pretty quickly
