Esempio n. 1
0
void LinkSum::Program_Control (void)
{
	int i, field, ngroup, num;
	bool binary;
	String key, token;

	Location_File *location_file;
	Db_Field *fld;	
	Doubles dbl;
	Doubles_Itr itr;

	//---- set the equivalence flags ----

	Zone_Equiv_Flag (Check_Control_Key (NEW_GROUP_TRAVEL_FILE));

	group_select = Set_Control_Flag (SELECT_BY_LINK_GROUP);
	Link_Equiv_Flag (group_select || Report_Flag (LINK_GROUP) || Report_Flag (TRAVEL_TIME) || 
		Report_Flag (GROUP_REPORT) || Report_Flag (GROUP_SUMMARY) || Check_Control_Key (NEW_GROUP_SUMMARY_FILE));

	//---- open network files ----

	Data_Service::Program_Control ();

	Read_Select_Keys ();

	turn_flag = System_File_Flag (TURN_DELAY);
	
	Print (2, String ("%s Control Keys:") % Program ());	

	//---- open the compare performance file ----
	
	key = Get_Control_String (COMPARE_PERFORMANCE_FILE);

	if (!key.empty ()) {
		compare_file.File_Type ("Compare Performance File");
		Print (1);

		if (Check_Control_Key (COMPARE_PERFORMANCE_FORMAT)) {
			compare_file.Dbase_Format (Get_Control_String (COMPARE_PERFORMANCE_FORMAT));
		}
		compare_file.Open (Project_Filename (key));
		compare_flag = true;
	}
	num_inc = sum_periods.Num_Periods ();
	if (num_inc < 1) num_inc = 1;

	cap_factor = (double) sum_periods.Range_Length () / (Dtime (1, HOURS) * num_inc);
	if (cap_factor <= 0.0) cap_factor = 1.0;

	//---- open the compare link map file ----
	
	key = Get_Control_String (COMPARE_LINK_MAP_FILE);

	if (!key.empty ()) {
		link_map_file.File_Type ("Compare Link Map File");
		Print (1);

		if (Check_Control_Key (COMPARE_LINK_MAP_FORMAT)) {
			link_map_file.Dbase_Format (Get_Control_String (COMPARE_LINK_MAP_FORMAT));
		}
		link_map_file.Open (Project_Filename (key));
		link_map_flag = true;
	}

	//---- get minimum volume ----
	
	minimum_volume = Get_Control_Double (MINIMUM_LINK_VOLUME);

	//---- person-based statistics ----

	person_flag = Get_Control_Flag (PERSON_BASED_STATISTICS);

	//---- get the select by link group flag ----

	group_select = Get_Control_Flag (SELECT_BY_LINK_GROUP);
	if (group_select || select_subareas || select_polygon || select_facilities) select_flag = true;

	//---- turning movement data ----

	if (turn_flag) {

		//---- open the compare turn delays file ----
	
		key = Get_Control_String (COMPARE_TURN_DELAY_FILE);

		if (!key.empty ()) {
			turn_compare_file.File_Type ("Compare Turn Delay File");
			Print (1);

			if (Check_Control_Key (COMPARE_TURN_DELAY_FORMAT)) {
				turn_compare_file.Dbase_Format (Get_Control_String (COMPARE_TURN_DELAY_FORMAT));
			}
			turn_compare_file.Open (Project_Filename (key));
			turn_compare_flag = true;
		}

		//---- select turn nodes----
	
		key = exe->Get_Control_Text (TURN_NODE_RANGE);

		if (!key.empty () && !key.Equals ("ALL")) {
			if (!turn_range.Add_Ranges (key)) {
				exe->Error ("Adding Turn Node Ranges");
			}
		}
	}

	//---- create link activity file ----

	key = Get_Control_String (NEW_LINK_ACTIVITY_FILE);

	if (!key.empty ()) {
		if (!System_File_Flag (LOCATION)) {
			Error ("A Location File is needed for the Link Activity File");
		}
		location_file = System_Location_File ();
		binary = (location_file->Record_Format () == BINARY);

		Print (1);
		activity_file.File_Type ("New Link Activity File");

		if (Check_Control_Key (NEW_LINK_ACTIVITY_FORMAT)) {
			activity_file.Dbase_Format (Get_Control_String (NEW_LINK_ACTIVITY_FORMAT));
		}
		activity_file.Create (Project_Filename (key));

		//---- copy location field name ----

		key = Get_Control_Text (COPY_LOCATION_FIELDS);
		if (key.empty ()) {
			Error ("Location Field Names are Required for Link Activity File");
		}
		link_db.File_Type ("Link Location Database");

		//---- set required fields ----

		link_db.Add_Field ("LINK", DB_INTEGER, 10);
		activity_file.Add_Field ("LINK", DB_INTEGER, 10);

		//---- copy selected fields ----

		while (!key.Split (token)) {
			field = location_file->Field_Number (token);
			if (field < 0) {
				Error (String ("Field %s was Not Found in the Location File") % token);
			}
			field_list.push_back (field);

			fld = location_file->Field (field);

			link_db.Add_Field (fld->Name (), fld->Type (), fld->Size (), fld->Units (), binary);
			activity_file.Add_Field (fld->Name (), fld->Type (), fld->Size (), fld->Units (), binary);
		}
		activity_file.Write_Header ();
		activity_flag = true;
	}

	//---- create zone travel file ----

	key = Get_Control_String (NEW_ZONE_TRAVEL_FILE);

	if (!key.empty ()) {
		if (!System_File_Flag (LOCATION)) {
			Error ("A Location File is needed for the Zone Travel File");
		}
		Print (1);
		zone_file.File_Type ("New Zone Travel File");

		if (Check_Control_Key (NEW_ZONE_TRAVEL_FORMAT)) {
			zone_file.Dbase_Format (Get_Control_String (NEW_ZONE_TRAVEL_FORMAT));
		}
		zone_file.Create (Project_Filename (key));
		zone_flag = true;
	}

	//---- create zone group travel file ----

	key = Get_Control_String (NEW_GROUP_TRAVEL_FILE);

	if (!key.empty ()) {
		if (!System_File_Flag (LOCATION)) {
			Error ("A Location File is needed for the Group Travel File");
		}
		Print (1);
		group_file.File_Type ("New Group Travel File");

		if (Check_Control_Key (NEW_GROUP_TRAVEL_FORMAT)) {
			group_file.Dbase_Format (Get_Control_String (NEW_GROUP_TRAVEL_FORMAT));
		}
		group_file.Create (Project_Filename (key));
		group_flag = true;
	}

	if (!activity_flag && !zone_flag && !group_flag) {
		System_File_False (LOCATION);
	}

	//---- get the number of direction groups ----

	ngroup = Highest_Control_Group (NEW_LINK_DIRECTION_FILE, 0);

	if (ngroup > 0) {
		Dir_Group group, *group_ptr;

		//---- process each group ----

		for (i=1; i <= ngroup; i++) {
			key = Get_Control_String (NEW_LINK_DIRECTION_FILE, i);
			if (key.empty ()) continue;

			Print (1);
			dir_group.push_back (group);
			group_ptr = &dir_group.back ();

			group_ptr->group = i;
			group_ptr->file = new Link_Direction_File ();
			group_ptr->file->File_Type (String ("New Link Direction File #%d") % i);

			if (Check_Control_Key (NEW_LINK_DIRECTION_FORMAT, i)) {
				group_ptr->file->Dbase_Format (Get_Control_String (NEW_LINK_DIRECTION_FORMAT, i));
			}
			group_ptr->file->Lane_Use_Flows (Lane_Use_Flows ());
			group_ptr->file->Create (Project_Filename (key));

			//---- get the field name ----

			key = Get_Control_Text (NEW_LINK_DIRECTION_FIELD, i);
			if (key.empty ()) {
				Error (String ("New Link Direction Field #%d is Missing") % i);
			}
			group_ptr->field = Performance_Code (key);

			group_ptr->index = Get_Control_Flag (NEW_LINK_DIRECTION_INDEX, i);
			
			group_ptr->flip = Get_Control_Flag (NEW_LINK_DIRECTION_FLIP, i);

			if (group_ptr->flip && !compare_flag) {
				Warning ("Link Direction Flipping requires Comparison Data");
				group_ptr->flip = false;
			}
			Set_Link_Dir (group_ptr);
		}
	}

	//---- get the number of groups ----

	ngroup = Highest_Control_Group (NEW_LINK_DATA_FILE, 0);

	if (ngroup > 0) {
		Data_Group group, *group_ptr;

		//---- process each group ----

		for (i=1; i <= ngroup; i++) {
			key = Get_Control_String (NEW_LINK_DATA_FILE, i);
			if (key.empty ()) continue;

			Print (1);
			data_group.push_back (group);
			group_ptr = &data_group.back ();

			group_ptr->group = i;
			group_ptr->file = new Link_Data_File ();
			group_ptr->file->File_Type (String ("New Link Data File #%d") % i);

			if (Check_Control_Key (NEW_LINK_DATA_FORMAT, i)) {
				group_ptr->file->Dbase_Format (Get_Control_String (NEW_LINK_DATA_FORMAT, i));
			}
			group_ptr->file->Lane_Use_Flows (Lane_Use_Flows ());
			group_ptr->file->Create (Project_Filename (key));

			//---- get the field name ----

			key = Get_Control_Text (NEW_LINK_DATA_FIELD, i);
			if (key.empty ()) {
				Error (String ("New Link Data Field #%d is Missing") % i);
			}
			group_ptr->field = Performance_Code (key);

			Set_Link_Data (group_ptr);
		}
	}

	//---- data summary file ----

	key = Get_Control_String (NEW_DATA_SUMMARY_FILE);

	if (!key.empty ()) {
		Print (1);
		summary_file.File_Type ("New Data Summary File");

		if (Check_Control_Key (NEW_DATA_SUMMARY_FORMAT)) {
			summary_file.Dbase_Format (Get_Control_String (NEW_DATA_SUMMARY_FORMAT));
		}
		summary_file.Add_Field ("MEASURE", DB_STRING, 40);
		summary_file.Add_Field ("VALUE", DB_DOUBLE, 12.2);
		if (compare_flag) summary_file.Add_Field ("COMPARE", DB_DOUBLE, 12.2);

		summary_file.Create (Project_Filename (key));
		summary_flag = true;

		//---- data summary periods ----

		if (!Control_Key_Empty (NEW_DATA_SUMMARY_PERIODS)) {
			periods_flag = data_periods.Add_Ranges (Get_Control_Text (NEW_DATA_SUMMARY_PERIODS));
		}

		//---- data summary ratios ----

		if (Check_Control_Key (NEW_DATA_SUMMARY_RATIOS)) {
			Double_List list;
			Dbl_Itr itr;

			Get_Control_List (NEW_DATA_SUMMARY_RATIOS, list);

			for (i=0, itr = list.begin (); itr != list.end (); itr++, i++) {
				if (i > 0 && *itr >= 1.0) {
					data_ratios.push_back (Round (*itr * 100.0));
					ratios_flag = true;
				}
			}
		}
	}

	//---- group summary file ----

	key = Get_Control_String (NEW_GROUP_SUMMARY_FILE);

	if (!key.empty ()) {
		Print (1);
		group_sum_file.File_Type ("New Group Summary File");

		if (Check_Control_Key (NEW_GROUP_SUMMARY_FORMAT)) {
			group_sum_file.Dbase_Format (Get_Control_String (NEW_GROUP_SUMMARY_FORMAT));
		}
		group_sum_file.Add_Field ("MEASURE", DB_STRING, 40);
		group_sum_file.Add_Field ("VALUE", DB_DOUBLE, 12.2);
		if (compare_flag) group_sum_file.Add_Field ("COMPARE", DB_DOUBLE, 12.2);

		group_sum_file.Create (Project_Filename (key));
		group_sum_flag = true;
	}

	//---- read report types ----

	List_Reports ();

	if (!compare_flag && (Report_Flag (TIME_CHANGE) || Report_Flag (VOLUME_CHANGE) ||
		Report_Flag (TOP_TIME_CHANGE) || Report_Flag (TOP_VOL_CHANGE) || Report_Flag (RELATIVE_GAP))) {

		Error ("A Compare Performance File is Required for Change Reports");
	}

	//---- process support data ----

	if (Link_Equiv_Flag ()) {
		link_equiv.Read (Report_Flag (LINK_EQUIV));
	}

	if (group_flag) {
		zone_equiv.Read (Report_Flag (ZONE_EQUIV));
	}

	//---- allocate work space ----

	if (periods_flag || ratios_flag) {
		num = (periods_flag) ? (int) data_periods.size () : 1;
		num += (ratios_flag) ? (int) data_ratios.size () : 1;
		if (num_inc + 1 > num) {
			num = num_inc + 1;
		}
	} else {
		num = num_inc + 1;
	}
	sum_bin.assign (num, dbl);

	for (itr = sum_bin.begin (); itr != sum_bin.end (); itr++) {
		itr->assign (NUM_SUM_BINS, 0.0);
	}
} 
Esempio n. 2
0
void PlanSum::Program_Control (void)
{
	String key;
	bool link_flag, report_flag;

	link_flag = report_flag = false;

	if (!Set_Control_Flag (UPDATE_FLOW_RATES) && !Set_Control_Flag (UPDATE_TRAVEL_TIMES)) {
		System_File_False (NEW_LINK_DELAY);
	}

	//---- initialize the MPI thread range ----

	MPI_Setup ();

	//---- set equivalence flags ---
	
	if (Report_Flag (LINK_GROUP) || Report_Flag (RIDER_GROUP)) {
		Link_Equiv_Flag (true);
		link_flag = true;
	}
	if (skim_flag || trip_flag) {
		Zone_Equiv_Flag (true);
		zone_flag = true;
	}
	Stop_Equiv_Flag (Report_Flag (STOP_GROUP));

	//---- create the network files ----

	Data_Service::Program_Control ();
	
	Read_Select_Keys ();
	Read_Flow_Time_Keys ();

	plan_file = (Plan_File *) System_File_Handle (PLAN);
	if (!plan_file->Part_Flag ()) Num_Threads (1);

	select_flag = System_File_Flag (SELECTION);
	new_delay_flag = System_File_Flag (NEW_LINK_DELAY);

	if (System_File_Flag (LINK_DELAY)) {
		link_flag = true;
		Link_Delay_File *file = (Link_Delay_File *) System_File_Handle (LINK_DELAY);
		turn_flag = file->Turn_Flag ();
	}
	if (new_delay_flag) {
		link_flag = true;
		Link_Delay_File *file = (Link_Delay_File *) System_File_Handle (NEW_LINK_DELAY);
		turn_flag = file->Turn_Flag ();
	} else {
		turn_flag = System_File_Flag (CONNECTION);
	}
	Print (2, String ("%s Control Keys:") % Program ());

	//---- new trip time file ----

	key = Get_Control_String (NEW_TRIP_TIME_FILE);

	if (!key.empty ()) {
		time_file.File_Type ("New Trip Time File");
		time_file.File_ID ("Time");

		if (Master ()) {
			time_file.Create (Project_Filename (key));
		}
		time_flag = true;
	}

	//---- new link volume file ----

	key = Get_Control_String (NEW_LINK_VOLUME_FILE);

	if (!key.empty ()) {
		volume_file.File_Type ("New Link Volume File");
		volume_file.File_ID ("Volume");

		if (Master ()) {
			volume_file.Create (Project_Filename (key));

			volume_file.Num_Decimals (1);
			volume_file.Data_Units (Performance_Units_Map (FLOW_DATA));
			volume_file.Copy_Periods (sum_periods);

			volume_file.Create_Fields ();
			volume_file.Write_Header ();
		}
		volume_flag = new_delay_flag = link_flag = true;
	}

	//---- read report types ----

	List_Reports ();

	if (Report_Flag (TOP_100) || Report_Flag (VC_RATIO) || Report_Flag (LINK_GROUP)) {
		new_delay_flag = link_flag = report_flag = true;
		cap_factor = (double) sum_periods.Range_Length () / (Dtime (1, HOURS) * sum_periods.Num_Periods ());
	}
	if (link_flag && (!System_File_Flag (LINK) || !System_File_Flag (NODE))) {
		Error ("Link and Node Files are Required for Link-Based Output");
	}
	if (System_File_Flag (LANE_USE) && !System_File_Flag (LINK)) {
		Error ("A Link File is Required for Lane-Use Processing");
	}
	travel_flag = Report_Flag (SUM_TRAVEL);

	//---- ridership summary ----

	passenger_flag = Report_Flag (SUM_PASSENGERS);
	transfer_flag = (Report_Flag (SUM_STOPS) || Report_Flag (STOP_GROUP));
	rider_flag = (System_File_Flag (NEW_RIDERSHIP) || Report_Flag (SUM_RIDERS) || Report_Flag (RIDER_GROUP));
	xfer_flag = Report_Flag (SUM_TRANSFERS);
	xfer_detail = Report_Flag (XFER_DETAILS);

	if (passenger_flag || transfer_flag || rider_flag || xfer_flag || xfer_detail) {
		if (!System_File_Flag (TRANSIT_STOP) || !System_File_Flag (TRANSIT_ROUTE) ||
			!System_File_Flag (TRANSIT_SCHEDULE)) {

			Error ("Transit Network Files are Required for Ridership Output");
		}
		if ((passenger_flag || rider_flag) && !System_File_Flag (TRANSIT_DRIVER)) {
			Error ("A Transit Driver File is needed for Passengers Summaries");
		}
	} else {
		System_File_False (TRANSIT_STOP);
		System_File_False (TRANSIT_ROUTE);
		System_File_False (TRANSIT_SCHEDULE);
		System_File_False (TRANSIT_DRIVER);
	}

	//---- process support data ----

	if (Link_Equiv_Flag ()) {
		link_equiv.Read (Report_Flag (LINK_EQUIV));
	}
	if (Zone_Equiv_Flag ()) {
		zone_equiv.Read (Report_Flag (ZONE_EQUIV));
	}
	if (Stop_Equiv_Flag ()) {
		stop_equiv.Read (Report_Flag (STOP_EQUIV));
	}

	//---- allocate work space ----

	if (time_flag || Report_Flag (TRIP_TIME)) {
		time_flag = true;

		int periods = sum_periods.Num_Periods ();
		
		start_time.assign (periods, 0);
		mid_time.assign (periods, 0);
		end_time.assign (periods, 0);
	}

	//---- transfer arrays ----

	if (xfer_flag || xfer_detail) {
		Integers rail;

		rail.assign (10, 0);
		total_on_array.assign (10, rail);

		if (xfer_detail) {
			int num = sum_periods.Num_Periods ();
			if (num < 1) num = 1;

			walk_on_array.assign (num, total_on_array);
			drive_on_array.assign (num, total_on_array);
		}
	}

	//---- initialize the trip summary data ----

	if (travel_flag) {
		trip_sum_data.Copy_Periods (sum_periods);
	}

	//---- initialize the passenger summary data ----

	if (passenger_flag) {
		pass_sum_data.Copy_Periods (sum_periods);
	}
}
Esempio n. 3
0
void Validate::Program_Control (void)
{
	int i, num;
	String key, record;
	Dtime low, high;
	Db_File label_file;
	Str_Map_Stat map_stat;

	//---- set equivalence flags ----

	line_flag = Report_Flag (LINE_GROUP);
	stop_flag = (Report_Flag (STOP_GROUP) || Report_Flag (BOARD_GROUP) || Report_Flag (ALIGHT_GROUP));

	Link_Equiv_Flag (Report_Flag (LINK_GROUP) || Report_Flag (GROUP_DETAILS));
	Zone_Equiv_Flag (Report_Flag (ZONE_GROUP));
	Stop_Equiv_Flag (stop_flag);
	Line_Equiv_Flag (line_flag);

	//---- open network files ----

	Data_Service::Program_Control ();
	
	Print (2, String ("%s Control Keys:") % Program ());	

	//---- check for traffic counts ----

	if (Check_Control_Key (TRAFFIC_COUNT_FILE)) {
		link_flag = true;

		if (Report_Flag (ZONE_GROUP)) {
			if (!System_File_Flag (ZONE)) {
				Error ("Zone File is Required for Zone Group Reports");
			}
			zone_flag = true;
		} else if (Report_Flag (AREA_TYPE)) {
			zone_flag = System_File_Flag (ZONE);
		}
	} else {
		if (Report_Flag (VOLUME_LEVEL) || Report_Flag (FACILITY_TYPE) ||
			Report_Flag (AREA_TYPE) || Report_Flag (ZONE_GROUP) ||
			Report_Flag (LINK_GROUP) || Report_Flag (GROUP_DETAILS)) {

			Error ("Traffic Count file is Required for Link-Based Reports");
		}
	}

	//---- check for turning movements ----

	if (Check_Control_Key (TURN_COUNT_FILE)) {
		if ((Report_Flag (TURN_MOVEMENT) || Report_Flag (TURN_LOS)) && 
			!System_File_Flag (CONNECTION)) {

			Error ("Connection File is Required for Turning Movement Reports");
		}
		if (Report_Flag (TURN_LOS) && !(System_File_Flag (SIGNAL) &&
			System_File_Flag (TIMING_PLAN) && System_File_Flag (PHASING_PLAN))) {

			Error ("Signal Data is Required for Turn Level of Service Analysis");
		}
		turn_flag = true;
	} else {
		if (Report_Flag (TURN_MOVEMENT) || Report_Flag (TURN_LOS)) {
			Error ("Turn Count File is Required for Turning Movement Reports");
		}
		System_File_False (POCKET);
		System_File_False (CONNECTION);
		System_File_False (SIGNAL);
		System_File_False (TIMING_PLAN);
		System_File_False (PHASING_PLAN);
	}

	//---- check for transit reports ----

	if (line_flag || stop_flag) {
		if (!System_File_Flag (TRANSIT_STOP) || !System_File_Flag (TRANSIT_ROUTE) ||
			!System_File_Flag (TRANSIT_SCHEDULE) || !System_File_Flag (TRANSIT_DRIVER) ||
			!System_File_Flag (RIDERSHIP)) {

			Error ("Transit Network and Ridership are Required for Transit Reports");
		}
		if (line_flag && !Check_Control_Key (LINE_EQUIVALENCE_FILE)) {
			Error ("Line Group Equivalance is Required for Line Group Reports");
		}
		if (line_flag && !Check_Control_Key (LINE_GROUP_COUNT_FILE)) {
			Error ("Line Group Counts are Required for Line Group Reports");
		}
		if (stop_flag && !Check_Control_Key (STOP_EQUIVALENCE_FILE)) {
			Error ("Stop Group Equivalance is Required for Stop Group Reports");
		}
		if (stop_flag && !Check_Control_Key (STOP_GROUP_COUNT_FILE)) {
			Error ("Stop Group Counts are Required for Stop Group Reports");
		}
	} else {
		System_File_False (TRANSIT_STOP);
		System_File_False (TRANSIT_ROUTE);
		System_File_False (TRANSIT_SCHEDULE);
		System_File_False (TRANSIT_DRIVER);
		System_File_False (RIDERSHIP);
	}

	//---- check for a link delay file ----

	if (!System_File_Flag (LINK_DELAY)) {

		//---- open the link volume file ----

		if (link_flag) {
			key = Get_Control_String (INPUT_VOLUME_FILE);

			if (key.empty ()) goto control_error;

			Print (1);
			volume_file.File_Type ("Input Volume File");

			volume_file.Open (Project_Filename (key));
		
			Print (1, "Number of Time Periods = ") << volume_file.Num_Periods ();
		}

		//---- open the turn movement file ----

		if (turn_flag) {
			key = Get_Control_String (TURN_VOLUME_FILE);

			if (key.empty ()) goto control_error;

			Print (1);
			turn_volume.File_Type ("Turn Volume File");

			turn_volume.Open (Project_Filename (key));
		}
	} else {
		delay_flag = true;
	}

	//---- open the traffic count file ----

	if (link_flag) {
		key = Get_Control_String (TRAFFIC_COUNT_FILE);

		Print (1);
		count_file.File_Type ("Traffic Count File");

		count_file.Open (Project_Filename (key));

		Print (1, "Number of Time Periods = ") << count_file.Num_Periods ();
	}

	//---- open the turn count file ----

	if (turn_flag) {
		key = Get_Control_String (TURN_COUNT_FILE);

		Print (1);
		turn_count.File_Type ("Turn Count File");

		turn_count.Open (Project_Filename (key));
	}

	//---- open the transit line group count file ----

	if (line_flag) {
		key = Get_Control_String (LINE_GROUP_COUNT_FILE);

		Print (1);
		line_count_file.File_Type ("Transit Line Group Count File");

		line_count_file.Open (Project_Filename (key));

		line_count_file.Required_Field ("GROUP", "LINE", "LINEGROUP", "LINEGRP", "ID");
		line_count_file.Required_Field ("COUNT", "RIDERS", "PASSENGERS", "TOTAL", "VOLUME");
	}

	//---- open the transit stop group count file ----

	if (stop_flag) {
		key = Get_Control_String (STOP_GROUP_COUNT_FILE);

		Print (1);
		stop_count_file.File_Type ("Transit Stop Group Count File");

		stop_count_file.Open (Project_Filename (key));

		stop_count_file.Required_Field ("GROUP", "STOP", "STOPGROUP", "STOPGRP", "ID");

		if (Report_Flag (STOP_GROUP)) {
			stop_count_file.Required_Field ("TOTAL",  "ONOFF", "ON_OFF", "PASSENGERS", "COUNT");
		}
		if (Report_Flag (BOARD_GROUP)) {
			stop_count_file.Required_Field ("BOARDINGS", "BOARD", "ON", "PASSENGERS", "COUNT");
		}
		if (Report_Flag (ALIGHT_GROUP)) {
			stop_count_file.Required_Field ("ALIGHTINGS", "ALIGHT", "OFF", "PASSENGERS", "COUNT");
		}
	}

	//---- create new volume file ----

	key = Get_Control_String (NEW_VOLUME_FILE);

	if (!key.empty ()) {
		if (!delay_flag && !link_flag) {
			Error ("Link Delay or Volume File is Required to Output Volume Data");
		}
		Print (1);
		output_file.File_Type ("New Volume File");

		output_file.Create (Project_Filename (key));
		output_flag = true;
	}

	//---- create new volume count file ----

	key = Get_Control_String (NEW_VOLUME_COUNT_FILE);

	if (!key.empty ()) {
		if (!delay_flag && !link_flag) {
			Error ("Volume and Count Files are Required to Output Volume Count Data");
		}
		Print (1);
		vol_cnt_file.File_Type ("New Volume Count File");

		vol_cnt_file.Create (Project_Filename (key));
		vc_flag = true;
	}

	//---- adjust the volume ranges ----

	hours = 24.0 * sum_periods.Range_Length () / Dtime (MIDNIGHT, SECONDS);

	if (hours < 12.0) {
		double adjust = (hours <= 4.0) ? 0.1 : 0.5;

		for (i=0; volume_level [i] > 0; i++) {
			volume_level [i] = (int) (volume_level [i] * adjust + 0.5);
		}
	}
	hours = hours / sum_periods.Num_Periods ();

	//---- check the data fields ----

	if (link_flag) {
		key = "Traffic Count";

		num = sum_periods.Num_Periods ();

		if (count_file.Num_Periods () < num) goto field_error;

		for (i=0; i < num; i++) {
			sum_periods.Period_Range (i, low, high);
			if (!count_file.In_Range (low) || !count_file.In_Range ((low + high) / 2)) goto field_error;
		}
		if (!delay_flag) {
			key = "Input Volume";

			if (volume_file.Num_Periods () < num) goto field_error;

			for (i=0; i < num; i++) {
				sum_periods.Period_Range (i, low, high);
				if (!volume_file.In_Range (low) || !volume_file.In_Range ((low + high) / 2)) goto field_error;
			}
		}
	}

	//---- read the analysis method ----

	key = Get_Control_Text (ANALYSIS_METHOD);

	if (!key.empty ()) {
		if (key.Equals ("VOLUME")) {
			method = false;
		} else if (key.Equals ("VMT")) {
			method = true;
		} else {
			Error (String ("Analysis Method = %s was Unrecognized") % key);
		}
	}
	header1 = String ("\n%29cNum.  ------%s------ ---Difference---  --Abs.Error--    Std.     %%     R   ----V/C----") %
				BLANK % ((method) ? "--VMT-" : "Volume") % FINISH;

	header2 = String ("    Obs.  Estimate  Observed   %6.6s      %%     Avg.     %%     Dev.   RMSE   Sq.   Avg.  Max.\n") %
				((method) ? "VMT" : "Volume") % FINISH;
	
	//---- read the adjustment factor ----

	factor = Get_Control_Double (ADJUSTMENT_FACTOR);

	//---- open the facility type labels ----

	if (Report_Flag (FACILITY_TYPE)) {
		key = Get_Control_String (FACILITY_TYPE_LABELS);

		if (!key.empty ()) {
			label_file.File_Type ("Facility Type Label File");
			Print (1);

			label_file.Open (Project_Filename (key));

			while (label_file.Read ()) {
				record = label_file.Record_String ();
				if (record.empty ()) continue;

				record.Split (key);
				i = key.Integer ();

				map_stat = facility_type.insert (Str_Map_Data (i, record));

				if (!map_stat.second) {
					Error ("Duplicate Facility Type Label");
				}
			}
			label_file.Close ();
		}
	}

	//---- open the area type labels ----

	if (Report_Flag (AREA_TYPE)) {
		key = Get_Control_String (AREA_TYPE_LABELS);

		if (!key.empty ()) {
			label_file.File_Type ("Area Type Label File");
			Print (1);

			label_file.Open (Project_Filename (key));

			while (label_file.Read ()) {
				record = label_file.Record_String ();
				if (record.empty ()) continue;

				record.Split (key);
				i = key.Integer ();

				map_stat = area_type.insert (Str_Map_Data (i, record));

				if (!map_stat.second) {
					Error ("Duplicate Area Type Label");
				}
			}
			label_file.Close ();
		}
	}

	//---- write the report names ----

	List_Reports ();

	//---- read the zone equiv ----

	if (Zone_Equiv_Flag ()) {
		zone_equiv.Read (Report_Flag (ZONE_EQUIV));
	}

	//---- process support data ----

	if (Link_Equiv_Flag ()) {
		link_equiv.Read (Report_Flag (LINK_EQUIV));
	}

	//---- read the line equiv ----

	if (line_flag) {
		line_equiv.Read (Report_Flag (LINE_EQUIV));
	}

	//---- read the stop equiv ----

	if (stop_flag) {
		stop_equiv.Read (Report_Flag (STOP_EQUIV));
	}
	return;

	//---- error message ----

field_error:
	Error (String ("The %s File has insufficient data for %d Time Increments") % key % num);

control_error:
	Error (String ("Missing Control Key = %s") % Current_Key ());
}