コード例 #1
0
ファイル: filence.c プロジェクト: github188/SimpleCode
static void initialize(void) {
	size_t	size = MEMORY_CREATION_SIZE;
	size_t	slack;
	Slot *	slot;

	FE_Print(version);

	lock();

	/*
	 * Get the run-time configuration of the virtual memory page size.
 	 */
	bytesPerPage = Page_Size();

	/*
	 * Figure out how many Slot structures to allocate at one time.
	 */
	slotCount = slotsPerPage = bytesPerPage / sizeof(Slot);
	allocationListSize = bytesPerPage;

	if ( allocationListSize > size )
		size = allocationListSize;

	if ( (slack = size % bytesPerPage) != 0 )
		size += bytesPerPage - slack;

	/*
	 * Allocate memory, and break it up into two malloc buffers. The
	 * first buffer will be used for Slot structures, the second will
	 * be marked free.
	 */
	slot = allocationList = (Slot *)DpsMalloc(size);
	memset((char *)allocationList, 0, allocationListSize);

	/*
	 * Account for the two slot structures that we've used.
	 */
	unUsedSlots = slotCount;

	release();
#ifdef HAVE_PTHREAD
	if (!semEnabled) {
		semEnabled = 1;
		if (sem_init(&FE_sem, 0, 1) < 0) {
		  semEnabled = 0;
		}
	}
#endif
}
コード例 #2
0
ファイル: Emissions.cpp プロジェクト: kravitz/transims4
Emissions::Emissions (void) : Demand_Service ()
{
	Program ("Emissions");
	Version ("4.0.16");
	Title ("Apply Vehicle Emissions Rates");

	Network_File optional_network [] = {
		DIRECTORY, LINK, NODE, ZONE, ACTIVITY_LOCATION, END_NETWORK
	};
	Demand_File optional_demand [] = {
		VEHICLE, END_DEMAND
	};

	char *keys [] = {
		SPEED_BIN_FILE,
		SPEED_BIN_FORMAT,
		SPEED_BIN_FACTOR,
		SPEED_BIN_FILE_x,
		SPEED_BIN_FORMAT_x,
		SPEED_BIN_FACTOR_x,

		TRAVELER_FILE,
		TRAVELER_FORMAT,

		VOLUME_SPEED_FILE,
		VOLUME_SPEED_FORMAT,
		VOLUME_SPEED_FACTOR,
		VOLSPD_LENGTH_FIELD,
		VOLSPD_LENGTH_UNITS,
		VOLSPD_FACILITY_FIELD,
		VOLSPD_RAMP_FACILITY,
		VOLSPD_AREATYPE_FIELD,
		VOLSPD_PERIOD_FIELD,
		VOLSPD_PERIOD_UNITS,
		VOLSPD_SPEED_FIELD,
		VOLSPD_SPEED_UNITS,
		VOLSPD_VOLUME_FIELD_x,
		USE_SIMPLE_INTERPOLATION,

		EMISSION_RATE_FILE,
		EMISSION_RATE_FORMAT,
		RATE_YEAR_FIELD,
		RATE_MONTH_FIELD,
		RATE_PERIOD_FIELD,
		RATE_REGION_FIELD,
		RATE_AREA_TYPE_FIELD,
		RATE_FACILITY_FIELD,
		RATE_ROAD_TYPE_FIELD,
		RATE_VEHICLE_FIELD,
		RATE_POLLUTANT_FIELD,
		RATE_SPEED_BIN_FIELD,
		EMISSION_RATE_FIELD,
		EMISSION_RATE_UNITS,
		EMISSION_RATE_POLLUTANT,

		EMISSION_RATE_FILE_x,
		EMISSION_RATE_FORMAT_x,
		RATE_YEAR_FIELD_x,
		RATE_MONTH_FIELD_x,
		RATE_PERIOD_FIELD_x,
		RATE_REGION_FIELD_x,
		RATE_AREA_TYPE_FIELD_x,
		RATE_FACILITY_FIELD_x,
		RATE_ROAD_TYPE_FIELD_x,
		RATE_VEHICLE_FIELD_x,
		RATE_POLLUTANT_FIELD_x,
		RATE_SPEED_BIN_FIELD_x,
		EMISSION_RATE_FIELD_x,
		EMISSION_RATE_UNITS_x,
		EMISSION_RATE_POLLUTANT_x,

		YEAR_NUMBER_x,
		MONTH_NUMBER_x,
		PERIOD_NUMBER_x,
		REGION_NUMBER_x,
		AREA_TYPE_NUMBER_x,
		FACILITY_NUMBER_x,
		ROAD_TYPE_NUMBER_x,
		VEHICLE_NUMBER_x,
		SPEED_BIN_NUMBER_x,
		POLLUTANT_NUMBER_x,
		POLLUTANT_UNITS_x,
		HPMS_NUMBER_x,

		SUMMARY_YEARS,
		SUMMARY_MONTHS,
		SUMMARY_TIME_PERIODS,
		SUMMARY_TIME_INCREMENT,
		WEEKEND_TRAVEL_FACTOR,

		SELECT_ZONE_RANGE,
		SELECT_SUBAREA_POLYGON,

		LINK_EQUIVALENCE_FILE,
		ZONE_EQUIVALENCE_FILE,
		REGION_EQUIVALENCE_FILE,

		AREA_TYPE_LABELS,
		FACILITY_TYPE_LABELS,
		VEHICLE_TYPE_LABELS,
		ROAD_TYPE_LABELS,

		AREA_TYPE_MAP,
		FACILITY_TYPE_MAP,
		VEHICLE_TYPE_MAP,
		ROAD_TYPE_MAP,
		HPMS_TYPE_MAP,

		NEW_EMISSION_RATE_FILE,
		NEW_EMISSION_RATE_FORMAT,
		NEW_EMISSION_SUMMARY_FILE,
		NEW_EMISSION_SUMMARY_FORMAT,

		NEW_SPEED_SUMMARY_FILE,
		NEW_SPEED_SUMMARY_FORMAT,
		NEW_MOVES_HPMS_VMT_FILE,
		NEW_MOVES_HPMS_VMT_FORMAT,
		NEW_MOVES_RAMP_FRACTION_FILE,
		NEW_MOVES_RAMP_FRACTION_FORMAT,
		NEW_MOVES_SPEED_HOUR_FILE,
		NEW_MOVES_SPEED_HOUR_FORMAT,
		NEW_MOVES_VMT_HOUR_FILE,
		NEW_MOVES_VMT_HOUR_FORMAT,
		NEW_MOVES_VMT_ROAD_FILE,
		NEW_MOVES_VMT_ROAD_FORMAT,

		NEW_MOVES_LINK_SUMMARY_FILE,
		NEW_MOVES_LINK_SUMMARY_FORMAT,
		NEW_MOVES_LINK_VEHICLE_FILE,
		NEW_MOVES_LINK_VEHICLE_FORMAT,
		NEW_MOVES_LINK_SPEED_FILE,
		NEW_MOVES_LINK_SPEED_FORMAT,
		USE_AVERAGE_SEGMENT_SPEEDS,
		NEW_MOVES_LINK_OPERATIONS_FILE,
		NEW_MOVES_LINK_OPERATIONS_FORMAT,

		SMOOTH_TO_MOVES_SPEED_BINS,
		SMOOTH_GROUP_SIZE,
		SMOOTH_SPEED_INCREMENT,
		PERCENT_MOVED_FORWARD,
		PERCENT_MOVED_BACKWARD,
		NUMBER_OF_ITERATIONS,

		NEW_SMOOTH_SAMPLE_FILE,
		NEW_SMOOTH_SAMPLE_FORMAT,
		PERCENT_SAMPLE_SIZE,
		RANDOM_NUMBER_SEED,

		NEW_TRAVELER_FILE,
		NEW_TRAVELER_FORMAT,

		REPORT_TRAVEL_UNITS,
		REPORT_EMISSIONS_UNITS,
		NULL
	};
	char *reports [] = {
		"EMISSIONS_BY_AREA_TYPE",
		"EMISSIONS_BY_FACILITY_TYPE",
		"EMISSIONS_BY_VEHICLE_TYPE",
		"EMISSIONS_BY_ROAD_TYPE",
		"EMISSIONS_BY_AREA_AND_FACILITY",
		"EMISSIONS_BY_AREA_AND_VEHICLE",
		"EMISSIONS_BY_FACILITY_AND_VEHICLE",
		"EMISSIONS_BY_ROAD_AND_VEHICLE",
		"EMISSIONS_SUMMARY_REPORT",
		"PRINT_LINK_EQUIVALENCIES",
		"PRINT_ZONE_EQUIVALENCIES",
		"PRINT_REGION_EQUIVALENCIES",
		NULL
	};

	Optional_Network_Files (optional_network);
	Optional_Demand_Files (optional_demand);

	Key_List (keys);
	Report_List (reports);
	
	Page_Size (120, 47);
	
	num_pollutants = box_length = cell_size = num_bins = max_bin = num_sample = 0;
	zone_flag = location_flag = link_flag = link_eq_flag = output_flag = input_flag = false;
	link_sum_flag = link_veh_flag = link_spd_flag = link_ops_flag = speed_flag = false;
	traveler_flag = new_traveler_flag = interpolate_flag = false;
	veh_map_flag = fac_map_flag = at_map_flag = road_map_flag = sample_flag = false;
	year_flag = month_flag = at_equiv_flag = reg_equiv_flag = new_rate_flag = false;
	select_flag = subarea_flag = rate_flag = vol_spd_flag = ramp_flag = hpms_flag = false;
	spd_flag = vmt_flag = road_flag = moves_bin_flag = smooth_flag = scan_flag = bin_sum_flag = false;

	length_field = facility_field = areatype_field = period_field = speed_field = 0;
	length_units = period_units = speed_units = num_vol_fld = emission_units = 0;
	travel_units = 1;
	volume_field = NULL;

	ramp_facility = 9;
	niter = 3;
	naverage = 3;
	forward = 20.0;
	backward = 20.0;
	bin_size = 1.0;
	weekend_factor = 1.0;
	volume_factor = 1.0;
	sample_size = 0.05;

	memset (facility_map, '\0', sizeof (facility_map));

	area_type.Initialize (sizeof (Label_Type), 10);
	facility_type.Initialize (sizeof (Label_Type), 10);
	vehicle_type.Initialize (sizeof (Label_Type), 10);
	road_type.Initialize (sizeof (Label_Type), 10);
}
コード例 #3
0
ファイル: efence.c プロジェクト: carriercomm/dataparksearch
/*
 * initialize sets up the memory allocation arena and the run-time
 * configuration information.
 */
