示例#1
0
ParseBlock* CostConfig::toBlock() const
{
    ParseBlock *ret = resolution::AlgorithmConfig::toBlock();
    
    // Type
    ret->setProperty("cost_type", objective_type);
    
    // Bounds
    
    ParseBlock *bounds_block = new ParseBlock;
    
    bounds_block->setProperty("upper", functions::printVector(upper_bounds));
    bounds_block->setProperty("lower", functions::printVector(lower_bounds));
    bounds_block->setProperty("speed", functions::printVector(speed_bounds));
    
    ret->setBlock("bounds", bounds_block);

    
    // Cost parameters
    ParseBlock *cost_block = new ParseBlock;
    
    cost_block -> setProperty("distance", numberToString(distance_cost));
    cost_block -> setProperty("collision_penalty", numberToString(collision_penalty));
    ret->setBlock("cost", cost_block);
    
    // Sampling parameters
    ret->setProperty("population", numberToString(population));
    ret->setProperty("generations", numberToString(generations));
    ret->setProperty("max_time", numberToString(max_time));
    
    ret->setProperty("waypoint_dimension", numberToString(waypoint_dimension));
    ret->setProperty("intermediate_waypoints", numberToString(intermediate_waypoints));
    ret->setProperty("altitude_levels", boolToString(altitude_levels));
    ret->setProperty("altitude_step", numberToString(altitude_step));
    ret->setProperty("export_evolution", boolToString(export_evolution));
    ret->setProperty("evolution_filename", evolution_file);
    ret->setProperty("time_exploration", boolToString(time_exploration));
    switch (time_exploration_type) {
      case INDEPENDENT_VELOCITY:
	ret->setProperty("time_exploration_type", numberToString(INDEPENDENT_VELOCITY));
	break;
	
      default:
	ret->setProperty("time_exploration_type", numberToString(MANTAIN_ETA));
    }
    ret->setProperty("speed_factor", numberToString(speed_factor));
    
    // MS-PSO stuff
    ret->setProperty("manoeuvre_selection", boolToString(manoeuvre_selection));
    ret->setProperty("min_z", numberToString(min_z));
    ret->setProperty("max_z", numberToString(max_z));
    ret->setProperty("max_course", numberToString(max_course));
    
    return ret;
}
示例#2
0
void TestbedConfigManager::writeTestbedConfigToStream(Common::WriteStream *ws) {
	for (Common::Array<Testsuite *>::const_iterator i = _testsuiteList.begin(); i < _testsuiteList.end(); i++) {
		_configFileInterface.setKey("this", (*i)->getName(), boolToString((*i)->isEnabled()));
		const Common::Array<Test *> &testList = (*i)->getTestList();
		for (Common::Array<Test *>::const_iterator j = testList.begin(); j != testList.end(); j++) {
			_configFileInterface.setKey((*j)->featureName, (*i)->getName(), boolToString((*j)->enabled));
		}
	}
	_configFileInterface.saveToStream(*ws);
	ws->flush();
}
示例#3
0
static void triggerInfo(Engine *engine) {
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)

	trigger_shape_s *ts = &engine->triggerShape;

	scheduleMsg(&logger, "Template %s/%d trigger %d", getConfigurationName(engineConfiguration->engineType),
			engineConfiguration->engineType, engineConfiguration->triggerConfig.triggerType);

	scheduleMsg(&logger, "trigger event counters %d/%d/%d/%d", triggerCentral.getHwEventCounter(0),
			triggerCentral.getHwEventCounter(1), triggerCentral.getHwEventCounter(2),
			triggerCentral.getHwEventCounter(3));
	scheduleMsg(&logger, "expected cycle events %d/%d/%d", ts->expectedEventCount[0],
			engine->triggerShape.expectedEventCount[1], ts->expectedEventCount[2]);

	scheduleMsg(&logger, "trigger type=%d/need2ndChannel=%s", engineConfiguration->triggerConfig.triggerType,
			boolToString(engineConfiguration->needSecondTriggerInput));
	scheduleMsg(&logger, "expected duty #0=%f/#1=%f", ts->dutyCycle[0], ts->dutyCycle[1]);

	scheduleMsg(&logger, "isError %s/total errors=%d ord_err=%d/total revolutions=%d/self=%s",
			boolToString(isTriggerDecoderError()), triggerCentral.triggerState.totalTriggerErrorCounter,
			triggerCentral.triggerState.orderingErrorCounter, triggerCentral.triggerState.getTotalRevolutionCounter(),
			boolToString(engineConfiguration->directSelfStimulation));
#endif

