How to relate between popup parameter in subsystem and switch case in matlab function?

1 visualización (últimos 30 días)
switch HE_Type %(which HE_Type has 2 only choices parallel_flow or counter_flow)
case 'parallel_flow'
E = (1-exp(-NTU*(1+C)))/(1+C)
case 'counter_flow'
E =(1-exp(-NTU*(1+C)))/((1-C*exp(-NTU*(1-C))))
end
% i make a model simulink to calculate the temperature of heat exchanger
%so there is 2 types of heat exchanger so for each type there is own equation
%so i wanna to make a popup parameter in mask of subsystm (types) and relate this popup with switch case in matlab function
  4 comentarios
Mostafa Kamel
Mostafa Kamel el 6 de Jun. de 2022
i make a model simulink to calculate the temperature of heat exchanger
so there is 2 types of heat exchanger so for each type there is own equation
so i wanna to make a popup parameter in mask of subsystm (types) and relate this popup with switch case in matlab function

Iniciar sesión para comentar.

Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 6 de Jun. de 2022
Editada: Fangjun Jiang el 6 de Jun. de 2022
Best way for this is to use "Variant Subsystem". See document and example
There is no need to add mask anymore, although you can still add mask to select the variant if you prefer.
Second option is to use that popup in mask to control the value of a String Constant block in Simulink. That Constant block is fed as an input (the "HE_Type" input) of your MATLAB function block. Then everything is linked together.
  2 comentarios
Mostafa Kamel
Mostafa Kamel el 14 de Jun. de 2022
Editada: Mostafa Kamel el 14 de Jun. de 2022
more explaination for the second option ,please ??
Fangjun Jiang
Fangjun Jiang el 14 de Jun. de 2022
The second option is just like any ordinary mask. You have a variable (for the value of the String Constant block) inside the subsystem. You bring it to the mask dialog. Based on the popuo option, the value of that String Constant block will change. Then inside your MATLAB Function, you read that String Constnat value (through input port) and use it in the switch-case statment.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Schedule Model Components en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by