コード例 #1
0
void
AGActivityGenHandler::parseParameters(const SUMOSAXAttributes& attrs) {
    try	{
        myCity.statData.carPreference = attrs.getFloatSecure(AGEN_ATTR_CARPREF, 0.0);
        myCity.statData.speedTimePerKm = attrs.getFloatSecure(AGEN_ATTR_CITYSPEED, 360.0);
        myCity.statData.freeTimeActivityRate = attrs.getFloatSecure(AGEN_ATTR_FREETIMERATE, 0.15);
        myCity.statData.uniformRandomTrafficRate = attrs.getFloatSecure(AGEN_ATTR_UNI_RAND_TRAFFIC, 0.0);
        myCity.statData.departureVariation = attrs.getFloatSecure(AGEN_ATTR_DEP_VARIATION, 0.0);

    } catch (const exception& e) {
        WRITE_ERROR("Error while parsing the element " +
                    SUMOXMLDefinitions::Tags.getString(AGEN_TAG_PARAM) + ": " +
                    e.what());
        throw ProcessError();
    }
}
コード例 #2
0
void
AGActivityGenHandler::parseGeneralCityInfo(const SUMOSAXAttributes& attrs) {
    try {
        myCity.statData.inhabitants = attrs.getInt(AGEN_ATTR_INHABITANTS);
        myCity.statData.households = attrs.getInt(AGEN_ATTR_HOUSEHOLDS);
        myCity.statData.limitAgeChildren = attrs.getIntSecure(AGEN_ATTR_CHILDREN, 18);
        myCity.statData.limitAgeRetirement = attrs.getIntSecure(AGEN_ATTR_RETIREMENT, 63);
        myCity.statData.carRate = attrs.getFloatSecure(AGEN_ATTR_CARS, 0.58);
        myCity.statData.unemployement = attrs.getFloatSecure(AGEN_ATTR_UNEMPLOYEMENT, 0.06);
        myCity.statData.maxFootDistance = attrs.getFloatSecure(AGEN_ATTR_MAX_FOOT_DIST, 300.0);
        myCity.statData.incomingTraffic = attrs.getIntSecure(AGEN_ATTR_IN_TRAFFIC, 0);
        myCity.statData.outgoingTraffic = attrs.getIntSecure(AGEN_ATTR_OUT_TRAFFIC, 0);

    } catch (const exception& e) {
        WRITE_ERROR("Error while parsing the element " +
                    SUMOXMLDefinitions::Tags.getString(AGEN_TAG_GENERAL) + ": " +
                    e.what());
        throw ProcessError();
    }
}