#if EFI_PROD_CODE
	scheduleMsg(&logger, "sn=%s ignitionMathTime=%d schTime=%d triggerMaxDuration=%d",
			boolToString(ts->isSynchronizationNeeded), engine->ignitionMathTime, engine->ignitionSchTime,
			triggerMaxDuration);

	triggerMaxDuration = 0;

	scheduleMsg(&logger, "maxLockTime=%d / maxTriggerReentraint=%d", maxLockTime, maxTriggerReentraint);
	scheduleMsg(&logger, "maxEventQueueTime=%d", maxEventQueueTime);

	scheduleMsg(&logger, "primary trigger simulator: %s %s freq=%d",
			hwPortname(boardConfiguration->triggerSimulatorPins[0]),
			pinModeToString(boardConfiguration->triggerSimulatorPinModes[0]),
			boardConfiguration->triggerSimulatorFrequency);
	scheduleMsg(&logger, "secondary trigger simulator: %s %s phase=%d",
			hwPortname(boardConfiguration->triggerSimulatorPins[1]),
			pinModeToString(boardConfiguration->triggerSimulatorPinModes[1]), triggerSignal.safe.phaseIndex);
	scheduleMsg(&logger, "3rd trigger simulator: %s %s", hwPortname(boardConfiguration->triggerSimulatorPins[2]),
			pinModeToString(boardConfiguration->triggerSimulatorPinModes[2]));

	scheduleMsg(&logger, "trigger error extra LED: %s %s", hwPortname(boardConfiguration->triggerErrorPin),
			pinModeToString(boardConfiguration->triggerErrorPinMode));

	scheduleMsg(&logger, "primary trigger input: %s", hwPortname(boardConfiguration->triggerInputPins[0]));
	scheduleMsg(&logger, "secondary trigger input: %s", hwPortname(boardConfiguration->triggerInputPins[1]));
	scheduleMsg(&logger, "primary logic input: %s", hwPortname(boardConfiguration->logicAnalyzerPins[0]));
	scheduleMsg(&logger, "secondary logic input: %s", hwPortname(boardConfiguration->logicAnalyzerPins[1]));

#endif /* EFI_PROD_CODE */
}
示例#4
0
/*  INFO: Не получилось сравнить дтва std::tuple "штатными средствами boost".
    Реализовал через "строковое представление". 
*/
std::string PhaseStateToString(PhaseState phase)
{
  std::string rezult = "(";
  rezult += boolToString(phase.A);
  rezult += " ";
  rezult += boolToString(phase.B);
  rezult += " ";
  rezult += boolToString(phase.C);
  rezult += " ";
  rezult += boolToString(phase.D);
  rezult += ")";
  return rezult;
}
示例#5
0
static void canInfo(void) {
	if (!engineConfiguration->isCanEnabled) {
		scheduleMsg(&logger, "CAN is not enabled, please enable & restart");
		return;
	}

	scheduleMsg(&logger, "CAN TX %s", hwPortname(boardConfiguration->canTxPin));
	scheduleMsg(&logger, "CAN RX %s", hwPortname(boardConfiguration->canRxPin));
	scheduleMsg(&logger, "type=%d canReadEnabled=%s canWriteEnabled=%s period=%d", engineConfiguration->canNbcType,
			boolToString(engineConfiguration->canReadEnabled), boolToString(engineConfiguration->canWriteEnabled),
			engineConfiguration->canSleepPeriod);

	scheduleMsg(&logger, "CAN rx count %d/tx ok %d/tx not ok %d", canReadCounter, canWriteOk, canWriteNotOk);
}
void RenderThread::setSwitches(bool aa, bool sfx, bool lfx, bool hsize, bool hfps,
                               bool fewpart, bool xsmooth, bool ntsc, bool nopmult, bool varw)
{
    switchAA = boolToString(aa);
    switchShapeFX = boolToString(sfx);
    switchLayerFX = boolToString(lfx);
    switchHalfSize = boolToString(hsize);
    switchHalfFPS = boolToString(hfps);
    switchFewParticles = boolToString(fewpart);
    switchExtraSmooth = boolToString(xsmooth);
    switchNTSCSafe = boolToString(ntsc);
    switchPremultiply = boolToString(!nopmult); // This option is weird.
    switchVariableWidths = boolToString(varw);
}
示例#7
0
static void showFuelInfo2(float rpm, float engineLoad) {

	float baseFuelMs = getBaseTableFuel(engineConfiguration, (int) rpm, engineLoad);

	scheduleMsg(&logger, "SD magic fuel %f", sdMath(engineConfiguration, 100, 100, 14.7, convertCelsiusToKelvin(20)));
	scheduleMsg(&logger, "inj flow %fcc/min displacement %fL", engineConfiguration->injector.flow,
			engineConfiguration->specs.displacement);

	scheduleMsg(&logger2, "algo=%s/pump=%s", getEngine_load_mode_e(engineConfiguration->algorithm),
			boolToString(enginePins.fuelPumpRelay.getLogicValue()));

	scheduleMsg(&logger2, "injection phase=%f/global fuel correction=%f", getinjectionOffset(rpm), engineConfiguration->globalFuelCorrection);

	scheduleMsg(&logger2, "baro correction=%f", engine->engineState.baroCorrection);

#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
	scheduleMsg(&logger, "base cranking fuel %f", engineConfiguration->cranking.baseFuel);
	scheduleMsg(&logger2, "cranking fuel: %f", getCrankingFuel(PASS_ENGINE_PARAMETER_F));

	if (engine->rpmCalculator.isRunning()) {
		float iatCorrection = engine->engineState.iatFuelCorrection;
		float cltCorrection = engine->engineState.cltFuelCorrection;
		float injectorLag = engine->injectorLagMs;
		scheduleMsg(&logger2, "rpm=%f engineLoad=%f", rpm, engineLoad);
		scheduleMsg(&logger2, "baseFuel=%f", baseFuelMs);

		scheduleMsg(&logger2, "iatCorrection=%f cltCorrection=%f injectorLag=%f", iatCorrection, cltCorrection,
				injectorLag);

		float value = getRunningFuel(baseFuelMs, (int) rpm PASS_ENGINE_PARAMETER);
		scheduleMsg(&logger2, "injection pulse width: %f", value);
	}
#endif
}
/*
    Test interoperation timer against current time. Return true if timed out
    or timer set 0 zero indicating that the timer is not active.
    Returns bool true if timer not zero and Interoperation timer
    is greater than interoperation timeout (i.e timed out).
*/
bool EnumerationContext::isTimedOut(Uint64 currentTime)
{
    PEGASUS_DEBUG_ASSERT(valid());

    if (_operationTimerUsec == 0)
    {
            return false;
    }

    bool timedOut = _operationTimerUsec <= currentTime;

#ifdef ENUMERATION_CONTEXT_DIAGNOSTIC_TRACE
    PEG_TRACE((TRC_ENUMCONTEXT, Tracer::LEVEL4,
        "isTimedOut Timer. ContextId=%s timer(sec)=%lu"
           " current(sec)=%lu time to timeout(usec)=%ld isTimedOut=%s",
        *Str(getContextId()),
        (long unsigned int)(_operationTimerUsec / PEG_MICROSEC),
        (long unsigned int)(currentTime / PEG_MICROSEC),
        (long signed int)((_operationTimerUsec - currentTime)),
        boolToString(timedOut) ));
#endif
    // If it is timed out, set timer inactive.
    if (timedOut)
    {
        _operationTimerUsec = 0;
    }
    return(timedOut);
}
    static STString itemToStr(const STDataItem &item)
    {
        STString ret;

        if (!item.isValid() ) {
            return ret;
        }

        ret += "<" + item.tagName() + ">";
        if (item.type() == Type_Parent) {
            STDataItems childs = item.childs();
            for (unsigned int i=0; i<childs.size(); ++i) {
                ret += itemToStr(childs[i]);
            }
        }
        else {
            switch (item.type() ) {
            case Type_Bool:
                ret += "<bool>" + boolToString(item.toBool() ) + "</bool>";
                break;
            case Type_Int:
                ret += "<int>" + intToString(item.toInt() ) + "</int>";
                break;
            case Type_String:
                ret += "<string>" + item.toString() + "</string>";
                break;
            default:
                break;
            }
        }
        ret += "</" + item.tagName() + ">";

        return ret;
    }
