Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from math import sqrt
- import matplotlib.pyplot as plt
- print("test")
- #Masa grzejnika [kg]
- m = 10
- #Cieplo wlasciwe grzejnika [J/kgK] [Zelazo - 449]
- cw = 449
- #no jakas stala
- b = 0.5
- #Stala czasowa? - czyli chyba jak czesto iteracja
- tp = 0.1
- #Liczba iteracji
- ile = 60000
- #Temperatura do ktorej dazy uklad
- temperaturaZadana = 20
- #Moc grzejna [W]
- pg = 70
- #temperatura otoczenia
- temperaturaOtoczenia = 0
- ti = 100
- kp = 2
- listaTemperatur = []
- listU = []
- listE = []
- def liczTemperature(n):
- return ((tp * ((pg / b) - listaTemperatur[n - 1])) / ((m * cw) / b)) + listaTemperatur[n - 1]
- def liczE(n):
- return temperaturaZadana - listaTemperatur[n]
- def liczU(n):
- return b * (liczE(n) - temperaturaOtoczenia)
- listaTemperatur.append(0);
- listU.append(0)
- listE.append(0)
- for index in range(1, ile):
- listaTemperatur.append(liczTemperature(index))
- listE.append(liczE(index))
- listU.append(liczU(index))
- #print(listaTemperatur[index])
- if listU[index] < 0:
- pg = 70
- elif listU[index] < temperaturaZadana:
- pg = listU[index] * 10.8
- else:
- pg = 0
- print(pg)
- plt.plot(listaTemperatur)
- plt.ylabel('temepratura')
- plt.xlabel('t')
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement