Upload
koustubh-banerjee
View
219
Download
0
Embed Size (px)
DESCRIPTION
This document provides the code for finding the temperature of or current in a conductor given current/temp and other environmental parameters. The code is based on IEEE 738-2006 standard.
Citation preview
TEMPVSCU.CPP May 21, 2013 Page 1
#include#include#include#include#include#define PI 3.14159265358979
float air_density(float a, float b, float c);
float natural_convection(float a, float b, float c, float e);
float dynamic_viscosity(float a);
float thermal_cond(float a);
float wind_direction(float a);
float forced_convc(float a, float b, float c, float d, float e, float f, float g, float h);
float select_lfc(float a, float b);
float rad_heat(float a, float b, float c, float d);
float sol_heat_gain(float a, float b, float c, float d, float e, float f);
float cond_resist(float a, float b, float c, float d, float e);
float steady_current(float a, float b, float c, float d);
void main()
{float
v_speed,He,em,ab,T_amb,T_max,lat,dia,pf,uf,kf,kangle,qr,qcn,phi;float
qc,sol_hr,N_day,T_flim,qc_f,I_pc,I_rem,I_rate,T_acsr,dia_acsr;float
qs,T_high,T_low,R_max,I_max,R_low,R_high,R_low_acsr,R_high_acsr;int
count;
cout
TEMPVSCU.CPP May 21, 2013 Page 2
do{T_flim = (T_max+T_amb)/2;pf = air_density(T_amb,T_max,He);uf = dynamic_viscosity(T_flim);kf = thermal_cond(T_flim);kangle = wind_direction(phi);if(count == 0){qcn = natural_convection(T_amb,T_max,pf,dia_acsr);qc_f = forced_convc(dia_acsr,pf,v_speed,uf,kf,kangle,T_max,T_amb);qr = rad_heat(dia_acsr,em,T_max,T_amb);qs = sol_heat_gain(dia_acsr,N_day,sol_hr,lat,He,ab);R_max = cond_resist(R_high_acsr,R_low_acsr,T_high,T_low,T_max);}else{qcn = natural_convection(T_amb,T_max,pf,dia);qc_f = forced_convc(dia,pf,v_speed,uf,kf,kangle,T_max,T_amb);qr = rad_heat(dia,em,T_max,T_amb);qs = sol_heat_gain(dia,N_day,sol_hr,lat,He,ab);R_max = cond_resist(R_high,R_low,T_high,T_low,T_max);}qc = select_lfc(qc_f,qcn);I_max = steady_current(qc,qr,qs,R_max);if(count == 0){I_rem = I_max-10;while (I_rem>10)I_rem = I_rem-10;I_rate = 10-I_rem+I_max;cout
TEMPVSCU.CPP May 21, 2013 Page 3
//Forced convection heat lossfloat
dynamic_viscosity(float a){float
b;double
F;F = 1.458*pow(10,-6);b = (F*pow((a+273),1.5))/(a+383.4);return
b;}
float thermal_cond(float a)
{float
G,b;double
H,I;G = 0.02424;H = 7.477*pow(10,-5);I = 4.407*pow(10,-9);b = G+(H*a)-(I*pow(a,2));return
b;}
float wind_direction(float a)
{float
phir,b;phir = a*(PI/180);b = 1.194-cos(phir)+0.194*cos(2*phir)+0.368*sin(2*phir);return
b;}
float forced_convc(float a, float b, float c, float d, float e, float f, float g, float h)
{float
qc12,qc1,qc2;qc1 = (1.01+(0.0372*pow((a*b*c)/d,0.52)))*e*f*(g-h);qc2 = (0.0119*pow(((a*b*c)/d),0.6)*e*f*(g-h));if(qc1>=qc2){qc12=qc1;return
qc12;}else{qc12=qc2;return
qc12;}}
//Selection of larger of the convection heat lossfloat
select_lfc(float a, float b){float
c;if
(a>=b){c = a;return
c;}else{c = b;return
c;}}
//Radiated heat lossfloat
rad_heat(float a, float b, float c, float d){float
e;e = 0.0178*a*b*(pow((c+273)/100,4)-pow((d+273)/100,4));return
e;}
TEMPVSCU.CPP May 21, 2013 Page 4
//Solar heat gainfloat
sol_heat_gain(float a, float b, float c, float d, float e, float f){float
A_pro,del_arg,del_argr,del,w,latr,delr,Hc,Hc_deg,J,K,L,Qs,ksolar,Qse,g;double
M,N,O,P,Q,R;A_pro = a/1000;del_arg = ((284+b)/365)*360;del_argr = del_arg*(PI/180);del = 23.4583*sin(del_argr);w = (c-12)*15*(PI/180);latr = d*(PI/180);delr = del*(PI/180);Hc = asin((cos(latr)*cos(delr)*cos(w))+(sin(latr)*sin(delr)));Hc_deg = Hc*(180/PI);J = -42.2391;K = 63.8044;L = -1.9220;M = 3.46921*pow(10,-2);N = -3.61118*pow(10,-4);O = 1.94318*pow(10,-6);P = -4.07608*pow(10,-9);
Qs = J+(K*Hc_deg)+(L*pow(Hc_deg,2))+(M*pow(Hc_deg,3))+(N*pow(Hc_deg,4))+(O*pow(Hc_deg,5))+(P*pow(Hc_deg,6)); //heat flux recieved at the sea level
Q = 1.148*pow(10,-4);R = -1.108*pow(10,-8);ksolar = 1+(Q*e)+(R*pow(e,2));Qse = ksolar*Qs; //heat flux corrected for elevation
g = f*Qse*A_pro;return
g;}
//Conductor electrical resistancefloat
cond_resist(float a, float b, float c, float d, float e){float
f;f = ((((a-b)/1609.34)/(c-d))*(e-d))+(b/1609.34);return
f;}
//Steady state heat balancefloat
steady_current(float a, float b, float c, float d){float
HR,e;HR = (a+b-c)/d;if(HR < 0){HR = 0;return
HR;}else{e = pow(HR,0.5);return
e;}}