示例#10
0
void BoolEditor::setValue(const bool &aValue)
{
    ui->valueCheckBox->blockSignals(true);

    ui->valueCheckBox->setChecked(aValue);
    ui->valueCheckBox->setText(boolToString(aValue));

    ui->valueCheckBox->blockSignals(false);
}
示例#11
0
//// KS_FUTURE make DEBUG compile only
// Diagnostic display of data in the enumeration context object
void EnumerationContext::trace()
{
    PEGASUS_DEBUG_ASSERT(valid());
    PEG_TRACE((TRC_ENUMCONTEXT, Tracer::LEVEL3,
        "EnumerationContextTrace ContextId=%s "
        "requestOperationTimeOut=%u "
        "operationTimer=%lu sec "
        "continueOnError=%s "
        "pullMsgType=%s "
        "processingState=%s "
        "providersComplete=%s "
        "closed=%s "
        "timeOpen=%lu ms "
        "totalPullCount=%u "
        "cacheHighWaterMark=%u "
        "Request count=%u "
        "ResponseObjectCount=%u "
        "totalWaitTimeUsec=%llu "
        "maxWaitTimeUsec=%llu "
        "RequestedResponseObjectCount=%u "
        "consecutiveZeroLenObjectResponseCtr=%u "
        "totalZeroLenObjectResponseCounter=%u"
        "ResponseCacheSize=%u",
        *Str(getContextId()),
        _operationTimeoutSec,
        (long unsigned int)_operationTimerUsec,
        boolToString(_continueOnError),
        MessageTypeToString(_pullRequestType),
        processingState(),
        boolToString(_providersComplete),
        boolToString(_clientClosed),
        (long unsigned int)
            (System::getCurrentTimeUsec() - _startTimeUsec)/1000,
        _pullOperationCounter,
        _cacheHighWaterMark,
        _requestCount,
        _responseObjectsCount,
        _totalWaitTimeUsec,
        _maxWaitTimeUsec,
        _requestedResponseObjectsCount,
        _consecutiveZeroLenObjectResponseCounter,
        _totalZeroLenObjectResponseCounter,
         responseCacheSize()));
}
void JucerFillType::fillInGeneratedCode (GeneratedCode& code, String& paintMethodCode) const
{
    String s;

    switch (mode)
    {
    case solidColour:
        s << "g.setColour (" << colourToCode (colour) << ");\n";
        break;

    case linearGradient:
    case radialGradient:
        {
            String x1, y1, w, h, x2, y2;
            positionToCode (gradPos1, code.document->getComponentLayout(), x1, y1, w, h);
            positionToCode (gradPos2, code.document->getComponentLayout(), x2, y2, w, h);

            s << "g.setGradientFill (ColourGradient (";

            const String indent (String::repeatedString (T(" "), s.length()));

            s << colourToCode (gradCol1) << ",\n"
              << indent << castToFloat (x1) << ", " << castToFloat (y1) << ",\n"
              << indent << colourToCode (gradCol2) << ",\n"
              << indent << castToFloat (x2) << ", " << castToFloat (y2) << ",\n"
              << indent << boolToString (mode == radialGradient) << "));\n";
            break;
        }

    case imageBrush:
        {
            const String imageVariable ("cachedImage_" + imageResourceName + "_" + String (code.getUniqueSuffix()));

            code.addImageResourceLoader (imageVariable, imageResourceName);

            String x, y, w, h;
            positionToCode (imageAnchor, code.document->getComponentLayout(), x, y, w, h);

            s << "g.setTiledImageFill (*";

            const String indent (String::repeatedString (T(" "), s.length()));

            s << imageVariable << ",\n"
              << indent << x << ", " << y << ",\n"
              << indent << valueToFloat (imageOpacity) << ");\n";

            break;
        }

    default:
        jassertfalse
        break;
    }

    paintMethodCode += s;
}
示例#13
0
/*!
  Sets rememberDimensions value in configuration to \a newValue.

  \sa rememberDimensions
  */
