You are on page 1of 4

TEMPVSCU.

CPP

May 21, 2013

Page 1

#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
#include<fstream.h>
#define PI 3.14159265358979
float
float
float
float
float
float
float
float
float
float
float

air_density(float a, float b, float c);


natural_convection(float a, float b, float c, float e);
dynamic_viscosity(float a);
thermal_cond(float a);
wind_direction(float a);
forced_convc(float a, float b, float c, float d, float e, float f, float g, float h);
select_lfc(float a, float b);
rad_heat(float a, float b, float c, float d);
sol_heat_gain(float a, float b, float c, float d, float e, float f);
cond_resist(float a, float b, float c, float d, float e);
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<<"Enter wind speed (m/s)"<<endl;
cin>>v_speed;
cout<<"Enter Elevation (m)"<<endl;
cin>>He;
cout<<"Enter emissivity"<<endl;
cin>>em;
cout<<"Enter absorptivity"<<endl;
cin>>ab;
cout<<"Enter ambient temperature (Celsius)"<<endl;
cin>>T_amb;
cout<<"Enter latitude"<<endl;
cin>>lat;
cout<<"Enter conductor diameter (mm)"<<endl;
cin>>dia;
cout<<"Enter the angle between the wind direction and the conductor axis"<<endl;
cin>>phi;
cout<<"Enter the day number"<<endl;
cin>>N_day;
cout<<"Enter the solar hour (24hr format)"<<endl;
cin>>sol_hr;
cout<<"Enter the low temperature"<<endl;
cin>>T_low;
cout<<"Enter the high temperature"<<endl;
cin>>T_high;
cout<<"Enter the resistance at low temp (ohm/mile)"<<endl;
cin>>R_low;
cout<<"Enter the resistance at high temp (ohm/mile)"<<endl;
cin>>R_high;
cout<<"Enter the resistance at low temp (ohm/mile) for equivalent ACSR"<<endl;
cin>>R_low_acsr;
cout<<"Enter the resistance at high temp (ohm/mile) for equivalent ACSR"<<endl;
cin>>R_high_acsr;
cout<<"Enter the diameter of equivalent ACSR"<<endl;
cin>>dia_acsr;
cout<<"Enter ACSR thermal rating"<<endl;
cin>>T_acsr;
ofstream out("accclap1");
if(!out)
{
cout<<"Cannot open file"<<endl;
}

T_max = T_acsr;
count = 0;

TEMPVSCU.CPP

May 21, 2013

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<<"The current rating of ACSR under given conditions "<<I_rate<<" A"<<endl;
cout<<"Press any key to continue"<<endl;
out<<"Base current is "<<I_rate<<" (rating of ACSR)"<<endl;
out<<"Current (%)
Temperature (C)"<<endl;
T_max = T_amb;
I_pc = 0;
}
else
{
I_pc = (I_max/I_rate)*100;
out<<I_pc<<"
"<<T_max<<endl;
T_max+=0.1;
}
count = 1;
}while (T_max>=T_amb && I_pc<=300);
out.close();
getch();
}

//Natural convection heat loss


float air_density(float a, float b, float c)
{
float A,D,d,e;
double B,C;
d = (a+b)/2;
A = 1.293;
B = 1.525*pow(10,-4);
C = 6.379*pow(10,-9);
D = 0.00367;
e = (A-(B*c)+(C*pow(c,2)))/(1+(D*d));
return e;
}
float natural_convection(float a, float b, float c, float e)
{
float E,d;
E = 0.0205;
d = E*pow(c,0.5)*pow(e,0.75)*pow((b-a),1.25);
return d;
}

Page 2

TEMPVSCU.CPP

May 21, 2013

Page 3

//Forced convection heat loss


float 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 loss


float select_lfc(float a, float b)
{
float c;
if (a>=b)
{
c = a;
return c;
}
else
{
c = b;
return c;
}
}

//Radiated heat loss


float 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 gain


float 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*po
w(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 resistance
float 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 balance
float 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;
}
}

You might also like