Matlab / Simulink Block Error
조회 수: 11 (최근 30일)
이전 댓글 표시
Hey guys,
I don't understand which parameters are wrong. I want to simulate a isothermal expansion. Here I got this Error:
A valid state attribute should be a non-missing string array, a character vector, a cell array or a valid MATLAB structure.
Component:Simulink | Category:Block error
This is my Matlab Code:
clc, clearvars
% Parameter deklarieren
V0 = 0.001; % Anfangsvolumen [m^3]
Q = 1; % Heizleistung [W]
Rs = 287.058; % spezifische Gaskonstante für Luft [J/(kg*K)]
T = 293.15; % Anfangstemperatur [K]
p = 100000; % Anfangsdruck [Pa]
Tsim = 200; % Simulationsdauer [s]
h = 0.1; % Schrittweite [s]
% Simulink-Modell laden
open_system('isotherm_expansion');
% Anfangsbedingungen setzen
set_param('isotherm_expansion/Integrator', 'InitialCondition', '0.001');
set_param('isotherm_expansion/Gain', 'Gain', num2str(Q/(Rs*T)));
% Simulationszeit konfigurieren
set_param('isotherm_expansion', 'StopTime', num2str(Tsim));
% Simulation ausführen
sim('isotherm_expansion');
% Simulationsergebnisse speichern
t = V.time; % Zeitvektor
v = V.signals.values; % Volumenvektor
% Ergebnisse plotten
plot(t,v);
title('Volumenänderung während einer isothermen Expansion');
xlabel('Zeit [s]');
ylabel('Volumen [m^3]');
My Blocks + Parameters:

Integrator:
Sum:

Gain:

Hope that you can help me.
Thanks a lot! Cheers,
Alessandro
댓글 수: 0
채택된 답변
Fangjun Jiang
2023년 3월 30일
The "State Name" parameter of the Integrator block, where you set as "V0", should not be a value. It is a "Name". It should be something like " 'Anfangsvolumen' ", like e.g. 'Position' in the dialog prompt.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 General Applications에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!