How to make a variable periodic

60 Views Asked by At

I have wrote this code in python and I need the temperature to be periodic (period = 1s)(like a Sin function).

Tmax = 308
Tmin = 298
t1 = 600
t2 = t1+600
t3 = t2+1800
t4 = t3+600
tr = 3600
Tr = 273
def T(t):
 if t>0 and t<=t1/tr: Ti = (Tmax-Tmin)/Tr*(tr/t1)*t + Tmin/Tr 
 if t>t1/tr and t<=t2/tr: Ti = Tmax/Tr
 if t>t2/tr and t<=t3/tr: Ti = -(Tmax-Tmin)/Tr*(tr*t-t2)/(t3-t2) + Tmax/Tr
 if t>t3/tr and t<=t4/tr: Ti = Tmin/Tr
 return Ti

Actually i need a way to implement the following temperature profile in an ode solver.

Temperature over timespan (0,20)

0

There are 0 best solutions below