SHARE
TWEET

Untitled

a guest Mar 26th, 2020 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. close all;
  2. clear all;
  3.  
  4. %Przeplyw
  5. cpp = 1008; %J/kg K, powietrze
  6. rop = 1.185; %kg/m3, powietrze
  7. cpw = 4175.4; %J/kg K, woda
  8. row = 997.04; %kg/m3,  woda
  9.  
  10. %Wartosci nominalne
  11. Twewn=20;
  12. Tzewn=-20;
  13. Tgzn1=90;
  14. Tgzn2=90;
  15. Tgpn=70;
  16. Tkzn=90;
  17. Tkpn=70;
  18. qgn=5000;
  19. qgn1=5000;
  20. qkn=5000;
  21. Top=7000;
  22. fmgn1=(qgn/(cpw*(Tgzn1-Tgpn)));
  23. fmgn2=(qgn1/(cpw*(Tgzn2-Tgpn)));
  24. fmkn=(qkn/(cpw*(Tkzn-Tkpn)));
  25. simTime=1000000;
  26.  
  27. %Wartosci poczatkowe
  28. %t=2000;
  29. Tzew0=Tzewn;
  30. Tgz1=Tgzn1;
  31. Tgz2=Tgzn2;
  32. fmg1=fmgn1;
  33. fmg2=fmgn2;
  34. fmk0=fmkn;
  35. Tkz0=Tkzn;
  36. Tkp0=Tkpn;
  37. qg=qgn;
  38. qk0=qkn;
  39. qt1=0;
  40. qt2=0;
  41. Top_wek=[];
  42.  
  43. %Skoki
  44. t0=2000;
  45. dTzew=0;
  46. dTgz=0;
  47. dfmg1=0;
  48. dfmg2=0;
  49. dqg=0;
  50. dqt=0;
  51. dfmk=0;
  52. dqk=0;
  53. dTkp=0;
  54.  
  55. %Grzejnik
  56. hg=0.4;
  57. wg=0.2;
  58. lg=1.5;
  59.  
  60. %Pomieszczenie
  61. h1=2.5;
  62. w1=5;
  63. l1=4;
  64.  
  65. h2=2.5;
  66. w2=3;
  67. l2=4;
  68.  
  69. %Kocioł
  70. hk=0.4;
  71. wk=0.2;
  72. lk=1.5;
  73.  
  74. %Pojemności
  75. Vp1=h1*w1*l1;
  76. Vp2=h2*w2*l2;
  77. Vg1=hg*wg*lg;
  78. Vgw=hk*wk*lk;
  79.  
  80. %Pojemnosci cieplne
  81. Cvg = cpw*row*Vg1;
  82. Cvw1 = cpp*rop*Vp1;
  83. Cvw2 = cpp*rop*Vp2;
  84. Cvk = cpw*row*Vgw;
  85.  
  86. %Identyfikacja parametrow
  87. Kcw=qgn/(Twewn-Tzewn);
  88. Kcg=qgn/(Tgpn-Twewn);
  89.  
  90. %Stany równowagi
  91. Twew1=(cpw*fmg1*Kcg*Tgz1+Kcw*(Kcg+cpw*fmg1)*Tzew0)/(Kcg*Kcw+cpw*fmg1*(Kcg+Kcw));
  92. Tgp1=((Kcg+Kcw)*Twew1-Kcw*Tzew0)/Kcg;
  93. Twew2=(cpw*fmg2*Kcg*Tgz2+Kcw*(Kcg+cpw*fmg2)*Tzew0)/(Kcg*Kcw+cpw*fmg2*(Kcg+Kcw));
  94. Tgp2=((Kcg+Kcw)*Twew2-Kcw*Tzew0)/Kcg;
  95.  
  96. %Symulacje
  97. %{
  98. sim('pomieszczenie');
  99. subplot(5,1,1);
  100. hold on, grid on, title('Zmiana temperatury pomieszczenia');
  101. xlabel('czas');
  102. ylabel('temperatura');
  103. plot(ans.t,ans.Twew);
  104.  
  105. subplot(5,1,2);
  106. hold on, grid on, title('Zmiana temperatury wody w grzejniku');
  107. xlabel('czas');
  108. ylabel('temperatura');
  109. plot(ans.t,ans.Tgp);
  110.  
  111. subplot(5,1,3);
  112. hold on, grid on, title('Zmiana temperatury w kotle');
  113. xlabel('czas');
  114. ylabel('temperatura');
  115. plot(ans.t,ans.Tkz);
  116.  
  117. subplot(5,1,4);
  118. hold on, grid on, title('Zmiana temperatury pomieszczenia');
  119. xlabel('czas');
  120. ylabel('temperatura');
  121. plot(ans.t,ans.Twew1);
  122.  
  123. subplot(5,1,5);
  124. hold on, grid on, title('Zmiana temperatury wody w grzejniku');
  125. xlabel('czas');
  126. ylabel('temperatura');
  127. plot(ans.t,ans.Tgp1);
  128. %}
  129. %CHARAKTERYSTYKI STATYCZNE
  130. Tzew_wek = [-20:40];
  131. Twew1_wek = [];
  132. Twew2_wek = [];
  133. Tkp_wek = [];
  134. fmg_wek1 = linspace(0, fmgn1, 61);
  135. fmg_wek2 = linspace(0, fmgn2, 61);
  136. for i=1:length(Tzew_wek) %przeplyw nominal
  137.     Twew1_wek(i)=(cpw*fmg1*Kcg*Tgz1+Kcw*(Kcg+cpw*fmg1)*Tzew_wek(i))/(Kcg*Kcw+cpw*fmg1*(Kcg+Kcw));
  138.     Twew2_wek(i)=(cpw*fmg2*Kcg*Tgz2+Kcw*(Kcg+cpw*fmg2)*Tzew_wek(i))/(Kcg*Kcw+cpw*fmg2*(Kcg+Kcw));
  139.     Tgp1_temp=((Kcg+Kcw)*Twew1_wek(i)-Kcw*Tzew_wek(i))/Kcg;
  140.     Tgp2_temp=((Kcg+Kcw)*Twew2_wek(i)-Kcw*Tzew_wek(i))/Kcg;
  141.     Tkp_wek(i) = (Tgp1_temp * fmg1 + Tgp2_temp * fmg2) / (fmg1 + fmg2);
  142. end
  143.  
  144. figure(2)
  145. subplot(4, 1, 1)
  146. grid on;
  147. hold on;
  148. plot(Tzew_wek, Twew1_wek,'-.r','LineWidth',2)
  149. plot(Tzew_wek, Twew2_wek,'-b','LineWidth',1)
  150. plot(Tzewn,Twew1,'*','LineWidth',5)
  151. xlabel('Tzew[°C]');
  152. ylabel('Twew[°C]');
  153. legend('Twew1','Twew2','TwewN');
  154.  
  155. subplot(4, 1, 2)
  156. grid on;
  157. hold on;
  158. plot(Tzew_wek, Tkp_wek,'LineWidth',2)
  159. plot(Tzewn, Tkp0,'*','LineWidth',5)
  160. xlabel('Tzew[°C]');
  161. ylabel('Tkp[°C]');
  162. legend('Tkp','TkpN');
  163.  
  164. %%%%%
  165. Twew1_wek = [];
  166. Twew2_wek = [];
  167. Tkp_wek = [];
  168.  
  169. for i=1:length(fmg_wek1) %przeplyw nominal
  170.     Twew1_wek(i) = (cpw*fmg_wek1(i)*Kcg*Tgz1+Kcw*(Kcg+cpw*fmg_wek1(i))*Tzew0)/(Kcg*Kcw+cpw*fmg_wek1(i)*(Kcg+Kcw));
  171.     Twew2_wek(i) = (cpw*fmg_wek2(i)*Kcg*Tgz2+Kcw*(Kcg+cpw*fmg_wek2(i))*Tzew0)/(Kcg*Kcw+cpw*fmg_wek2(i)*(Kcg+Kcw));
  172.     Tgp1_temp=((Kcg+Kcw)*Twew1_wek(i)-Kcw*Tzewn)/Kcg;
  173.     Tgp2_temp=((Kcg+Kcw)*Twew2_wek(i)-Kcw*Tzewn)/Kcg;
  174.     Tkp_wek(i) = (Tgp1_temp * fmg_wek1(i) + Tgp2_temp * fmg_wek2(i)) / (fmg_wek1(i)+fmg_wek2(i));
  175. end
  176.  
  177. subplot(4, 1, 3)
  178. grid on;
  179. hold on;
  180. plot(fmg_wek1, Twew1_wek,'-.r','LineWidth',2)
  181. plot(fmg_wek2, Twew2_wek,'-b','LineWidth',1)
  182. plot(fmgn1,Twew1,'*','LineWidth',5)
  183. xlabel('fmg[kg/s]');
  184. ylabel('Twew[°C]');
  185. legend('Twew1','Twew2','TwewN');
  186.  
  187. subplot(4, 1, 4)
  188. grid on;
  189. hold on;
  190. plot(fmg_wek1, Tkp_wek,'LineWidth',2)
  191. plot(fmg_wek2, Tkp_wek,'LineWidth',2)
  192. plot(fmgn1, Tkpn,'*','LineWidth',5)
  193. xlabel('fmg[kg/s]');
  194. ylabel('Tkp[°C]');
  195. legend('Tkp','TkpN');
  196.  
  197. %SCHODKI
  198. Top_wek = [3000,7000,21000];
  199. dqk=0.1*qkn;
  200.  
  201. figure(3)
  202. grid on;
  203. hold on;
  204.  
  205. for i = 1:length(Top_wek)
  206.    Top = Top_wek(i);
  207.    sim('pomieszczenie');
  208.    plot(ans.t, ans.Tkp,'LineWidth',2);
  209.    hold on;
  210. end
  211. xlabel('t[s]');
  212. ylabel('Tkp[°C]');
  213. legend('Top=3000','Top=7000','Top=21000');
  214.  
  215. dqk=0;
  216. Top=3000;
  217.  
  218. %REAKCJA NA SKOK
  219. simTime=400000;
  220. dqk=0.1*qkn;
  221. sim('pomieszczenie');
  222.  
  223. figure(4)
  224. subplot(3, 1, 1)
  225. grid on;
  226. hold on;
  227.  
  228. plot(ans.t, ans.Twew1,'LineWidth',2);
  229. plot(ans.t, ans.Twew2,'LineWidth',2);
  230. xlabel('t[s]');
  231. ylabel('Twew[°C]');
  232. legend('Twew1', 'Twew2');
  233.  
  234. %
  235.  
  236. dqk=0;
  237. dTzew=1;
  238. sim('pomieszczenie');
  239.  
  240. subplot(3, 1, 2)
  241. grid on;
  242. hold on;
  243.  
  244. plot(ans.t, ans.Twew1,'LineWidth',2);
  245. plot(ans.t, ans.Twew2,'LineWidth',2);
  246. xlabel('t[s]');
  247. ylabel('Twew[°C]');
  248. legend('Twew1', 'Twew2');
  249.  
  250. simTime=5000;
  251. sim('pomieszczenie');
  252.  
  253. subplot(3, 1, 3)
  254. grid on;
  255. hold on;
  256.  
  257. plot(ans.t, ans.Twew1,'LineWidth',2);
  258. plot(ans.t, ans.Twew2,'LineWidth',2);
  259. xlabel('t[s]');
  260. ylabel('Twew[°C]');
  261. legend('Twew1', 'Twew2');
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top