I´m currently working on the Simulation of a heat exchanger in combination with a controll system in Simulink. I wrote a function in Matlab to solve a differential equation and call this script via a Interpreted MATLAB Function Block in Simulink. The code looks as the following:
function [T_ww] = Definition_of_Tww(T_rl)
cond = T_w(0)==273.15+15;
eqn = c_1*diff((T_vll-T_rl),t)-c_pkt1*(T_vll-T_rl)==c_2*diff((T_wkk-T_w),t)-c_pkt2*(T_wkk-T_w);
To solve this differential equation i need both massflows in the heat exchanger. I´m transporting them to the Matlab base Workspace via a Matlab function in Simulink with the following code:
function z = fcn(w)
z = w;
The function for m_pkt2 is analog. I tested this function in a seperat Simulink project with a Sine Wave Block and a Profile for m_pkt2 witch i want to Simulate with and it worked there. But in the normal project only m_pkt2 gets passed over to the base Workspace. With a Simple "sin" in the Interpreted MATLAB Function Block m_pkt1 actually gets passed to the base Workspace. I tried some things so far but nothing worked.
I hope somebody can help me with this Problem.