I have two lists of numbers, the first list has 365 numbers and the other one has 8760.
I want to loop the first list first and get the value. Then inside the first loop, I want to loop the second list to get the 24 number each time.
For the next iterative, it will skip the first 24 and get the next 24.
The problem is the "countelev" seems to not change and stay in ''24'' for every time when I print it. It supposes to be changed to 48, 72, 96....
This is my code:
foreach (var dec in declinationangle)
{
double declination = dec;
double elev = Degreetoradian(declination);
double lati = Degreetoradian(latitude);
// Solar elevation angle, expressed as α, is the angular height of the
//sun in the sky measured from the horizontal 0° at sunrise and 90° when
//the sun is right overhead.
//α = sin−1 (sin δ sin φ + cos δ cos φ cos τ)
int countelev = 0;
foreach (var hra in Solarhourangle.Skip(countelev).Take(24))
{
double hras = Degreetoradian(hra);
double elev1 = Math.Sin(elev) * Math.Sin(lati);
double elev2 = Math.Cos(elev) * Math.Cos(lati) * Math.Cos(hras);
double slav = Math.Asin(elev1 + elev2);
double sla = Radiantodegree(slav);
solarelevationangle.Add(sla);
}
countelev += 24;
TaskDialog.Show("countelev", countelev.ToString());
}