TVFloat CPV::getNextDayFrc ( int time_ref ){ TVFloat result; result = getNextDayNrFrc( time_ref ); for ( int i = 0 ; i < result.size() ; i++ ){ result[i] *= m_fPAmp; } return result; };
void CSimulator::_configureGrid ( XMLElement* elem ){ string attr; // Get Grid maximum amplitude if ( elem->Attribute("amp") ){ attr = elem->Attribute("amp"); m_sSimCnf.GridProfile.amp = atof( attr.c_str() ); } else{ m_sSimCnf.GridProfile.amp = 0.0; } // Configure grid sinusiodal components int nCmp; if ( elem->Attribute("cmp") ){ attr = elem->Attribute("cmp"); nCmp = atoi( attr.c_str() ); } else{ nCmp = 0; } if ( nCmp > 0 ){ m_pcGrid->setSCmp ( elem ); } // Get Profile if ( elem->Attribute("file") ){ string file_name; attr = elem->Attribute("file"); file_name.assign ( m_sSimCnf.sDataFolder ); file_name.append ( attr ); ifstream inputFile ( file_name.c_str() ); if ( inputFile.is_open() ){ TVFloat profile; float tmp_float, tmp_float_old, slope; inputFile.ignore ( 256, ' ' ); inputFile.ignore ( 256, ' ' ); inputFile.ignore ( 256, ' ' ); inputFile.ignore ( 256, ' ' ); inputFile.ignore ( 256, ' ' ); inputFile >> tmp_float_old; inputFile.ignore ( 256, '\n' ); inputFile.ignore ( 256, ' ' ); inputFile.ignore ( 256, ' ' ); inputFile.ignore ( 256, ' ' ); inputFile.ignore ( 256, ' ' ); inputFile.ignore ( 256, ' ' ); while( !inputFile.eof() ){ inputFile >> tmp_float; slope = (tmp_float - tmp_float_old)/60.0; for ( int j = 0 ; j < 60 ; j++ ){ profile.push_back( tmp_float_old + slope * j ); } tmp_float_old = tmp_float; inputFile.ignore ( 256, '\n' ); inputFile.ignore ( 256, ' ' ); inputFile.ignore ( 256, ' ' ); inputFile.ignore ( 256, ' ' ); inputFile.ignore ( 256, ' ' ); inputFile.ignore ( 256, ' ' ); } inputFile.close(); m_sSimCnf.GridProfile.dur = profile.size(); m_sSimCnf.GridProfile.profile = profile; // Normalized profile TVFloat nr_profile; float max = 0.0; for ( int i = 0 ; i < profile.size() ; i++ ){ if ( profile[i] > max ){ max = profile[i]; } } for ( int i = 0 ; i < profile.size() ; i++ ){ nr_profile.push_back( profile[i] / max ); } m_sSimCnf.GridProfile.nr_profile = nr_profile; }