AvailabilityManagerHighTemperatureTurnOn::AvailabilityManagerHighTemperatureTurnOn(const Model& model) : AvailabilityManager(AvailabilityManagerHighTemperatureTurnOn::iddObjectType(),model) { OS_ASSERT(getImpl<detail::AvailabilityManagerHighTemperatureTurnOn_Impl>()); setTemperature(30); }
ChromoConditions::ChromoConditions(double iColumnLength, double iColumnDiameter, double iColumnPoreSize, Gradient iGradient, double iSecondSolventConcentrationA, double iSecondSolventConcentrationB, double iDelayTime, double iFlowRate, double iDV, double iColumnRelativeStrength, double iColumnVpToVtot, double iColumnPorosity, double iTemperature) throw(ChromoConditionsException) { // Set an empty gradient to prevent recalculation of SSConcentrations. mGradient = Gradient(); setMixingCorrection(false); setColumnLength(iColumnLength); setColumnDiameter(iColumnDiameter); setColumnPoreSize(iColumnPoreSize); setColumnVpToVtot(iColumnVpToVtot); setColumnPorosity(iColumnPorosity); setTemperature(iTemperature); setColumnRelativeStrength(iColumnRelativeStrength); setFlowRate(iFlowRate); setDV(iDV); setDelayTime(iDelayTime); setSecondSolventConcentrationA(iSecondSolventConcentrationA); setSecondSolventConcentrationB(iSecondSolventConcentrationB); setGradient(iGradient); }
int cmd_Start(int iStep){ // Meshing if (steps >= iStep){ unsigned long timePause = 60u * 1000u * params[iStep-1][1]; char buffer[256]; displayData(itoa(iStep, buffer, 10)); displayData(","); displayData(itoa(params[iStep-1][1], buffer, 10)); displayData(","); displayData(itoa(durationMillis / 60u / 1000u, buffer, 10)); displayData(","); int maxTemp = params[iStep-1][0]; if(params[iStep-1][3] == 1 && isWait){ maxTemp = 0; if(readYes()) iStep++; } Serial.println(iStep); if (setTemperature(maxTemp)){ Serial.println(maxTemp); unsigned long curMillis = millis(); durationMillis = durationMillis + (curMillis - prevMillis); prevMillis = curMillis; if (durationMillis > timePause){ if(params[iStep-1][2] == 0){ goNext = true; }else if((params[iStep-1][2] == 1) && (readYes())){ goNext = true; }else isWait = true; if(goNext){ durationMillis = 0; prevMillis = millis(); iStep++; displayData("Step: "); displayData(itoa(iStep, buffer, 10)); displayData("\r\n"); goNext = false; isWait = false; } } }else{ prevMillis = millis(); } }else displayData("Finished\r\n"); // Check gravity // Boiling with melt // Boiling + hop delay(1000); return iStep; }
void ThermoPhase::setState_conditional_TP(doublereal t, doublereal p, bool set_p) { setTemperature(t); if (set_p) { setPressure(p); } }
// The loop function is called in an endless loop void loop() { delay(SENSOR_CHANGE_TRIGGER_TIME); unsigned long unchangedTime = millis() - lastMotionDetected; if (unchangedTime < MAX_ON_TIME) { lcd.display(); lcd.backlight(); switch (sensor) { case TEMPERATURE_SENSOR_NUM: setTemperature(); break; case HUMIDITY_SENSOR_NUM: setHumidity(); break; case SOIL_SENSOR_NUM: setSoilHumidity(); break; case PRESSURE_SENSOR_NUM: setPressure(); break; } } else { lcd.noDisplay(); lcd.noBacklight(); } delay(500); }
void LatticeSim::init(){ lattice->setAA(fn_aa); setInitialConfig(); setTemperature(0.2); lattice->stats.getLatticeStats(lattice); lattice->setNative(); lattice->stats.getLatticeStats(lattice); }
void PDSS_ConstVol::setState_TR(doublereal temp, doublereal rho) { doublereal rhoStored = m_mw / m_constMolarVolume; if (fabs(rhoStored - rho) / (rhoStored + rho) > 1.0E-4) { throw CanteraError("PDSS_ConstVol::setState_TR", "Inconsistent supplied rho"); } setTemperature(temp); }
Status::Status(){ setSolenoid(0); setReedSwitch(0); setVibration(0); setMic(1023); setHumidity(0.0); setTemperature(0.0); }
/// initialise simulation and create lattice void Simulation2D::init(string fn_pdb){ lattice->readPDBMultiChain(fn_pdb); setTemperature(0.2); lattice->stats.getLatticeStats(lattice); lattice->setNative(); lattice->stats.getLatticeStats(lattice); }
Integrator::Integrator( double temperature, double frictionCoeff, double stepSize, const Parameters ¶ms ) : maxEigenvalue( 4.34e5 ), stepsSinceDiagonalize( 0 ), mParameters( params ), mAnalysis( new Analysis ) { setTemperature( temperature ); setFriction( frictionCoeff ); setStepSize( stepSize ); setConstraintTolerance( 1e-4 ); setMinimumLimit( mParameters.minLimit ); setRandomNumberSeed( ( int ) time( 0 ) ); }
bool TemperatureSensor::StoreTemperature(float t) { if (t == NAN) { // error reading value setTemperature (NAN); setRawTemperature(NAN); return false; } else { // raw, non-corrected, values setRawTemperature(t); // correct based on calibration values t = t * getCal(TEMP_CAL_INDEX_TEMP_SLOPE) + getCal(TEMP_CAL_INDEX_TEMP_OFFSET); // store the corrected temperature value setTemperature(t); return true; } return false; }
/// Initialized the main CoMD data stucture, SimFlat, based on command /// line input from the user. Also performs certain sanity checks on /// the input to screen out certain non-sensical inputs. /// /// Simple data members such as the time step dt are initialized /// directly, substructures such as the potential, the link cells, the /// atoms, etc., are initialized by calling additional initialization /// functions (initPotential(), initLinkCells(), initAtoms(), etc.). /// Initialization order is set by the natural dependencies of the /// substructure such as the atoms need the link cells so the link cells /// must be initialized before the atoms. SimFlat* initSimulation(Command cmd) { SimFlat* sim = comdMalloc(sizeof(SimFlat)); sim->nSteps = cmd.nSteps; sim->printRate = cmd.printRate; sim->dt = cmd.dt; sim->domain = NULL; sim->boxes = NULL; sim->atoms = NULL; sim->ePotential = 0.0; sim->eKinetic = 0.0; sim->atomExchange = NULL; sim->pot = initPotential(cmd.doeam, cmd.potDir, cmd.potName, cmd.potType); real_t latticeConstant = cmd.lat; if (cmd.lat < 0.0) latticeConstant = sim->pot->lat; // ensure input parameters make sense. sanityChecks(cmd, sim->pot->cutoff, latticeConstant, sim->pot->latticeType); sim->species = initSpecies(sim->pot); real3 globalExtent; globalExtent[0] = cmd.nx * latticeConstant; globalExtent[1] = cmd.ny * latticeConstant; globalExtent[2] = cmd.nz * latticeConstant; sim->domain = initDecomposition( cmd.xproc, cmd.yproc, cmd.zproc, globalExtent); sim->boxes = initLinkCells(sim->domain, sim->pot->cutoff); sim->atoms = initAtoms(sim->boxes); // create lattice with desired temperature and displacement. createFccLattice(cmd.nx, cmd.ny, cmd.nz, latticeConstant, sim); setTemperature(sim, cmd.temperature); randomDisplacements(sim, cmd.initialDelta); sim->atomExchange = initAtomHaloExchange(sim->domain, sim->boxes); // Forces must be computed before we call the time stepper. startTimer(redistributeTimer); redistributeAtoms(sim); stopTimer(redistributeTimer); startTimer(computeForceTimer); computeForce(sim); stopTimer(computeForceTimer); kineticEnergy(sim); return sim; }
void Phase::restoreState(size_t lenstate, const doublereal* state) { if (lenstate >= nSpecies() + 2) { setMassFractions_NoNorm(state + 2); setTemperature(state[0]); setDensity(state[1]); } else { throw ArraySizeError("Phase::restoreState", lenstate,nSpecies()+2); } }
void SurfPhase::setStateFromXML(const XML_Node& state) { double t; if (getOptionalFloat(state, "temperature", t, "temperature")) { setTemperature(t); } if (state.hasChild("coverages")) { string comp = getChildValue(state,"coverages"); setCoveragesByName(comp); } }
void PDSS_Water::constructSet() { if (m_sub) { delete m_sub; } m_sub = new WaterPropsIAPWS(); if (m_sub == 0) { throw CanteraError("PDSS_Water::initThermo", "could not create new substance object."); } /* * Calculate the molecular weight. * hard coded to Cantera's elements and Water. */ m_mw = 2 * 1.00794 + 15.9994; /* * Set the baseline */ doublereal T = 298.15; m_p0 = OneAtm; doublereal presLow = 1.0E-2; doublereal oneBar = 1.0E5; doublereal dens = 1.0E-9; m_dens = m_sub->density(T, presLow, WATER_GAS, dens); m_pres = presLow; SW_Offset = 0.0; doublereal s = entropy_mole(); s -= GasConstant * log(oneBar/presLow); if (s != 188.835E3) { SW_Offset = 188.835E3 - s; } s = entropy_mole(); s -= GasConstant * log(oneBar/presLow); //printf("s = %g\n", s); doublereal h = enthalpy_mole(); if (h != -241.826E6) { EW_Offset = -241.826E6 - h; } h = enthalpy_mole(); //printf("h = %g\n", h); /* * Set the initial state of the system to 298.15 K and * 1 bar. */ setTemperature(298.15); m_dens = m_sub->density(298.15, OneAtm, WATER_LIQUID); m_pres = OneAtm; }
void PreferencesUnits::syncSettings() { auto units = SettingsObjectWrapper::instance()->unit_settings; QString unitSystem[] = {"metric", "imperial", "personal"}; short unitValue = ui->metric->isChecked() ? METRIC : (ui->imperial->isChecked() ? IMPERIAL : PERSONALIZE); units->setUnitSystem(unitSystem[unitValue]); units->setTemperature(ui->fahrenheit->isChecked() ? units::FAHRENHEIT : units::CELSIUS); units->setLength(ui->feet->isChecked() ? units::FEET : units::METERS); units->setPressure(ui->psi->isChecked() ? units::PSI : units::BAR); units->setVolume(ui->cuft->isChecked() ? units::CUFT : units::LITER); units->setWeight(ui->lbs->isChecked() ? units::LBS : units::KG); units->setVerticalSpeedTime(ui->vertical_speed_minutes->isChecked() ? units::MINUTES : units::SECONDS); units->setCoordinatesTraditional(ui->gpsTraditional->isChecked()); }
void SingleSpeciesTP::setState_SV(doublereal s, doublereal v, doublereal tol) { doublereal dt; setDensity(1.0/v); for (int n = 0; n < 50; n++) { dt = (s - entropy_mass())*temperature()/cv_mass(); if (dt > 100.0) dt = 100.0; else if (dt < -100.0) dt = -100.0; setTemperature(temperature() + dt); if (fabs(dt) < tol) { return; } } throw CanteraError("setState_SV","no convergence. dt = " + fp2str(dt)); }
SampleSAT::SampleSAT(SatProblem* sat, samplesatparams* ssparams, bool csmode, learnparams* lparams) { sat_ = sat; ssparams_ = ssparams; lparams_ = lparams; setWalkMax(ssparams_->walkmax); setNumSample(ssparams_->numSample); setWalkSatProb(ssparams_->walksatProb); setRandomWalkProb(ssparams_->randomWalkProb); setTemperature(ssparams_->temperature); numAtom = sat_->getNumVariables(); numClause = sat_->getNumClauses(); numSample = 0; stepAve = 0; csmode_ = csmode; }
void SingleSpeciesTP::setState_UV(doublereal u, doublereal v, doublereal tol) { doublereal dt; setDensity(1.0/v); for (int n = 0; n < 50; n++) { dt = (u - intEnergy_mass())/cv_mass(); if (dt > 100.0) dt = 100.0; else if (dt < -100.0) dt = -100.0; setTemperature(temperature() + dt); if (fabs(dt) < tol) { return; } } throw CanteraError("setState_UV", "no convergence. dt = " + fp2str(dt)+"\n" +"u = "+fp2str(u)+" v = "+fp2str(v)+"\n"); }
void SingleSpeciesTP::setState_SV(doublereal s, doublereal v, doublereal tol) { doublereal dt; if (v == 0.0) { setDensity(1.0E100); } else { setDensity(1.0/v); } for (int n = 0; n < 50; n++) { dt = clip((s - entropy_mass())*temperature()/cv_mass(), -100.0, 100.0); setTemperature(temperature() + dt); if (fabs(dt) < tol) { return; } } throw CanteraError("setState_SV","no convergence. dt = " + fp2str(dt)); }
HardwareState::HardwareState() { // set initial states and values of modules setEnergy((MIN_PROPER_VOLTAGE + MAX_PROPER_VOLTAGE)/2); setEnergyCurrent(MAX_PROPER_CURRENT); setEnergyStatus(MODULE_ON); setTemperature((MAX_PROPER_TEMPERATURE + MIN_PROPER_TEMPERATURE)/2); setTemperatureStatus(MODULE_ON); setPayload(1); setPayloadStatus(MODULE_STANDBY); setSband(1); setSbandStatus(MODULE_STANDBY); setSolarPanels(1); setSolarPanelsStatus(MODULE_ON); setThermalControl(1); setThermalControlStatus(MODULE_STANDBY); }
/// starts a simulation round /// \param nMcSteps the number of Monte Carlo steps /// \param temperature the temperature at which the simulation is performed /// \param step iteration number for statistics /// returns the number of energy samples taken int Simulation2D::simulate ( int nMcSteps, double temperature, int step){ // get a pointer to the chain to simulate (first chain on the lattice) Chain2D * chain= lattice->chains[0]; // set the temperature setTemperature(temperature); // set the fraction of global moves (point rotations) double pGlobal= 0.1; // keep the accumalitive statistics for the // and number of native contacts (sumCn) double sumCn=0; // calculate the the fraction of sampling int modSampling = nMcSteps / MAX_SAMPLES; int sample=0; // perform monte carlo moves for(int i=0;i<nMcSteps;i++){ chain->localMove(); if(drand48() < pGlobal){ chain->globalMove(); } //sample // update the number of native contacts sumCn += getNativeContacts(); // store energy as often as 'modSampling' allows if(((i % modSampling) == 0) && sample < MAX_SAMPLES){ energyTable[step][sample] = getEnergy(); sample++; } } // store statistics temperatureTable[step]= temperature; // get fraction of native contacts nativeContactsTable[step]= sumCn/(nMcSteps * getTotalNativeContacts()); // return the number of samples taken return sample; }
void SingleSpeciesTP::setState_UV(doublereal u, doublereal v, doublereal tol) { doublereal dt; if (v == 0.0) { setDensity(1.0E100); } else { setDensity(1.0/v); } for (int n = 0; n < 50; n++) { dt = clip((u - intEnergy_mass())/cv_mass(), -100.0, 100.0); setTemperature(temperature() + dt); if (fabs(dt) < tol) { return; } } throw CanteraError("setState_UV", "no convergence. dt = " + fp2str(dt)+"\n" +"u = "+fp2str(u)+" v = "+fp2str(v)+"\n"); }
void PDSS_Water::constructSet() { /* * Calculate the molecular weight. * hard coded to Cantera's elements and Water. */ m_mw = 2 * 1.00794 + 15.9994; /* * Set the baseline */ doublereal T = 298.15; m_p0 = OneAtm; doublereal presLow = 1.0E-2; doublereal oneBar = 1.0E5; doublereal dens = 1.0E-9; m_dens = m_sub.density(T, presLow, WATER_GAS, dens); m_pres = presLow; SW_Offset = 0.0; doublereal s = entropy_mole(); s -= GasConstant * log(oneBar/presLow); if (s != 188.835E3) { SW_Offset = 188.835E3 - s; } s = entropy_mole(); s -= GasConstant * log(oneBar/presLow); doublereal h = enthalpy_mole(); if (h != -241.826E6) { EW_Offset = -241.826E6 - h; } h = enthalpy_mole(); /* * Set the initial state of the system to 298.15 K and * 1 bar. */ setTemperature(298.15); m_dens = m_sub.density(298.15, OneAtm, WATER_LIQUID); m_pres = OneAtm; }
void assign(const FluidState& fs) { if (enableTemperature || enableEnergy) setTemperature(fs.temperature(/*phaseIdx=*/0)); unsigned pvtRegionIdx = getPvtRegionIndex_<FluidState>(fs); setPvtRegionIndex(pvtRegionIdx); setRs(Opm::BlackOil::getRs_<FluidSystem, FluidState, Scalar>(fs, pvtRegionIdx)); setRv(Opm::BlackOil::getRv_<FluidSystem, FluidState, Scalar>(fs, pvtRegionIdx)); for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { setSaturation(phaseIdx, fs.saturation(phaseIdx)); setPressure(phaseIdx, fs.pressure(phaseIdx)); setDensity(phaseIdx, fs.density(phaseIdx)); if (enableEnergy) setEnthalpy(phaseIdx, fs.enthalpy(phaseIdx)); setInvB(phaseIdx, getInvB_<FluidSystem, FluidState, Scalar>(fs, phaseIdx, pvtRegionIdx)); } }
PDSS_Water::PDSS_Water() : m_waterProps(&m_sub), m_dens(1000.0), m_iState(WATER_LIQUID), EW_Offset(0.0), SW_Offset(0.0), m_allowGasPhase(false) { m_minTemp = 200.; m_maxTemp = 10000.; m_mw = 2*getElementWeight("H") + getElementWeight("O"); // Set the baseline doublereal T = 298.15; m_p0 = OneAtm; doublereal presLow = 1.0E-2; doublereal oneBar = 1.0E5; doublereal dens = 1.0E-9; m_dens = m_sub.density(T, presLow, WATER_GAS, dens); m_pres = presLow; SW_Offset = 0.0; doublereal s = entropy_mole(); s -= GasConstant * log(oneBar/presLow); if (s != 188.835E3) { SW_Offset = 188.835E3 - s; } s = entropy_mole(); s -= GasConstant * log(oneBar/presLow); doublereal h = enthalpy_mole(); if (h != -241.826E6) { EW_Offset = -241.826E6 - h; } h = enthalpy_mole(); // Set the initial state of the system to 298.15 K and 1 bar. setTemperature(298.15); m_dens = m_sub.density(298.15, OneAtm, WATER_LIQUID); m_pres = OneAtm; }
void Programme::setFromData(uint8_t f0, uint8_t f1, uint8_t f2, uint8_t f3, uint8_t f4) { if (f0 == 0xFF) { // Weekday programme setWeekday(true); setWeekdays(f2); } else { // Non-weekday programme setWeekday(false); setStartDayNumber(f0); setEndDayNumber(f2); } // Load start and end times setStartTime(f1); setEndTime(f3); // Load temperature setTemperature(f4); }
void ThermoPhase::setStateFromXML(const XML_Node& state) { string comp = getChildValue(state,"moleFractions"); if (comp != "") { setMoleFractionsByName(comp); } else { comp = getChildValue(state,"massFractions"); if (comp != "") { setMassFractionsByName(comp); } } if (state.hasChild("temperature")) { double t = getFloat(state, "temperature", "temperature"); setTemperature(t); } if (state.hasChild("pressure")) { double p = getFloat(state, "pressure", "pressure"); setPressure(p); } if (state.hasChild("density")) { double rho = getFloat(state, "density", "density"); setDensity(rho); } }
void WeatherPlugin::element_end(const char *el) { if (!strcmp(el, "obst")){ setLocation(m_data.c_str()); m_data = ""; return; } if (!strcmp(el, "lsup")){ setUpdated(m_data.c_str()); m_data = ""; return; } if (!strcmp(el, "sunr") && m_bCC){ setSun_raise(m_data.c_str()); m_data = ""; return; } if (!strcmp(el, "suns") && m_bCC){ setSun_set(m_data.c_str()); m_data = ""; return; } if (!strcmp(el, "vis") && m_bCC){ setVisibility(m_data.c_str()); m_data = ""; return; } if (!strcmp(el, "tmp") && m_bCC){ setTemperature(atol(m_data.c_str())); m_data = ""; return; } if (!strcmp(el, "flik") && m_bCC){ setFeelsLike(atol(m_data.c_str())); m_data = ""; return; } if (!strcmp(el, "devp") && m_bCC){ setDewPoint(atol(m_data.c_str())); m_data = ""; return; } if (!strcmp(el, "hmid") && m_bCC){ setHumidity(atol(m_data.c_str())); m_data = ""; return; } if (!strcmp(el, "low") && m_day){ setMinT(m_day, m_data.c_str()); m_data = ""; return; } if (!strcmp(el, "hi") && m_day){ setMaxT(m_day, m_data.c_str()); m_data = ""; return; } if (!strcmp(el, "t")){ if (!m_bBar && !m_bWind && !m_bUv){ if (m_bCC){ setConditions(m_data.c_str()); }else{ setDayConditions(m_day, m_data.c_str()); } } if (m_bWind && m_bCC) setWind(m_data.c_str()); m_data = ""; return; } if (!strcmp(el, "icon")){ if (m_bCC){ setIcon(atol(m_data.c_str())); }else{ setDayIcon(m_day, m_data.c_str()); } m_data = ""; return; } if (!strcmp(el, "ut")){ setUT(m_data.c_str()); m_data = ""; return; } if (!strcmp(el, "up")){ setUP(m_data.c_str()); m_data = ""; return; } if (!strcmp(el, "us")){ setUS(m_data.c_str()); m_data = ""; return; } if (!strcmp(el, "gust") && m_bCC){ setWindGust(atol(m_data.c_str())); m_data = ""; return; } if (!strcmp(el, "bar")){ m_bBar = false; return; } if (!strcmp(el, "cc")){ m_bCC = false; return; } if (!strcmp(el, "r") && m_bBar && m_bCC){ unsigned long v = 0; for (const char *p = m_data.c_str(); *p; p++){ if (*p == '.') break; if (*p == ',') continue; v = (v * 10) + (*p - '0'); } setPressure(v); return; } if (!strcmp(el, "d") && m_bBar && m_bCC){ setPressureD(m_data.c_str()); m_data = ""; return; } if (!strcmp(el, "wind")){ m_bWind = false; return; } if (!strcmp(el, "s") && m_bWind && m_bCC){ setWind_speed(atol(m_data.c_str())); return; } if (!strcmp(el, "uv")){ m_bUv = false; return; } }
void PDSS_IdealGas::setState_TR(doublereal temp, doublereal rho) { m_pres = GasConstant * temp * rho / m_mw; setTemperature(temp); }