Bonjour,

je travaille sur un projet de régulation de température, c'est pour cette raison j'ai consulté le site officiel de MATLAB, et j'ai trouvé cet exemple:

http://www.mathworks.fr/products/sim...househeat.html

J'ai essayé de faire la même simulation mais sans passer par Simulink, j'ai utilisé la fonction ode45 pour résoudre l'équation différentielle,

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
function Tpint = rigid(t,Tint)
Tpint = 0;% a column vector
 
r2d = 180/pi;
% -------------------------------
% Define the house geometry
% -------------------------------
% House length = 30 m
lenHouse = 30;
% House width = 10 m
widHouse = 10;
% House height = 4 m
htHouse = 4;
% Roof pitch = 40 deg
pitRoof = 40/r2d;
% Number of windows = 6
numWindows = 6;
% Height of windows = 1 m
htWindows = 1;
% Width of windows = 1 m
widWindows = 1;
windowArea = numWindows*htWindows*widWindows;
wallArea = 2*lenHouse*htHouse + 2*widHouse*htHouse + ...
           2*(1/cos(pitRoof/2))*widHouse*lenHouse + ...
           tan(pitRoof)*widHouse - windowArea;
% -------------------------------
% Define the type of insulation used
% -------------------------------
% Glass wool in the walls, 0.2 m thick
% k is in units of J/sec/m/C - convert to J/hr/m/C multiplying by 3600
kWall = 0.038*3600;   % hour is the time unit
LWall = .2;
RWall = LWall/(kWall*wallArea);
% Glass windows, 0.01 m thick
kWindow = 0.78*3600;  % hour is the time unit
LWindow = .01;
RWindow = LWindow/(kWindow*windowArea);
% -------------------------------
% Determine the equivalent thermal resistance for the whole building
% -------------------------------
Rq = RWall*RWindow/(RWall + RWindow);
% c = cp of air (273 K) = 1005.4 J/kg-K
c = 1005.4;
% -------------------------------
% Enter the temperature of the heated air
% -------------------------------
% The air exiting the heater has a constant temperature which is a heater
% property. Tch = 50 deg C
Tch = 50;
% Air flow rate Mp = 1 kg/sec = 3600 kg/hr
Mp = 3600;  % hour is the time unit
% -------------------------------
% Determine total internal air mass = M
% -------------------------------
% Density of air at sea level = 1.2250 kg/m^3
densAir = 1.2250;
M = (lenHouse*widHouse*htHouse+tan(pitRoof)*widHouse*lenHouse)*densAir;
 
%text
Text=10+6*sin(t*2*pi/24);
Tcon=20;
 
 
global Commande 
 
 
 
if Tint>=Tcon+2
 
     Commande=0;
 
 end
 
if Tint<=Tcon-2
 
    Commande=1;
 
end
 
 
 
 
Qp=(Tch-Tint)*Mp*c*Commande;
Ql=(Tint-Text)/Rq;
 
Tpint = (1/M*c)*(Qp-Ql) ;
Le problème est que je n'ai pas les mêmes résultats que Simulink, j'ai utilisé les mêmes constantes.