Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.24 KB | None | 0 0
  1. from math import sqrt
  2. import matplotlib.pyplot as plt
  3.  
  4. print("test")
  5.  
  6. #Masa grzejnika [kg]
  7. m = 10
  8.  
  9. #Cieplo wlasciwe grzejnika [J/kgK] [Zelazo - 449]
  10. cw = 449
  11.  
  12. #no jakas stala
  13. b = 0.5
  14.  
  15. #Stala czasowa? - czyli chyba jak czesto iteracja
  16. tp = 0.1
  17.  
  18. #Liczba iteracji
  19. ile = 60000
  20.  
  21. #Temperatura do ktorej dazy uklad
  22. temperaturaZadana = 20
  23.  
  24.  
  25. #Moc grzejna [W]
  26. pg = 70
  27.  
  28. #temperatura otoczenia
  29. temperaturaOtoczenia = 0
  30.  
  31. ti = 100
  32. kp = 2
  33.  
  34. listaTemperatur = []
  35. listU = []
  36. listE = []
  37.  
  38. def liczTemperature(n):
  39.     return ((tp * ((pg / b) - listaTemperatur[n - 1])) / ((m * cw) / b)) + listaTemperatur[n - 1]
  40.  
  41. def liczE(n):
  42.     return temperaturaZadana - listaTemperatur[n]
  43.  
  44. def liczU(n):
  45.     return b * (liczE(n) - temperaturaOtoczenia)
  46.    
  47. listaTemperatur.append(0);
  48. listU.append(0)
  49. listE.append(0)
  50.  
  51. for index in range(1, ile):
  52.     listaTemperatur.append(liczTemperature(index))
  53.     listE.append(liczE(index))
  54.     listU.append(liczU(index))
  55.    
  56.     #print(listaTemperatur[index])
  57.    
  58.     if listU[index] < 0:
  59.         pg = 70
  60.     elif listU[index] < temperaturaZadana:
  61.         pg =  listU[index] * 10.8
  62.     else:
  63.         pg = 0
  64.     print(pg)
  65.  
  66. plt.plot(listaTemperatur)
  67. plt.ylabel('temepratura')
  68. plt.xlabel('t')
  69. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement