import math
# calculating the temperature after 1.5 s
# Variables
th0 = 100.;
t = 1.5;
tc = 3.5;
# Calculations
th = th0*(1-math.exp(-t/tc));
# Results
print "temperature after 1.5 s (degree C)", th
import math
# calculate time to read half of the temperature difference
# Variables
tc = 10./5;
th = 1.;
th0 = 2.;
# Calculations
t = -tc*math.log(1-(th/th0));
# Results
print "Time to read half of the temperature difference (s)", t
import math
# Calculate the temperature after 10s
# Variables
th0 = 25;
thi = 150;
t = 10.;
tc = 6;
# Calculations
th = th0+(thi-th0)*(math.exp(-t/tc));
# Results
print "the temperature after 10s (degree C)", th
import math
# Calculate the value of resistance after 15s
# Variables
R0 = 29.44;
Rs = 100.;
t = 15.;
tc = 5.5;
# Calculations
R_15 = Rs+R0*(1-math.exp(-t/tc));
# Results
print "value of resistance after 15s(ohm)", R_15
import math
# Calculate the depth after one hour
# Variables
Qm = 0.16*10**-3;
Hin = 1.2;
K1 = Qm/(Hin)**0.5;
Qo = 0.2*10**-3;
Ho = (Qo/K1)**2;
R = Hin/Qm;
C = 0.1;
tc = R*C;
t = 3600;
# Calculations
H = Ho+(Hin-Ho)*math.exp(-t/tc);
# Results
print "the depth after one hour(m)", H
import math
#Calculate time constant
# Variables
S = 3.5;
Ac = (math.pi/4)*(0.25)**2;
alpha = 0.18*10**-3;
# Calculations and Results
Vb = S*Ac/alpha;
print "volume of bulb(mm2)", Vb
Rb = ((Vb/math.pi)*(3/.4))**(1./3);
Ab = 4*math.pi*Rb**2;
D = 13.56*10**3;
s = 139;
H = 12;
tc = (D*s*Vb*10**-9)/(H*Ab*10**-6);
print "time constant (s)", tc
# Variables
ess = 5;
A = 0.1;
# Calculations
tc = ess/A;
# Results
print "time constant(s)", tc
import math
# Calculate the temperature at a depth of 1000 m
# Variables
th0 = 20.;
t = 2000.;
# Calculations
thr = th0-0.005*(t-50)-0.25*math.exp(-t/50);
# Results
print "temperature at a depth of 1000 m (degree C)", thr
import math
# Calculate the value of resistance at different values of time
# Variables
Gain = 0.3925;
T = 75.;
p_duration = Gain*T;
tc = 5.5;
Rin = 100.;
t = 1;
# Calculations and Results
Rt = p_duration*(1-math.exp(-t/tc))+Rin;
print "Value of resistance after 1s(ohm) = ", Rt
t = 2;
Rt = p_duration*(1-math.exp(-t/tc))+Rin;
print "Value of resistance after 2s(ohm) = ", Rt
t = 3;
Rt = p_duration*(1-math.exp(-t/tc))+Rin;
print "Value of resistance after 3s(ohm) = ", Rt
R_inc = Rt-Rin;
t = 5;
Rt = (R_inc)*(math.exp(-(t-3)/(5.5)))+Rin;
print "Value of resistance after 5s(ohm) = ", Rt
t = 10;
Rt = (R_inc)*(math.exp(-(t-3)/(5.5)))+Rin;
print "Value of resistance after 10s(ohm) = ", Rt
t = 20;
Rt = (R_inc)*(math.exp(-(t-3)/(5.5)))+Rin;
print "Value of resistance after 20s(ohm) = ", Rt
t = 30;
Rt = (R_inc)*(math.exp(-(t-3)/(5.5)))+Rin;
print "Value of resistance after 30s(ohm) = ", Rt
# Variables
M = 8*10**-3;
K = 1000.;
# Calculations and Results
wn = (K/M)**0.5;
print "for critically damped system eta = 1",
B = 2*(K*M);
print "Damping constant for critically damped system (N/ms-1) = ", B
eta = 0.6;
wd = wn*(1-eta**2)**0.5;
print "frequency of damped oscillations (rad/s) = ", wd
import math
# Variables
K = (40.*10**-6)/(math.pi/2);
J = 0.5*10**-6;
B = 5.*10**-6;
# Calculations and Results
eta = B/(2*(K*J)**0.5);
print "damping ratio = ", eta
wn = (K/J)**0.5;
print "natural frequency (rad/sec)", wn
wd = wn*(1-(eta)**2)**0.5;
print "frequency of damped oscillations (rad/s)", wd
tc = 1/wn;
print "time constant (s)", tc
ess = 2*eta/wn;
print " steady state error (V) = ", "for a ramp input of 5V"
ess = 5*2*eta/wn;
print "", ess
T_lag = 2*eta*tc;
print "Time lag (s)", T_lag
import math
# Calculate the natural frequency
# Variables
wn = 2*math.pi*30;
print " for a frequency of 30 Hz wn = (K/M+5*10**-3)**0.5.........(i)",
print "But wn = (K/M)**0.5.........(ii)",
print "for a frequency of 25 Hz wn = (K/M+5*10**-3+5*10**-3)**0.5.........(iii) ",
print " (ii) and (iii)", "on solving (i)"
# Calculations and Results
M = 6.36*10**-3;
K = 403.6;
print "M = ", M
print "K = ", K
wn = (K/M)**0.5;
f = wn/(2*math.pi);
print "natural frequency (Hz)", f
# Variables
K = 60.*10**3;
M = 30.;
# Calculations and Results
wn = (K/M)**0.5;
print "natural frequency (rad/sec)", wn
eta = 0.7;
ts = 4/(eta*wn);
print "setteling time (s)", ts
import math
# Calculate time lag and ratio of output and input
# Variables
print "when time period is 600s"
w = 2*math.pi/600;
tc = 60.;
# Calculations and Results
T_lag = (1/w)*math.atan(w*tc);
print "time lag (s) = ", T_lag
M = 1/((1+(w*tc)**2)**0.5);
print "ratio of output and input = ", M
print "when time period is 120s",
w = 2*math.pi/120;
tc = 60;
T_lag = (1/w)*math.atan(w*tc);
print "time lag (s) = ", T_lag
M = 1/((1+(w*tc)**2)**0.5);
print "ratio of output and input = ", M
import math
# Calculate the maximum allowable time constant and phase shift
# Variables
M = 1-0.05;
w = 2*math.pi*100;
# Calculations and Results
tc = (((1/M**2)-1)/(w**2))**0.5;
print "maximum allowable time constant (s)", tc
print "phase shift at 50 Hz (degree) = ",
ph = (-math.atan(2*math.pi*50*tc))*(180/math.pi);
print ph
print "phase shift at 100 Hz (degree) = ",
ph = (-math.atan(2*math.pi*100*tc))*(180/math.pi);
print ph
import math
# Calculate maximum value of indicated temperature and delay time
# Variables
T = 120.;
w = 2*math.pi/T;
tc1 = 40.;
tc2 = 20.;
# Calculations and Results
M = (1/((1+(w*tc1)**2)**0.5))*(1/((1+(w*tc2)**2)**0.5));
M_temp = M*10;
print "maximum value of indicated temperature (degree C)", M_temp
ph = ((math.atan(w*tc1)+math.atan(w*tc2)));
T_lag = ph/w;
print "Time lag (s)", T_lag
import math
# Find the output
print "when tc = 0.2",
print "output = 1/(1+(2*0.2)**2)**0.5]math.sin[2t-math.atan(2*0.2)]+3/(1+(2*0.2)**2)**0.5]math.sin[20t-math.atan(20*0.2)]",
print "on solving output = 0.93 math.sin(2t-21.8)+0.073 math.sin(20t-76)",
print "when tc = 0.002",
print "output = 1/(1+(2*0.002)**2)**0.5]math.sin[2t-math.atan(2*0.002)]+3/(1+(2*0.002)**2)**0.5]math.sin[20t-math.atan(20*0.002)]",
print "on solving output = 1math.sin(2t-0.23)+0.3 math.sin(20t-2.3)",
import math
#Calculate maximum and minimum value of indicated temperature, phase shift, time lag
# Variables
T_max = 640.;
T_min = 600.;
T_mean = (T_max+T_min)/2;
Ai = T_mean-T_min;
w = 2*math.pi/80;
tc = 10;
# Calculations and Results
Ao = Ai/((1+(w*tc)**2))**0.5;
T_max_indicated = T_mean+Ao;
print "Maximum value of indicated temperature(degree C) = ", T_max_indicated
T_min_indicated = T_mean-Ao;
print "Minimum value of indicated temperature(degree C) = ", T_min_indicated
ph = -math.atan(w*tc);
Time_lag = -ph/w;
print "Time lag (s)", Time_lag
import math
# determine damping ratio
# Variables
w = 2.;
K = 1.5;
J = 200.*10**-3;
wn = (K/J)**0.5;
u = w/wn;
M = 1.1;
# Calculations and Results
eta = (((1/(M**2))-((1-u**2)**2))/(2*u)**2)**0.5;
print "damping ratio = ", eta
import math
# Calculate the frequency range
# Variables
eta = 0.6;
fn = 1000;
M = 1.1;
print "M = 1/[[(1-u**2)**2]+(2*u*eta)**2]**0.5 ..........(i)",
print "on solving u**4-0.5u**2+0.173 = 0",
print "the above equation gives imaginary values for frequency so for eta = 0.6 the output is not 1.1",
print " on solving equation (i) we have", "Now let M = 0.9"
print "u**4-0.56u**2-0.234 = 0",
print "on solving u = 0.916",
# Calculations and Results
u = 0.916;
f = u*fn;
print "maximum value of range (Hz) = ", f
print " the range of the frequency is from 0 to 916 Hz", "So"
import math
# determine the error
# Variables
w = 6.;
wn = 4.;
u = w/wn;
eta = 0.66;
# Calculations
M = 1/(((1-u**2)**2)+(2*eta*u)**2)**0.5;
Error = (M-1)*100;
# Results
print "error (%) = ", Error