Ejemplo n.º 1
0
void OpenSMOKE_ICEM::DefineFromFile(const std::string inputFile)
{
    double			double_value;
    std::string			string_value;
    int				int_value;
	vector<string>  string_vector;

    OpenSMOKE_Dictionary_ICEM dictionary;
    dictionary.ParseFile(inputFile);


    // COMPULSORY: Rotation Rate
	if (dictionary.Return("#RotationRate", double_value, string_value))
		AssignRotationRate(string_value, double_value);

    // COMPULSORY: Compression Ratio
	if (dictionary.Return("#CompressionRatio", double_value))
		AssignCompressionRatio(double_value);

    // COMPULSORY: Reactor Clearance Volume
    if (dictionary.Return("#ClearanceVolume", double_value, string_value))
        AssignClearanceVolume(string_value, double_value);

    // COMPULSORY: Arm Ratio
    if (dictionary.Return("#ArmRatio", double_value))
        AssignArmRatio(double_value);

    // COMPULSORY: Start angle
    if (dictionary.Return("#StartAngle", double_value, string_value))
        AssignStartAngle(string_value, double_value);
	
	// COMPULSORY: Start angle
    if (dictionary.Return("#Diameter", double_value, string_value))
        AssignDiameter(string_value, double_value);

	// OPTIONAL: Number of cycles
    if (dictionary.Return("#NumberOfCycles", double_value))
        SetNumberOfCycles(double_value);



	// OPTIONAL: KeySpecies
    if (dictionary.Return("#Key", string_vector))
        SetKeySpecies(string_vector);

    // OPTIONAL: Output folder
    if (dictionary.Return("#Output", string_value))
        SetOutputFolder(string_value);

    // OPTIONAL: Print Options
    if (dictionary.Return("#Nvideo", int_value))
        SetVideoOptions(int_value);

    // OPTIONAL: Print Options
    if (dictionary.Return("#Nfile", int_value))
        SetFileOptions(int_value);

    // OPTIONAL: Print Options
    if (dictionary.Return("#NoVerbose"))
        UnsetVerbose();

	// OPTIONAL: Verbose Energy
    if (dictionary.Return("#VerboseEnergy"))
        SetVerboseEnergy();

    // OPTIONAL: Global kinetics
    if (dictionary.Return("#GlobalKinetics"))
        SetGlobalKinetics();

    // OPTIONAL: Relative tolerance
    if (dictionary.Return("#RelTol", double_value))
        SetRelativeTolerance(double_value);

    // OPTIONAL: Absolute tolerance
    if (dictionary.Return("#AbsTol", double_value))
        SetAbsoluteTolerance(double_value);

	// OPTIONAL: Adiabatic
    if (dictionary.Return("#Adiabatic"))
        SetAdiabatic();


	// OPTIONAL: Heat flux
    if (dictionary.Return("#Qe", double_value, string_value))
        SetConstantHeatFlux(double_value, string_value);

	// OPTIONAL: Exchange area
    if (dictionary.Return("#A", double_value, string_value))
        SetConstantExchangeArea(double_value, string_value);

	// OPTIONAL: Exchange coefficient
    if (dictionary.Return("#U", double_value, string_value))
        SetConstantHeatExchangeCoefficient(double_value, string_value);

	// OPTIONAL: Ambient temperature
    if (dictionary.Return("#Twall", double_value, string_value))
        SetConstantAmbientTemperature(double_value, string_value);


	// OPTIONAL: UserDefined_Qe
    if (dictionary.Return("#UserDefined_Qe", string_value))
        SetUserDefinedHeatFlux(string_value);

	// OPTIONAL: UserDefined_Ae
    if (dictionary.Return("#UserDefined_A", string_value))
        SetUserDefinedExchangeArea(string_value);

	// OPTIONAL: UserDefined_U
    if (dictionary.Return("#UserDefined_U", string_value))
        SetUserDefinedHeatExchangeCoefficient(string_value);

	// OPTIONAL: UserDefined_Twall
    if (dictionary.Return("#UserDefined_Twall", string_value))
        SetUserDefinedAmbientTemperature(string_value);
 

	// OPTIONAL: TwoEquationModel
    if (dictionary.Return("#2E_Model"))
        SetTwoEquationModel();

	// OPTIONAL: Reaction Rates
    if (dictionary.Return("#ReactionRates", string_vector))
		SetReactionRatesOnFile(string_vector);

	// OPTIONAL: Formation Rates
    if (dictionary.Return("#FormationRates", string_vector))
		SetFormationRatesOnFile(string_vector);

	// OPTIONAL: Rate of Production Analysis
    if (dictionary.Return("#ROPA"))
		SetROPAOnFile();

	// OPTIONAL: Sensitivity Analysis
    if (dictionary.Return("#Sensitivity", string_vector))
		SetSensitivityOnFile(string_vector);

	Lock();
}
Ejemplo n.º 2
0
///////////////////////////////////////////////////////////////////////////////////
// 
// Function Name: hv_gps_start
// Parameters: 
// Description: 
//        Start GPS
// Notes: sjchen 2012/09/04
//
///////////////////////////////////////////////////////////////////////////////////
static int hv_gps_start()
{
	GpsSvStatus sv_inf;

	LOGE("GPS Starting=======================");

	//Clear the SV info 
	memset(&sv_inf,0,sizeof(GpsSvStatus));
	sv_inf.size = sizeof(GpsSvStatus);
	(*g_sv_status_cb)(&sv_inf);

	WaitSem(&s_hStopSem,180000); //3 minute

  if(g_GPSStarted)
  {
         sem_post(&s_hStopSem);
         return -1;
  }

	unsigned long  u32ParameterAge = 604800;

	//for save GPS temporary file
	SetOutputFolder((char *)"/data/gpsdata");

	if(!InitGbc())
	{
		LOGE("InitGbc failed \r\n");
		return -1;
	}

	if(LoadParameter())
	{
		u32ParameterAge = GetParameterAge();
	}	

	if(u32ParameterAge < 7000) //about 2 hours 
	{
		GPS_HotStart();
	}
	else if(u32ParameterAge < 86400) // one day
	{
		GPS_WarmStart();
	}
	else 
	{
		GPS_ColdStart();
	}

	D("GPS Started %d\r\n",u32ParameterAge);

	g_GPSStarted = true;

	D("%s: called", __FUNCTION__);

	LOGE("GPS Starting====================done");


	sem_post(&s_hStopSem);

	return 0;
}