static void initialize(void) {
    size_t	size = MEMORY_CREATION_SIZE;
    size_t	slack;
    char *	string;
    Slot *	slot;

    EF_Print(version);

#ifdef __linux__
    {
        struct rlimit nolimit = { RLIM_INFINITY, RLIM_INFINITY };
        int rc = setrlimit( RLIMIT_AS, &nolimit);
    }
#endif

    lock();

    /*
     * Import the user's environment specification of the default
     * alignment for malloc(). We want that alignment to be under
     * user control, since smaller alignment lets us catch more bugs,
     * however some software will break if malloc() returns a buffer
     * that is not word-aligned.
     *
     * I would like
     * alignment to be zero so that we could catch all one-byte
     * overruns, however if malloc() is asked to allocate an odd-size
     * buffer and returns an address that is not word-aligned, or whose
     * size is not a multiple of the word size, software breaks.
     * This was the case with the Sun string-handling routines,
     * which can do word fetches up to three bytes beyond the end of a
     * string. I handle this problem in part by providing
     * byte-reference-only versions of the string library functions, but
     * there are other functions that break, too. Some in X Windows, one
     * in Sam Leffler's TIFF library, and doubtless many others.
     */
    if ( EF_ALIGNMENT == -1 ) {
        if ( (string = getenv("EF_ALIGNMENT")) != 0 )
            EF_ALIGNMENT = (size_t)atoi(string);
        else
            EF_ALIGNMENT = sizeof(int);
    }

    /*
     * See if the user wants to protect the address space below a buffer,
     * rather than that above a buffer.
     */
    if ( EF_PROTECT_BELOW == -1 ) {
        if ( (string = getenv("EF_PROTECT_BELOW")) != 0 )
            EF_PROTECT_BELOW = (atoi(string) != 0);
        else
            EF_PROTECT_BELOW = 0;
    }

    /*
     * See if the user wants to protect memory that has been freed until
     * the program exits, rather than until it is re-allocated.
     */
    if ( EF_PROTECT_FREE == -1 ) {
        if ( (string = getenv("EF_PROTECT_FREE")) != 0 )
            EF_PROTECT_FREE = (atoi(string) != 0);
        else
            EF_PROTECT_FREE = 0;
    }

    /*
     * See if the user wants to allow malloc(0).
     */
    if ( EF_ALLOW_MALLOC_0 == -1 ) {
        if ( (string = getenv("EF_ALLOW_MALLOC_0")) != 0 )
            EF_ALLOW_MALLOC_0 = (atoi(string) != 0);
        else
            EF_ALLOW_MALLOC_0 = 0;
    }


    /*
     * Check if we should be filling new memory with a value.
     */
    if ( EF_FILL == -1 ) {
        if ( (string = getenv("EF_FILL")) != 0)
            EF_FILL = (unsigned char) atoi(string);
    }

    /*
     * Get the run-time configuration of the virtual memory page size.
     */
    bytesPerPage = Page_Size();

    /*
     * Figure out how many Slot structures to allocate at one time.
     */
    slotCount = slotsPerPage = bytesPerPage / sizeof(Slot);
    allocationListSize = bytesPerPage;

    if ( allocationListSize > size )
        size = allocationListSize;

    if ( (slack = size % bytesPerPage) != 0 )
        size += bytesPerPage - slack;

    /*
     * Allocate memory, and break it up into two malloc buffers. The
     * first buffer will be used for Slot structures, the second will
     * be marked free.
     */
    slot = allocationList = (Slot *)Page_Create(size);
    memset((char *)allocationList, 0, allocationListSize);

    slot[0].internalSize = slot[0].userSize = allocationListSize;
    slot[0].internalAddress = slot[0].userAddress = allocationList;
    slot[0].mode = INTERNAL_USE;
    if ( size > allocationListSize ) {
        slot[1].internalAddress = slot[1].userAddress
                                  = ((char *)slot[0].internalAddress) + slot[0].internalSize;
        slot[1].internalSize
            = slot[1].userSize = size - slot[0].internalSize;
        slot[1].mode = FREE;
    }

    /*
     * Deny access to the free page, so that we will detect any software
     * that treads upon free memory.
     */
    Page_DenyAccess(slot[1].internalAddress, slot[1].internalSize);

    /*
     * Account for the two slot structures that we've used.
     */
    unUsedSlots = slotCount - 2;

    /*	if (slotCount > 1) DpsSort(allocationList, slotCount, sizeof(Slot), (qsort_cmp)cmp_Slot);*/

    release();
#ifdef HAVE_PTHREAD
    if (!semEnabled) {
        semEnabled = 1;
#if USE_DPS_MUTEX
        InitMutex(&ef_mutex);
#else
        if (sem_init(&EF_sem, 0, 1) < 0) {
            semEnabled = 0;
        }
#endif
    }
#endif
}
コード例 #4
0
ファイル: LineSum.cpp プロジェクト: kravitz/transims5
LineSum::LineSum (void) : Execution_Service ()
{
	Program ("LineSum");
	Version (17);
	Title ("Transit Ridership Summary");

	Control_Key keys [] = { //--- code, key, level, status, type, default, range, help ----
		{ PEAK_RIDERSHIP_FILE, "PEAK_RIDERSHIP_FILE", LEVEL1, OPT_KEY, IN_KEY, "", FILE_RANGE, NO_HELP },
		{ PEAK_RIDERSHIP_FORMAT, "PEAK_RIDERSHIP_FORMAT", LEVEL1, OPT_KEY, TEXT_KEY, "TAB_DELIMITED", FORMAT_RANGE, FORMAT_HELP },
		{ OFFPEAK_RIDERSHIP_FILE, "OFFPEAK_RIDERSHIP_FILE", LEVEL1, OPT_KEY, IN_KEY, "", FILE_RANGE, NO_HELP },
		{ OFFPEAK_RIDERSHIP_FORMAT, "OFFPEAK_RIDERSHIP_FORMAT", LEVEL1, OPT_KEY, TEXT_KEY, "TAB_DELIMITED", FORMAT_RANGE, FORMAT_HELP },
		{ NEW_PEAK_RIDERSHIP_FILE, "NEW_PEAK_RIDERSHIP_FILE", LEVEL0, OPT_KEY, OUT_KEY, "", FILE_RANGE, NO_HELP },
		{ NEW_PEAK_RIDERSHIP_FORMAT, "NEW_PEAK_RIDERSHIP_FORMAT", LEVEL0, OPT_KEY, TEXT_KEY, "TAB_DELIMITED", FORMAT_RANGE, FORMAT_HELP },
		{ NEW_OFFPEAK_RIDERSHIP_FILE, "NEW_OFFPEAK_RIDERSHIP_FILE", LEVEL0, OPT_KEY, OUT_KEY, "", FILE_RANGE, NO_HELP },
		{ NEW_OFFPEAK_RIDERSHIP_FORMAT, "NEW_OFFPEAK_RIDERSHIP_FORMAT", LEVEL0, OPT_KEY, TEXT_KEY, "TAB_DELIMITED", FORMAT_RANGE, FORMAT_HELP },
		{ NEW_TOTAL_RIDERSHIP_FILE, "NEW_TOTAL_RIDERSHIP_FILE", LEVEL0, OPT_KEY, OUT_KEY, "", FILE_RANGE, NO_HELP },
		{ NEW_TOTAL_RIDERSHIP_FORMAT, "NEW_TOTAL_RIDERSHIP_FORMAT", LEVEL0, OPT_KEY, TEXT_KEY, "TAB_DELIMITED", FORMAT_RANGE, FORMAT_HELP },
		{ STOP_NAME_FILE, "STOP_NAME_FILE", LEVEL0, OPT_KEY, IN_KEY, "", FILE_RANGE, NO_HELP },
		{ STOP_NAME_FORMAT, "STOP_NAME_FORMAT", LEVEL0, OPT_KEY, TEXT_KEY, "TAB_DELIMITED", FORMAT_RANGE, FORMAT_HELP },
		{ LINE_REPORT_TITLE, "LINE_REPORT_TITLE", LEVEL1, OPT_KEY, TEXT_KEY, "Line Report", "Report Title", NO_HELP },
		{ LINE_REPORT_LINES, "LINE_REPORT_LINES", LEVEL1, OPT_KEY, LIST_KEY, "ALL", NAME_RANGE, NO_HELP }, 
		{ LINE_REPORT_MODES, "LINE_REPORT_MODES", LEVEL1, OPT_KEY, LIST_KEY, "ALL", RANGE_RANGE, NO_HELP }, 
		{ LINE_REPORT_ALL_NODES, "LINE_REPORT_ALL_NODES", LEVEL1, OPT_KEY, BOOL_KEY, "False", BOOL_RANGE, NO_HELP },
		{ LINK_REPORT_TITLE, "LINK_REPORT_TITLE", LEVEL1, OPT_KEY, TEXT_KEY, "Link Report", "Report Title", NO_HELP },
		{ LINK_REPORT_LINKS, "LINK_REPORT_LINKS", LEVEL1, OPT_KEY, LIST_KEY, "", "e.g., 100-200, 300-400-500", NO_HELP }, 
		{ LINK_REPORT_MODES, "LINK_REPORT_MODES", LEVEL1, OPT_KEY, LIST_KEY, "ALL", RANGE_RANGE, NO_HELP }, 
		{ LINK_REPORT_LINES, "LINK_REPORT_LINES", LEVEL1, OPT_KEY, LIST_KEY, "ALL", NAME_RANGE, NO_HELP }, 
		{ LINK_REPORT_ONEWAY, "LINK_REPORT_ONEWAY", LEVEL1, OPT_KEY, BOOL_KEY, "False", BOOL_RANGE, NO_HELP }, 
		{ ON_OFF_REPORT_TITLE, "ON_OFF_REPORT_TITLE", LEVEL1, OPT_KEY, TEXT_KEY, "Boarding Report", "Report Title", NO_HELP },
		{ ON_OFF_REPORT_STOPS, "ON_OFF_REPORT_STOPS", LEVEL1, OPT_KEY, LIST_KEY, "ALL", RANGE_RANGE, NO_HELP }, 
		{ ON_OFF_REPORT_MODES, "ON_OFF_REPORT_MODES", LEVEL1, OPT_KEY, LIST_KEY, "ALL", RANGE_RANGE, NO_HELP }, 
		{ ON_OFF_REPORT_DETAILS, "ON_OFF_REPORT_DETAILS", LEVEL1, OPT_KEY, BOOL_KEY, "False", "TRUE/FALSE/MODE, YES/NO/MODE, 1/0/2, T/F/M, Y/N/M", NO_HELP }, 
		{ NEW_ON_OFF_REPORT_FILE, "NEW_ON_OFF_REPORT_FILE", LEVEL1, OPT_KEY, OUT_KEY, "", FILE_RANGE, NO_HELP },
		{ NEW_ON_OFF_REPORT_FORMAT, "NEW_ON_OFF_REPORT_FORMAT", LEVEL1, OPT_KEY, TEXT_KEY, "TAB_DELIMITED", FORMAT_RANGE, FORMAT_HELP },
		{ ACCESS_REPORT_TITLE, "ACCESS_REPORT_TITLE", LEVEL1, OPT_KEY, TEXT_KEY, "Access Report", "Report Title", NO_HELP },
		{ ACCESS_REPORT_STOPS, "ACCESS_REPORT_STOPS", LEVEL1, OPT_KEY, LIST_KEY, "ALL", RANGE_RANGE, NO_HELP }, 
		{ ACCESS_REPORT_MODES, "ACCESS_REPORT_MODES", LEVEL1, OPT_KEY, LIST_KEY, "ALL", RANGE_RANGE, NO_HELP }, 
		{ ACCESS_REPORT_DETAILS, "ACCESS_REPORT_DETAILS", LEVEL1, OPT_KEY, BOOL_KEY, "False", "TRUE/FALSE/MODE, YES/NO/MODE, 1/0/2, T/F/M, Y/N/M", NO_HELP }, 
		{ NEW_ACCESS_REPORT_FILE, "NEW_ACCESS_REPORT_FILE", LEVEL1, OPT_KEY, OUT_KEY, "", FILE_RANGE, NO_HELP },
		{ NEW_ACCESS_REPORT_FORMAT, "NEW_ACCESS_REPORT_FORMAT", LEVEL1, OPT_KEY, TEXT_KEY, "TAB_DELIMITED", FORMAT_RANGE, FORMAT_HELP },
		{ STOP_REPORT_TITLE, "STOP_REPORT_TITLE", LEVEL1, OPT_KEY, TEXT_KEY, "Stop Report", "Report Title", NO_HELP },
		{ STOP_REPORT_STOPS, "STOP_REPORT_STOPS", LEVEL1, OPT_KEY, LIST_KEY, "", RANGE_RANGE, NO_HELP }, 
		{ STOP_REPORT_MODES, "STOP_REPORT_MODES", LEVEL1, OPT_KEY, LIST_KEY, "ALL", RANGE_RANGE, NO_HELP }, 
		{ STOP_REPORT_LINES, "STOP_REPORT_LINES", LEVEL1, OPT_KEY, LIST_KEY, "ALL", NAME_RANGE, NO_HELP }, 
		{ STOP_REPORT_TRANSFERS, "STOP_REPORT_TRANSFERS", LEVEL1, OPT_KEY, LIST_KEY, "NONE", RANGE_RANGE, NO_HELP }, 
		{ TOTAL_REPORT_TITLE, "TOTAL_REPORT_TITLE", LEVEL1, OPT_KEY, TEXT_KEY, "Total Report", "Report Title", NO_HELP },
		{ TOTAL_REPORT_LINES, "TOTAL_REPORT_LINES", LEVEL1, OPT_KEY, LIST_KEY, "ALL", "e.g., LINE1, LINE2, LINE1..LINE10", NO_HELP }, 
		{ TOTAL_REPORT_MODES, "TOTAL_REPORT_MODES", LEVEL1, OPT_KEY, LIST_KEY, "ALL", RANGE_RANGE, NO_HELP }, 
		{ NEW_TOTAL_REPORT_FILE, "NEW_TOTAL_REPORT_FILE", LEVEL1, OPT_KEY, OUT_KEY, "", FILE_RANGE, NO_HELP },
		{ NEW_TOTAL_REPORT_FORMAT, "NEW_TOTAL_REPORT_FORMAT", LEVEL1, OPT_KEY, TEXT_KEY, "TAB_DELIMITED", FORMAT_RANGE, FORMAT_HELP },
		{ NEW_LINK_RIDER_FILE, "NEW_LINK_RIDER_FILE", LEVEL1, OPT_KEY, OUT_KEY, "", FILE_RANGE, NO_HELP },
		{ NEW_LINK_RIDER_FORMAT, "NEW_LINK_RIDER_FORMAT", LEVEL1, OPT_KEY, TEXT_KEY, "TAB_DELIMITED", FORMAT_RANGE, FORMAT_HELP },
		{ LINK_RIDER_MODES, "LINK_RIDER_MODES", LEVEL1, OPT_KEY, LIST_KEY, "ALL", RANGE_RANGE, NO_HELP }, 
		{ LINK_RIDER_LINES, "LINK_RIDER_LINES", LEVEL1, OPT_KEY, LIST_KEY, "ALL", NAME_RANGE, NO_HELP }, 
		{ LINK_RIDER_PEAK_HOURS, "LINK_RIDER_PEAK_HOURS", LEVEL1, OPT_KEY, TIME_KEY, "6.0 hours", "1.0..10.0 hours", NO_HELP }, 
		{ LINK_RIDER_PEAK_FACTOR, "LINK_RIDER_PEAK_FACTOR", LEVEL1, OPT_KEY, FLOAT_KEY, "1.0", "1.0..1.5", NO_HELP }, 
		{ LINK_RIDER_PEAK_CAPACITY, "LINK_RIDER_PEAK_CAPACITY", LEVEL1, OPT_KEY, FLOAT_KEY, "1.0", "1.0..1000.0", NO_HELP }, 
		{ LINK_RIDER_OFFPEAK_HOURS, "LINK_RIDER_OFFPEAK_HOURS", LEVEL1, OPT_KEY, TIME_KEY, "10.0 hours", "1.0..20.0 hours", NO_HELP }, 
		{ LINK_RIDER_XY_FILE, "LINK_RIDER_XY_FILE", LEVEL1, OPT_KEY, IN_KEY, "", FILE_RANGE, NO_HELP },
		{ LINK_RIDER_XY_FORMAT, "LINK_RIDER_XY_FORMAT", LEVEL1, OPT_KEY, TEXT_KEY, "TAB_DELIMITED", FORMAT_RANGE, FORMAT_HELP },
		{ LINK_RIDER_SIDE_OFFSET, "LINK_RIDER_SIDE_OFFSET", LEVEL1, OPT_KEY, FLOAT_KEY, "0.0 feet", "0.0..1000 feet", NO_HELP },
		{ LINK_SHAPE_FILE, "LINK_SHAPE_FILE", LEVEL0, OPT_KEY, IN_KEY, "", FILE_RANGE, NO_HELP },
		{ LINK_SHAPE_ANODE, "LINK_SHAPE_ANODE", LEVEL0, OPT_KEY, TEXT_KEY, "ANODE", "", NO_HELP },
		{ LINK_SHAPE_BNODE, "LINK_SHAPE_BNODE", LEVEL0, OPT_KEY, TEXT_KEY, "BNODE", "", NO_HELP },
		{ SERVICE_FILE, "SERVICE_FILE", LEVEL0, OPT_KEY, IN_KEY, "", FILE_RANGE, NO_HELP },
		{ SERVICE_FORMAT, "SERVICE_FORMAT", LEVEL0, OPT_KEY, TEXT_KEY, "TAB_DELIMITED", FORMAT_RANGE, FORMAT_HELP },
		{ SERVICE_LINE_FIELD, "SERVICE_LINE_FIELD", LEVEL0, OPT_KEY, TEXT_KEY, "LINE", "", NO_HELP },
		{ SERVICE_PEAK_FIELD, "SERVICE_PEAK_FIELD", LEVEL0, OPT_KEY, TEXT_KEY, "PEAK", "", NO_HELP },
		{ SERVICE_OFFPEAK_FIELD, "SERVICE_OFFPEAK_FIELD", LEVEL0, OPT_KEY, TEXT_KEY, "OFFPEAK", "", NO_HELP },
		{ BASE_ROUTE_FILE, "BASE_ROUTE_FILE", LEVEL1, OPT_KEY, IN_KEY, "", FILE_RANGE, NO_HELP },
		{ BASE_ROUTE_FORMAT, "BASE_ROUTE_FORMAT", LEVEL1, OPT_KEY, TEXT_KEY, "DBASE", FORMAT_RANGE, FORMAT_HELP },
		{ ALTERNATIVE_ROUTE_FILE, "ALTERNATIVE_ROUTE_FILE", LEVEL1, OPT_KEY, IN_KEY, "", FILE_RANGE, NO_HELP },
		{ ALTERNATIVE_ROUTE_FORMAT, "ALTERNATIVE_ROUTE_FORMAT", LEVEL1, OPT_KEY, TEXT_KEY, "DBASE", FORMAT_RANGE, FORMAT_HELP },
		END_CONTROL
	};
	const char *reports [] = {
		"LINE_REPORT",
		"LINK_REPORT",
		"ON_OFF_REPORT",
		"ACCESS_REPORT",
		"STOP_REPORT",
		"TOTAL_REPORT",
		"DIFFERENCE_REPORT",
		""
	};
	Key_List (keys);
	Report_List (reports);

	projection.Add_Keys ();

	on_off_flag = access_flag = station_flag = shape_flag = service_flag = false;
	anode_field = bnode_field = line_fld = peak_fld = offpeak_fld = -1;
	report_code = 0;

	Page_Size (172, 65);

	int ignore_keys [] = {
		TIME_OF_DAY_FORMAT, MODEL_START_TIME, MODEL_END_TIME, MODEL_TIME_INCREMENT, UNITS_OF_MEASURE, 
		RANDOM_NUMBER_SEED,	MAX_WARNING_MESSAGES, MAX_WARNING_EXIT_FLAG, MAX_PROBLEM_COUNT, NUMBER_OF_THREADS, 0
	};
	Ignore_Keys (ignore_keys);
}
コード例 #5
0
ファイル: Validate.cpp プロジェクト: qingswu/Transim
Validate::Validate (void) : Data_Service ()
{
	Program ("Validate");
	Version (17);
	Title ("Compare Volumes to Counts");

	System_File_Type required_files [] = {
		NODE, LINK, END_FILE
	};
	System_File_Type optional_files [] = {
		ZONE, SHAPE, POCKET, CONNECTION, ACCESS_LINK, LOCATION, PARKING, LANE_USE, 
		SIGN, SIGNAL, TIMING_PLAN, PHASING_PLAN, DETECTOR, 
		TRANSIT_STOP, TRANSIT_ROUTE, TRANSIT_SCHEDULE, TRANSIT_DRIVER, VEHICLE_TYPE,
		TURN_PENALTY, PERFORMANCE, TURN_DELAY, RIDERSHIP, END_FILE
	};
	int file_service_keys [] = {
		NOTES_AND_NAME_FIELDS, SAVE_LANE_USE_FLOWS, LINK_EQUIVALENCE_FILE, ZONE_EQUIVALENCE_FILE, 
		STOP_EQUIVALENCE_FILE, LINE_EQUIVALENCE_FILE, 0
	};
	int data_service_keys [] = {
		DAILY_WRAP_FLAG, SUMMARY_TIME_RANGES, SUMMARY_TIME_INCREMENT, LINK_BEARING_WARNINGS, 0
	};
	Control_Key validate_keys [] = { //--- code, key, level, status, type, default, range, help ----
		{ INPUT_VOLUME_FILE, "INPUT_VOLUME_FILE", LEVEL0, OPT_KEY, IN_KEY, "", FILE_RANGE, NO_HELP },
		{ TRAFFIC_COUNT_FILE, "TRAFFIC_COUNT_FILE", LEVEL0, OPT_KEY, IN_KEY, "", FILE_RANGE, NO_HELP },
		{ TURN_VOLUME_FILE, "TURN_VOLUME_FILE", LEVEL0, OPT_KEY, IN_KEY, "", FILE_RANGE, NO_HELP },
		{ TURN_COUNT_FILE, "TURN_COUNT_FILE", LEVEL0, OPT_KEY, IN_KEY, "", FILE_RANGE, NO_HELP },
		{ LINE_GROUP_COUNT_FILE, "LINK_GROUP_COUNT_FILE", LEVEL0, OPT_KEY, IN_KEY, "", FILE_RANGE, NO_HELP},
		{ STOP_GROUP_COUNT_FILE, "STOP_GROUP_COUNT_FILE", LEVEL0, OPT_KEY, IN_KEY, "", FILE_RANGE, NO_HELP },
		{ NEW_VOLUME_FILE, "NEW_VOLUME_FILE", LEVEL0, OPT_KEY,  OUT_KEY, "", FILE_RANGE, NO_HELP},
		{ NEW_VOLUME_COUNT_FILE, "NEW_VOLUME_COUNT_FILE", LEVEL0, OPT_KEY,  OUT_KEY, "", FILE_RANGE, NO_HELP},
		{ ANALYSIS_METHOD, "ANALYSIS_METHOD", LEVEL0, OPT_KEY, TEXT_KEY, "VOLUME", "VOLUME, VMT, VKT", NO_HELP },
		{ ENTRY_DATA_FLAG, "ENTRY_DATA_FLAG", LEVEL0, OPT_KEY, BOOL_KEY, "FALSE", BOOL_RANGE, NO_HELP },
		{ ADJUSTMENT_FACTOR, "ADJUSTMENT_FACTOR", LEVEL0, OPT_KEY, FLOAT_KEY, "1.0", "0.05..10.0", NO_HELP },
		{ FACILITY_TYPE_LABELS, "FACILITY_TYPE_LABELS", LEVEL0, OPT_KEY, IN_KEY, "", FILE_RANGE, NO_HELP},
		{ AREA_TYPE_LABELS, "AREA_TYPE_LABELS", LEVEL0, OPT_KEY, IN_KEY, "", FILE_RANGE, NO_HELP },
		{ CHECK_NETWORK_FLAG, "CHECK_NETWORK_FLAG", LEVEL0, OPT_KEY, BOOL_KEY, "FALSE", BOOL_RANGE, NO_HELP },
		{ NEW_PROBLEM_NODE_FILE, "NEW_PROBLEM_NODE_FILE", LEVEL0, OPT_KEY, OUT_KEY, "", FILE_RANGE, NO_HELP },
		{ NEW_PROBLEM_LINK_FILE, "NEW_PROBLEM_LINK_FILE", LEVEL0, OPT_KEY, OUT_KEY, "", FILE_RANGE, NO_HELP },
		{ NEW_PROBLEM_COORDINATE_FILE, "NEW_PROBLEM_COORDINATE_FILE", LEVEL0, OPT_KEY, OUT_KEY, "", FILE_RANGE, NO_HELP },
		END_CONTROL
	};
	const char *reports [] = {
		"VOLUME_LEVEL_SUMMARY",
		"FACILITY_TYPE_SUMMARY",
		"AREA_TYPE_SUMMARY",
		"ZONE_GROUP_SUMMARY",
		"ZONE_AT_FT_SUMMARY",
		"LINK_GROUP_SUMMARY",
		"LINK_GROUP_DETAILS",
		"TURN_MOVEMENT_SUMMARY",
		"TURN_LEVEL_OF_SERVICE",
		"ZONE_EQUIVALENCE",
		"LINK_EQUIVALENCE",
		"LINE_GROUP_SUMMARY",
		"STOP_GROUP_SUMMARY",
		"BOARDING_GROUP_SUMMARY",
		"ALIGHTING_GROUP_SUMMARY",
		"LINE_EQUIVALENCE",
		"STOP_EQUIVALENCE",
		""
	};
	Required_System_Files (required_files);
	Optional_System_Files (optional_files);
	File_Service_Keys (file_service_keys);
	Data_Service_Keys (data_service_keys);
	
	Sum_Flow_Flag (true);
	Key_List (validate_keys);
	Report_List (reports);

	Page_Size (120, 47);

	problem_node_flag = problem_link_flag = problem_coord_flag = cnt_dir_flag = false;
	delay_flag = link_flag = turn_flag = output_flag = zone_flag = method = entry_flag = false;
	line_flag = stop_flag = vc_flag = check_net_flag = false;
	factor = 1.0;
	hours = 1.0;

	compass.Set_Points (8);
	
	System_Read_False (PERFORMANCE);

	stats_format = "\n%25.25s %7d%10.0lf%10.0lf%9.0lf %7.1lf %7.0lf %6.1lf %7.0lf %6.1lf %6.3lf%6.2lf%6.2lf";
}