from sympy import symbols, diff, solve
from __future__ import division
# Given that
A = 20 # Value of A in voltage length characteristic equation
B = 40 # Value of B in voltage length characteristic equation
v= 80 # Open circuit voltage in V
I = 1000 # Short circuit current in amp
l, I=symbols("l I")
i = ((v-A)-(B* l))*(I/v)
V_given = (A+B*l)# Given in the question
V_cal = v-v/1e3*I # Volts # power source characteristic
# equating both V gives I
I = (v-(A+B*l))/(v/1e3) # A
P = V_given*I
#k = derivat(P)
k = diff(P,l)
#L=roots(k)
L=solve(k,l)[0]
I = (v-(A+B*L))/(v/1e3) # A
#Pmax=((v-A)-(B* L))*(I/v)*(A+B*L)
V_given = (A+B*L)
Pmax = V_given*I
print "Maximum power of the arc = %0.f kVA"%(Pmax/1000)
from math import pi
# Given that
N =25 # No. of bridges per cm**2
r = 0.1 # Radius of bridge in mm
rho = 2e-5 # Resistivity of the material in ohm-cm
v= 5 # Applied voltage in V
Rc = 0.85*rho/(N*pi*r*0.1)
Q = (v**2)/Rc
print "Rate of heat generated per unit area = %0.2e W/cm**2"%(Q)
# Answer in the book is given as 1.136e5 W/cm**2
from math import sin
# Given that
P = 2.5 # Power in kVA
t = 3 # Thickness of steel plate in mm
T = 85 # Percentage of total time when arc is on
alpha = 1.2e-5 # Thermal diffusivity of steel in m**2/sec
k = 43.6 # Thermal conductivity of steel in W/m-°C
theta_ = 1530 # Melting point of steel in °C
theta = 30 # Ambient temperature in °C
gama = 60 # Angle in degree
C = T/100
Q = C*P*10**3
w = t/sin(gama*pi/180)
theta_m = theta_ - theta
v_max = (4*alpha/(w*(10**-3)))*((Q/(8*k*theta_m*t*(10**-3)))-0.2)
print "Maximum passible welding speed = %0.4f m/sec"%(v_max)
# Answer in the book is given as 0.0146 m/sec
# Given that
t = 1.2 # Thickness of aluminium sheet in mm
t_ = 0.25 # Adhesive thickness in mm
l = 12 # Overlapped length in mm
E = 703 # Modulus of elastisity in N/mm**2
G = 11.9 # Shear modulus of adhesive in N/mm**2
T_S = 0.6 # Ultimate shear stress in N/mm**2
K = (((l**2)*G)/(2*E*t*t_))**(1/2)
T = T_S/K
print "The maximum shear stress the lap joint can withstand = %0.4f N/mm**2"%(T)
# Answer in the book is given as 0.274 N/mm**2