function TrackerTwoAxisHorizontalPerpendicular($SUNPOS, $w, $ws, $HI, $ANISO, $SITE, $PVGEN, $OPTIONS, $TIME) { //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //INITIAL CALCULATIONS //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //INPUTS //SUNPOS $costetazs = $SUNPOS['costetazs']; $cosfis = $SUNPOS['cosfis']; $gammas = $SUNPOS['gammas']; $tetazs = $SUNPOS['tetazs']; $fis = $SUNPOS['fis']; //HI $G0 = $HI['G0']; $B0 = $HI['B0']; $D0 = $HI['D0']; //ANISO $k1 = $ANISO['k1']; $k2 = $ANISO['k2']; //PVGEN //Common $NBGH = $PVGEN['NBGH']; $NBGV = $PVGEN['NBGV']; $NBT = $PVGEN['NBT']; //This tracker $LEO = $PVGEN['Track2HP']['LEO']; $LNS = $PVGEN['Track2HP']['LNS']; $ALARG = $PVGEN['Track2HP']['ALARG']; $Rotation_MAX = $PVGEN['Track2HP']['Rotation_MAX']; $Axis_inclination = $PVGEN['Track2HP']['Axis_inclination']; $Inclination_MAX = $PVGEN['Track2HP']['Inclination_MAX']; $RSES = $PVGEN['Track2HP']['RSES']; $RSEH = $PVGEN['Track2HP']['RSEH']; //Conversion to radian $rotMAX = $Rotation_MAX * pi() / 180; $inclieje = $Axis_inclination * pi() / 180; $incliMAX = $Inclination_MAX * pi() / 180; //OTHER PARAMETERS //Degree of dust, model parameters $DDP = DustDegreeParameters($OPTIONS['DustDegree']); $ar = $DDP['ar']; $c2 = $DDP['c2']; $Transm = $DDP['Transm']; //Shading, model coefficients $SMP = ShadingModelParameters($OPTIONS['ShadingModel']); $MSP = $SMP['MSP']; $MSO = $SMP['MSO']; $MSC = $SMP['MSC']; //Ground reflectance $GroundReflectance = $OPTIONS['GroundReflectance']; //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //CALCULATIONS //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for ($d = 0; $d < $TIME['Ndays']; $d++) { for ($h = 0; $h < $TIME['Nsteps']; $h++) { //Sets the coordinates of the unit radius vector of the sun in a system of coordinates Oxyz //solidarity with the place and the x axis X, Y, Z pointing respectively to the west, south //and the zenith $xsol[$d][$h] = cos($gammas[$d][$h]) * sin($fis[$d][$h]); $ysol[$d][$h] = cos($gammas[$d][$h]) * cos($fis[$d][$h]); $zsol[$d][$h] = sin($gammas[$d][$h]); //Sets the coordinates of the unit radius vector of the sun in a coordinate system Ox'y'z' //solidarity with the place, but with an axis inclined at an angle inclieje and, therefore, //with the x axis X', Y ', Z' pointing respectively west (x '), integral with the axis of //rotation (y') and plane normal x'y '(z') $rosol[$d][$h] = sqrt(pow($ysol[$d][$h], 2) + pow($zsol[$d][$h], 2)); $tetasol[$d][$h] = atan($zsol[$d][$h] / $ysol[$d][$h]); $xprimasol[$d][$h] = $xsol[$d][$h]; $yprimasol[$d][$h] = $rosol[$d][$h] * cos($tetasol[$d][$h] + $inclieje); $zprimasol[$d][$h] = $rosol[$d][$h] * sin($tetasol[$d][$h] + $inclieje); //CONSIDERATION PRINCIPAL AXIS MOTION, + //// Angle of rotation axis (rotNS) if ($zprimasol[$d][$h] == 0) { $rotNS[$d][$h] = pi() / 2 * valueSign($fis[$d][$h]); } else { $rotNS[$d][$h] = abs(atan($xprimasol[$d][$h] / $zprimasol[$d][$h])) * valueSign($fis[$d][$h]); } //Limits the rotation angle to a maximum of 90 degrees if (abs($rotNS[$d][$h]) > pi() / 2) { $rotNS[$d][$h] = pi() / 2 * valueSign($fis[$d][$h]); } //Limits the rotation angle to the constructive value, the result is called rotNSC $rotNSC[$d][$h] = $rotNS[$d][$h]; if (abs($rotNS[$d][$h]) > $rotMAX) { $rotNSC[$d][$h] = $rotMAX * valueSign($fis[$d][$h]); } //Shadow testing and, if necessary, corrected by "back-tracking" on the horizontal axis, RSEH. $sombra[$d][$h] = 1 / cos($rotNS[$d][$h]); $rotNSBTC[$d][$h] = $rotNS[$d][$h] - $RSEH * acos(min(1, $LEO * cos($rotNS[$d][$h]))) * valueSign($w[$d][$h]); //CONSIDERATION OF SECOND AXIS MOTION //Coordinates of the Sun in a supportive system with the surface associated to the principal axis, ie, //the normal points south at noon, and rotates with the shaft throughout the day, including the possibility //of backtracking (RSEH = 1) $x2primasol[$d][$h] = $xprimasol[$d][$h] * cos($rotNSBTC[$d][$h]) - $zprimasol[$d][$h] * sin($rotNSBTC[$d][$h]); $y2primasol[$d][$h] = $yprimasol[$d][$h]; $z2primasol[$d][$h] = $xprimasol[$d][$h] * sin($rotNSBTC[$d][$h]) + $zprimasol[$d][$h] * cos($rotNSBTC[$d][$h]); //Angle of inclination of the surface (rotation about the second axis) perpendicular to the projection of //the Sun on the plane Z''Y ' if ($z2primasol[$d][$h] > 0) { $betasupideal[$d][$h] = atan($y2primasol[$d][$h] / $z2primasol[$d][$h]); } else { $betasupideal[$d][$h] = 0; } // Reset overnight, to facilitate the presentation if ($zsol[$d][$h] < 0) { $betasupideal[$d][$h] = 0; } // Set initial zero shade factors and correction for backtracking $FSGHS[$d][$h] = 0; $FSGVS[$d][$h] = 0; $CBTP[$d][$h] = 0; //Analysis shadows between rows, ie, the row that is the South: //Coordinates of the Sun in a solidary system with the receiving surface (equation 3.77) $x3primasol[$d][$h] = $x2primasol[$d][$h]; $y3primasol[$d][$h] = $y2primasol[$d][$h] * cos($betasupideal[$d][$h]) - $z2primasol[$d][$h] * sin($betasupideal[$d][$h]); //Avoid division by zero if ($x3primasol[$d][$h] == 0) { $x3primasol[$d][$h] = 1.0E-6; } //There are shadows if (equation 3.78) if ($LNS * cos($betasupideal[$d][$h]) - $ALARG < abs($y3primasol[$d][$h] / $x3primasol[$d][$h])) { //Lengths and shade factors $sombrapos[$d][$h] = $ALARG * 1 / cos($betasupideal[$d][$h]); $sombraposv[$d][$h] = $ALARG + abs($y3primasol[$d][$h] / $x3primasol[$d][$h]); $FSGHS[$d][$h] = max(0, 1 - $LNS / $sombrapos[$d][$h]); $FSGVS[$d][$h] = max(0, 1 - $LNS * cos($betasupideal[$d][$h]) / $sombraposv[$d][$h]); //Angle correction $CBTP[$d][$h] = acos(min(1, $LNS / $ALARG * cos($betasupideal[$d][$h]))); } //Tilt angle after backtracking $betasupBT[$d][$h] = (abs($betasupideal[$d][$h]) - $CBTP[$d][$h] * $RSES) * valueSign($betasupideal[$d][$h]); //Removing shadows if backtracking if ($RSES == 1) { $FSGHS[$d][$h] = 0; } //Limit angle to constructive value if (abs($betasupBT[$d][$h]) > $incliMAX) { $betasupBTC[$d][$h] = $incliMAX * valueSign($betasupBT[$d][$h]); } else { $betasupBTC[$d][$h] = $betasupBT[$d][$h]; } // Scan the shadows again: // Coordinates of the Sun in a solidary system with the receptor surface $y3primasol[$d][$h] = $y2primasol[$d][$h] * cos($betasupBTC[$d][$h]) - $z2primasol[$d][$h] * sin($betasupBTC[$d][$h]); //There are shadows if if ($LNS * cos($betasupBTC[$d][$h]) - $ALARG < abs($y3primasol[$d][$h] / $x3primasol[$d][$h])) { //Lengths and shade factors $sombrapos[$d][$h] = $ALARG * 1 / cos($betasupBTC[$d][$h]); $sombraposv[$d][$h] = $ALARG + abs($y3primasol[$d][$h] / $x3primasol[$d][$h]); $FSGHS[$d][$h] = max(0, 1 - $LNS / $sombrapos[$d][$h]); $FSGVS[$d][$h] = max(0, 1 - $LNS * cos($betasupBTC[$d][$h]) / $sombraposv[$d][$h]); } //Full and effective shadow projected by the south row $FSGTS[$d][$h] = $FSGHS[$d][$h] * $FSGVS[$d][$h]; //Martinez shading model $NBSVS[$d][$h] = 0; $NBSHS[$d][$h] = 0; $NBSTS[$d][$h] = 0; $FSEVS[$d][$h] = 0; $FSEHS[$d][$h] = 0; $FSETS[$d][$h] = 0; //Effective values: if ($FSGTS[$d][$h] > 0) { $NBSVS[$d][$h] = RoundToZero($FSGVS[$d][$h] * $NBGV + 0.999); $NBSHS[$d][$h] = RoundToZero($FSGHS[$d][$h] * $NBGH + 0.999); $NBSTS[$d][$h] = $NBSVS[$d][$h] * $NBSHS[$d][$h]; $FSEVS[$d][$h] = $NBSVS[$d][$h] / $NBGV; $FSEHS[$d][$h] = $NBSHS[$d][$h] / $NBGH; if ($MSC == 1) { $FSETS[$d][$h] = $FSEVS[$d][$h] * $FSEHS[$d][$h]; } else { $FSETS[$d][$h] = 1 - (1 - $FSGTS[$d][$h]) * (1 - (1 - $MSO) * $NBSTS[$d][$h] / ($NBT + 1)) * (1 - $MSP); } } //Limit angle to constructive value if (abs($betasupBT[$d][$h]) > $incliMAX) { $betasupBTC[$d][$h] = $incliMAX * valueSign($betasupBT[$d][$h]); } else { $betasupBTC[$d][$h] = $betasupBT[$d][$h]; } //Surface coordinates in the XYZ system $xsup[$d][$h] = cos($betasupBTC[$d][$h]) * sin($rotNSBTC[$d][$h]); $ysup[$d][$h] = sin($betasupBTC[$d][$h]); $zsup[$d][$h] = cos($betasupBTC[$d][$h]) * cos($rotNSBTC[$d][$h]); //Inclination of the receptor surface $beta[$d][$h] = acos($zsup[$d][$h]); //Azimuth of the receptor surface if ($ysup[$d][$h] == 0) { $alfa[$d][$h] = pi() / 2 * valueSign($w[$d][$h]); } else { $alfa[$d][$h] = atan($xsup[$d][$h] / $ysup[$d][$h]); } //Incidence angle if (abs($w[$d][$h]) >= abs($ws[$d])) { $costetas[$d][$h] = 1; } else { $costetas[$d][$h] = $xsol[$d][$h] * $xsup[$d][$h] + $ysol[$d][$h] * $ysup[$d][$h] + $zsol[$d][$h] * $zsup[$d][$h]; } //Direct component if (abs($w[$d][$h]) >= abs($ws[$d])) { $B[$d][$h] = 0; } else { $B[$d][$h] = $B0[$d][$h] * max(0, $costetas[$d][$h]) / $costetazs[$d][$h]; } //Isotropic, circumsolar and horizon components of the diffuse irradiance if (abs($w[$d][$h]) >= abs($ws[$d])) { $Diso[$d][$h] = 0; $Dcir[$d][$h] = 0; $Dhor[$d][$h] = 0; $D[$d][$h] = 0; } else { $Diso[$d][$h] = $D0[$d][$h] * (1 - $k1[$d][$h]) * (1 + cos($beta[$d][$h])) / 2; $Dcir[$d][$h] = $D0[$d][$h] * $k1[$d][$h] * max(0, $costetas[$d][$h]) / $costetazs[$d][$h]; $Dhor[$d][$h] = $D0[$d][$h] * $k2[$d][$h] * sin($beta[$d][$h]); $D[$d][$h] = $Diso[$d][$h] + $Dcir[$d][$h] + $Dhor[$d][$h]; } //Albedo component if (abs($w[$d][$h]) >= abs($ws[$d])) { $R[$d][$h] = 0; } else { $R[$d][$h] = $GroundReflectance * $G0[$d][$h] * (1 - cos($beta[$d][$h])) / 2; } //Global irradiation $G[$d][$h] = $B[$d][$h] + $D[$d][$h] + $R[$d][$h]; //Consideration of the effects of the incidence angle // Angle correction factor of direct irradiance if (abs($w[$d][$h]) >= abs($ws[$d])) { $FCB[$d][$h] = 0; } else { $FCB[$d][$h] = (1 - exp(-$costetas[$d][$h] / $ar)) / (1 - exp(-1 / $ar)); } //Angle correction factor of the diffuse irradiance if (abs($w[$d][$h]) >= abs($ws[$d])) { $FCD[$d][$h] = 0; } else { $FCD[$d][$h] = 1 - exp(-1 / $ar * ((sin($beta[$d][$h]) + (pi() - $beta[$d][$h] - sin($beta[$d][$h])) / (1 + cos($beta[$d][$h]))) * 4 / 3 / pi() + $c2 * pow(sin($beta[$d][$h]) + (pi() - $beta[$d][$h] - sin($beta[$d][$h])) / (1 + cos($beta[$d][$h])), 2))); } //Angular correction albedo factor if (abs($w[$d][$h]) >= abs($ws[$d])) { $FCR[$d][$h] = 0; } else { if ($beta[$d][$h] == 0) { $FCR[$d][$h] = 0; } else { $FCR[$d][$h] = 1 - exp(-1 / $ar * ((sin($beta[$d][$h]) + ($beta[$d][$h] - sin($beta[$d][$h])) / (1 - cos($beta[$d][$h]))) * 4 / 3 / pi() + $c2 * pow(sin($beta[$d][$h]) + ($beta[$d][$h] - sin($beta[$d][$h])) / (1 - cos($beta[$d][$h])), 2))); } } //Effective irradiance components $Bef[$d][$h] = $B[$d][$h] * $FCB[$d][$h] * $Transm; $Def[$d][$h] = (($Diso[$d][$h] + $Dhor[$d][$h]) * $FCD[$d][$h] + $Dcir[$d][$h] * $FCB[$d][$h]) * $Transm; $Ref[$d][$h] = $R[$d][$h] * $FCR[$d][$h] * $Transm; //Effective irradiation $Gef[$d][$h] = $Bef[$d][$h] + $Def[$d][$h] + $Ref[$d][$h]; // Consideration of shadows projected by the "axes" to E and W // Value unit to the horizontal dimension of the shadow $FSGHE[$d][$h] = 1; $FSGHO[$d][$h] = 1; // Vertical dimension shaded by tracker located east, FSGVE, which is relevant only in the morning if ($w[$d][$h] <= 0) { $FSGVO[$d][$h] = 0; if (abs($rotNS[$d][$h]) == pi() / 2) { $FSGVE[$d][$h] = 1; } else { $FSGVE[$d][$h] = (1 - $RSEH) * max(0, 1 - $LEO / $sombra[$d][$h]); } if (abs($w[$d][$h]) >= abs($ws[$d])) { $FSGVE[$d][$h] = 0; } } // Vertical dimension shaded by tracker located West FSGVO, which is only relevant in the afternoon if ($w[$d][$h] > 0) { $FSGVE[$d][$h] = 0; if (abs($rotNS[$d][$h]) == pi() / 2) { $FSGVO[$d][$h] = 1; } else { $FSGVO[$d][$h] = (1 - $RSEH) * max(0, 1 - $LEO / $sombra[$d][$h]); } if (abs($w[$d][$h]) >= abs($ws[$d])) { $FSGVO[$d][$h] = 0; } } // Total geometric shadow Factor E and W $FSGTE[$d][$h] = $FSGVE[$d][$h] * $FSGHE[$d][$h]; $FSGTO[$d][$h] = $FSGVO[$d][$h] * $FSGHO[$d][$h]; //Martinez shading model $NBSVE[$d][$h] = 0; $NBSHE[$d][$h] = 0; $NBSTE[$d][$h] = 0; $FSEVE[$d][$h] = 0; $FSEHE[$d][$h] = 0; $FSETE[$d][$h] = 0; //Effective values: if ($FSGTE[$d][$h] > 0) { $NBSVE[$d][$h] = RoundToZero($FSGVE[$d][$h] * $NBGV + 0.999); $NBSHE[$d][$h] = RoundToZero($FSGHE[$d][$h] * $NBGH + 0.999); $NBSTE[$d][$h] = $NBSVE[$d][$h] * $NBSHE[$d][$h]; $FSEVE[$d][$h] = $NBSVE[$d][$h] / $NBGV; $SEHE[$d][$h] = $NBSHE[$d][$h] / $NBGH; if ($MSC == 1) { $FSETE[$d][$h] = $FSEVE[$d][$h] * $FSEHE[$d][$h]; } else { $FSETE[$d][$h] = 1 - (1 - $FSGTE[$d][$h]) * (1 - (1 - $MSO) * $NBSTE[$d][$h] / ($NBT + 1)) * (1 - $MSP); } } //Martinez shading model $NBSVO[$d][$h] = 0; $NBSHO[$d][$h] = 0; $NBSTO[$d][$h] = 0; $FSEVO[$d][$h] = 0; $FSEHO[$d][$h] = 0; $FSETO[$d][$h] = 0; //Effective values: if ($FSGTO[$d][$h] > 0) { $NBSVO[$d][$h] = RoundToZero($FSGVO[$d][$h] * $NBGV + 0.999); $NBSHO[$d][$h] = RoundToZero($FSGHO[$d][$h] * $NBGH + 0.999); $NBSTO[$d][$h] = $NBSVO[$d][$h] * $NBSHO[$d][$h]; $FSEVO[$d][$h] = $NBSVO[$d][$h] / $NBGV; $FSEHO[$d][$h] = $NBSHO[$d][$h] / $NBGH; if ($MSC == 1) { $FSETO[$d][$h] = $FSEVO[$d][$h] * $FSEHO[$d][$h]; } else { $FSETO[$d][$h] = 1 - (1 - $FSGTO[$d][$h]) * (1 - (1 - $MSO) * $NBSTO[$d][$h] / ($NBT + 1)) * (1 - $MSP); } } $FSGTEO[$d][$h] = $FSGTE[$d][$h] + $FSGTO[$d][$h]; //Calculation of the effective shadow $FSETEO[$d][$h] = $FSETE[$d][$h] + $FSETO[$d][$h]; $Befsa[$d][$h] = (1 - $FSETEO[$d][$h]) * $Bef[$d][$h]; $Defsa[$d][$h] = (($Diso[$d][$h] + $Dhor[$d][$h]) * $FCD[$d][$h] + $Dcir[$d][$h] * $FCB[$d][$h] * (1 - $FSETEO[$d][$h])) * $Transm; $Gefsa[$d][$h] = $Befsa[$d][$h] + $Defsa[$d][$h] + $Ref[$d][$h]; // For total shadow, we agree that if there are simultaneous shadows, ie, once projected to the south row and one of the axes, // is null the generation corresponding to direct irradiance and diffuse circumsolar component $Befsayp[$d][$h] = (1 - $FSETS[$d][$h]) * $Befsa[$d][$h]; $Defsayp[$d][$h] = (($Diso[$d][$h] + $Dhor[$d][$h]) * $FCD[$d][$h] + $Dcir[$d][$h] * $FCB[$d][$h] * (1 - $FSETEO[$d][$h]) * (1 - $FSETS[$d][$h])) * $Transm; $Gefsayp[$d][$h] = $Befsayp[$d][$h] + $Defsayp[$d][$h] + $Ref[$d][$h]; } //end FOR $h Nsteps } //end FOR $d Ndays $ISI = array('G' => $G, 'B' => $B, 'D' => $D, 'R' => $R, 'Gef' => $Gef, 'Bef' => $Bef, 'Def' => $Def, 'Ref' => $Ref, 'Gefsa' => $Gefsa, 'Befsa' => $Befsa, 'Defsa' => $Defsa, 'Gefsayp' => $Gefsayp, 'Befsayp' => $Befsayp, 'Defsayp' => $Defsayp); return $ISI; }
function TrackerTwoAxisConcentrator($SUNPOS, $w, $ws, $HI, $ANISO, $SITE, $PVGEN, $OPTIONS, $TIME) { //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //INITIAL CALCULATIONS //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //INPUTS //SUNPOS $costetazs = $SUNPOS['costetazs']; $cosfis = $SUNPOS['cosfis']; $gammas = $SUNPOS['gammas']; $tetazs = $SUNPOS['tetazs']; $fis = $SUNPOS['fis']; //HI $G0 = $HI['G0']; $B0 = $HI['B0']; for ($d = 0; $d < $TIME['Ndays']; $d++) { for ($h = 0; $h < $TIME['Nsteps']; $h++) { $D0[$d][$h] = 0; //(*) } } //ANISO $k1 = $ANISO['k1']; $k2 = $ANISO['k2']; //PVGEN //Common $NBGH = $PVGEN['NBGH']; $NBGV = $PVGEN['NBGV']; $NBT = $PVGEN['NBT']; //This tracker $Azimut_MAX = $PVGEN['Track2CO']['Azimut_MAX']; $Inclination_MAX = $PVGEN['Track2CO']['Inclination_MAX']; $LEO = $PVGEN['Track2CO']['LEO']; $LNS = $PVGEN['Track2CO']['LNS']; $ALARG = $PVGEN['Track2CO']['ALARG']; $RSEV = 0; //(*) $RSEH = 0; //(*) //OTHER PARAMETERS //Degree of dust, model parameters $DDP = DustDegreeParameters($OPTIONS['DustDegree']); $ar = $DDP['ar']; $c2 = $DDP['c2']; $Transm = $DDP['Transm']; //Shading, model coefficients $SMP = ShadingModelParameters($OPTIONS['ShadingModel']); $MSP = $SMP['MSP']; $MSO = $SMP['MSO']; $MSC = $SMP['MSC']; //Ground reflectance $GroundReflectance = $OPTIONS['GroundReflectance']; //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //CALCULATIONS //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for ($d = 0; $d < $TIME['Ndays']; $d++) { for ($h = 0; $h < $TIME['Nsteps']; $h++) { // SETTING TRACKER ANGLES // The analysis process is: ideal value, design limitations, // analysis of shadows, back-tracking corrections //Ideal values $beta[$d][$h] = $tetazs[$d][$h]; $alfa[$d][$h] = $fis[$d][$h]; //Limits the angle of inclination to constructive maximum value if ($beta[$d][$h] > $Inclination_MAX * pi() / 180) { $beta[$d][$h] = $Inclination_MAX * pi() / 180; } // Limits the azimuthal rotation angle of maximum constructive. if (abs($alfa[$d][$h]) > $Azimut_MAX * pi() / 180) { $alfa[$d][$h] = $Azimut_MAX * pi() / 180 * valueSign($alfa[$d][$h]); } // Set horizontal overnight if (abs($w[$d][$h]) > abs($ws[$d])) { $beta[$d][$h] = 0; } // Calculate the length of the shadow. if (abs($w[$d][$h]) >= abs($ws[$d])) { $S1[$d][$h] = 1.0E-7; $S2[$d][$h] = 0; } else { $S1[$d][$h] = $ALARG * cos($beta[$d][$h]); $S2[$d][$h] = $ALARG * sin($beta[$d][$h]) * tan($tetazs[$d][$h]); } $SP[$d][$h] = $S1[$d][$h] + $S2[$d][$h]; // Consideration of the shadows projected by a tracker located at E. // geometric: // Reset to zero (needed for the program if no shade) $FSGVE[$d][$h] = 0; $FSGHE[$d][$h] = 0; // Factor calculation when shadow if ($w[$d][$h] <= 0) { if ($fis[$d][$h] < -pi() / 2) { $FSGHE[$d][$h] = max(0, 1 - $LEO * cos(pi() - $fis[$d][$h])); } else { $FSGHE[$d][$h] = max(0, 1 - $LEO * cos($fis[$d][$h])); } if ($gammas[$d][$h] > 1.0E-6) { $FSGVE[$d][$h] = max(0, 1 + $LEO / $SP[$d][$h] * sin($fis[$d][$h])); } } $FSGTE[$d][$h] = $FSGVE[$d][$h] * $FSGHE[$d][$h]; // Martinez shading model $NBSVE[$d][$h] = 0; $NBSHE[$d][$h] = 0; $NBSTE[$d][$h] = 0; $FSEVE[$d][$h] = 0; $FSEHE[$d][$h] = 0; $FSETE[$d][$h] = 0; //Effective values: if ($FSGTE[$d][$h] > 0) { $NBSVE[$d][$h] = RoundToZero($FSGVE[$d][$h] * $NBGV + 0.999); $NBSHE[$d][$h] = RoundToZero($FSGHE[$d][$h] * $NBGH + 0.999); $NBSTE[$d][$h] = $NBSVE[$d][$h] * $NBSHE[$d][$h]; $FSEVE[$d][$h] = $NBSVE[$d][$h] / $NBGV; $FSEHE[$d][$h] = $NBSHE[$d][$h] / $NBGH; if ($MSC == 1) { $FSETE[$d][$h] = $FSEVE[$d][$h] * $FSEHE[$d][$h]; } else { $FSETE[$d][$h] = 1 - (1 - $FSGTE[$d][$h]) * (1 - (1 - $MSO) * $NBSTE[$d][$h] / ($NBT + 1)) * (1 - $MSP); } } // Consideration of the shadows projected by a tracker located at W. // geometric: $FSGVO[$d][$h] = 0; $FSGHO[$d][$h] = 0; if ($w[$d][$h] >= 0) { if ($fis[$d][$h] > pi() / 2) { $FSGHO[$d][$h] = max(0, 1 - $LEO * cos(pi() - $fis[$d][$h])); } else { $FSGHO[$d][$h] = max(0, 1 - $LEO * cos($fis[$d][$h])); } if ($gammas[$d][$h] > 1.0E-7) { $FSGVO[$d][$h] = max(0, 1 - $LEO / $SP[$d][$h] * sin($fis[$d][$h])); } } $FSGTO[$d][$h] = $FSGVO[$d][$h] * $FSGHO[$d][$h]; //Martinez shading model $NBSVO[$d][$h] = 0; $NBSHO[$d][$h] = 0; $NBSTO[$d][$h] = 0; $FSEVO[$d][$h] = 0; $FSEHO[$d][$h] = 0; $FSETO[$d][$h] = 0; //Effective values: if ($FSGTO[$d][$h] > 0) { $NBSVO[$d][$h] = RoundToZero($FSGVO[$d][$h] * $NBGV + 0.999); $NBSHO[$d][$h] = RoundToZero($FSGHO[$d][$h] * $NBGH + 0.999); $NBSTO[$d][$h] = $NBSVO[$d][$h] * $NBSHO[$d][$h]; $FSEVO[$d][$h] = $NBSVO[$d][$h] / $NBGV; $FSEHO[$d][$h] = $NBSHO[$d][$h] / $NBGH; if ($MSC == 1) { $FSETO[$d][$h] = $FSEVO[$d][$h] * $FSEHO[$d][$h]; } else { $FSETO[$d][$h] = 1 - (1 - $FSGTO[$d][$h]) * (1 - (1 - $MSO) * $NBSTO[$d][$h] / ($NBT + 1)) * (1 - $MSP); } } //if ( $FSGTO[$d][$h] > 0 ) // { // NBSVO[$d][$h] = RoundToZero($FSGVO[$d][$h]* $NBGV+ 0.999); // NBSHO[$d][$h] = RoundToZero($FSGHO[$d][$h]* $NBGH+ 0.999); // NBSTO[$d][$h] = $NBSVO[$d][$h] * $NBSHO[$d][$h]; // } //Effective values: //if ( $FSGTO[$d][$h] > 0 ) // { // $FSETO[$d][$h]=1-(1-$FSGTO[$d][$h])*(1-(1-$MSO)*$NBSTO[$d][$h]/($NBT+1))*(1-$MSP); // }else // { // $FSETO[$d][$h]=0; // } // Consideration of the shadows projected by a tracker located at SE. // geometric: // Azimuth at the beginning of the shadow $tanfiscsse = -($LEO + cos($fis[$d][$h])) / ($LNS + sin($fis[$d][$h])); // Azimuth at the end of the shadow $tanfisfsse = -($LEO - cos($fis[$d][$h])) / ($LNS - sin($fis[$d][$h])); //Azimuth of horizontal shade unity $tanfiss1se = -$LEO / $LNS; //Initial set to zero $FSGHSE[$d][$h] = 0; $FSGVSE[$d][$h] = 0; if (tan($fis[$d][$h]) >= $tanfiscsse) { if (tan($fis[$d][$h]) <= $tanfiss1se) { $FSGHSE[$d][$h] = 1 - ($tanfiss1se - tan($fis[$d][$h])) / ($tanfiss1se - $tanfiscsse); $FSGVSE[$d][$h] = max(0, 1 - ($LNS * cos($fis[$d][$h]) - $LEO * sin($fis[$d][$h])) / $SP[$d][$h]); } } if (tan($fis[$d][$h]) >= $tanfiss1se) { if (tan($fis[$d][$h]) <= $tanfisfsse) { $FSGHSE[$d][$h] = 1 - (tan($fis[$d][$h]) - $tanfiss1se) / ($tanfisfsse - $tanfiss1se); $FSGVSE[$d][$h] = max(0, 1 - ($LNS * cos($fis[$d][$h]) - $LEO * sin($fis[$d][$h])) / $SP[$d][$h]); } } $FSGTSE[$d][$h] = $FSGVSE[$d][$h] * $FSGHSE[$d][$h]; //Martinez shading model $NBSVSE[$d][$h] = 0; $NBSHSE[$d][$h] = 0; $NBSTSE[$d][$h] = 0; $FSEVSE[$d][$h] = 0; $FSEHSE[$d][$h] = 0; $FSETSE[$d][$h] = 0; //Effective values: if ($FSGTSE[$d][$h] > 0) { $NBSVSE[$d][$h] = RoundToZero($FSGVSE[$d][$h] * $NBGV + 0.999); $NBSHSE[$d][$h] = RoundToZero($FSGHSE[$d][$h] * $NBGH + 0.999); $NBSTSE[$d][$h] = $NBSVSE[$d][$h] * $NBSHSE[$d][$h]; $FSEVSE[$d][$h] = $NBSVSE[$d][$h] / $NBGV; $FSEHSE[$d][$h] = $NBSHSE[$d][$h] / $NBGH; if ($MSC == 1) { $FSETSE[$d][$h] = $FSEVSE[$d][$h] * $FSEHSE[$d][$h]; } else { $FSETSE[$d][$h] = 1 - (1 - $FSGTSE[$d][$h]) * (1 - (1 - $MSO) * $NBSTSE[$d][$h] / ($NBT + 1)) * (1 - $MSP); } } //if ( $FSGTSE[$d][$h] > 0 ) // { // $NBSVSE[$d][$h] = RoundToZero($FSGVSE[$d][$h]* $NBGV+ 0.999); // $NBSHSE[$d][$h] = RoundToZero($FSGHSE[$d][$h]* $NBGH+ 0.999); // $NBSTSE[$d][$h] = $NBSVSE[$d][$h] * $NBSHSE[$d][$h]; // // } //Effective values: //if ( $FSGTSE[$d][$h] > 0 ) // { // $FSETSE[$d][$h]=1-(1-$FSGTSE[$d][$h])*(1-(1-$MSO)*$NBSTSE[$d][$h]/($NBT+1))*(1-$MSP); // }else // { // $FSETSE[$d][$h]=0; // } // Consideration of the shadows projected by a tracker located at SW. // geometric: // Azimuth at the beginning of the shadow $tanfiscsso = ($LEO - cos($fis[$d][$h])) / ($LNS + sin($fis[$d][$h])); // Azimuth at the end of the shadow $tanfisfsso = ($LEO + cos($fis[$d][$h])) / ($LNS - sin($fis[$d][$h])); //Azimuth of the horizontal shade unity $tanfiss1so = $LEO / $LNS; //Initial set to zero $FSGHSO[$d][$h] = 0; $FSGVSO[$d][$h] = 0; if (tan($fis[$d][$h]) >= $tanfiscsso) { if (tan($fis[$d][$h]) <= $tanfiss1so) { $FSGHSO[$d][$h] = 1 - ($tanfiss1so - tan($fis[$d][$h])) / ($tanfiss1so - $tanfiscsso); $FSGVSO[$d][$h] = max(0, 1 - ($LNS * cos($fis[$d][$h]) + $LEO * sin($fis[$d][$h])) / $SP[$d][$h]); } } if (tan($fis[$d][$h]) >= $tanfiss1so) { if (tan($fis[$d][$h]) <= $tanfisfsso) { $FSGHSO[$d][$h] = 1 - (tan($fis[$d][$h]) - $tanfiss1so) / ($tanfisfsso - $tanfiss1so); $FSGVSO[$d][$h] = max(0, 1 - ($LNS * cos($fis[$d][$h]) + $LEO * sin($fis[$d][$h])) / $SP[$d][$h]); } } $FSGTSO[$d][$h] = $FSGVSO[$d][$h] * $FSGHSO[$d][$h]; //Martinez shading model $NBSVSO[$d][$h] = 0; $NBSHSO[$d][$h] = 0; $NBSTSO[$d][$h] = 0; $FSEVSO[$d][$h] = 0; $FSEHSO[$d][$h] = 0; $FSETSO[$d][$h] = 0; //Effective values: if ($FSGTSO[$d][$h] > 0) { $NBSVSO[$d][$h] = RoundToZero($FSGVSO[$d][$h] * $NBGV + 0.999); $NBSHSO[$d][$h] = RoundToZero($FSGHSO[$d][$h] * $NBGH + 0.999); $NBSTSO[$d][$h] = $NBSVSO[$d][$h] * $NBSHSO[$d][$h]; $FSEVSO[$d][$h] = $NBSVSO[$d][$h] / $NBGV; $FSEHSO[$d][$h] = $NBSHSO[$d][$h] / $NBGH; if ($MSC == 1) { $FSETSO[$d][$h] = $FSEVSO[$d][$h] * $FSEHSO[$d][$h]; } else { $FSETSO[$d][$h] = 1 - (1 - $FSGTSO[$d][$h]) * (1 - (1 - $MSO) * $NBSTSO[$d][$h] / ($NBT + 1)) * (1 - $MSP); } } //if ( $FSGTSO[$d][$h] > 0 ) // { // $NBSVSO[$d][$h] = RoundToZero($FSGVSO[$d][$h]* $NBGV+ 0.999); // $NBSHSO[$d][$h] = RoundToZero($FSGHSO[$d][$h]* $NBGH+ 0.999); // $NBSTSO[$d][$h] = $NBSVSO[$d][$h] * $NBSHSO[$d][$h]; // } //Effective values: //if ( $FSGTSO[$d][$h] > 0 ) // { // $FSETSO[$d][$h]=1-(1-$FSGTSO[$d][$h])*(1-(1-$MSO)*$NBSTSO[$d][$h]/($NBT+1))*(1-$MSP); // }else // { // $FSETSO[$d][$h]=0; // } // Consideration of the shadows projected by a tracker located at S. // geometric: // Azimuth at the beginning of the shadow $tanfiscss = -1 / $LNS; // Azimuth at the end of the shadow $tanfisfss = 1 / $LNS; //Azimuth of the horizontal shade unity $tanfiss1s = 0; //Initial set to zero $FSGHS[$d][$h] = 0; $FSGVS[$d][$h] = 0; if (abs($w[$d][$h]) < abs($ws[$d])) { if (tan($fis[$d][$h]) >= $tanfiscss) { if (tan($fis[$d][$h]) <= $tanfiss1s) { $FSGHS[$d][$h] = 1 - ($tanfiss1s - tan($fis[$d][$h])) / ($tanfiss1s - $tanfiscss); $FSGVS[$d][$h] = max(0, 1 - $LNS * cos($fis[$d][$h]) / $SP[$d][$h]); } } if (tan($fis[$d][$h]) >= $tanfiss1s) { if (tan($fis[$d][$h]) <= $tanfisfss) { $FSGHS[$d][$h] = 1 - (tan($fis[$d][$h]) - $tanfiss1s) / ($tanfisfss - $tanfiss1s); $FSGVS[$d][$h] = max(0, 1 - $LNS * cos($fis[$d][$h]) / $SP[$d][$h]); } } } $FSGTS[$d][$h] = $FSGVS[$d][$h] * $FSGHS[$d][$h]; //Martinez shading model $NBSVS[$d][$h] = 0; $NBSHS[$d][$h] = 0; $NBSTS[$d][$h] = 0; $FSEVS[$d][$h] = 0; $FSEHS[$d][$h] = 0; $FSETS[$d][$h] = 0; //Effective values: if ($FSGTS[$d][$h] > 0) { $NBSVS[$d][$h] = RoundToZero($FSGVS[$d][$h] * $NBGV + 0.999); $NBSHS[$d][$h] = RoundToZero($FSGHS[$d][$h] * $NBGH + 0.999); $NBSTS[$d][$h] = $NBSVS[$d][$h] * $NBSHS[$d][$h]; $FSEVS[$d][$h] = $NBSVS[$d][$h] / $NBGV; $FSEHS[$d][$h] = $NBSHS[$d][$h] / $NBGH; if ($MSC == 1) { $FSETS[$d][$h] = $FSEVS[$d][$h] * $FSEHS[$d][$h]; } else { $FSETS[$d][$h] = 1 - (1 - $FSGTS[$d][$h]) * (1 - (1 - $MSO) * $NBSTS[$d][$h] / ($NBT + 1)) * (1 - $MSP); } } //if ( $FSGTS[$d][$h] > 0 ) // { // $NBSVS[$d][$h] = RoundToZero($FSGVS[$d][$h]* $NBGV+ 0.999); // $NBSHS[$d][$h] = RoundToZero($FSGHS[$d][$h]* $NBGH+ 0.999); // $NBSTS[$d][$h] = $NBSVS[$d][$h] * $NBSHS[$d][$h]; // } //Effective values: //if ( $FSGTS[$d][$h] > 0 ) // { // $FSETS[$d][$h]=1-(1-$FSGTS[$d][$h])*(1-(1-$MSO)*$NBSTS[$d][$h]/($NBT+1))*(1-$MSP); // }else // { // $FSETS[$d][$h]=0; // } // Total Shadows (sum of above) // Geometric: $FSGTT[$d][$h] = $FSGTE[$d][$h] + $FSGTO[$d][$h] + $FSGTSE[$d][$h] + $FSGTSO[$d][$h] + $FSGTS[$d][$h]; //Effective $FSETT[$d][$h] = $FSETE[$d][$h] + $FSETO[$d][$h] + $FSETSE[$d][$h] + $FSETSO[$d][$h] + $FSETS[$d][$h]; //Correction of the azimuthal backtracking angle: //On one hand, this version is based on the conjecture (probably true for NBGV = NBGH) that //the best option to back-tracking corresponds precisely to the lower angle correction. //On the other hand, note the choice: when beta, eleccionbeta = 1; when alpha, eleccionbeta = -1. //When it refers to the tracker shadow located southeast and southwest eleccionbetaseo use = 1 //and eleccionbetaseo= -1 //Initial set to zero $correcionalfae[$d][$h] = 0; $correcionalfao[$d][$h] = 0; $correcionalfas[$d][$h] = 0; $correcionalfase[$d][$h] = 0; $correcionalfaso[$d][$h] = 0; $correcionalfafe[$d][$h] = 0; $correcionalfafo[$d][$h] = 0; $correcionalfafs = 0; $correcionalfafse[$d][$h] = 0; $correcionalfafso[$d][$h] = 0; $correcionbetae[$d][$h] = 0; $correcionbetao[$d][$h] = 0; $correcionbetas[$d][$h] = 0; $correcionbetase[$d][$h] = 0; $correcionbetaso[$d][$h] = 0; $correcionbetafe[$d][$h] = 0; $correcionbetafo[$d][$h] = 0; $correcionbetafs[$d][$h] = 0; $correcionbetafse[$d][$h] = 0; $correcionbetafso[$d][$h] = 0; $eleccionbeta[$d][$h] = 0; $eleccionbetaseo[$d][$h] = 0; // To avoid shadows projected by a tracker located at E if ($w[$d][$h] <= 0) { if ($FSGTE[$d][$h] > 0 && $gammas[$d][$h] > 0) { if ($fis[$d][$h] < -pi() / 2) { $correcionalfae[$d][$h] = acos(min(1, $LEO * cos(pi() - $fis[$d][$h]))); } else { $correcionalfae[$d][$h] = acos(min(1, $LEO * cos($fis[$d][$h]))); } $correcionbetae[$d][$h] = acos(min(1, $LEO / $ALARG * sin($gammas[$d][$h]))); if ($RSEV == 1) { if ($RSEH == 1) { if ($correcionalfae[$d][$h] > $correcionbetae[$d][$h]) { $correcionalfafe[$d][$h] = 0; $correcionbetafe[$d][$h] = $correcionbetae[$d][$h]; $eleccionbeta[$d][$h] = 1; } else { $correcionalfafe[$d][$h] = $correcionalfae[$d][$h]; $correcionbetafe[$d][$h] = 0; $eleccionbeta[$d][$h] = -1; } } if ($RSEH == 0) { $correcionalfafe[$d][$h] = $correcionalfae[$d][$h]; $correcionbetafe[$d][$h] = 0; $eleccionbeta[$d][$h] = -1; } } if ($RSEV == 0) { if ($RSEH == 1) { $correcionalfafe[$d][$h] = 0; $correcionbetafe[$d][$h] = $correcionbetae[$d][$h]; $eleccionbeta[$d][$h] = 1; } } $alfa[$d][$h] = $fis[$d][$h] + $correcionalfafe[$d][$h]; $beta[$d][$h] = $tetazs[$d][$h] - $correcionbetafe[$d][$h]; } } // To avoid shadows projected by a tracker located at W if ($w[$d][$h] >= 0) { if ($FSGTO[$d][$h] > 0 && $gammas[$d][$h] > 0) { if ($fis[$d][$h] > pi() / 2) { $correcionalfao[$d][$h] = acos(min(1, $LEO * cos(pi() - $fis[$d][$h]))); } else { $correcionalfao[$d][$h] = acos(min(1, $LEO * cos($fis[$d][$h]))); } $correcionbetao[$d][$h] = acos(min(1, $LEO / $ALARG * sin($gammas[$d][$h]))); if ($RSEV == 1) { if ($RSEH == 1) { if ($correcionalfao[$d][$h] > $correcionbetao[$d][$h]) { $correcionalfafo[$d][$h] = 0; $correcionbetafo[$d][$h] = $correcionbetao[$d][$h]; $eleccionbeta[$d][$h] = 1; } else { $correcionalfafo[$d][$h] = $correcionalfao[$d][$h]; $correcionbetafo[$d][$h] = 0; $eleccionbeta[$d][$h] = -1; } } if ($RSEH == 0) { $correcionalfafo[$d][$h] = $correcionalfao[$d][$h]; $correcionbetafo[$d][$h] = 0; $eleccionbeta[$d][$h] = -1; } } if ($RSEV == 0) { if ($RSEH == 1) { $correcionalfafo[$d][$h] = 0; $correcionbetafo[$d][$h] = $correcionbetao[$d][$h]; $eleccionbeta[$d][$h] = 1; } } $alfa[$d][$h] = $fis[$d][$h] - $correcionalfafo[$d][$h]; $beta[$d][$h] = $tetazs[$d][$h] - $correcionbetafo[$d][$h]; } } // To avoid shadows projected by a tracker located at SE // Are cancelled in azimuth because of implant there is a 180-degree turn, but maintain in inclination if ($RSEH == 1 && $gammas[$d][$h] > 0) { if (tan($fis[$d][$h]) >= $tanfiscsse) { if (tan($fis[$d][$h]) <= $tanfiss1se) { $correcionbetase[$d][$h] = acos(min(1, (-$LEO * sin($fis[$d][$h]) + $LNS * cos($fis[$d][$h])) / $ALARG * sin($gammas[$d][$h]))); $correcionbetafse[$d][$h] = $correcionbetase[$d][$h]; $beta[$d][$h] = $tetazs[$d][$h] - $correcionbetafse[$d][$h]; $eleccionbetaseo[$d][$h] = 1; } } if (tan($fis[$d][$h]) >= $tanfiss1se) { if (tan($fis[$d][$h]) <= $tanfisfsse) { $correcionbetase[$d][$h] = acos(min(1, (-$LEO * sin($fis[$d][$h]) + $LNS * cos($fis[$d][$h])) / $ALARG * sin($gammas[$d][$h]))); $correcionbetafse[$d][$h] = $correcionbetase[$d][$h]; $beta[$d][$h] = $tetazs[$d][$h] - $correcionbetafse[$d][$h]; $eleccionbetaseo[$d][$h] = 1; } } } // To avoid shadows projected by a tracker located at SW if ($RSEH == 1 && $gammas[$d][$h] > 0) { if (tan($fis[$d][$h]) >= $tanfiscsso) { if (tan($fis[$d][$h]) <= $tanfiss1so) { $correcionbetaso[$d][$h] = acos(min(1, ($LEO * sin($fis[$d][$h]) + $LNS * cos($fis[$d][$h])) / $ALARG * sin($gammas[$d][$h]))); $correcionbetafso[$d][$h] = $correcionbetaso[$d][$h]; $beta[$d][$h] = $tetazs[$d][$h] - $correcionbetafso[$d][$h]; $eleccionbetaseo[$d][$h] = 1; } } if (tan($fis[$d][$h]) >= $tanfiss1so) { if (tan($fis[$d][$h]) <= $tanfisfsso) { $correcionbetaso[$d][$h] = acos(min(1, (LEO * sin(fis(h, d)) + LNS * cos(fis(h, d))) / ALARG * sin(gammas(h, d)))); $correcionbetafso[$d][$h] = $correcionbetaso[$d][$h]; $beta[$d][$h] = $tetazs[$d][$h] - $correcionbetafso[$d][$h]; $eleccionbetaseo[$d][$h] = 1; } } } // Limits, again, the angle of inclination to constructive maximum value if ($beta[$d][$h] > $Inclination_MAX * pi() / 180) { $beta[$d][$h] = $Inclination_MAX * pi() / 180; } // Limits the azimuthal rotation angle of maximum constructive. if (abs($alfa[$d][$h]) > $Azimut_MAX * pi() / 180) { $alfa[$d][$h] = $Azimut_MAX * pi() / 180 * valueSign($alfa[$d][$h]); } // Incidence angle. For just before dawn, the value of zero for the cosine of the angle of incidence is set. // It is a way to eliminate radiation in that period. //Coordinates of unit radius vector of the sun in a system of coordinates Oxyz solidarity with the place and //the x axis X, Y, Z pointing respectively to the west, south and the zenith $xsol[$d][$h] = cos($gammas[$d][$h]) * sin($fis[$d][$h]); $ysol[$d][$h] = cos($gammas[$d][$h]) * cos($fis[$d][$h]); $zsol[$d][$h] = sin($gammas[$d][$h]); // Coordinates of the normal to the surface in the same previous coordinate system $xsup[$d][$h] = sin($beta[$d][$h]) * sin($alfa[$d][$h]); $ysup[$d][$h] = sin($beta[$d][$h]) * cos($alfa[$d][$h]); $zsup[$d][$h] = cos($beta[$d][$h]); //Incidence angle if (abs($w[$d][$h]) >= abs($ws[$d])) { $costetas[$d][$h] = 1; } else { $costetas[$d][$h] = $xsol[$d][$h] * $xsup[$d][$h] + $ysol[$d][$h] * $ysup[$d][$h] + $zsol[$d][$h] * $zsup[$d][$h]; } //Direct component //Resets direct predawn (redundant with the previous statement) and posterior incidence if (abs($w[$d][$h]) >= abs($ws[$d])) { $B[$d][$h] = 0; } else { $B[$d][$h] = $B0[$d][$h] * max(0, $costetas[$d][$h]) / $costetazs[$d][$h]; } //Isotropic, circumsolar and horizon of the diffuse irradiance if (abs($w[$d][$h]) >= abs($ws[$d])) { $Diso[$d][$h] = 0; $Dcir[$d][$h] = 0; $Dhor[$d][$h] = 0; $D[$d][$h] = 0; } else { $Diso[$d][$h] = $D0[$d][$h] * (1 - $k1[$d][$h]) * (1 + cos($beta[$d][$h])) / 2; $Dcir[$d][$h] = $D0[$d][$h] * $k1[$d][$h] * max(0, $costetas[$d][$h]) / $costetazs[$d][$h]; $Dhor[$d][$h] = $D0[$d][$h] * $k2[$d][$h] * sin($beta[$d][$h]); $D[$d][$h] = $Diso[$d][$h] + $Dcir[$d][$h] + $Dhor[$d][$h]; } //Albedo component if (abs($w[$d][$h]) >= abs($ws[$d])) { $R[$d][$h] = 0; } else { $R[$d][$h] = 0; //(*) } //Global irradiance $G[$d][$h] = $B[$d][$h] + $D[$d][$h] + $R[$d][$h]; //Consideration of the effects of the incidence angle //Direct irradiation correction factor $FCB[$d][$h] = (1 - exp(-$costetas[$d][$h] / $ar)) / (1 - exp(-1 / $ar)); //Diffuse irradiation correction factor $FCD[$d][$h] = 1 - exp(-1 / $ar * ((sin($beta[$d][$h]) + (pi() - $beta[$d][$h] - sin($beta[$d][$h])) / (1 + cos($beta[$d][$h]))) * 4 / 3 / pi() + $c2 * pow(sin($beta[$d][$h]) + (pi() - $beta[$d][$h] - sin($beta[$d][$h])) / (1 + cos($beta[$d][$h])), 2))); //Albedo irradiation correction factor if ($beta[$d][$h] == 0) { $FCR[$d][$h] = 0; } else { $FCR[$d][$h] = 1 - exp(-1 / $ar * ((sin($beta[$d][$h]) + ($beta[$d][$h] - sin($beta[$d][$h])) / (1 - cos($beta[$d][$h]))) * 4 / 3 / pi() + $c2 * pow(sin($beta[$d][$h]) + ($beta[$d][$h] - sin($beta[$d][$h])) / (1 - cos($beta[$d][$h])), 2))); } //Effective irradiation components $Bef[$d][$h] = $B[$d][$h] * $FCB[$d][$h] * $Transm; $Def[$d][$h] = (($Diso[$d][$h] + $Dhor[$d][$h]) * $FCD[$d][$h] + $Dcir[$d][$h] * $FCB[$d][$h]) * $Transm; $Ref[$d][$h] = $R[$d][$h] * $FCR[$d][$h] * $Transm; //Effective irradiation $Gef[$d][$h] = $Bef[$d][$h] + $Def[$d][$h] + $Ref[$d][$h]; // Effective irradiance after adjacent shadows (E + W) // Maximum limitation factor to unity shadows $FSET[$d][$h] = min(1, $FSETE[$d][$h] + $FSETO[$d][$h]); $Befsa[$d][$h] = (1 - $FSET[$d][$h] * (1 - $RSEV)) * $Bef[$d][$h]; //$Befsa[$d][$h]=(1-($FSETE[$d][$h]+$FSETO[$d][$h])*(1-$RSEV))*$Bef[$d][$h]; $Defsa[$d][$h] = (($Diso[$d][$h] + $Dhor[$d][$h]) * $FCD[$d][$h] + $Dcir[$d][$h] * $FCB[$d][$h] * (1 - $FSET[$d][$h] * (1 - $RSEV))) * $Transm; //$Defsa[$d][$h]=(($Diso[$d][$h]+$Dhor[$d][$h])*$FCD[$d][$h]+$Dcir[$d][$h]*$FCB[$d][$h]*(1-($FSETE[$d][$h]+$FSETO[$d][$h])*(1-$RSEV)))*$Transm; $Gefsa[$d][$h] = $Befsa[$d][$h] + $Defsa[$d][$h] + $Ref[$d][$h]; // Total effective irradiance after shadows (E + W + SE + SW) // Maximum limitation factor to unity shadows $FSETT[$d][$h] = min(1, $FSETE[$d][$h] + $FSETO[$d][$h] + $FSETSE[$d][$h] + $FSETSO[$d][$h]); $Befsayp[$d][$h] = (1 - $FSETT[$d][$h] * (1 - $RSEV)) * $Bef[$d][$h]; //$Befsayp[$d][$h]=(1-($FSETE[$d][$h]+$FSETO[$d][$h]+$FSETSE[$d][$h]+$FSETSO[$d][$h])*(1-$RSEV))*$Bef[$d][$h]; $Defsayp[$d][$h] = (($Diso[$d][$h] + $Dhor[$d][$h]) * $FCD[$d][$h] + $Dcir[$d][$h] * $FCB[$d][$h] * (1 - $FSETT[$d][$h] * (1 - $RSEV))) * $Transm; //$Defsayp[$d][$h]=(($Diso[$d][$h]+$Dhor[$d][$h])*$FCD[$d][$h]+$Dcir[$d][$h]*$FCB[$d][$h]*(1-($FSETE[$d][$h]+$FSETO[$d][$h]+$FSETSE[$d][$h]+$FSETSO[$d][$h])*(1-$RSEV)))*$Transm; $Gefsayp[$d][$h] = $Befsayp[$d][$h] + $Defsayp[$d][$h] + $Ref[$d][$h]; } //end FOR $h Nsteps } //end FOR $d Ndays $ISI = array('G' => $G, 'B' => $B, 'D' => $D, 'R' => $R, 'Gef' => $Gef, 'Bef' => $Bef, 'Def' => $Def, 'Ref' => $Ref, 'Gefsa' => $Gefsa, 'Befsa' => $Befsa, 'Defsa' => $Defsa, 'Gefsayp' => $Gefsayp, 'Befsayp' => $Befsayp, 'Defsayp' => $Defsayp); return $ISI; }
function StaticFacade($SUNPOS, $w, $ws, $HI, $ANISO, $SITE, $PVGEN, $OPTIONS, $TIME) { /////////////////////////////////////// // INITIAL CALCULATIONS /////////////////////////////////////// // INPUTS // $SUNPOS $costetazs = $SUNPOS['costetazs']; $cosfis = $SUNPOS['cosfis']; $gammas = $SUNPOS['gammas']; $tetazs = $SUNPOS['tetazs']; $fis = $SUNPOS['fis']; // $HI $G0 = $HI['G0']; $B0 = $HI['B0']; $D0 = $HI['D0']; // $ANISO $k1 = $ANISO['k1']; $k2 = $ANISO['k2']; // $PVGEN // Common $NBGH = $PVGEN['NBGH']; $NBGV = $PVGEN['NBGV']; $NBT = $PVGEN['NBT']; // Facade $Inclination_generator = $PVGEN['Facade']['Inclination_generator']; $Orientation_facade = $PVGEN['Facade']['Orientation_facade']; $Inclination_facade = $PVGEN['Facade']['Inclination_facade']; $LCN = $PVGEN['Facade']['LCN']; $AEO = $PVGEN['Facade']['AEO']; $DEO = $PVGEN['Facade']['DEO']; //Conversion to radian $beta_facade = $Inclination_facade * pi() / 180; // OTHER PARAMETERS // OptimumSlope if ($OPTIONS['OptimumSlope'] == 1) { $Inclination_generator = 3.7 + 0.6899999999999999 * $SITE['Latitude'] * valueSign($SITE['Latitude']); $Orientation_facade = 0; $Inclination_facade = 0; } // Degree of dust, model parameters $DDP = DustDegreeParameters($OPTIONS['DustDegree']); $ar = $DDP['ar']; $c2 = $DDP['c2']; $Transm = $DDP['Transm']; // Shading, model coefficients $SMP = ShadingModelParameters($OPTIONS['ShadingModel']); $MSP = $SMP['MSP']; $MSO = $SMP['MSO']; $MSC = $SMP['MSC']; // Ground reflectance $GroundReflectance = $OPTIONS['GroundReflectance']; /////////////////////////////////// // CALCULATIONS /////////////////////////////////// for ($d = 0; $d < $TIME['Ndays']; $d++) { for ($h = 0; $h < $TIME['Nsteps']; $h++) { // Conversion to radian $beta[$d][$h] = $Inclination_generator * pi() / 180; $alfa[$d][$h] = $Orientation_facade * pi() / 180; // Coordinates of unit radius vector of the sun in a system of coordinates Oxyz // solidarity with the place and the x axis X, Y, Z pointing respectively to the // west, south and the zenith $xsol[$d][$h] = cos($gammas[$d][$h]) * sin($fis[$d][$h]); $ysol[$d][$h] = cos($gammas[$d][$h]) * cos($fis[$d][$h]); $zsol[$d][$h] = sin($gammas[$d][$h]); // Coordinates of the normal to the surface in the same previous coordinate system $xsup[$d][$h] = sin($beta[$d][$h]) * sin($alfa[$d][$h]); $ysup[$d][$h] = sin($beta[$d][$h]) * cos($alfa[$d][$h]); $zsup[$d][$h] = cos($beta[$d][$h]); // Incidence angle if (abs($w[$d][$h]) >= abs($ws[$d])) { $costetas[$d][$h] = 1; } else { $costetas[$d][$h] = $xsol[$d][$h] * $xsup[$d][$h] + $ysol[$d][$h] * $ysup[$d][$h] + $zsol[$d][$h] * $zsup[$d][$h]; } // Direct component if (abs($w[$d][$h]) >= abs($ws[$d])) { $B[$d][$h] = 0; } else { $B[$d][$h] = $B0[$d][$h] * max(0, $costetas[$d][$h]) / $costetazs[$d][$h]; } // Isotropic, circumsolar and horizon diffuse irradiance components if (abs($w[$d][$h]) >= abs($ws[$d])) { $Diso[$d][$h] = 0; $Dcir[$d][$h] = 0; $Dhor[$d][$h] = 0; $D[$d][$h] = 0; } else { $Diso[$d][$h] = $D0[$d][$h] * (1 - $k1[$d][$h]) * (1 + cos($beta[$d][$h])) / 2; $Dcir[$d][$h] = $D0[$d][$h] * $k1[$d][$h] * max(0, $costetas[$d][$h]) / $costetazs[$d][$h]; $Dhor[$d][$h] = $D0[$d][$h] * $k2[$d][$h] * sin($beta[$d][$h]); $D[$d][$h] = $Diso[$d][$h] + $Dcir[$d][$h] + $Dhor[$d][$h]; } // Albedo component if (abs($w[$d][$h]) >= abs($ws[$d])) { $R[$d][$h] = 0; } else { $R[$d][$h] = $GroundReflectance * $G0[$d][$h] * (1 - cos($beta[$d][$h])) / 2; } // Global irradiance $G[$d][$h] = $B[$d][$h] + $D[$d][$h] + $R[$d][$h]; // Consideration of the effects of the incidence angle // Direct correction factor $FCB[$d][$h] = (1 - exp(-$costetas[$d][$h] / $ar)) / (1 - exp(-1 / $ar)); // Diffuse correction factor (Isotropic component) $FCD[$d][$h] = 1 - exp(-1 / $ar * ((sin($beta[$d][$h]) + (pi() - $beta[$d][$h] - sin($beta[$d][$h])) / (1 + cos($beta[$d][$h]))) * 4 / 3 / pi() + $c2 * pow(sin($beta[$d][$h]) + (pi() - $beta[$d][$h] - sin($beta[$d][$h])) / (1 + cos($beta[$d][$h])), 2))); // Albedo correction factor if ($beta[$d][$h] == 0) { $FCR[$d][$h] = 0; } else { $FCR[$d][$h] = 1 - exp(-1 / $ar * ((sin($beta[$d][$h]) + ($beta[$d][$h] - sin($beta[$d][$h])) / (1 - cos($beta[$d][$h]))) * 4 / 3 / pi() + $c2 * pow(sin($beta[$d][$h]) + ($beta[$d][$h] - sin($beta[$d][$h])) / (1 - cos($beta[$d][$h])), 2))); } // Effective irradiation components $Bef[$d][$h] = $B[$d][$h] * $FCB[$d][$h] * $Transm; $Def[$d][$h] = (($Diso[$d][$h] + $Dhor[$d][$h]) * $FCD[$d][$h] + $Dcir[$d][$h] * $FCB[$d][$h]) * $Transm; $Ref[$d][$h] = $R[$d][$h] * $FCR[$d][$h] * $Transm; // Global effective irradiance $Gef[$d][$h] = $Bef[$d][$h] + $Def[$d][$h] + $Ref[$d][$h]; // Calculation of the geometric shadow cast by a row // Located in the South, FSGTS. // Reset the factors $FSGHC[$d][$h] = 0; $FSGVC[$d][$h] = 0; $FSGTC[$d][$h] = 0; $FSGF[$d][$h] = 0; $FSEF[$d][$h] = 0; $LVS[$d][$h] = 0; $LHS[$d][$h] = 0; // Sun coordinates, in the coordinate system resulting from turning the primal alpha = angle (facade orientation) around the z axis $xprimasol[$d][$h] = $xsol[$d][$h] * cos($alfa[$d][$h]) - $ysol[$d][$h] * sin($alfa[$d][$h]); $yprimasol[$d][$h] = $xsol[$d][$h] * sin($alfa[$d][$h]) + $ysol[$d][$h] * cos($alfa[$d][$h]); $zprimasol[$d][$h] = $zsol[$d][$h]; // Rotated coordinate system resulting from previous coordinate one -beta_facade angle around the axis xprima $x2primasol[$d][$h] = $xprimasol[$d][$h]; $y2primasol[$d][$h] = $yprimasol[$d][$h] * cos(-$beta_facade) - $zprimasol[$d][$h] * sin(-$beta_facade); $z2primasol[$d][$h] = $yprimasol[$d][$h] * sin(-$beta_facade) + $zprimasol[$d][$h] * cos(-$beta_facade); // Shadows caused by the own facade (Geometric Shadow Factor caused by the facade, FSGF). The condition is that either day and the sun // is at the back of the facade. if ($zsol[$d][$h] > 0 && $y2primasol[$d][$h] <= 0.0035) { $FSGF[$d][$h] = 1; $FSEF[$d][$h] = 1; } // Shadows caused by the row located over the zenith // Geometric shadow factor horizontally. Calculate strictly when it is day and the sun is in front of the facade if ($zsol[$d][$h] > 0 && $y2primasol[$d][$h] >= 0.0035) { if ($x2primasol[$d][$h] < 0) { $FSGHC[$d][$h] = max(0, 1 - $DEO / $AEO - ($LCN - sin($beta[$d][$h])) / $AEO * $x2primasol[$d][$h] / $z2primasol[$d][$h]); } else { $FSGHC[$d][$h] = max(0, 1 + $DEO / $AEO + ($LCN - sin($beta[$d][$h])) / $AEO * $x2primasol[$d][$h] / $z2primasol[$d][$h]); } } // Separation reversion to vertical façade LCN_FV $LCN_FV = $LCN * (cos($beta_facade) - sin($beta_facade) * tan($beta[$d][$h])); // Vertical shadow reversion factor to vertical façade $FSGVC_FV[$d][$h] = max(0, 1 - $LCN_FV / (sin($beta[$d][$h]) + cos($beta[$d][$h]) * $zprimasol[$d][$h] / $yprimasol[$d][$h])); // Vertical shadow factor on the actual facade $FSGVC[$d][$h] = $FSGVC_FV[$d][$h] - $LCN * sin($beta_facade) / cos($beta[$d][$h]); // Total geometric shadow factor caused by the row located at the zenith $FSGTC[$d][$h] = $FSGHC[$d][$h] * $FSGVC[$d][$h]; // Martinez shading Model $NBSVC[$d][$h] = 0; $NBSHC[$d][$h] = 0; $NBSTC[$d][$h] = 0; $FSEVC[$d][$h] = 0; $FSEHC[$d][$h] = 0; $FSETC[$d][$h] = 0; // effective values if ($FSGTC[$d][$h] > 0) { $NBSVC[$d][$h] = RoundToZero($FSGVC[$d][$h] * $NBGV + 0.999); $NBSHC[$d][$h] = RoundToZero($FSGHC[$d][$h] * $NBGH + 0.999); $NBSTC[$d][$h] = $NBSVC[$d][$h] * $NBSHC[$d][$h]; $FSEVC[$d][$h] = $NBSVC[$d][$h] / $NBGV; $FSEHC[$d][$h] = $NBSHC[$d][$h] / $NBGH; if ($MSC == 1) { $FSETC[$d][$h] = $FSEVC[$d][$h] * $FSEHC[$d][$h]; } else { $FSETC[$d][$h] = 1 - (1 - $FSGTC[$d][$h]) * (1 - (1 - $MSO) * $NBSTC[$d][$h] / ($NBT + 1)) * (1 - $MSP); } } // Total shadow = caused by the facade + projected by the row // located at the zenith $FSETT[$d][$h] = $FSEF[$d][$h] + $FSETC[$d][$h]; // Irradiances // Peak limiting factor to unity shadows $FSETT[$d][$h] = min(1, $FSETT[$d][$h]); $Befsayp[$d][$h] = (1 - $FSETT[$d][$h]) * $Bef[$d][$h]; $Defsayp[$d][$h] = (($Diso[$d][$h] + $Dhor[$d][$h]) * $FCD[$d][$h] + $Dcir[$d][$h] * $FCB[$d][$h] * (1 - $FSETT[$d][$h])) * $Transm; $Gefsayp[$d][$h] = $Befsayp[$d][$h] + $Defsayp[$d][$h] + $Ref[$d][$h]; // Agreement to maintain variables in other parts of the program $Befsa[$d][$h] = $Befsayp[$d][$h]; $Defsa[$d][$h] = $Defsayp[$d][$h]; $Gefsa[$d][$h] = $Gefsayp[$d][$h]; } } return $ISI = array('G' => $G, 'B' => $B, 'D' => $D, 'R' => $R, 'Gef' => $Gef, 'Bef' => $Bef, 'Def' => $Def, 'Ref' => $Ref, 'Gefsa' => $Gefsa, 'Befsa' => $Befsa, 'Defsa' => $Defsa, 'Gefsayp' => $Gefsayp, 'Befsayp' => $Befsayp, 'Defsayp' => $Defsayp); }
function TrackerOneAxisAzimutal($SUNPOS, $w, $ws, $HI, $ANISO, $SITE, $PVGEN, $OPTIONS, $TIME) { /////////////////////////////////////// // INITIAL CALCULATIONS /////////////////////////////////////// // INPUTS // $SUNPOS $costetazs = $SUNPOS['costetazs']; $cosfis = $SUNPOS['cosfis']; $gammas = $SUNPOS['gammas']; $tetazs = $SUNPOS['tetazs']; $fis = $SUNPOS['fis']; // $HI $G0 = $HI['G0']; $B0 = $HI['B0']; $D0 = $HI['D0']; // $ANISO $k1 = $ANISO['k1']; $k2 = $ANISO['k2']; // $PVGEN // Common $NBGH = $PVGEN['NBGH']; $NBGV = $PVGEN['NBGV']; $NBT = $PVGEN['NBT']; // This tracker $Inclination_surface = $PVGEN['Track1V']['Inclination_surface']; $LEO = $PVGEN['Track1V']['LEO']; $LNS = $PVGEN['Track1V']['LNS']; $ALARG = $PVGEN['Track1V']['ALARG']; $RSEV = $PVGEN['Track1V']['RSEV']; // OTHER PARAMETERS // Degree of dust, model parameters $DDP = DustDegreeParameters($OPTIONS['DustDegree']); $ar = $DDP['ar']; $c2 = $DDP['c2']; $Transm = $DDP['Transm']; // Shading, model coefficients $SMP = ShadingModelParameters($OPTIONS['ShadingModel']); $MSP = $SMP['MSP']; $MSO = $SMP['MSO']; $MSC = $SMP['MSC']; // Ground reflectance $GroundReflectance = $OPTIONS['GroundReflectance']; /////////////////////////////////// // CALCULATIONS /////////////////////////////////// for ($d = 0; $d < $TIME['Ndays']; $d++) { for ($h = 0; $h < $TIME['Nsteps']; $h++) { // Angles to the Sun's surface following an azimuth axis begins the ideal value, // and then considers whether it should be corrected $beta[$d][$h] = $Inclination_surface * pi() / 180; $alfa[$d][$h] = $fis[$d][$h]; // Find the length of the shadow. if (abs($w[$d][$h]) >= abs($ws[$d])) { $S1[$d][$h] = 1.0E-7; $S2[$d][$h] = 0; } else { $S1[$d][$h] = $ALARG * cos($beta[$d][$h]); $S2[$d][$h] = $ALARG * sin($beta[$d][$h]) * tan($tetazs[$d][$h]); } $SP[$d][$h] = $S1[$d][$h] + $S2[$d][$h]; // Consideration of the shadows projected by a tracker located at E. // geometric: // Inicial reset to zero (the program need if no shade) $FSGVE[$d][$h] = 0; $FSGHE[$d][$h] = 0; // Factor calculation when have shadow if ($w[$d][$h] <= 0) { if ($fis[$d][$h] < -pi() / 2) { $FSGHE[$d][$h] = max(0, 1 - $LEO * cos(pi() - $fis[$d][$h])); } else { $FSGHE[$d][$h] = max(0, 1 - $LEO * cos($fis[$d][$h])); } if ($gammas[$d][$h] > 1.0E-6) { $FSGVE[$d][$h] = max(0, 1 + $LEO / $SP[$d][$h] * sin($fis[$d][$h])); } } $FSGTE[$d][$h] = $FSGVE[$d][$h] * $FSGHE[$d][$h]; // Martinez shading model $NBSVE[$d][$h] = 0; $NBSHE[$d][$h] = 0; $NBSTE[$d][$h] = 0; $FSEVE[$d][$h] = 0; $FSEHE[$d][$h] = 0; $FSETE[$d][$h] = 0; // Effective values: if ($FSGTE[$d][$h] > 0) { $NBSVE[$d][$h] = RoundToZero($FSGVE[$d][$h] * $NBGV + 0.999); $NBSHE[$d][$h] = RoundToZero($FSGHE[$d][$h] * $NBGH + 0.999); $NBSTE[$d][$h] = $NBSVE[$d][$h] * $NBSHE[$d][$h]; $FSEVE[$d][$h] = $NBSVE[$d][$h] / $NBGV; $FSEHE[$d][$h] = $NBSHE[$d][$h] / $NBGH; if ($MSC == 1) { $FSETE[$d][$h] = $FSEVE[$d][$h] * $FSEHE[$d][$h]; } else { $FSETE[$d][$h] = 1 - (1 - $FSGTE[$d][$h]) * (1 - (1 - $MSO) * $NBSTE[$d][$h] / ($NBT + 1)) * (1 - $MSP); } } //Consideration of the shadows projected by a tracker located at W. // Geometric: $FSGVO[$d][$h] = 0; $FSGHO[$d][$h] = 0; if ($w[$d][$h] >= 0) { if ($fis[$d][$h] > pi() / 2) { $FSGHO[$d][$h] = max(0, 1 - $LEO * cos(pi() - $fis[$d][$h])); } else { $FSGHO[$d][$h] = max(0, 1 - $LEO * cos($fis[$d][$h])); } if ($gammas[$d][$h] > 1.0E-7) { $FSGVO[$d][$h] = max(0, 1 - $LEO / $SP[$d][$h] * sin($fis[$d][$h])); } } $FSGTO[$d][$h] = $FSGVO[$d][$h] * $FSGHO[$d][$h]; // Martinez shading model $NBSVO[$d][$h] = 0; $NBSHO[$d][$h] = 0; $NBSTO[$d][$h] = 0; $FSEVO[$d][$h] = 0; $FSEHO[$d][$h] = 0; $FSETO[$d][$h] = 0; // Effective values: if ($FSGTO[$d][$h] > 0) { $NBSVO[$d][$h] = RoundToZero($FSGVO[$d][$h] * $NBGV + 0.999); $NBSHO[$d][$h] = RoundToZero($FSGHO[$d][$h] * $NBGH + 0.999); $NBSTO[$d][$h] = $NBSVO[$d][$h] * $NBSHO[$d][$h]; $FSEVO[$d][$h] = $NBSVO[$d][$h] / $NBGV; $FSEHO[$d][$h] = $NBSHO[$d][$h] / $NBGH; if ($MSC == 1) { $FSETO[$d][$h] = $FSEVO[$d][$h] * $FSEHO[$d][$h]; } else { $FSETO[$d][$h] = 1 - (1 - $FSGTO[$d][$h]) * (1 - (1 - $MSO) * $NBSTO[$d][$h] / ($NBT + 1)) * (1 - $MSP); } } //Consideration of the shadows projected by a tracker located at the SE. //Geometric: //Azimuth at the beginning of the shade $tanfiscsse = -($LEO + cos($fis[$d][$h])) / ($LNS + sin($fis[$d][$h])); // Azimuth at the final of the shade $tanfisfsse = -($LEO - cos($fis[$d][$h])) / ($LNS - sin($fis[$d][$h])); // Azimuth of horizontal shade unity $tanfiss1se = -$LEO / $LNS; // Initial reset to zero $FSGHSE[$d][$h] = 0; $FSGVSE[$d][$h] = 0; if (tan($fis[$d][$h]) >= $tanfiscsse) { if (tan($fis[$d][$h]) <= $tanfiss1se) { $FSGHSE[$d][$h] = 1 - ($tanfiss1se - tan($fis[$d][$h])) / ($tanfiss1se - $tanfiscsse); $FSGVSE[$d][$h] = max(0, 1 - ($LNS * cos($fis[$d][$h]) - $LEO * sin($fis[$d][$h])) / $SP[$d][$h]); } } if (tan($fis[$d][$h]) >= $tanfiss1se) { if (tan($fis[$d][$h]) <= $tanfisfsse) { $FSGHSE[$d][$h] = 1 - (tan($fis[$d][$h]) - $tanfiss1se) / ($tanfisfsse - $tanfiss1se); $FSGVSE[$d][$h] = max(0, 1 - ($LNS * cos($fis[$d][$h]) - $LEO * sin($fis[$d][$h])) / $SP[$d][$h]); } } $FSGTSE[$d][$h] = $FSGVSE[$d][$h] * $FSGHSE[$d][$h]; // Martinez shading model $NBSVSE[$d][$h] = 0; $NBSHSE[$d][$h] = 0; $NBSTSE[$d][$h] = 0; $FSEVSE[$d][$h] = 0; $FSEHSE[$d][$h] = 0; $FSETSE[$d][$h] = 0; // Effective values: if ($FSGTSE[$d][$h] > 0) { $NBSVSE[$d][$h] = RoundToZero($FSGVSE[$d][$h] * $NBGV + 0.999); $NBSHSE[$d][$h] = RoundToZero($FSGHSE[$d][$h] * $NBGH + 0.999); $NBSTSE[$d][$h] = $NBSVSE[$d][$h] * $NBSHSE[$d][$h]; $FSEVSE[$d][$h] = $NBSVSE[$d][$h] / $NBGV; $FSEHSE[$d][$h] = $NBSHSE[$d][$h] / $NBGH; if ($MSC == 1) { $FSETSE[$d][$h] = $FSEVSE[$d][$h] * $FSEHSE[$d][$h]; } else { $FSETSE[$d][$h] = 1 - (1 - $FSGTSE[$d][$h]) * (1 - (1 - $MSO) * $NBSTSE[$d][$h] / ($NBT + 1)) * (1 - $MSP); } } // Consideration of the shadows cast by a fan located at the SW. // geometric: // Azimuth at the beginning of the shade $tanfiscsso = ($LEO - cos($fis[$d][$h])) / ($LNS + sin($fis[$d][$h])); // Azimuth at the end of the shade $tanfisfsso = ($LEO + cos($fis[$d][$h])) / ($LNS - sin($fis[$d][$h])); // Azimuth of the horizontal shade unity $tanfiss1so = $LEO / $LNS; //Initial reset to zero $FSGHSO[$d][$h] = 0; $FSGVSO[$d][$h] = 0; if (tan($fis[$d][$h]) >= $tanfiscsso) { if (tan($fis[$d][$h]) <= $tanfiss1so) { $FSGHSO[$d][$h] = 1 - ($tanfiss1so - tan($fis[$d][$h])) / ($tanfiss1so - $tanfiscsso); $FSGVSO[$d][$h] = max(0, 1 - ($LNS * cos($fis[$d][$h]) + $LEO * sin($fis[$d][$h])) / $SP[$d][$h]); } } if (tan($fis[$d][$h]) >= $tanfiss1so) { if (tan($fis[$d][$h]) <= $tanfisfsso) { $FSGHSO[$d][$h] = 1 - (tan($fis[$d][$h]) - $tanfiss1so) / ($tanfisfsso - $tanfiss1so); $FSGVSO[$d][$h] = max(0, 1 - ($LNS * cos($fis[$d][$h]) + $LEO * sin($fis[$d][$h])) / $SP[$d][$h]); } } $FSGTSO[$d][$h] = $FSGVSO[$d][$h] * $FSGHSO[$d][$h]; // Martinez shading model $NBSVSO[$d][$h] = 0; $NBSHSO[$d][$h] = 0; $NBSTSO[$d][$h] = 0; $FSEVSO[$d][$h] = 0; $FSEHSO[$d][$h] = 0; $FSETSO[$d][$h] = 0; // Effective values: if ($FSGTSO[$d][$h] > 0) { $NBSVSO[$d][$h] = RoundToZero($FSGVSO[$d][$h] * $NBGV + 0.999); $NBSHSO[$d][$h] = RoundToZero($FSGHSO[$d][$h] * $NBGH + 0.999); $NBSTSO[$d][$h] = $NBSVSO[$d][$h] * $NBSHSO[$d][$h]; $FSEVSO[$d][$h] = $NBSVSO[$d][$h] / $NBGV; $FSEHSO[$d][$h] = $NBSHSO[$d][$h] / $NBGH; if ($MSC == 1) { $FSETSO[$d][$h] = $FSEVSO[$d][$h] * $FSEHSO[$d][$h]; } else { $FSETSO[$d][$h] = 1 - (1 - $FSGTSO[$d][$h]) * (1 - (1 - $MSO) * $NBSTSO[$d][$h] / ($NBT + 1)) * (1 - $MSP); } } // Consideration of the shadows cast by a fan located at the S. // geometric: // Azimuth at the beginning of the shade $tanfiscss = -1 / $LNS; // Azimuth at the final of the shade $tanfisfss = 1 / $LNS; // Azimuth of the horizontal shade unity $tanfiss1s = 0; // Initial reset to zero $FSGHS[$d][$h] = 0; $FSGVS[$d][$h] = 0; if (abs($w[$d][$h]) < abs($ws[$d])) { if (tan($fis[$d][$h]) >= $tanfiscss) { if (tan($fis[$d][$h]) <= $tanfiss1s) { $FSGHS[$d][$h] = 1 - ($tanfiss1s - tan($fis[$d][$h])) / ($tanfiss1s - $tanfiscss); $FSGVS[$d][$h] = max(0, 1 - $LNS * cos($fis[$d][$h]) / $SP[$d][$h]); } } if (tan($fis[$d][$h]) >= $tanfiss1s) { if (tan($fis[$d][$h]) <= $tanfisfss) { $FSGHS[$d][$h] = 1 - (tan($fis[$d][$h]) - $tanfiss1s) / ($tanfisfss - $tanfiss1s); $FSGVS[$d][$h] = max(0, 1 - $LNS * cos($fis[$d][$h]) / $SP[$d][$h]); } } } $FSGTS[$d][$h] = $FSGVS[$d][$h] * $FSGHS[$d][$h]; // Martinez shading model $NBSVS[$d][$h] = 0; $NBSHS[$d][$h] = 0; $NBSTS[$d][$h] = 0; $FSEVS[$d][$h] = 0; $FSEHS[$d][$h] = 0; $FSETS[$d][$h] = 0; // Effective values: if ($FSGTS[$d][$h] > 0) { $NBSVS[$d][$h] = RoundToZero($FSGVS[$d][$h] * $NBGV + 0.999); $NBSHS[$d][$h] = RoundToZero($FSGHS[$d][$h] * $NBGH + 0.999); $NBSTS[$d][$h] = $NBSVS[$d][$h] * $NBSHS[$d][$h]; $FSEVS[$d][$h] = $NBSVS[$d][$h] / $NBGV; $FSEHS[$d][$h] = $NBSHS[$d][$h] / $NBGH; if (MSC == 1) { $FSETS[$d][$h] = $FSEVS[$d][$h] * $FSEHS[$d][$h]; } else { $FSETS[$d][$h] = 1 - (1 - $FSGTS[$d][$h]) * (1 - (1 - $MSO) * $NBSTS[$d][$h] / ($NBT + 1)) * (1 - $MSP); } } // Total shadows (sum of the above) // Geometric: $FSGTT[$d][$h] = $FSGTE[$d][$h] + $FSGTO[$d][$h] + $FSGTSE[$d][$h] + $FSGTSO[$d][$h] + $FSGTS[$d][$h]; // Effective $FSETT[$d][$h] = $FSETE[$d][$h] + $FSETO[$d][$h] + $FSETSE[$d][$h] + $FSETSO[$d][$h] + $FSETS[$d][$h]; // Limits the effective factor shade 1 (only relevant with the pessimistic model shadows) if ($FSETT[$d][$h] > 1) { $FSETT[$d][$h] = 1; } $alfa[$d][$h] = $fis[$d][$h]; // Correction of the backtracking azimuthal angle: // To avoid the projected shadows by a tracker located at E if ($w[$d][$h] <= 0 && $FSGTE[$d][$h] > 0) { if ($fis[$d][$h] < -pi() / 2) { $alfa[$d][$h] = $fis[$d][$h] + $RSEV * acos(min(1, $LEO * cos(pi() - $fis[$d][$h]))); } else { $alfa[$d][$h] = $fis[$d][$h] + $RSEV * acos(min(1, $LEO * cos($fis[$d][$h]))); } } // To avoid the projected shadows by a tracker located at W if ($w[$d][$h] >= 0 && $FSGTO[$d][$h] > 0) { if ($fis[$d][$h] > pi() / 2) { $alfa[$d][$h] = $fis[$d][$h] - $RSEV * acos(min(1, $LEO * cos(pi() - $fis[$d][$h]))); } else { $alfa[$d][$h] = $fis[$d][$h] - $RSEV * acos(min(1, $LEO * cos($fis[$d][$h]))); } } // Incidence angle. Just before dawn, set the value to zero for the cosine of the angle of incidence. // It is a way to eliminate radiaciónen in that period. // Coordinates of unit radius vector of the sun in a system of coordinates Oxyz solidarity with the place and // the x axis X, Y, Z pointing respectively to the west, south and the zenith $xsol[$d][$h] = cos($gammas[$d][$h]) * sin($fis[$d][$h]); $ysol[$d][$h] = cos($gammas[$d][$h]) * cos($fis[$d][$h]); $zsol[$d][$h] = sin($gammas[$d][$h]); // Coordinates of the normal to the surface in the same previous coordinate system $xsup[$d][$h] = sin($beta[$d][$h]) * sin($alfa[$d][$h]); $ysup[$d][$h] = sin($beta[$d][$h]) * cos($alfa[$d][$h]); $zsup[$d][$h] = cos($beta[$d][$h]); // Incidence angle if (abs($w[$d][$h]) >= abs($ws[$d])) { $costetas[$d][$h] = 1; } else { $costetas[$d][$h] = $xsol[$d][$h] * $xsup[$d][$h] + $ysol[$d][$h] * $ysup[$d][$h] + $zsol[$d][$h] * $zsup[$d][$h]; } // Direct component // Resets direct predawn (redundant with the previous statement) and rear incidence if (abs($w[$d][$h]) >= abs($ws[$d])) { $B[$d][$h] = 0; } else { $B[$d][$h] = $B0[$d][$h] * max(0, $costetas[$d][$h]) / $costetazs[$d][$h]; } // Isotropic, cincumsolar and horizon diffuse irradiance components if (abs($w[$d][$h]) >= abs($ws[$d])) { $Diso[$d][$h] = 0; $Dcir[$d][$h] = 0; $Dhor[$d][$h] = 0; $D[$d][$h] = 0; } else { $Diso[$d][$h] = $D0[$d][$h] * (1 - $k1[$d][$h]) * (1 + cos($beta[$d][$h])) / 2; $Dcir[$d][$h] = $D0[$d][$h] * $k1[$d][$h] * max(0, $costetas[$d][$h]) / $costetazs[$d][$h]; $Dhor[$d][$h] = $D0[$d][$h] * $k2[$d][$h] * sin($beta[$d][$h]); $D[$d][$h] = $Diso[$d][$h] + $Dcir[$d][$h] + $Dhor[$d][$h]; } // Albedo components if (abs($w[$d][$h]) >= abs($ws[$d])) { $R[$d][$h] = 0; } else { $R[$d][$h] = $GroundReflectance * $G0[$d][$h] * (1 - cos($beta[$d][$h])) / 2; } // Global irradiance $G[$d][$h] = $B[$d][$h] + $D[$d][$h] + $R[$d][$h]; //Consideration of the effects of the incidence angle // Direct correction factor $FCB[$d][$h] = (1 - exp(-$costetas[$d][$h] / $ar)) / (1 - exp(-1 / $ar)); // Diffuse correction factor $FCD[$d][$h] = 1 - exp(-1 / $ar * ((sin($beta[$d][$h]) + (pi() - $beta[$d][$h] - sin($beta[$d][$h])) / (1 + cos($beta[$d][$h]))) * 4 / 3 / pi() + $c2 * pow(sin($beta[$d][$h]) + (pi() - $beta[$d][$h] - sin($beta[$d][$h])) / (1 + cos($beta[$d][$h])), 2))); // Albedo correction factor if ($beta[$d][$h] == 0) { $FCR[$d][$h] = 0; } else { $FCR[$d][$h] = 1 - exp(-1 / $ar * ((sin($beta[$d][$h]) + ($beta[$d][$h] - sin($beta[$d][$h])) / (1 - cos($beta[$d][$h]))) * 4 / 3 / pi() + $c2 * pow(sin($beta[$d][$h]) + ($beta[$d][$h] - sin($beta[$d][$h])) / (1 - cos($beta[$d][$h])), 2))); } // Effective irradiance components $Bef[$d][$h] = $B[$d][$h] * $FCB[$d][$h] * $Transm; $Def[$d][$h] = (($Diso[$d][$h] + $Dhor[$d][$h]) * $FCD[$d][$h] + $Dcir[$d][$h] * $FCB[$d][$h]) * $Transm; $Ref[$d][$h] = $R[$d][$h] * $FCR[$d][$h] * $Transm; // Effective irradiance $Gef[$d][$h] = $Bef[$d][$h] + $Def[$d][$h] + $Ref[$d][$h]; // Effective irradiance after adjacent shadows (E + W) // Peak limiting factor to unity shadows $FSET[$d][$h] = min(1, $FSETE[$d][$h] + $FSETO[$d][$h]); $Befsa[$d][$h] = (1 - $FSET[$d][$h] * (1 - $RSEV)) * $Bef[$d][$h]; $Defsa[$d][$h] = (($Diso[$d][$h] + $Dhor[$d][$h]) * $FCD[$d][$h] + $Dcir[$d][$h] * $FCB[$d][$h] * (1 - $FSET[$d][$h] * (1 - $RSEV))) * $Transm; //$Befsa[$d][$h] = (1-($FSETE[$d][$h] + $FSETO[$d][$h]) * (1-$RSEV)) * $Bef[$d][$h]; //$Defsa[$d][$h] = (($Diso[$d][$h] + $Dhor[$d][$h]) * $FCD[$d][$h] + $Dcir[$d][$h] * $FCB[$d][$h] * (1- ($FSETE[$d][$h] + $FSETO[$d][$h]) * (1-$RSEV)) ) * $Transm; $Gefsa[$d][$h] = $Befsa[$d][$h] + $Defsa[$d][$h] + $Ref[$d][$h]; // Effective irradiances after total shadows (E+W+SE+SW) // Peak limiting factor to unity shadows $FSETT[$d][$h] = min(1, $FSETE[$d][$h] + $FSETO[$d][$h] + $FSETSE[$d][$h] + $FSETSO[$d][$h]); $Befsayp[$d][$h] = (1 - $FSETT[$d][$h] * (1 - $RSEV)) * $Bef[$d][$h]; // $Befsayp[$d][$h] = (1-($FSETE[$d][$h]+$FSETO[$d][$h]+$FSETSE[$d][$h]+$FSETSO[$d][$h])*(1-$RSEV))*$Bef[$d][$h]; $Defsayp[$d][$h] = (($Diso[$d][$h] + $Dhor[$d][$h]) * $FCD[$d][$h] + $Dcir[$d][$h] * $FCB[$d][$h] * (1 - $FSETT[$d][$h] * (1 - $RSEV))) * $Transm; // $Defsayp[$d][$h] = ( ($Diso[$d][$h]+$Dhor[$d][$h]) * $FCD[$d][$h] + $Dcir[$d][$h] * $FCB[$d][$h] * ( 1-($FSETE[$d][$h]+$FSETO[$d][$h]+$FSETSE[$d][$h]+$FSETSO[$d][$h]) * (1-$RSEV)) ) * $Transm; $Gefsayp[$d][$h] = $Befsayp[$d][$h] + $Defsayp[$d][$h] + $Ref[$d][$h]; } } /////////////////////////////////////////////////////////////////////////////// // OUTPUT /////////////////////////////////////////////////////////////////////////////// return $ISI = array('G' => $G, 'B' => $B, 'D' => $D, 'R' => $R, 'Gef' => $Gef, 'Bef' => $Bef, 'Def' => $Def, 'Ref' => $Ref, 'Gefsa' => $Gefsa, 'Befsa' => $Befsa, 'Defsa' => $Defsa, 'Gefsayp' => $Gefsayp, 'Befsayp' => $Befsayp, 'Defsayp' => $Defsayp); }
function TrackerTwoAxisVenetianBlind($SUNPOS, $w, $ws, $HI, $ANISO, $SITE, $PVGEN, $OPTIONS, $TIME) { //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //INITIAL CALCULATIONS //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //INPUTS //SUNPOS $costetazs = $SUNPOS['costetazs']; $cosfis = $SUNPOS['cosfis']; $gammas = $SUNPOS['gammas']; $tetazs = $SUNPOS['tetazs']; $fis = $SUNPOS['fis']; //HI $G0 = $HI['G0']; $B0 = $HI['B0']; $D0 = $HI['D0']; //ANISO $k1 = $ANISO['k1']; $k2 = $ANISO['k2']; //PVGEN //Common $NBGH = $PVGEN['NBGH']; $NBGV = $PVGEN['NBGV']; $NBT = $PVGEN['NBT']; //This tracker $Inclination_rack = $PVGEN['Track2VE']['Inclination_rack']; $LEO = $PVGEN['Track2VE']['LEO']; $LNS = $PVGEN['Track2VE']['LNS']; $ALARG = $PVGEN['Track2VE']['ALARG']; $RSEV = $PVGEN['Track2VE']['RSEV']; $RSEH = $PVGEN['Track2VE']['RSEH']; $LNS_rack = $PVGEN['Track2VE']['LNS_rack']; $ALARGF = $PVGEN['Track2VE']['ALARGF']; $NF = $PVGEN['Track2VE']['NF']; $NBFV = $PVGEN['Track2VE']['NBFV']; //OTHER PARAMETERS //Degree of dust, model parameters $DDP = DustDegreeParameters($OPTIONS['DustDegree']); $ar = $DDP['ar']; $c2 = $DDP['c2']; $Transm = $DDP['Transm']; //Shading, model coefficients $SMP = ShadingModelParameters($OPTIONS['ShadingModel']); $MSP = $SMP['MSP']; $MSO = $SMP['MSO']; $MSC = $SMP['MSC']; //Ground reflectance $GroundReflectance = $OPTIONS['GroundReflectance']; //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //CALCULATIONS //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for ($d = 0; $d < $TIME['Ndays']; $d++) { for ($h = 0; $h < $TIME['Nsteps']; $h++) { // Angles surface following the sun in azimuthal one axis // Start the ideal value, and then considers whether it should be corrected $beta_parrilla[$d][$h] = $Inclination_rack * pi() / 180; $alfa[$d][$h] = $fis[$d][$h]; //Calculate the length of the shadow. if (abs($w[$d][$h]) >= abs($ws[$d])) { $S1[$d][$h] = 1.0E-7; $S2[$d][$h] = 0; } else { $S1[$d][$h] = $ALARG * cos($beta_parrilla[$d][$h]); $S2[$d][$h] = $ALARG * sin($beta_parrilla[$d][$h]) * tan($tetazs[$d][$h]); } $SP[$d][$h] = $S1[$d][$h] + $S2[$d][$h]; // Consideration of the shadows projected by a tracker located at E. // geometric: // Initial set to zero (needed for the program if no shade) $FSGVE[$d][$h] = 0; $FSGHE[$d][$h] = 0; //Factor calculation when shadow if ($w[$d][$h] <= 0) { if ($fis[$d][$h] < -pi() / 2) { $FSGHE[$d][$h] = max(0, 1 - $LEO * cos(pi() - $fis[$d][$h])); } else { $FSGHE[$d][$h] = max(0, 1 - $LEO * cos($fis[$d][$h])); } if ($gammas[$d][$h] > 1.0E-6) { $FSGVE[$d][$h] = max(0, 1 + $LEO / $SP[$d][$h] * sin($fis[$d][$h])); } } $FSGTE[$d][$h] = $FSGVE[$d][$h] * $FSGHE[$d][$h]; //Martinez shading model $NBSVE[$d][$h] = 0; $NBSHE[$d][$h] = 0; $NBSTE[$d][$h] = 0; $FSEVE[$d][$h] = 0; $FSEHE[$d][$h] = 0; $FSETE[$d][$h] = 0; //Effective values: if ($FSGTE[$d][$h] > 0) { $NBSVE[$d][$h] = RoundToZero($FSGVE[$d][$h] * $NBGV + 0.999); $NBSHE[$d][$h] = RoundToZero($FSGHE[$d][$h] * $NBGH + 0.999); $NBSTE[$d][$h] = $NBSVE[$d][$h] * $NBSHE[$d][$h]; $FSEVE[$d][$h] = $NBSVE[$d][$h] / $NBGV; $FSEHE[$d][$h] = $NBSHE[$d][$h] / $NBGH; if ($MSC == 1) { $FSETE[$d][$h] = $FSEVE[$d][$h] * $FSEHE[$d][$h]; } else { $FSETE[$d][$h] = 1 - (1 - $FSGTE[$d][$h]) * (1 - (1 - $MSO) * $NBSTE[$d][$h] / ($NBT + 1)) * (1 - $MSP); } } // Consideration of the shadows projected by a tracker located at W. // geometric: $FSGVO[$d][$h] = 0; $FSGHO[$d][$h] = 0; if ($w[$d][$h] >= 0) { if ($fis[$d][$h] > pi() / 2) { $FSGHO[$d][$h] = max(0, 1 - $LEO * cos(pi() - $fis[$d][$h])); } else { $FSGHO[$d][$h] = max(0, 1 - $LEO * cos($fis[$d][$h])); } if ($gammas[$d][$h] > 1.0E-7) { $FSGVO[$d][$h] = max(0, 1 - $LEO / $SP[$d][$h] * sin($fis[$d][$h])); } } $FSGTO[$d][$h] = $FSGVO[$d][$h] * $FSGHO[$d][$h]; //Martinez shading model $NBSVO[$d][$h] = 0; $NBSHO[$d][$h] = 0; $NBSTO[$d][$h] = 0; $FSEVO[$d][$h] = 0; $FSEHO[$d][$h] = 0; $FSETO[$d][$h] = 0; //Effective values: if ($FSGTO[$d][$h] > 0) { $NBSVO[$d][$h] = RoundToZero($FSGVO[$d][$h] * $NBGV + 0.999); $NBSHO[$d][$h] = RoundToZero($FSGHO[$d][$h] * $NBGH + 0.999); $NBSTO[$d][$h] = $NBSVO[$d][$h] * $NBSHO[$d][$h]; $FSEVO[$d][$h] = $NBSVO[$d][$h] / $NBGV; $FSEHO[$d][$h] = $NBSHO[$d][$h] / $NBGH; if ($MSC == 1) { $FSETO[$d][$h] = $FSEVO[$d][$h] * $FSEHO[$d][$h]; } else { $FSETO[$d][$h] = 1 - (1 - $FSGTO[$d][$h]) * (1 - (1 - $MSO) * $NBSTO[$d][$h] / ($NBT + 1)) * (1 - $MSP); } } // Consideration of the shadows projected by a tracker located at SE. // geometric: //Azimuth at the beginning of the shade $tanfiscsse = -($LEO + cos($fis[$d][$h])) / ($LNS + sin($fis[$d][$h])); //Azimuth at the end of the shade $tanfisfsse = -($LEO - cos($fis[$d][$h])) / ($LNS - sin($fis[$d][$h])); //Azimuth horizontal shadow unity $tanfiss1se = -$LEO / $LNS; //Initial set to zero $FSGHSE[$d][$h] = 0; $FSGVSE[$d][$h] = 0; if (tan($fis[$d][$h]) >= $tanfiscsse) { if (tan($fis[$d][$h]) <= $tanfiss1se) { $FSGHSE[$d][$h] = 1 - ($tanfiss1se - tan($fis[$d][$h])) / ($tanfiss1se - $tanfiscsse); $FSGVSE[$d][$h] = max(0, 1 - ($LNS * cos($fis[$d][$h]) - $LEO * sin($fis[$d][$h])) / $SP[$d][$h]); } } if (tan($fis[$d][$h]) >= $tanfiss1se) { if (tan($fis[$d][$h]) <= $tanfisfsse) { $FSGHSE[$d][$h] = 1 - (tan($fis[$d][$h]) - $tanfiss1se) / ($tanfisfsse - $tanfiss1se); $FSGVSE[$d][$h] = max(0, 1 - ($LNS * cos($fis[$d][$h]) - $LEO * sin($fis[$d][$h])) / $SP[$d][$h]); } } $FSGTSE[$d][$h] = $FSGVSE[$d][$h] * $FSGHSE[$d][$h]; //Martinez shading model $NBSVSE[$d][$h] = 0; $NBSHSE[$d][$h] = 0; $NBSTSE[$d][$h] = 0; $FSEVSE[$d][$h] = 0; $FSEHSE[$d][$h] = 0; $FSETSE[$d][$h] = 0; //Effective values: if ($FSGTSE[$d][$h] > 0) { $NBSVSE[$d][$h] = RoundToZero($FSGVSE[$d][$h] * $NBGV + 0.999); $NBSHSE[$d][$h] = RoundToZero($FSGHSE[$d][$h] * $NBGH + 0.999); $NBSTSE[$d][$h] = $NBSVSE[$d][$h] * $NBSHSE[$d][$h]; $FSEVSE[$d][$h] = $NBSVSE[$d][$h] / $NBGV; $FSEHSE[$d][$h] = $NBSHSE[$d][$h] / $NBGH; if ($MSC == 1) { $FSETSE[$d][$h] = $FSEVSE[$d][$h] * $FSEHSE[$d][$h]; } else { $FSETSE[$d][$h] = 1 - (1 - $FSGTSE[$d][$h]) * (1 - (1 - $MSO) * $NBSTSE[$d][$h] / ($NBT + 1)) * (1 - $MSP); } } // Consideration of the shadows projected by a tracker located at SW. // geometric: //Azimuth at the beginning of the shade $tanfiscsso = ($LEO - cos($fis[$d][$h])) / ($LNS + sin($fis[$d][$h])); //Azimuth at the end of the shade $tanfisfsso = ($LEO + cos($fis[$d][$h])) / ($LNS - sin($fis[$d][$h])); //Azimuth horizontal shadow unity $tanfiss1so = $LEO / $LNS; //Initial set to zero $FSGHSO[$d][$h] = 0; $FSGVSO[$d][$h] = 0; if (tan($fis[$d][$h]) >= $tanfiscsso) { if (tan($fis[$d][$h]) <= $tanfiss1so) { $FSGHSO[$d][$h] = 1 - ($tanfiss1so - tan($fis[$d][$h])) / ($tanfiss1so - $tanfiscsso); $FSGVSO[$d][$h] = max(0, 1 - ($LNS * cos($fis[$d][$h]) + $LEO * sin($fis[$d][$h])) / $SP[$d][$h]); } } if (tan($fis[$d][$h]) >= $tanfiss1so) { if (tan($fis[$d][$h]) <= $tanfisfsso) { $FSGHSO[$d][$h] = 1 - (tan($fis[$d][$h]) - $tanfiss1so) / ($tanfisfsso - $tanfiss1so); $FSGVSO[$d][$h] = max(0, 1 - ($LNS * cos($fis[$d][$h]) + $LEO * sin($fis[$d][$h])) / $SP[$d][$h]); } } $FSGTSO[$d][$h] = $FSGVSO[$d][$h] * $FSGHSO[$d][$h]; //Martinez shading model $NBSVSO[$d][$h] = 0; $NBSHSO[$d][$h] = 0; $NBSTSO[$d][$h] = 0; $FSEVSO[$d][$h] = 0; $FSEHSO[$d][$h] = 0; $FSETSO[$d][$h] = 0; //Effective values: if ($FSGTSO[$d][$h] > 0) { $NBSVSO[$d][$h] = RoundToZero($FSGVSO[$d][$h] * $NBGV + 0.999); $NBSHSO[$d][$h] = RoundToZero($FSGHSO[$d][$h] * $NBGH + 0.999); $NBSTSO[$d][$h] = $NBSVSO[$d][$h] * $NBSHSO[$d][$h]; $FSEVSO[$d][$h] = $NBSVSO[$d][$h] / $NBGV; $FSEHSO[$d][$h] = $NBSHSO[$d][$h] / $NBGH; if ($MSC == 1) { $FSETSO[$d][$h] = $FSEVSO[$d][$h] * $FSEHSO[$d][$h]; } else { $FSETSO[$d][$h] = 1 - (1 - $FSGTSO[$d][$h]) * (1 - (1 - $MSO) * $NBSTSO[$d][$h] / ($NBT + 1)) * (1 - $MSP); } } // Consideration of the shadows projected by a tracker located at S. // geometric: //Azimuth at the beginning of the shade $tanfiscss = -1 / $LNS; //Azimuth at the end of the shade $tanfisfss = 1 / $LNS; //Azimuth horizontal shadow unity $tanfiss1s = 0; //Initial set to zero $FSGHS[$d][$h] = 0; $FSGVS[$d][$h] = 0; if (abs($w[$d][$h]) < abs($ws[$d])) { if (tan($fis[$d][$h]) >= $tanfiscss) { if (tan($fis[$d][$h]) <= $tanfiss1s) { $FSGHS[$d][$h] = 1 - ($tanfiss1s - tan($fis[$d][$h])) / ($tanfiss1s - $tanfiscss); $FSGVS[$d][$h] = max(0, 1 - $LNS * cos($fis[$d][$h]) / $SP[$d][$h]); } } if (tan($fis[$d][$h]) >= $tanfiss1s) { if (tan($fis[$d][$h]) <= $tanfisfss) { $FSGHS[$d][$h] = 1 - (tan($fis[$d][$h]) - $tanfiss1s) / ($tanfisfss - $tanfiss1s); $FSGVS[$d][$h] = max(0, 1 - $LNS * cos($fis[$d][$h]) / $SP[$d][$h]); } } } $FSGTS[$d][$h] = $FSGVS[$d][$h] * $FSGHS[$d][$h]; //Martinez shading model $NBSVS[$d][$h] = 0; $NBSHS[$d][$h] = 0; $NBSTS[$d][$h] = 0; $FSEVS[$d][$h] = 0; $FSEHS[$d][$h] = 0; $FSETS[$d][$h] = 0; //Effective values: if ($FSGTS[$d][$h] > 0) { $NBSVS[$d][$h] = RoundToZero($FSGVS[$d][$h] * $NBGV + 0.999); $NBSHS[$d][$h] = RoundToZero($FSGHS[$d][$h] * $NBGH + 0.999); $NBSTS[$d][$h] = $NBSVS[$d][$h] * $NBSHS[$d][$h]; $FSEVS[$d][$h] = $NBSVS[$d][$h] / $NBGV; $FSEHS[$d][$h] = $NBSHS[$d][$h] / $NBGH; if ($MSC == 1) { $FSETS[$d][$h] = $FSEVS[$d][$h] * $FSEHS[$d][$h]; } else { $FSETS[$d][$h] = 1 - (1 - $FSGTS[$d][$h]) * (1 - (1 - $MSO) * $NBSTS[$d][$h] / ($NBT + 1)) * (1 - $MSP); } } // Total Shadows (sum of above) // Geometric: $FSGTT[$d][$h] = $FSGTE[$d][$h] + $FSGTO[$d][$h] + $FSGTSE[$d][$h] + $FSGTSO[$d][$h] + $FSGTS[$d][$h]; //Effective $FSETT[$d][$h] = $FSETE[$d][$h] + $FSETO[$d][$h] + $FSETSE[$d][$h] + $FSETSO[$d][$h] + $FSETS[$d][$h]; // Correction azimuth angle by backtracking: // To avoid shadows projected by a tracker located at E if ($w[$d][$h] <= 0 && $FSGTE[$d][$h] > 0) { if ($fis[$d][$h] < -pi() / 2) { $alfa[$d][$h] = $fis[$d][$h] + $RSEV * acos(min(1, $LEO * cos(pi() - $fis[$d][$h]))); } else { $alfa[$d][$h] = $fis[$d][$h] + $RSEV * acos(min(1, $LEO * cos($fis[$d][$h]))); } } //To avoid shadows projected by the tracker located at W if ($w[$d][$h] >= 0 && $FSGTO[$d][$h] > 0) { if ($fis[$d][$h] > pi() / 2) { $alfa[$d][$h] = $fis[$d][$h] - $RSEV * acos(min(1, $LEO * cos(pi() - $fis[$d][$h]))); } else { $alfa[$d][$h] = $fis[$d][$h] - $RSEV * acos(min(1, $LEO * cos($fis[$d][$h]))); } } // Angle of incidence. For just before dawn, the value of zero for the cosine of the incident angle is set. // It is a way to eliminate radiation in that period. // Coordinates of the radius vector of the sun unit in a system of coordinates Oxyz solidarity with the place // and the x axis X, Y, Z pointing respectively to the west, south and the zenith $xsol[$d][$h] = cos($gammas[$d][$h]) * sin($fis[$d][$h]); $ysol[$d][$h] = cos($gammas[$d][$h]) * cos($fis[$d][$h]); $zsol[$d][$h] = sin($gammas[$d][$h]); // UPON ROTATION OF HORIZONTAL AXIS // Unit coordinates of the radius vector of the sun in a coordinate system Ox'y'z 'integral with the follower // and the x axis X', Y ', Z' pointing respectively to the horizontal direction of the row, to perpendicular // to the row direction and the zenith $xprimasol[$d][$h] = $xsol[$d][$h] * cos($alfa[$d][$h]) - $ysol[$d][$h] * sin($alfa[$d][$h]); $yprimasol[$d][$h] = $xsol[$d][$h] * sin($alfa[$d][$h]) + $ysol[$d][$h] * cos($alfa[$d][$h]); $zprimasol[$d][$h] = $zsol[$d][$h]; //Ideal inclination angle. Only works when the sun is ahead //(yprimasol >=0 ) if ($yprimasol[$d][$h] > 0 && $zprimasol[$d][$h] > 0) { $beta_ideal[$d][$h] = atan($yprimasol[$d][$h] / $zprimasol[$d][$h]); } else { $beta_ideal[$d][$h] = $beta_parrilla[$d][$h]; } // Consideration of shadows // Initial set to zero $FSGFHN[$d][$h] = 0; //FSGFVN[$d][$h]=0; //Length of the shadow on the support of the grid $SPARRILLA[$d][$h] = 1 / cos($beta_ideal[$d][$h] - $beta_parrilla[$d][$h]); // Consideration of whether it is day shadows (zprimasol> 0) and the sun is in front (yprimasol> 0) if ($yprimasol[$d][$h] > 0 && $zprimasol[$d][$h] > 0) { // Factor shade of the row (the name now includes an "F" row) in the vertically projected by the row that is to N $FSGFVN[$d][$h] = max(0, 1 - $LNS_rack / $SPARRILLA[$d][$h]); //Shade factor row in the horizontal direction if ($xprimasol[$d][$h] == 0) { $FSGFHN[$d][$h] = 1; } elseif ($xprimasol[$d][$h] > 0) { $FSGFHN[$d][$h] = max(0, 1 - ($LNS_rack * cos($beta_parrilla[$d][$h]) - $ALARGF * cos($beta_ideal[$d][$h])) * ($yprimasol[$d][$h] / $xprimasol[$d][$h])); } elseif ($xprimasol[$d][$h] < 0) { $FSGFHN[$d][$h] = max(0, 1 + ($LNS_rack * cos($beta_parrilla[$d][$h]) - $ALARGF * cos($beta_ideal[$d][$h])) * ($yprimasol[$d][$h] / $xprimasol[$d][$h])); } } else { $FSGFVN[$d][$h] = 0; $FSGFHN[$d][$h] = 0; } $FSGFTN[$d][$h] = $FSGFVN[$d][$h] * $FSGFHN[$d][$h]; // MODELS OF SHADOWS (THE NOMENCLATURE RESULTS OF ADDING AN "F" ROW) $NBSFVN[$d][$h] = 0; $NBSFHN[$d][$h] = 0; $NBSFTN[$d][$h] = 0; $FSEFVN[$d][$h] = 0; $FSEFHN[$d][$h] = 0; $FSEFTN[$d][$h] = 0; //Effective values: if ($FSGFTN[$d][$h] > 0) { $NBSFVN[$d][$h] = RoundToZero($FSGFVN[$d][$h] * $NBFV + 0.999); $NBSFHN[$d][$h] = RoundToZero($FSGFHN[$d][$h] * $NBGH + 0.999); $NBSFTN[$d][$h] = $NBSFVN[$d][$h] * $NBSFHN[$d][$h]; $FSEFVN[$d][$h] = $NBSFVN[$d][$h] / $NBFV; $FSEFHN[$d][$h] = $NBSFHN[$d][$h] / $NBGH; if ($MSC == 1) { $FSEFTN[$d][$h] = $FSEFVN[$d][$h] * $FSEFHN[$d][$h]; } else { $FSEFTN[$d][$h] = 1 - (1 - $FSGFTN[$d][$h]) * (1 - (1 - $MSO) * $NBSTS[$d][$h] / ($NBFV * $NBGH + 1)) * (1 - $MSP); } } //Consideration of the horizontal axis backtracking $beta[$d][$h] = $beta_ideal[$d][$h] - $RSEH * acos(min(1, $LNS_rack / $SPARRILLA[$d][$h])); // Coordinates of the normal to the surface in the same previous coordinate system $xsup[$d][$h] = sin($beta[$d][$h]) * sin($alfa[$d][$h]); $ysup[$d][$h] = sin($beta[$d][$h]) * cos($alfa[$d][$h]); $zsup[$d][$h] = cos($beta[$d][$h]); //Incidence angle if (abs($w[$d][$h]) >= abs($ws[$d])) { $costetas[$d][$h] = 1; } else { $costetas[$d][$h] = $xsol[$d][$h] * $xsup[$d][$h] + $ysol[$d][$h] * $ysup[$d][$h] + $zsol[$d][$h] * $zsup[$d][$h]; } //Direct component //Resets direct predawn (redundant with the previous statement) and posterior incidence if (abs($w[$d][$h]) >= abs($ws[$d])) { $B[$d][$h] = 0; } else { $B[$d][$h] = $B0[$d][$h] * max(0, $costetas[$d][$h]) / $costetazs[$d][$h]; } //Isotropic, circumsolar and horizon components of the diffuse irradiation if (abs($w[$d][$h]) >= abs($ws[$d])) { $Diso[$d][$h] = 0; $Dcir[$d][$h] = 0; $Dhor[$d][$h] = 0; $D[$d][$h] = 0; } else { $Diso[$d][$h] = $D0[$d][$h] * (1 - $k1[$d][$h]) * (1 + cos($beta[$d][$h])) / 2; $Dcir[$d][$h] = $D0[$d][$h] * $k1[$d][$h] * max(0, $costetas[$d][$h]) / $costetazs[$d][$h]; $Dhor[$d][$h] = $D0[$d][$h] * $k2[$d][$h] * sin($beta[$d][$h]); $D[$d][$h] = $Diso[$d][$h] + $Dcir[$d][$h] + $Dhor[$d][$h]; } //Albedo component if (abs($w[$d][$h]) >= abs($ws[$d])) { $R[$d][$h] = 0; } else { $R[$d][$h] = $GroundReflectance * $G0[$d][$h] * (1 - cos($beta[$d][$h])) / 2; } //Global irradiance $G[$d][$h] = $B[$d][$h] + $D[$d][$h] + $R[$d][$h]; // Consideration of the effects of the incidence angle // Correction of the directly irradiation factor $FCB[$d][$h] = (1 - exp(-$costetas[$d][$h] / $ar)) / (1 - exp(-1 / $ar)); //Correction of the diffuse irradiation factor $FCD[$d][$h] = 1 - exp(-1 / $ar * ((sin($beta[$d][$h]) + (pi() - $beta[$d][$h] - sin($beta[$d][$h])) / (1 + cos($beta[$d][$h]))) * 4 / 3 / pi() + $c2 * pow(sin($beta[$d][$h]) + (pi() - $beta[$d][$h] - sin($beta[$d][$h])) / (1 + cos($beta[$d][$h])), 2))); //Correction of the albedo factor if ($beta[$d][$h] == 0) { $FCR[$d][$h] = 0; } else { $FCR[$d][$h] = 1 - exp(-1 / $ar * ((sin($beta[$d][$h]) + ($beta[$d][$h] - sin($beta[$d][$h])) / (1 - cos($beta[$d][$h]))) * 4 / 3 / pi() + $c2 * pow(sin($beta[$d][$h]) + ($beta[$d][$h] - sin($beta[$d][$h])) / (1 - cos($beta[$d][$h])), 2))); } //Effective irradiation components $Bef[$d][$h] = $B[$d][$h] * $FCB[$d][$h] * $Transm; $Def[$d][$h] = (($Diso[$d][$h] + $Dhor[$d][$h]) * $FCD[$d][$h] + $Dcir[$d][$h] * $FCB[$d][$h]) * $Transm; $Ref[$d][$h] = $R[$d][$h] * $FCR[$d][$h] * $Transm; //Effective irradiance $Gef[$d][$h] = $Bef[$d][$h] + $Def[$d][$h] + $Ref[$d][$h]; // Effective irradiance after adjacent shadows (E + W) // Maximum limitation shadow factor to the unit $FSET[$d][$h] = min(1, $FSETE[$d][$h] + $FSETO[$d][$h]); $Befsa[$d][$h] = (1 - $FSET[$d][$h] * (1 - $RSEV)) * $Bef[$d][$h]; //$Befsa[$d][$h]=(1-($FSETE[$d][$h]+$FSETO[$d][$h])*(1-$RSEV))*$Bef[$d][$h]; $Defsa[$d][$h] = (($Diso[$d][$h] + $Dhor[$d][$h]) * $FCD[$d][$h] + $Dcir[$d][$h] * $FCB[$d][$h] * (1 - $FSET[$d][$h] * (1 - $RSEV))) * $Transm; //$Defsa[$d][$h]=(($Diso[$d][$h]+$Dhor[$d][$h])*$FCD[$d][$h]+$Dcir[$d][$h]*$FCB[$d][$h]*(1-($FSETE[$d][$h]+$FSETO[$d][$h])*(1-$RSEV)))*$Transm; $Gefsa[$d][$h] = $Befsa[$d][$h] + $Defsa[$d][$h] + $Ref[$d][$h]; //Total effective irradiance after shadows(E + W + SE + SW) and shading between rows //Maximum limitation shadow factor to the unit $FSETT[$d][$h] = min(1, $FSETE[$d][$h] + $FSETO[$d][$h] + $FSETSE[$d][$h] + $FSETSO[$d][$h]); $FSEFTN[$d][$h] = min(1, $FSEFTN[$d][$h]); $Befsayp[$d][$h] = (1 - $FSETT[$d][$h] * (1 - $RSEV)) * (1 - $FSEFTN[$d][$h] * (1 - $RSEH)) * $Bef[$d][$h]; //$Befsayp[$d][$h]=(1-($FSETE[$d][$h]+$FSETO[$d][$h]+$FSETSE[$d][$h]+$FSETSO[$d][$h])*(1-$RSEV))*(1-$FSEFTN[$d][$h]*(1-$RSEH))*$Bef[$d][$h]; $Defsayp[$d][$h] = (($Diso[$d][$h] + $Dhor[$d][$h]) * $FCD[$d][$h] + $Dcir[$d][$h] * $FCB[$d][$h] * (1 - $FSETT[$d][$h] * (1 - $RSEV) * (1 - $FSEFTN[$d][$h] * (1 - $RSEH)))) * $Transm; //$Defsayp[$d][$h]=(($Diso[$d][$h]+$Dhor[$d][$h])*$FCD[$d][$h]+$Dcir[$d][$h]*$FCB[$d][$h]*(1-($FSETE[$d][$h]+$FSETO[$d][$h]+$FSETSE[$d][$h]+$FSETSO[$d][$h])*(1-$RSEV)*(1-$FSEFTN[$d][$h]*(1-$RSEH))))*$Transm; $Gefsayp[$d][$h] = $Befsayp[$d][$h] + $Defsayp[$d][$h] + $Ref[$d][$h]; } //end FOR $h Nsteps } //end FOR $d Ndays $ISI = array('G' => $G, 'B' => $B, 'D' => $D, 'R' => $R, 'Gef' => $Gef, 'Bef' => $Bef, 'Def' => $Def, 'Ref' => $Ref, 'Gefsa' => $Gefsa, 'Befsa' => $Befsa, 'Defsa' => $Defsa, 'Gefsayp' => $Gefsayp, 'Befsayp' => $Befsayp, 'Defsayp' => $Defsayp); return $ISI; }
function StaticGroundRoof($SUNPOS, $w, $ws, $HI, $ANISO, $SITE, $PVGEN, $OPTIONS, $TIME) { //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //INITIAL CALCULATIONS //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //INPUTS //SUNPOS $costetazs = $SUNPOS['costetazs']; $cosfis = $SUNPOS['cosfis']; $gammas = $SUNPOS['gammas']; $tetazs = $SUNPOS['tetazs']; $fis = $SUNPOS['fis']; //HI $G0 = $HI['G0']; $B0 = $HI['B0']; $D0 = $HI['D0']; //ANISO $k1 = $ANISO['k1']; $k2 = $ANISO['k2']; //PVGEN //Common $NBGH = $PVGEN['NBGH']; $NBGV = $PVGEN['NBGV']; $NBT = $PVGEN['NBT']; //GroundRoof $Inclination_roof = $PVGEN['GroundRoof']['Inclination_roof']; $Orientation_roof = $PVGEN['GroundRoof']['Orientation_roof']; $Inclination_generator = $PVGEN['GroundRoof']['Inclination_generator']; $Orientation_generator = $PVGEN['GroundRoof']['Orientation_generator']; $LNS = $PVGEN['GroundRoof']['LNS']; $AEO = $PVGEN['GroundRoof']['AEO']; $DEO = $PVGEN['GroundRoof']['DEO']; //OTHER PARAMETERS //OptimumSlope if ($OPTIONS['OptimumSlope'] == 1) { $Inclination_roof = 0; $Orientation_roof = 0; $Inclination_generator = 3.7 + 0.6899999999999999 * $SITE['Latitude'] * valueSign($SITE['Latitude']); $Orientation_generator = 0; } //Degree of dust, model parameters $DDP = DustDegreeParameters($OPTIONS['DustDegree']); $ar = $DDP['ar']; $c2 = $DDP['c2']; $Transm = $DDP['Transm']; //Shading, model coefficients $SMP = ShadingModelParameters($OPTIONS['ShadingModel']); $MSP = $SMP['MSP']; $MSO = $SMP['MSO']; $MSC = $SMP['MSC']; //Ground reflectance $GroundReflectance = $OPTIONS['GroundReflectance']; //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //CALCULATIONS //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for ($d = 0; $d < $TIME['Ndays']; $d++) { for ($h = 0; $h < $TIME['Nsteps']; $h++) { //Conversion from degree to radian //Roof position $beta_roof = $Inclination_roof * pi() / 180; $alfa_roof = $Orientation_roof * pi() / 180; //PV generator position $beta_generator = $Inclination_generator * pi() / 180; $alfa_generator = $Orientation_generator * pi() / 180; //Coordinates of unit vector of the Sun in a Cartesian coordinate system //0XYZ, whose origen (0) is placed in the location and with the axis //X, Y, Z pointing to West, South and Zenith, respectively. $xsol[$d][$h] = cos($gammas[$d][$h]) * sin($fis[$d][$h]); $ysol[$d][$h] = cos($gammas[$d][$h]) * cos($fis[$d][$h]); $zsol[$d][$h] = sin($gammas[$d][$h]); //Coordinates of the unit vector of the Sun in a coordinate system 0X'Y'Z' //that results of rotating the original system an angle "alfa_roof" around the Z //axis. $xprimasol[$d][$h] = $xsol[$d][$h] * cos($alfa_roof) - $ysol[$d][$h] * sin($alfa_roof); $yprimasol[$d][$h] = $xsol[$d][$h] * sin($alfa_roof) + $ysol[$d][$h] * cos($alfa_roof); $zprimasol[$d][$h] = $zsol[$d][$h]; //Coordinates of the unit vector of the Sun in a coordinate system 0X2'XY'XZ' //that results of rotating the original system an angle "alfa_roof" around the Z //axis and and angle "beta_roof" around the X' axis. $x2primasol[$d][$h] = $xprimasol[$d][$h]; $y2primasol[$d][$h] = $yprimasol[$d][$h] * cos($beta_roof) - $zprimasol[$d][$h] * sin($beta_roof); $z2primasol[$d][$h] = $yprimasol[$d][$h] * sin($beta_roof) + $zprimasol[$d][$h] * cos($beta_roof); //Coordinates of the normal unit vector of the surface, in the previous //coordinate system $x2primasup[$d][$h] = sin($beta_generator) * sin($alfa_generator); $y2primasup[$d][$h] = sin($beta_generator) * cos($alfa_generator); $z2primasup[$d][$h] = cos($beta_generator); //Coordinates of the normal unit vector of the surface, in the //coordinate system that results of rotating the previous one an angle //"beta_roof" (negative) around X2' $xprimasup[$d][$h] = $x2primasup[$d][$h]; $yprimasup[$d][$h] = $y2primasup[$d][$h] * cos($beta_roof) + $z2primasup[$d][$h] * sin($beta_roof); $zprimasup[$d][$h] = -$y2primasup[$d][$h] * sin($beta_roof) + $z2primasup[$d][$h] * cos($beta_roof); //Coordinates of the normal unit vector of the surface in 0XYZ coordinate //system $xsup[$d][$h] = $xprimasup[$d][$h] * cos($alfa_roof) + $yprimasup[$d][$h] * sin($alfa_roof); $ysup[$d][$h] = -$xprimasup[$d][$h] * sin($alfa_roof) + $yprimasup[$d][$h] * cos($alfa_roof); $zsup[$d][$h] = $zprimasup[$d][$h]; //Alfa y beta angles of the PV generator in OXYZ coordinate system $beta[$d][$h] = acos($zsup[$d][$h]); if ($ysup[$d][$h] == 0) { $alfa[$d][$h] = 0; } else { $alfa[$d][$h] = atan($xsup[$d][$h] / $ysup[$d][$h]); } //Incidence angle if (abs($w[$d][$h]) >= abs($ws[$d])) { $costetas[$d][$h] = 1; } else { $costetas[$d][$h] = $xsol[$d][$h] * $xsup[$d][$h] + $ysol[$d][$h] * $ysup[$d][$h] + $zsol[$d][$h] * $zsup[$d][$h]; } //Beam irradiance component if (abs($w[$d][$h]) >= abs($ws[$d])) { $B[$d][$h] = 0; } else { $B[$d][$h] = $B0[$d][$h] * max(0, $costetas[$d][$h]) / $costetazs[$d][$h]; } //Diffuse irradiance components: isotropic (Diso), circumsolar (Dcir) and the //horizon (Dhor) if (abs($w[$d][$h]) >= abs($ws[$d])) { $Diso[$d][$h] = 0; $Dcir[$d][$h] = 0; $Dhor[$d][$h] = 0; $D[$d][$h] = 0; } else { $Diso[$d][$h] = $D0[$d][$h] * (1 - $k1[$d][$h]) * (1 + cos($beta[$d][$h])) / 2; $Dcir[$d][$h] = $D0[$d][$h] * $k1[$d][$h] * max(0, $costetas[$d][$h]) / $costetazs[$d][$h]; $Dhor[$d][$h] = $D0[$d][$h] * $k2[$d][$h] * sin($beta[$d][$h]); $D[$d][$h] = $Diso[$d][$h] + $Dcir[$d][$h] + $Dhor[$d][$h]; } //Albedo irradiance component if (abs($w[$d][$h]) >= abs($ws[$d])) { $R[$d][$h] = 0; } else { $R[$d][$h] = $GroundReflectance * $G0[$d][$h] * (1 - cos($beta[$d][$h])) / 2; } //Global irradiance $G[$d][$h] = $B[$d][$h] + $D[$d][$h] + $R[$d][$h]; //Effects of incidence angles //Correction of the beam irradiance $FCB[$d][$h] = (1 - exp(-$costetas[$d][$h] / $ar)) / (1 - exp(-1 / $ar)); //Correction of the diffuse irradiance (isotropic component) $FCD[$d][$h] = 1 - exp(-1 / $ar * ((sin($beta[$d][$h]) + (pi() - $beta[$d][$h] - sin($beta[$d][$h])) / (1 + cos($beta[$d][$h]))) * 4 / 3 / pi() + $c2 * pow(sin($beta[$d][$h]) + (pi() - $beta[$d][$h] - sin($beta[$d][$h])) / (1 + cos($beta[$d][$h])), 2))); //Correction of the albedo irradiance if ($beta[$d][$h] == 0) { $FCR[$d][$h] = 0; } else { $FCR[$d][$h] = 1 - exp(-1 / $ar * ((sin($beta[$d][$h]) + ($beta[$d][$h] - sin($beta[$d][$h])) / (1 - cos($beta[$d][$h]))) * 4 / 3 / pi() + $c2 * pow(sin($beta[$d][$h]) + ($beta[$d][$h] - sin($beta[$d][$h])) / (1 - cos($beta[$d][$h])), 2))); } //Effective irradiance components $Bef[$d][$h] = $B[$d][$h] * $FCB[$d][$h] * $Transm; $Def[$d][$h] = (($Diso[$d][$h] + $Dhor[$d][$h]) * $FCD[$d][$h] + $Dcir[$d][$h] * $FCB[$d][$h]) * $Transm; $Ref[$d][$h] = $R[$d][$h] * $FCR[$d][$h] * $Transm; //Effective global irradiance $Gef[$d][$h] = $Bef[$d][$h] + $Def[$d][$h] + $Ref[$d][$h]; //Coordinates of the Sun that results of rotating the original an angle //"alfa" around the Z axis $x3primasol[$d][$h] = $x2primasol[$d][$h] * cos($alfa_generator) - $y2primasol[$d][$h] * sin($alfa_generator); $y3primasol[$d][$h] = $x2primasol[$d][$h] * sin($alfa_generator) + $y2primasol[$d][$h] * cos($alfa_generator); $z3primasol[$d][$h] = $z2primasol[$d][$h]; //Geometric shading factor caused by the roof and by a row placed //towards the South, FSGTS. //Initialisation $FSGHS[$d][$h] = 0; $FSGVS[$d][$h] = 0; $FSGTS[$d][$h] = 0; $FSGT[$d][$h] = 0; $FSET[$d][$h] = 0; //Geometric shading factor caused by the roof itself (FSGT) if ($zsol[$d][$h] > 0 && $z3primasol[$d][$h] <= 0) { $FSGT[$d][$h] = 1; $FSET[$d][$h] = 1; } //Shading caused by the a row placed towards the south //Shading factor in horizontal direction if ($y3primasol[$d][$h] > 0 && $z3primasol[$d][$h] > 0) { if ($x3primasol[$d][$h] < 0) { $FSGHS[$d][$h] = max(0, 1 + $DEO / $AEO + ($LNS - cos($beta_generator)) / $AEO * ($x3primasol[$d][$h] / $y3primasol[$d][$h])); } else { $FSGHS[$d][$h] = max(0, 1 - $DEO / $AEO - ($LNS - cos($beta_generator)) / $AEO * ($x3primasol[$d][$h] / $y3primasol[$d][$h])); } //Shading factor in the vertical direction $FSGVS[$d][$h] = max(0, 1 - $LNS / (cos($beta_generator) + sin($beta_generator) * ($y3primasol[$d][$h] / $z3primasol[$d][$h]))); } //Total geometric shading factor $FSGTS[$d][$h] = $FSGHS[$d][$h] * $FSGVS[$d][$h]; //Martinez Shading model $NBSVS[$d][$h] = 0; $NBSHS[$d][$h] = 0; $NBSTS[$d][$h] = 0; $FSEVS[$d][$h] = 0; $FSEHS[$d][$h] = 0; $FSETS[$d][$h] = 0; //Effective values if ($FSGTS[$d][$h] > 0) { $NBSVS[$d][$h] = RoundToZero($FSGVS[$d][$h] * $NBGV + 0.999); $NBSHS[$d][$h] = RoundToZero($FSGHS[$d][$h] * $NBGH + 0.999); $NBSTS[$d][$h] = $NBSVS[$d][$h] * $NBSHS[$d][$h]; $FSEVS[$d][$h] = $NBSVS[$d][$h] / $NBGV; $FSEHS[$d][$h] = $NBSHS[$d][$h] / $NBGH; if ($MSC == 1) { $FSETS[$d][$h] = $FSEVS[$d][$h] * $FSEHS[$d][$h]; } else { $FSETS[$d][$h] = min(1, 1 - (1 - $FSGTS[$d][$h]) * (1 - (1 - $MSO) * $NBSTS[$d][$h] / ($NBT + 1)) * (1 - $MSP)); } } //Total shading, caused by the roof and row placed towards the south $FSETT[$d][$h] = $FSET[$d][$h] + $FSETS[$d][$h]; //Irradiances $Befsayp[$d][$h] = (1 - $FSETT[$d][$h]) * $Bef[$d][$h]; $Defsayp[$d][$h] = (($Diso[$d][$h] + $Dhor[$d][$h]) * $FCD[$d][$h] + $Dcir[$d][$h] * $FCB[$d][$h] * (1 - $FSETT[$d][$h])) * $Transm; $Gefsayp[$d][$h] = $Befsayp[$d][$h] + $Defsayp[$d][$h] + $Ref[$d][$h]; //Other calculations $Befsa[$d][$h] = $Befsayp[$d][$h]; $Defsa[$d][$h] = $Defsayp[$d][$h]; $Gefsa[$d][$h] = $Gefsayp[$d][$h]; } //end FOR $h Nsteps } //end FOR $d Ndays //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //OUTPUT //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% $ISI = array('G' => $G, 'B' => $B, 'D' => $D, 'R' => $R, 'Gef' => $Gef, 'Bef' => $Bef, 'Def' => $Def, 'Ref' => $Ref, 'Gefsa' => $Gefsa, 'Befsa' => $Befsa, 'Defsa' => $Defsa, 'Gefsayp' => $Gefsayp, 'Befsayp' => $Befsayp, 'Defsayp' => $Defsayp); return $ISI; }
function TrackerOneAxisHorizontal($SUNPOS, $w, $ws, $HI, $ANISO, $SITE, $PVGEN, $OPTIONS, $TIME) { /////////////////////////////////////// // INITIAL CALCULATIONS /////////////////////////////////////// // INPUTS // $SUNPOS $costetazs = $SUNPOS['costetazs']; $cosfis = $SUNPOS['cosfis']; $gammas = $SUNPOS['gammas']; $tetazs = $SUNPOS['tetazs']; $fis = $SUNPOS['fis']; // $HI $G0 = $HI['G0']; $B0 = $HI['B0']; $D0 = $HI['D0']; // $ANISO $k1 = $ANISO['k1']; $k2 = $ANISO['k2']; // $PVGEN // Common $NBGH = $PVGEN['NBGH']; $NBGV = $PVGEN['NBGV']; $NBT = $PVGEN['NBT']; // This tracker $LEO = $PVGEN['Track1H']['LEO']; $Rotation_MAX = $PVGEN['Track1H']['Rotation_MAX']; $Axis_orientation = $PVGEN['Track1H']['Axis_orientation']; $Axis_inclination = $PVGEN['Track1H']['Axis_inclination']; $LNS = $PVGEN['Track1H']['LNS']; $Inclination_module = $PVGEN['Track1H']['Inclination_module']; $RSEH = $PVGEN['Track1H']['RSEH']; // Conversion to radian $rotMAX = $Rotation_MAX * pi() / 180; $alfa_eje = $Axis_orientation * pi() / 180; $beta_eje = $Axis_inclination * pi() / 180; $beta_mod = $Inclination_module * pi() / 180; // OTHER PARAMETERS // Degree of dust, model parameters $DDP = DustDegreeParameters($OPTIONS['DustDegree']); $ar = $DDP['ar']; $c2 = $DDP['c2']; $Transm = $DDP['Transm']; // Shading, model coefficients $SMP = ShadingModelParameters($OPTIONS['ShadingModel']); $MSP = $SMP['MSP']; $MSO = $SMP['MSO']; $MSC = $SMP['MSC']; // Ground reflectance $GroundReflectance = $OPTIONS['GroundReflectance']; /////////////////////////////////// // CALCULATIONS /////////////////////////////////// for ($d = 0; $d < $TIME['Ndays']; $d++) { for ($h = 0; $h < $TIME['Nsteps']; $h++) { //Sets the coordinates of the unit radius vector of the sun in a system //of coordinates Oxyz solidarity with the place and the x axis X, Y, Z //pointing respectively to the west, south and the zenith $xsol[$d][$h] = cos($gammas[$d][$h]) * sin($fis[$d][$h]); $ysol[$d][$h] = cos($gammas[$d][$h]) * cos($fis[$d][$h]); $zsol[$d][$h] = sin($gammas[$d][$h]); //SOl coordinates in a supportive system with the surface of the generator //at noon, ie when the edge of the generator is horizontal. This system is //to turn an alfa_eje angle around the Z axis, and another beta_eje + beta_mod, //about the x-axis' $x2primasol[$d][$h] = $xsol[$d][$h] * cos($alfa_eje) - $ysol[$d][$h] * sin($alfa_eje) * cos($beta_eje + $beta_mod) + $zsol[$d][$h] * sin($alfa_eje) * sin($beta_eje + $beta_mod); $y2primasol[$d][$h] = $xsol[$d][$h] * sin($alfa_eje) + $ysol[$d][$h] * cos($alfa_eje) * cos($beta_eje + $beta_mod) - $zsol[$d][$h] * cos($alfa_eje) * sin($beta_eje + $beta_mod); $z2primasol[$d][$h] = $ysol[$d][$h] * sin($beta_eje + $beta_mod) + $zsol[$d][$h] * cos($beta_eje + $beta_mod); // Rotating axis angle (rotNS) if ($z2primasol[$d][$h] == 0) { $rotNS[$d][$h] = pi() / 2 * valueSign($x2primasol[$d][$h]); } else { $rotNS[$d][$h] = atan($x2primasol[$d][$h] / $z2primasol[$d][$h]); } // Backtracking correction on the horizontal axis. // $RSEH. The result is called RNSCBT $rotNSCBT[$d][$h] = $rotNS[$d][$h] - $RSEH * acos(min(1, $LEO * cos($rotNS[$d][$h]))) * valueSign($x2primasol[$d][$h]); // Limits the rotation angle to 90 degrees or constructive value. // The result is called rotNSCBTyC. $rotNSCBTyC[$d][$h] = $rotNSCBT[$d][$h]; // Limit to 90 degrees if (abs($rotNSCBTyC[$d][$h]) > pi() / 2) { $rotNSCBTyC[$d][$h] = pi() / 2 * valueSign($x2primasol[$d][$h]); } // Limit to constructive value if (abs($rotNSCBTyC[$d][$h]) > $rotMAX) { $rotNSCBTyC[$d][$h] = $rotMAX * valueSign($x2primasol[$d][$h]); } // Surface coordinate system in solidarity with the generator at noon $x2primasup[$d][$h] = sin($rotNSCBTyC[$d][$h]); $y2primasup[$d][$h] = 0; $z2primasup[$d][$h] = cos($rotNSCBTyC[$d][$h]); // %Incidence angle if (abs($w[$d][$h]) >= abs($ws[$d])) { $costetas[$d][$h] = 0; } else { $costetas[$d][$h] = $x2primasol[$d][$h] * $x2primasup[$d][$h] + $y2primasol[$d][$h] * $y2primasup[$d][$h] + $z2primasol[$d][$h] * $z2primasup[$d][$h]; } // Surface coordinate system in solidarity with the place. // Result of rotating the OX''Y''Z 'angle - (+ beta_mod beta_eje) in // around the X axis'' $xprimasup[$d][$h] = $x2primasup[$d][$h]; $yprimasup[$d][$h] = $y2primasup[$d][$h] * cos($beta_eje + $beta_mod) + $z2primasup[$d][$h] * sin($beta_eje + $beta_mod); $zprimasup[$d][$h] = -$y2primasup[$d][$h] * sin($beta_eje + $beta_mod) + $z2primasup[$d][$h] * cos($beta_eje + $beta_mod); // Followed by rotating -alfa_eje an angle around the axis Z ' $xsup[$d][$h] = $xprimasup[$d][$h] * cos($alfa_eje) + $yprimasup[$d][$h] * sin($alfa_eje); $ysup[$d][$h] = -$xprimasup[$d][$h] * sin($alfa_eje) + $zprimasup[$d][$h] * cos($alfa_eje); $zsup[$d][$h] = $zprimasup[$d][$h]; // Inclination of the receiving surface $beta[$d][$h] = acos($zsup[$d][$h]); // Azimuth of the receiving surface if ($ysup[$d][$h] == 0) { $alfa[$d][$h] = pi() / 2 * valueSign($w[$d][$h]); } else { $alfa[$d][$h] = atan($xsup[$d][$h] / $ysup[$d][$h]); } // Components of the global irradiance incident on the receiving surface // Direct irradiance if (abs($w[$d][$h]) >= abs($ws[$d])) { $B[$d][$h] = 0; } else { $B[$d][$h] = $B0[$d][$h] * max(0, $costetas[$d][$h]) / $costetazs[$d][$h]; } // Diffuse irradiance (isotropic and circumsolar components) if (abs($w[$d][$h]) >= abs($ws[$d])) { $Diso[$d][$h] = 0; $Dcir[$d][$h] = 0; $Dhor[$d][$h] = 0; $D[$d][$h] = 0; } else { $Diso[$d][$h] = $D0[$d][$h] * (1 - $k1[$d][$h]) * (1 + cos($beta[$d][$h])) / 2; $Dcir[$d][$h] = $D0[$d][$h] * $k1[$d][$h] * max(0, $costetas[$d][$h]) / $costetazs[$d][$h]; $Dhor[$d][$h] = $D0[$d][$h] * $k2[$d][$h] * sin($beta[$d][$h]); $D[$d][$h] = $Diso[$d][$h] + $Dcir[$d][$h] + $Dhor[$d][$h]; } // Albedo component if (abs($w[$d][$h]) >= abs($ws[$d])) { $R[$d][$h] = 0; } else { $R[$d][$h] = $GroundReflectance * $G0[$d][$h] * (1 - cos($beta[$d][$h])) / 2; } // Glogal incident irradiation $G[$d][$h] = $B[$d][$h] + $D[$d][$h] + $R[$d][$h]; // Consideration of the effects of the incidence angle // Direct irradiation correction factor if (abs($w[$d][$h]) >= abs($ws[$d])) { $FCB[$d][$h] = 0; } else { $FCB[$d][$h] = (1 - exp(-$costetas[$d][$h] / $ar)) / (1 - exp(-1 / $ar)); } // Diffuse irradiation correction factor if (abs($w[$d][$h]) >= abs($ws[$d])) { $FCD[$d][$h] = 0; } else { $FCD[$d][$h] = 1 - exp(-1 / $ar * ((sin($beta[$d][$h]) + (pi() - $beta[$d][$h] - sin($beta[$d][$h])) / (1 + cos($beta[$d][$h]))) * 4 / 3 / pi() + $c2 * pow(sin($beta[$d][$h]) + (pi() - $beta[$d][$h] - sin($beta[$d][$h])) / (1 + cos($beta[$d][$h])), 2))); } // Albedo irradiation correction factor if (abs($w[$d][$h]) >= abs($ws[$d])) { $FCR[$d][$h] = 0; } elseif ($beta[$d][$h] == 0) { $FCR[$d][$h] = 0; } else { $FCR[$d][$h] = 1 - exp(-1 / $ar * ((sin($beta[$d][$h]) + ($beta[$d][$h] - sin($beta[$d][$h])) / (1 - cos($beta[$d][$h]))) * 4 / 3 / pi() + $c2 * pow(sin($beta[$d][$h]) + ($beta[$d][$h] - sin($beta[$d][$h])) / (1 - cos($beta[$d][$h])), 2))); } //Effective irradiance components $Bef[$d][$h] = $B[$d][$h] * $FCB[$d][$h] * $Transm; $Def[$d][$h] = (($Diso[$d][$h] + $Dhor[$d][$h]) * $FCD[$d][$h] + $Dcir[$d][$h] * $FCB[$d][$h]) * $Transm; $Ref[$d][$h] = $R[$d][$h] * $FCR[$d][$h] * $Transm; // Effective global irradiance $Gef[$d][$h] = $Bef[$d][$h] + $Def[$d][$h] + $Ref[$d][$h]; //Shadows EW (can if there are no back-tracking and monitoring is no ideal or is limited by construction) //Length of the shadow on the x-axis '' $sombra[$d][$h] = 1.0E-8; if ($z2primasol[$d][$h] == 0) { $z2primasol[$d][$h] = 1.0E-6; } else { $sombra[$d][$h] = cos($rotNSCBTyC[$d][$h]) + sin($rotNSCBTyC[$d][$h]) * $x2primasol[$d][$h] / $z2primasol[$d][$h]; } // Components of effective irradiance, CONSIDERING THE SHADOWS PLANNED BY THE ADJACENT TRACKERS, // Value unit to the horizontal dimension of the shadow $FSGHE[$d][$h] = 1; $FSGHO[$d][$h] = 1; $FSGHS[$d][$h] = 1; // Reset to zero the shadow factor vertically $FSGVE[$d][$h] = 0; $FSGVO[$d][$h] = 0; $FSGVS[$d][$h] = 0; // Vertical dimension shaded tracker located east, FSGVE, which is relevant only in the morning if ($w[$d][$h] <= 0) { // $FSGVE[$d][$h] = 0; if (abs($rotNSCBTyC[$d][$h]) == pi() / 2) { $FSGVE[$d][$h] = 1; } else { $FSGVE[$d][$h] = (1 - $RSEH) * max(0, 1 - $LEO / $sombra[$d][$h]); } if (abs($w[$d][$h]) >= abs($ws[$d])) { $FSGVE[$d][$h] = 0; } } // Total shadow factor projected by the tracker located east $FSGTE[$d][$h] = $FSGVE[$d][$h] * $FSGHE[$d][$h]; // Martinez shading model $NBSVE[$d][$h] = 0; $NBSHE[$d][$h] = 0; $NBSTE[$d][$h] = 0; $FSEVE[$d][$h] = 0; $FSEHE[$d][$h] = 0; $FSETE[$d][$h] = 0; // Effective values: if ($FSGTE[$d][$h] > 0) { $NBSVE[$d][$h] = RoundToZero($FSGVE[$d][$h] * $NBGV + 0.999); $NBSHE[$d][$h] = RoundToZero($FSGHE[$d][$h] * $NBGH + 0.999); $NBSTE[$d][$h] = $NBSVE[$d][$h] * $NBSHE[$d][$h]; $FSEVE[$d][$h] = $NBSVE[$d][$h] / $NBGV; $FSEHE[$d][$h] = $NBSHE[$d][$h] / $NBGH; if ($MSC == 1) { $FSETE[$d][$h] = $FSEVE[$d][$h] * $FSEHE[$d][$h]; } else { $FSETE[$d][$h] = 1 - (1 - $FSGTE[$d][$h]) * (1 - (1 - $MSO) * $NBSTE[$d][$h] / ($NBT + 1)) * (1 - $MSP); } } // Vertical dimension shaded tracker located West, FSGVO // Only relevant in the afternoon if ($w[$d][$h] > 0) { //$FSGVO[$d][$h]=0; if (abs($rotNSCBTyC[$d][$h]) == pi() / 2) { $FSGVO[$d][$h] = 1; } else { $FSGVO[$d][$h] = (1 - $RSEH) * max(0, 1 - $LEO / $sombra[$d][$h]); } if (abs($w[$d][$h]) >= abs($ws[$d])) { $FSGVO[$d][$h] = 0; } } // Total shadows factor projected by the tracker located west $FSGTO[$d][$h] = $FSGVO[$d][$h] * $FSGHO[$d][$h]; // Martinez shading model $NBSVO[$d][$h] = 0; $NBSHO[$d][$h] = 0; $NBSTO[$d][$h] = 0; $FSEVO[$d][$h] = 0; $FSEHO[$d][$h] = 0; $FSETO[$d][$h] = 0; // Effective values: if ($FSGTO[$d][$h] > 0) { $NBSVO[$d][$h] = RoundToZero($FSGVO[$d][$h] * $NBGV + 0.999); $NBSHO[$d][$h] = RoundToZero($FSGHO[$d][$h] * $NBGH + 0.999); $NBSTO[$d][$h] = $NBSVO[$d][$h] * $NBSHO[$d][$h]; $FSEVO[$d][$h] = $NBSVO[$d][$h] / $NBGV; $FSEHO[$d][$h] = $NBSHO[$d][$h] / $NBGH; if ($MSC == 1) { $FSETO[$d][$h] = $FSEVO[$d][$h] * $FSEHO[$d][$h]; } else { $FSETO[$d][$h] = 1 - (1 - $FSGTO[$d][$h]) * (1 - (1 - $MSO) * $NBSTO[$d][$h] / ($NBT + 1)) * (1 - $MSP); } } // Total geometric factor shadow projected by adjacent trackers $FSGTEO[$d][$h] = $FSGTE[$d][$h] + $FSGTO[$d][$h]; // Effective shadow factor, projected by adjacent trakcers $FSETEO[$d][$h] = $FSETE[$d][$h] + $FSETO[$d][$h]; $Befsa[$d][$h] = (1 - $FSETEO[$d][$h]) * $Bef[$d][$h]; $Defsa[$d][$h] = (($Diso[$d][$h] + $Dhor[$d][$h]) * $FCD[$d][$h] + $Dcir[$d][$h] * $FCB[$d][$h] * (1 - $FSETEO[$d][$h])) * $Transm; $Gefsa[$d][$h] = $Befsa[$d][$h] + $Defsa[$d][$h] + $Ref[$d][$h]; // The following is from the previous version, and can be generalized in future versions // Consideration of shadows projected by ROWS LOCATED SOUTH. Strictly, the code implemented here // is valid only when there is no back-tracking, and when there is only a deviation from the // horizontal, either module on the horizontal axis, or axis on horizontal ground. That is, // when only Bgen angle or Beje are nonzero angles. The angle of the sun with the horizontal, // measured on the normal to the surface of the receiving plane is called B. The length of the // shadow in the posterior direction, is called sombrapos (h, d); To consider the two deviations //in a single package instructions, you must create a new parameter, resulting from adding inclieje // and inclimod, called inclihorizonte. Shadow factor is called FSGTS (h, d). An "if" is added to //avoid the hassle of divisions by zero. $tanB[$d][$h] = sqrt(pow($xsol[$d][$h], 2) + pow($zsol[$d][$h], 2)) / $ysol[$d][$h]; if ($tanB[$d][$h] <= 0) { $FSGVS[$d][$h] = 0; } else { $inclihorizonte = $beta_eje + $beta_mod; $sombrapos[$d][$h] = cos($inclihorizonte) + sin($inclihorizonte) / $tanB[$d][$h]; $FSGVS[$d][$h] = max(0, 1 - $LNS / $sombrapos[$d][$h]); } $FSGTS[$d][$h] = $FSGVS[$d][$h] * $FSGHS[$d][$h]; // Martinez shading model $NBSVS[$d][$h] = 0; $NBSHS[$d][$h] = 0; $NBSTS[$d][$h] = 0; $FSEVS[$d][$h] = 0; $FSEHS[$d][$h] = 0; $FSETS[$d][$h] = 0; // Effective values: if ($FSGTS[$d][$h] > 0) { $NBSVS[$d][$h] = RoundToZero($FSGVS[$d][$h] * $NBGV + 0.999); $NBSHS[$d][$h] = RoundToZero($FSGHS[$d][$h] * $NBGH + 0.999); $NBSTS[$d][$h] = $NBSVS[$d][$h] * $NBSHS[$d][$h]; $FSEVS[$d][$h] = $NBSVS[$d][$h] / $NBGV; $FSEHS[$d][$h] = $NBSHS[$d][$h] / $NBGH; if (MSC == 1) { $FSETS[$d][$h] = $FSEVS[$d][$h] * $FSEHS[$d][$h]; } else { $FSETS[$d][$h] = 1 - (1 - $FSGTS[$d][$h]) * (1 - (1 - $MSO) * $NBSTS[$d][$h] / ($NBT + 1)) * (1 - $MSP); } } // Irradiations: // Peak limiting shadows factor to unity $FSETS[$d][$h] = min(1, $FSETS[$d][$h]); $FSETEO[$d][$h] = min(1, $FSETEO[$d][$h]); $Befsayp[$d][$h] = (1 - $FSETS[$d][$h]) * $Befsa[$d][$h]; $Defsayp[$d][$h] = (($Diso[$d][$h] + $Dhor[$d][$h]) * $FCD[$d][$h] + $Dcir[$d][$h] * $FCB[$d][$h] * (1 - $FSETEO[$d][$h]) * (1 - $FSETS[$d][$h])) * $Transm; $Gefsayp[$d][$h] = $Befsayp[$d][$h] + $Defsayp[$d][$h] + $Ref[$d][$h]; } } ///////////////////////////////////////////////////////////////////////////////// // OUTPUT ///////////////////////////////////////////////////////////////////////////////// return $ISI = array('G' => $G, 'B' => $B, 'D' => $D, 'R' => $R, 'Gef' => $Gef, 'Bef' => $Bef, 'Def' => $Def, 'Ref' => $Ref, 'Gefsa' => $Gefsa, 'Befsa' => $Befsa, 'Defsa' => $Defsa, 'Gefsayp' => $Gefsayp, 'Befsayp' => $Befsayp, 'Defsayp' => $Defsayp); }