Simulink - Simscape HTC input using model parameters

Hi,
I'm trying to define a variable convective heat transfer coefficient using model parameters (i.e. temperature) in the simulink model shown below. Is there a way to define this?

I get this error when I run the simulation ' ...or the model referenced by it contains a block that updates persistent or state variables while computing outputs and is not supported in an algebraic loop. It is in an algebraic loop with the following blocks.'
So does that mean we can't define the conv_HTC as a function of temperature or is there a way to do it?

Many thanks

4 Comments

Hi Delika,
It seems that the simulink model attachment/image did not make it through, can you please re-attach the model or image. Additionally if you can provide the full error message this would be addionally useful for me to investigate further.
Sincerely,
Youssef Noureddine
Hi Youssef,
Thank you very much for replying. I think I've made a mistake in how the loop was created. Initially I created the input signal using simulink and then converted to PS and got the error. But then I directly used the PS output from the temp sensor and gave it as an input. I'm not sure if this is the way to go. But the figure below shows what I was trying to do. i.e. basically define a custom convective HTC as a function of temperature. (connections shown in blue are the ones I had before, apologies for my childish art here :D .)
I'm not sure if this is the way to do it.
Any feedback would be much appreciated. (sorry I couldn't find a snapshot of the error I got, but this is what I basically got ...or the model referenced by it contains a block that updates persistent or state variables while computing outputs and is not supported in an algebraic loop. It is in an algebraic loop with the following blocks.')
Many thanks
Delika
Hi Delika,
Can you provide the contents of the "variable convective heat transfer" block? I would recommend continuing with this for now as it seems you are not encountering any errors. I would however suggest simplifying the model (blocks like temperature 1 and temperature 2 seem identical and may cause additional confusion).
Since I do not know what the contents of your custom block are, I cannot tell for certain if you will run into an error, but if you do, feel free to attach it here so we can understand what the exact issue simscape is running into is.
Hi Youssef,
Thanks, yeah I figured there is an extra temp sensor when I uploaded. Did change it afterwards. Please see the content for the variable convective HT block below.
-----------------------------------------------------------------------------------------------
inputs
T_diff = {1, 'K'}; % S:bottom
end
parameters
k = {0.598, 'W/(m*K)'}; %Thermal conductivity of water (W/mK)
C_p = {4200, 'J/(kg*K)'}; %specific heat capacity of the liquid (J/kgK)
beta = {210e-6, '1/K'}; %Volumetric thermal expansion coefficient
mu = {8.9e-4, 'kg/(m*s)'}; %Dynamic viscosity of water (Pa.s)
rho = {998.2, 'kg/m^3'}; %Density of water
g = {9.81, 'm/s^2'}; %acceleration due to gravity
%Battery dimensions
Bat_width = {160e-3, 'm'}; %Width of the battery (m)
Bat_height = {227e-3, 'm'}; %Height of the battery (m)
Bat_thickness = {7.25e-3, 'm'}; %Thicknesss of the battery (m)
end
parameters (Access=private)
nu = mu/rho; %Kinematic viscosity
alpha = k/(rho*C_p); %Thermal diffusivity
Vol_of_cell = Bat_height*Bat_width*Bat_thickness; %Volume of the pouch cell
Surf_area_cell = 2*Bat_height*Bat_width; %Surface of cooling of the cell (only one surface considered)
L = Vol_of_cell/Surf_area_cell %Lenght scale of the cell
end
nodes
A = foundation.thermal.thermal; % A:bottom
B = foundation.thermal.thermal; % B:top
end
variables (Access=private, Conversion=relative)
T = {0, 'K'}; % Temperature difference
end
variables (Access=private)
Q = {0, 'W'}; % Heat flow rate
end
branches
Q : A.Q -> B.Q;
end
equations
T == A.T - B.T;
%Equation for heat transfer coefficient is embedded in the following equation
Q == Surf_area_cell *((k/L)*(0.68 + ((0.67*((g*beta*T_diff*L^3)/(nu*alpha))^(1/4))/(1 + ((0.492*k)/(C_p*mu))^(9/16))^(4/9))))* T;
end
end
---------------------------------------------------
Cheers
Delika

Sign in to comment.

Answers (1)

Hello,
the convective heat transfer block supports variable heat transfer coefficient also in 22b. You just have to set the convection type to "Variable" which will open an additional port where you can provide your heat transfer coefficient (see below)
Hope this helps,
Best
Lorenzo

Categories

Products

Release

R2022b

Asked:

on 8 Nov 2022

Answered:

on 16 Dec 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!