void CcfConfig::setRememberDimensions(bool newValue)
{
    QString current = mConfiguration->value("remember dimensions on exit");
    bool currentBool = stringToBool(current);

    if (currentBool != newValue) {
        mConfiguration->replace("remember dimensions on exit", boolToString(newValue));
        emit rememberDimensionsChanged();
    }
}
示例#14
0
static void printAllInfo(void) {
	printTemperatureInfo();
	printTPSInfo();
#if EFI_WAVE_CHART
	scheduleMsg(&logger, "waveChartUsedSize=%d", waveChartUsedSize);
#endif
#if EFI_PROD_CODE
	scheduleMsg(&logger, "console mode jumper: %s", boolToString(!GET_CONSOLE_MODE_VALUE()));
#endif
}
示例#15
0
static void printTemperatureInfo(void) {
#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__)
	printThermistor("CLT", &engineConfiguration->clt, &engine->engineState.cltCurve);
	if (!isValidCoolantTemperature(getCoolantTemperature(PASS_ENGINE_PARAMETER_F))) {
		scheduleMsg(&logger, "CLT sensing error");
	}
	printThermistor("IAT", &engineConfiguration->iat, &engine->engineState.iatCurve);
	if (!isValidIntakeAirTemperature(getIntakeAirTemperature(PASS_ENGINE_PARAMETER_F))) {
		scheduleMsg(&logger, "IAT sensing error");
	}

	scheduleMsg(&logger, "fan=%s @ %s", boolToString(enginePins.fanRelay.getLogicValue()),
			hwPortname(boardConfiguration->fanPin));

	scheduleMsg(&logger, "A/C relay=%s @ %s", boolToString(enginePins.acRelay.getLogicValue()),
			hwPortname(boardConfiguration->acRelayPin));

#endif
}
示例#16
0
static void speedInfo(void) {
	scheduleMsg(logger, "VSS %s at %s", boolToString(engineConfiguration->hasVehicleSpeedSensor),
			hwPortname(boardConfiguration->vehicleSpeedSensorInputPin));

	scheduleMsg(logger, "c=%f eventCounter=%d speed=%f",
			engineConfiguration->vehicleSpeedCoef,
			vssCounter,
			getVehicleSpeed());
	scheduleMsg(logger, "vss diff %d", vssDiff);

}
示例#17
0
static void cylinderCleanupControl(Engine *engine) {
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
	bool newValue;
	if (engineConfiguration->isCylinderCleanupEnabled) {
		newValue = !engine->rpmCalculator.isRunning(PASS_ENGINE_PARAMETER_F) && getTPS(PASS_ENGINE_PARAMETER_F) > CLEANUP_MODE_TPS;
	} else {
		newValue = false;
	}
	if (newValue != engine->isCylinderCleanupMode) {
		engine->isCylinderCleanupMode = newValue;
		scheduleMsg(&logger, "isCylinderCleanupMode %s", boolToString(newValue));
	}
#endif
}
示例#18
0
//--------------------------------------------------------------
string ofxOpenNIUser::getDebugInfo(){
    ostringstream info;
    info << "XnUserID: " << ofToString(XnID) << " ";
    info << "autoCalibrate: " << boolToString(bUseAutoCalibration) << " ";
    info << "isFound: " << boolToString(isFound()) << " ";
    info << "isTracking: " << boolToString(isTracking()) << " ";
    info << "isSkeleton: " << boolToString(isSkeleton()) << " ";
    info << "isCalibrating: " << boolToString(isCalibrating()) << endl;
    info << "useMaskPixels: " << boolToString(getUseMaskPixels()) << " ";
    info << "useMaskTexture: " << boolToString(getUseMaskTexture()) << " ";
    info << "usePointCloud: " << boolToString(getUsePointCloud()) << " ";
    if (bUsePointCloud) {
        info << "pointCloudDrawSize: " << ofToString(pointCloudDrawSize) << " ";
        info << "pointCloudResolution: " << ofToString(pointCloudResolution) << " ";
    }
    return info.str();
}
示例#19
0
/*!
  Sets maximised configuration value to \a newValue.

  \sa maximised
  */
