Edit: I add the code needed to calculate radiation and solar constant correction.
void getSolRadBird(INPUTS i, SOLPOS solpos, SOLRAD * o)
{
double degRad = 0.017453292519943295769236907684886;
// relative air mass
double AM=1./(cos( solpos.Z*degRad )+0.15*pow(93.885-solpos.Z,-1.25));
double AMp=AM*i.sitePressure/1013.;
// Rayleigh
double Tr=exp(-0.0903*pow(AMp,0.84)*(1+AMp-pow(AMp,1.01)));
// ozone
double Ozm=i.ozone*AM;
double Toz=1.-0.1611*Ozm*pow(1.+139.48*Ozm,-0.3035)-0.002715*Ozm/(1.+0.044*Ozm+0.0003*pow(Ozm,2.));
// mixed gases
double Tm=exp(-0.0127*pow(AMp,0.26));
// water vapor
double Wm=AM * i.water;
// total water vapor
double Tw=1.-2.4959*Wm/((1.+pow(79.034*Wm,0.6828))+6.385*Wm);
// daily turbidity
// Ta5=A*sin((Dan-B)*PI/180.)+C; aerosol optical depth at 500 nm
// Ta3=Ta5+0.1;
double Ta5=i.AOT500;
double Ta3=i.AOT380;
double Tau=0.2758*Ta3+0.35*Ta5;
double Ta=exp((-pow(Tau,0.873))*(1.+Tau-(pow(Tau,0.7088)))*pow(AM,0.9108));
double TAA=1.-0.1*(1.-AM+pow(AM,1.06))*(1.-Ta);
double TAs=Ta/TAA;
double Rs=0.0685+(1.-0.84)*(1.-TAs);
// clear irradiance
double Io=i.SolConst;
// direct
// Earth/sun distance correction, Rsq = 1/R^2
// double d=f.doy;
// double Rsq=(1.00011+0.034221*cos(6.28318*(d-1)/365)+0.00128*sin(6.28318*(d-1)/365)+0.000719*cos(2*(6.28318*(d-1)/365))+0.000077*sin(2*(6.28318*(d-1)/365)));
double Rsq=1.0/ (solpos.R*solpos.R) ;
//alert("R= "+Rsq);
double Id=Rsq*Io*.9662*Tr*Toz*Tm*Tw*Ta;
// direct on horizontal surface
double Idh=Id*cos(solpos.Z*degRad);
// diffuse (scattered)
double Ias=0.79*Io*cos(solpos.Z*degRad)*Toz*Tm*Tw*TAA;
Ias=Ias*(0.5*(1.-Tr)+0.85*(1.-TAs))/(1.-AM+pow(AM,1.02));
// total dif + dir on horizontal
double Itot=(Idh+Ias)/(1.-i.albedo*Rs);
double Idif=Itot-Idh;
// Save the values
o->air_m = AM;
o->direct = Idh;
o->diffuse = Idif;
o->total = Itot;
o->S_corrected = Rsq*Io;
}