May-24-2021, 04:12 PM
0
I'm taking a programming class in python so i'm a beginner. We got an assignment where we were supposed to calculate and plot the time taken for a pool to reach 5 degrees celcius. I've tested the time taken with 3 smaller containers (0.3L, 0.5L, and 1.2L) and plotted them in a python program to find a k-value. Where the k-value is the projected time taken to cool them down. Then i've used regression in a program called "GeoGebra" to find a function for k given the volume V. Now im stuck.
The pool i'm gonna use is 1.250.000L, and i don't know how to get that into code and get it plotted, anyone got any tips?
This is the code that i used for the plotting of the three smaller containers;
Thanks in advance!
I'm taking a programming class in python so i'm a beginner. We got an assignment where we were supposed to calculate and plot the time taken for a pool to reach 5 degrees celcius. I've tested the time taken with 3 smaller containers (0.3L, 0.5L, and 1.2L) and plotted them in a python program to find a k-value. Where the k-value is the projected time taken to cool them down. Then i've used regression in a program called "GeoGebra" to find a function for k given the volume V. Now im stuck.
The pool i'm gonna use is 1.250.000L, and i don't know how to get that into code and get it plotted, anyone got any tips?
This is the code that i used for the plotting of the three smaller containers;
import numpy as np from matplotlib import pyplot as plt filename = "temperatur.txt" data = np.loadtxt(filename, float, skiprows = 1) measurement_start = 0 time = data[measurement_start:, 0] time -= time[0] temperature = data[measurement_start:, 1] plt.plot(time, temperature, 'x', label = "MÃ¥lingene") plt.xlabel("Time(s)") plt.ylabel("Temperaturen(C)") k = 0.00022 temp_outside = 5 T_0 = temperature[0] space = 1 # space between measurements t_start = 0 t_end = 45 * 60 N = int((t_end - t_start) / space + 1) t = np.linspace(t_start, t_end, N) T = np.zeros(N) T[0] = T_0 # Eulers method for i in range(N-1): T[i+1] = T[i] + k * (temp_outside - T[i]) * space print(f"Last valuei: {T[-1]}") plt.plot(t, T, label = "Model") plt.plot(t, (temp_outside +1) * np.ones(N), "--", label = "Temp outside + one degree") plt.title(f"k = {k}") plt.legend()This is the outcome i want, just with the pool size
Thanks in advance!