void CcfConfig::setMaximised(bool newValue)
{
//    QString current = configuration->value("maximised").first;
//    bool currentBool = stringToBool(current);
    bool currentBool = isMaximised();

    if (currentBool != newValue) {
        mConfiguration->replace("maximised", boolToString(newValue));
        emit maximisedChanged();
        if (newValue)
            emit maximise();
        else
            emit demaximise();
    }
}
示例#20
0
文件: hip9011.cpp 项目: rusefi/rusefi
static void showHipInfo(void) {
	if (!CONFIGB(isHip9011Enabled)) {
		scheduleMsg(logger, "hip9011 driver not active");
		return;
	}

	printSpiState(logger, boardConfiguration);
	scheduleMsg(logger, "enabled=%s state=%s bore=%.2fmm freq=%.2fkHz PaSDO=%d",
			boolToString(CONFIGB(isHip9011Enabled)),
			getHip_state_e(instance.state),
			engineConfiguration->cylinderBore, getHIP9011Band(PASS_HIP_PARAMS),
			engineConfiguration->hip9011PrescalerAndSDO);

	char *outputName = getPinNameByAdcChannel("hip", engineConfiguration->hipOutputChannel, hipPinNameBuffer);

	scheduleMsg(logger, "band_index=%d gain %.2f/index=%d output=%s", instance.currentBandIndex, engineConfiguration->hip9011Gain, instance.currentGainIndex,
			outputName);
	scheduleMsg(logger, "integrator index=%d knockVThreshold=%.2f knockCount=%d maxKnockSubDeg=%.2f",
	            instance.currentIntergratorIndex, engineConfiguration->knockVThreshold,
	            engine->knockCount, engineConfiguration->maxKnockSubDeg);

	const char * msg = instance.invalidHip9011ResponsesCount > 0 ? "NOT GOOD" : "ok";
	scheduleMsg(logger, "spi=%s IntHold@%s/%d response count=%d incorrect response=%d %s",
			getSpi_device_e(engineConfiguration->hip9011SpiDevice),
			hwPortname(CONFIGB(hip9011IntHoldPin)),
			CONFIGB(hip9011IntHoldPinMode),
			instance.correctResponsesCount, instance.invalidHip9011ResponsesCount,
			msg);
	scheduleMsg(logger, "CS@%s updateCount=%d", hwPortname(CONFIGB(hip9011CsPin)), instance.settingUpdateCount);

#if EFI_PROD_CODE
	scheduleMsg(logger, "hip %.2fv/last=%.2f@%s/max=%.2f adv=%d",
			engine->knockVolts,
			getVoltage("hipinfo", engineConfiguration->hipOutputChannel),
			getPinNameByAdcChannel("hip", engineConfiguration->hipOutputChannel, pinNameBuffer),
			hipValueMax,
			CONFIGB(useTpicAdvancedMode));
	scheduleMsg(logger, "mosi=%s", hwPortname(getMosiPin(engineConfiguration->hip9011SpiDevice)));
	scheduleMsg(logger, "miso=%s", hwPortname(getMisoPin(engineConfiguration->hip9011SpiDevice)));
	scheduleMsg(logger, "sck=%s", hwPortname(getSckPin(engineConfiguration->hip9011SpiDevice)));
#endif /* EFI_PROD_CODE */

	scheduleMsg(logger, "start %.2f end %.2f", engineConfiguration->knockDetectionWindowStart,
			engineConfiguration->knockDetectionWindowEnd);

	hipValueMax = 0;
	engine->printKnockState();
}
示例#21
0
ParseBlock* GeneticConfig::toBlock() const
{
    ParseBlock *ret = resolution::CostConfig::toBlock();
    
    ret->setProperty("initializer_type", initializer_type);
    ret->setProperty("crossover_type", crossover_type);
    ret->setProperty("mutator_type", mutator_type);
    ret->setProperty("custom_evolution", boolToString(custom_evolution));
    ret->setProperty("search_ratio", numberToString(search_ratio));
    ret->setProperty("max_checks", numberToString(max_checks));
    ret->setProperty("mutation_probability", numberToString(pMutation));
    ret->setProperty("crossover_probability", numberToString(pCrossover));
    ret->setProperty("mutation_deviation", numberToString(mutation_dev));
    
    return ret;
}
示例#22
0
static void printAnalogChannelInfoExt(const char *name, adc_channel_e hwChannel, float adcVoltage,
		float dividerCoeff) {
#if HAL_USE_ADC || defined(__DOXYGEN__)
	if (hwChannel == EFI_ADC_NONE) {
		scheduleMsg(&logger, "ADC is not assigned for %s", name);
		return;
	}

	if (fastAdc.isHwUsed(hwChannel)) {
		scheduleMsg(&logger, "fast enabled=%s", boolToString(boardConfiguration->isFastAdcEnabled));
	}

	float voltage = adcVoltage * dividerCoeff;
	scheduleMsg(&logger, "%s ADC%d %s %s adc=%f/input=%fv/divider=%f", name, hwChannel, getAdcMode(hwChannel),
			getPinNameByAdcChannel(name, hwChannel, pinNameBuffer), adcVoltage, voltage, dividerCoeff);
#endif
}
/*
 * A general handler for any uncaught exception.
 * Prints details about the exception and then tries to print a stack trace.
 */
