ssc/common.cpp
//this function checks the weather data to make sure that it is a single, continuous year with an even timestep starting jan 1 and ending dec 31
//HOWEVER, the year value may vary (i.e., TMY) so only checking month, day, hour, minute timesteps, not actual year vector
this function checks the weather data to make sure that it is a single, continuous year with an even timestep starting jan 1 and ending dec 31
HOWEVER, the year value may vary  so only checking month, day, hour, minute timesteps, not actual year vector
this function checks the weather data to make sure that it is a single continuous year with an even timestep starting jan 1 and ending dec 31 HOWEVER the year value may vary so only checking month day hour minute timesteps not actual year vector
bool weatherdata::check_continuous_single_year(bool leapyear)
{
	int ts_per_hour = 0; 
	if (leapyear)
		ts_per_hour = (int)(m_nRecords / 8784);
	else
		ts_per_hour = (int)(m_nRecords / 8760);
	double ts_min = 60. / ts_per_hour; 
	int idx = 0; 
	for (int m = 1; m <= 12; m++)
	{
		int daymax = util::days_in_month(m - 1);
		if (m == 2 && leapyear) daymax = 29; 
		for (int d = 1; d <= daymax; d++)
		{
			for (int h = 0; h < 24; h++)
			{
				double min = this->m_data[idx]->minute;
				for (int tsph = 0; tsph < ts_per_hour; tsph++)
				{
					min += tsph * ts_min;
					if (this->m_data[idx]->month != m || this->m_data[idx]->day != d || this->m_data[idx]->hour != h
					    || this->m_data[idx]->minute != min)
						return false;
					else
						idx++;
				}
			}
		}
	}
	return true;
}
bool weatherdata :: check_continuous_single_year ( bool leapyear ) { int ts_per_hour = 0 ; if ( leapyear ) ts_per_hour = ( int ) ( m_nRecords / 8784 ) ; else ts_per_hour = ( int ) ( m_nRecords / 8760 ) ; double ts_min = 60. / ts_per_hour ; int idx = 0 ; for ( int m = 1 ; m <= 12 ; m ++ ) { int daymax = util :: days_in_month ( m - 1 ) ; if ( m == 2 && leapyear ) daymax = 29 ; for ( int d = 1 ; d <= daymax ; d ++ ) { for ( int h = 0 ; h < 24 ; h ++ ) { double min = this -> m_data [ idx ] -> minute ; for ( int tsph = 0 ; tsph < ts_per_hour ; tsph ++ ) { min += tsph * ts_min ; if ( this -> m_data [ idx ] -> month != m || this -> m_data [ idx ] -> day != d || this -> m_data [ idx ] -> hour != h || this -> m_data [ idx ] -> minute != min ) return false ; else idx ++ ; } } } } return true ; }
this function checks the weather data to make sure that it is a single, continuous year with an even timestep starting jan 1 and ending dec 31
HOWEVER, the year value may vary (i.e., TMY) so only checking month, day, hour, minute timesteps, not actual year vector
this function checks the weather data to make sure that it is a single continuous year with an even timestep starting jan 1 and ending dec 31 HOWEVER the year value may vary ( i . e . TMY ) so only checking month day hour minute timesteps not actual year vector
//determine the number of timesteps in each hour //determine the number of minutes of each timestep // index to keep track of where we are in the timestamp vectors // now, check that the month, hour, day, and minute vectors are consistent with a single, continuous year with an // even timestep that starts on jan 1 and ends dec 31 //make sure to account for leap day in Feb //if any of the month, day, hour, or minute don't line up with what we've calculated, then it doesn't fit our criteria for a continuous year