static void stanfordCppLibTerminateHandler() {
    signalHandlerDisable();   // don't want both a signal AND a terminate() call
    std::string DEFAULT_EXCEPTION_KIND = "An exception";
    std::string DEFAULT_EXCEPTION_DETAILS = "(unknown exception details)";
    
    std::string msg;
    msg += "\n";
    msg += " ***\n";
    msg += " *** STANFORD-WHITTIER C++ LIBRARY\n";
    msg += " *** " + DEFAULT_EXCEPTION_KIND + " occurred during program execution: \n";
    msg += " *** " + DEFAULT_EXCEPTION_DETAILS + "\n";
    msg += " ***\n";
    
    std::ostream& out = std::cerr;
    try {
        throw;   // re-throws the exception that already occurred
    } catch (const ErrorException& ex) {
        FILL_IN_EXCEPTION_TRACE(ex, "An ErrorException", ex.what());
    }
//    catch (const InterruptedIOException& /* iex */) {
//        // blocked console I/O was interrupted; just exit program immediately
//        // (doesn't close any other JBE-generated GUI windows, but oh well)
//        std::cout.flush();
//        exit(0);
//    }
    catch (const std::exception& ex) {
        FILL_IN_EXCEPTION_TRACE(ex, "A C++ exception", ex.what());
    } catch (std::string str) {
        FILL_IN_EXCEPTION_TRACE(str, "A string exception", str);
    } catch (char const* str) {
        FILL_IN_EXCEPTION_TRACE(str, "A string exception", str);
    } catch (int n) {
        FILL_IN_EXCEPTION_TRACE(n, "An int exception", integerToString(n));
    } catch (long l) {
        FILL_IN_EXCEPTION_TRACE(l, "A long exception", longToString(l));
    } catch (char c) {
        FILL_IN_EXCEPTION_TRACE(c, "A char exception", charToString(c));
    } catch (bool b) {
        FILL_IN_EXCEPTION_TRACE(b, "A bool exception", boolToString(b));
    } catch (double d) {
        FILL_IN_EXCEPTION_TRACE(d, "A double exception", realToString(d));
    } catch (...) {
        std::string ex = "Unknown";
        FILL_IN_EXCEPTION_TRACE(ex, "An exception", std::string());
    }
}
示例#24
0
bool hasHeapBytesFree (GC_state s, size_t oldGen, size_t nursery) {
  size_t total;
  bool res;

  total =
    s->heap.oldGenSize + oldGen 
    + (s->canMinor ? 2 : 1) * (size_t)(s->limitPlusSlop - s->heap.nursery);
  res = 
    (total <= s->heap.size) 
    and (nursery <= (size_t)(s->limitPlusSlop - s->frontier));
  if (DEBUG_DETAILED)
    fprintf (stderr, "%s = hasBytesFree (%s, %s)\n",
             boolToString (res),
             uintmaxToCommaString(oldGen),
             uintmaxToCommaString(nursery));
  return res;
}
示例#25
0
QString SoilType::toHtml() const
{
    // Requires that the HTML header is already established.
    QString html = tr("<a name=\"%1\">%1</a>"
                       "<table border=\"0\">"
                       "<tr><th>Name:</th><td>%1</td></tr>"
                       "<tr><th>Notes:</th><td>%2</td></tr>"
                       "<tr><th>Unit Weight:</th><td>%3 %4</td></tr>"
                       "<tr><th>Initial Damping:</th><td>%5</td></tr>"
                       "<tr><th>Varied:</th><td>%6</td></tr>"
                       )
            .arg(m_name)
            .arg(m_notes)
            .arg(m_untWt)
            .arg(Units::instance()->untWt())
            .arg(m_damping)
            .arg(boolToString(m_isVaried));


    // Print the darendeli model parameters
    if (qobject_cast<DarendeliNonlinearProperty*>(m_modulusModel)
         || qobject_cast<DarendeliNonlinearProperty*>(m_dampingModel))
        html += tr(
                "<tr><th>Mean Stress:</th><td>%1 atm</td></tr>"
                "<tr><th>Plasticity index:</th><td>%2</td>"
                "<tr><th>Over-consolidation ratio:</th><td>%3</td></tr>"
                "<tr><th>Excitation frequency:</th><td>%4 Hz</td></tr>"
                "<tr><th>Number of cycles:</th><td>%5</td></tr>"
                )
        .arg(m_meanStress)
        .arg(m_pi)
        .arg(m_ocr)
        .arg(m_freq)
        .arg(m_nCycles);

    html += "</table>";

    // Print the information of the damping and modulus reduction
    // Techincally tables aren't supposed to be used for layout, but f**k em
    html += QString("<table border = \"0\"><tr><td>%1</td><td>%2</td></tr></table>")
            .arg( m_modulusModel->toHtml()). arg(m_dampingModel->toHtml());

    return html;
}
示例#26
0
static void showIdleInfo(void) {
	scheduleMsg(logger, "idleMode=%s position=%f isStepper=%s", getIdle_mode_e(engineConfiguration->idleMode),
			getIdlePosition(), boolToString(boardConfiguration->useStepperIdle));
	if (boardConfiguration->useStepperIdle) {
		scheduleMsg(logger, "direction=%s reactionTime=%f", hwPortname(boardConfiguration->idle.stepperDirectionPin),
				engineConfiguration->idleStepperReactionTime);
		scheduleMsg(logger, "step=%s steps=%d", hwPortname(boardConfiguration->idle.stepperStepPin),
				engineConfiguration->idleStepperTotalSteps);
		scheduleMsg(logger, "enable=%s", hwPortname(engineConfiguration->stepperEnablePin));
	} else {
		scheduleMsg(logger, "idle valve freq=%d on %s", boardConfiguration->idle.solenoidFrequency,
				hwPortname(boardConfiguration->idle.solenoidPin));
	}
	scheduleMsg(logger, "idleControl=%s", getIdle_control_e(engineConfiguration->idleControl));
	scheduleMsg(logger, "idle P=%f I=%f D=%f dT=%d", engineConfiguration->idleRpmPid.pFactor,
			engineConfiguration->idleRpmPid.iFactor,
			engineConfiguration->idleRpmPid.dFactor,
			engineConfiguration->idleDT);
}
示例#27
0
void splitHeader(GC_state s, GC_header header,
                 GC_objectTypeTag *tagRet, bool *hasIdentityRet,
                 uint16_t *bytesNonObjptrsRet, uint16_t *numObjptrsRet) {
  unsigned int objectTypeIndex; 
  GC_objectType objectType; 
  GC_objectTypeTag tag;
  bool hasIdentity;
  uint16_t bytesNonObjptrs, numObjptrs;

  assert (1 == (header & GC_VALID_HEADER_MASK)); 
  objectTypeIndex = (header & TYPE_INDEX_MASK) >> TYPE_INDEX_SHIFT; 
  assert (objectTypeIndex < s->objectTypesLength); 
  objectType = &(s->objectTypes[objectTypeIndex]);
  tag = objectType->tag; 
  hasIdentity = objectType->hasIdentity; 
  bytesNonObjptrs = objectType->bytesNonObjptrs; 
  numObjptrs = objectType->numObjptrs; 

  if (DEBUG_DETAILED) 
    fprintf (stderr, 
             "splitHeader ("FMTHDR")" 
             "  objectTypeIndex = %u"
             "  tag = %s" 
             "  hasIdentity = %s" 
             "  bytesNonObjptrs = %"PRIu16 
             "  numObjptrs = %"PRIu16"\n", 
             header, 
             objectTypeIndex,
             objectTypeTagToString(tag), 
             boolToString(hasIdentity), 
             bytesNonObjptrs, numObjptrs); 

  if (tagRet != NULL)
    *tagRet = tag;
  if (hasIdentityRet != NULL)
    *hasIdentityRet = hasIdentity;
  if (bytesNonObjptrsRet != NULL)
    *bytesNonObjptrsRet = bytesNonObjptrs;
  if (numObjptrsRet != NULL)
    *numObjptrsRet = numObjptrs;
}
示例#28
0
/*
    Test the cache to see if there is information that could be used
    for an immediate response. Returns immediatly with true or false
    indicating that a response should be issued.
    @param count Uint32 count of objects that the requests set as
    max number for response
    @return True if passes tests for something to send or error flag
    set.
*/
bool EnumerationContext::testCacheForResponses(
    Uint32 operationMaxObjectCount,
    bool requiresAll)
{
    bool rtn = false;

    // Error encountered, must send response. This makes error highest
    // priority.
    if (isErrorState())
    {
        rtn = true;
    }
    // Always allow requests for no objects
    else if (operationMaxObjectCount == 0)
    {
        rtn = true;
    }
    // If cache has enough objects return true
    else if (requiresAll && (responseCacheSize() >= operationMaxObjectCount))
    {
        rtn = true;
    }
    // anything in cache to return
    else if (!requiresAll && responseCacheSize() > 0)
    {
        rtn = true;
    }
    // Nothing more from providers. Must return response
    else if (providersComplete())
    {
        rtn = true;
    }

#ifdef ENUMERATION_CONTEXT_DIAGNOSTIC_TRACE
    PEG_TRACE((TRC_ENUMCONTEXT, Tracer::LEVEL4,
       "testCacheForResponse returns %s for ContextId=%s",
               boolToString(rtn), *Str(getContextId()) ));
#endif
    return rtn;
}
示例#29
0
static void showHipInfo(void) {
	if (!boardConfiguration->isHip9011Enabled) {
		scheduleMsg(logger, "hip9011 driver not active");
		return;
	}

	printSpiState(logger, boardConfiguration);
	scheduleMsg(logger, "enabled=%s state=%d bore=%fmm freq=%fkHz PaSDO=%d",
			boolToString(boardConfiguration->isHip9011Enabled),
			state,
			engineConfiguration->cylinderBore, getBand(),
			engineConfiguration->hip9011PrescalerAndSDO);

	scheduleMsg(logger, "band_index=%d gain %f/index=%d", currentBandIndex, boardConfiguration->hip9011Gain, currentGainIndex);
	scheduleMsg(logger, "integrator index=%d knockVThreshold=%f knockCount=%d maxKnockSubDeg=%f",
	            currentIntergratorIndex, engineConfiguration->knockVThreshold,
	            engine->knockCount, engineConfiguration->maxKnockSubDeg);

	scheduleMsg(logger, "spi=%s IntHold@%s response count=%d incorrect response=%d",
			getSpi_device_e(hipSpiDevice),
			hwPortname(boardConfiguration->hip9011IntHoldPin),
			correctResponse, invalidResponse);
	scheduleMsg(logger, "CS@%s updateCount=%d", hwPortname(boardConfiguration->hip9011CsPin), settingUpdateCount);

	scheduleMsg(logger, "hip %fv/last=%f@%s/max=%f spiCount=%d adv=%d",
			engine->knockVolts,
			getVoltage("hipinfo", engineConfiguration->hipOutputChannel),
			getPinNameByAdcChannel("hip", engineConfiguration->hipOutputChannel, pinNameBuffer),
			hipValueMax,
			spiCount, boardConfiguration->useTpicAdvancedMode);
	scheduleMsg(logger, "mosi=%s", hwPortname(getMosiPin(hipSpiDevice)));
	scheduleMsg(logger, "miso=%s", hwPortname(getMisoPin(hipSpiDevice)));
	scheduleMsg(logger, "sck=%s", hwPortname(getSckPin(hipSpiDevice)));

	scheduleMsg(logger, "start %f end %f", engineConfiguration->knockDetectionWindowStart,
			engineConfiguration->knockDetectionWindowEnd);

	hipValueMax = 0;
	engine->printKnockState();
}
示例#30
0
int PostOffice::get_trace_buffers(MsgEnv* message_envelope){
	if (message_envelope == NULL){
		return INVALID_INPUT;
	}

	//Make sure the envelope's contents are empty
	if (strlen(message_envelope->_messageContents) > 0 ){
		for (int i = 0; i < MESSAGE_SIZE; i ++) message_envelope->_messageContents[i] = 0;
	}
	MessageLog* nextLog;

	char* dataPtr = message_envelope->_messageContents;
    dataPtr = dataPtr + sprintf(dataPtr, "Send/Receive    From         To           Message Type    Timestamp\n");
	for (int i=0; i < _traceBuffer->getCount(); i++){
		nextLog = _traceBuffer->dequeue();
		dataPtr = dataPtr + sprintf(dataPtr, "%-16s", boolToString(nextLog->_isSend));
        dataPtr = dataPtr + sprintf(dataPtr, "%-13s", PROCESS_DESCS[nextLog->_senderID]);
        dataPtr = dataPtr + sprintf(dataPtr, "%-13s", PROCESS_DESCS[nextLog->_destinationID]);
        dataPtr = dataPtr + sprintf(dataPtr, "%-16s", MESSAGETYPE_DESCS[nextLog->_messageType]);
		dataPtr = dataPtr + sprintf(dataPtr, "%02i:%02i:%02i\n", nextLog->_hours,nextLog->_minutes,nextLog->_seconds);
		_traceBuffer->enqueue(nextLog);
	}
	return SUCCESS;
}