//main()函数的定义
void main(void)
{
    cout<<"The First information!"<<endl;
    cout<<"About to delay 5 seconds"<<endl;
    Dtime(5);
    cout<<"The Second information!"<<endl;
}
Ejemplo n.º 2
0
int Data_Service::Put_Skim_Data (Skim_File &file, Skim_Record &data)
{
	file.Origin (data.Origin ());
	file.Destination (data.Destination ());
	file.Period (data.Period ());
	file.Count (data.Count ());

	if (file.Data_Type () == TIME_TABLE  || file.Total_Time_Flag ()) {
		file.Time (Dtime (data.Time ()).Round_Seconds ());
	} else {
		file.Walk (Dtime (data.Walk ()).Round_Seconds ());
		file.Drive (Dtime (data.Drive ()).Round_Seconds ());
		file.Transit (Dtime (data.Transit ()).Round_Seconds ());
		file.Wait (Dtime (data.Wait ()).Round_Seconds ());
		file.Other (Dtime (data.Other ()).Round_Seconds ());
	}
	file.Length (UnRound (data.Length ()));
	file.Cost (UnRound (data.Cost ()));
	file.Impedance (data.Impedance ());

	if (!file.Write ()) {
		Error (String ("Writing %s") % file.File_Type ());
	}
	return (1);
}
Ejemplo n.º 3
0
int Data_Service::Put_Route_Nodes_Data (Route_Nodes_File &file, Route_Header &data)
{
	Route_Node_Itr node_itr;
	Route_Period_Itr period_itr;
	Node_Data *node_ptr;
	Veh_Type_Data *veh_type_ptr;

	int i, node, dwell, count = 0;
	file.Route (data.Route ());
	file.Mode (data.Mode ());

	if (veh_type_array.size () > 0 && data.Veh_Type () >= 0) {
		veh_type_ptr = &veh_type_array [data.Veh_Type ()];
		file.Veh_Type (veh_type_ptr->Type ());
	} else {
		file.Veh_Type (data.Veh_Type ());
	}
	file.Name (data.Name ());
	file.Notes (data.Notes ());
	file.Nodes ((int) data.nodes.size ());

	for (i=0, period_itr = data.periods.begin (); period_itr != data.periods.end (); period_itr++, i++) {
		file.Headway (i, period_itr->Headway ());
		file.Offset (i, period_itr->Offset ());
		file.TTime (i, period_itr->TTime ());
	}
	if (!file.Write (false)) {
		Error (String ("Writing %s") % file.File_Type ());
	}
	count++;

	for (node_itr = data.nodes.begin (); node_itr != data.nodes.end (); node_itr++) {
		node_ptr = &node_array [node_itr->Node ()];
		node = node_ptr->Node ();
		if (node_itr->Type () == NO_STOP && !file.Type_Flag ()) node = -node;
		dwell = node_itr->Dwell ();
		if (node_itr->Type () != NO_STOP && file.Dwell_Flag () && dwell <= 0) dwell = Dtime (5, SECONDS);

		file.Node (node);
		file.Type (node_itr->Type ());
		file.Dwell (dwell);
		file.Time (node_itr->Time ());
		file.Speed (node_itr->Speed ());

		if (!file.Write (true)) {
			Error (String ("Writing %s") % file.File_Type ());
		}
		count++;
	}
	return (count);
}
//main()函数的定义
void main(void)
{
    //声明变量
    int i;
    time_t current_time;
    char *timep;
    //循环10次,每隔2秒显示一次时间
    for(i=0;i<10;i++) {
        time(&current_time);
        timep=ctime(&current_time);
        cputs(timep);
        Dtime(2);
    }
}
Ejemplo n.º 5
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);
	}
}
Ejemplo n.º 6
0
void NewFormat::Read_Routes (void)
{
	String field;
	int i, node, route, route_fld, mode_fld, ttime_fld, name_fld, note_fld, node_fld, dwell_fld, time_fld, spd_fld;
	int head_fld [24], offset_fld [24], ttim_fld [24];

	Int_Map_Stat map_stat;
	Int_Map_Itr map_itr;
	Route_Header route_rec, *route_ptr;

	//---- process the route header file ----

	Show_Message (String ("Reading %s -- Record") % route_header.File_Type ());
	Set_Progress ();

	route_fld = route_header.Required_Field ("ROUTE", "LINE");
	mode_fld = route_header.Required_Field ("MODE", "TYPE");
	ttime_fld = route_header.Optional_Field ("TTIME", "TIME", "MIN_TIME");
	name_fld = route_header.Optional_Field ("NAME", "ROUTE_NAME", "RTNAME", "DESCRIPTION");
	note_fld = route_header.Optional_Field (NOTES_FIELD_NAMES);
	
	for (i=1; i <= route_periods; i++) {
		field ("HEADWAY_%d") % i;
		head_fld [i-1] = route_header.Required_Field (field.c_str ());

		field ("OFFSET_%d") % i;
		offset_fld [i-1] = route_header.Optional_Field (field.c_str ());

		field ("TTIME_%d") % i;
		ttim_fld [i-1] = route_header.Optional_Field (field.c_str ());
		if (ttim_fld [i-1] < 0) ttim_fld [i-1] = ttime_fld;
	}

	while (route_header.Read ()) {
		Show_Progress ();
		route_rec.Clear ();

		route_rec.Route (route_header.Get_Integer (route_fld));
		if (route_rec.Route () == 0) continue;

		//---- set the parking type ----
		
		route_rec.Mode (Transit_Code (route_header.Get_String (mode_fld)));
		route_rec.Name (route_header.Get_String (name_fld));
		route_rec.Notes (route_header.Get_String (note_fld));

		switch (route_rec.Mode ()) {
			case LOCAL_BUS:
				route_rec.Veh_Type (4);
				break;
			case EXPRESS_BUS:
				route_rec.Veh_Type (5);
				break;
			case BRT:
				route_rec.Veh_Type (6);
				break;
			case STREETCAR:
				route_rec.Veh_Type (7);
				break;
			case LRT:
				route_rec.Veh_Type (8);
				break;
			case RAPIDRAIL:
				route_rec.Veh_Type (9);
				break;
			case REGIONRAIL:
				route_rec.Veh_Type (10);
				break;
		}
		if (veh_type_array.size () > 0) {
			route_rec.Veh_Type (VehType40_Map (route_rec.Veh_Type (), 0));

			if (route_rec.Veh_Type () > 0) {
				Int_Map_Itr map_itr = veh_type_map.find (route_rec.Veh_Type ());
				if (map_itr == veh_type_map.end ()) {
					Warning (String ("Transit Vehicle Type %d was Not Found") % route_rec.Veh_Type ());
					route_rec.Veh_Type (0);
				} else {
					route_rec.Veh_Type (map_itr->second);
				}
			} else {
				route_rec.Veh_Type (0);
			}
		}

		for (i=0; i < route_periods; i++) {
			Route_Period period_rec;

			period_rec.Headway (route_header.Get_Time (head_fld [i]));
			period_rec.Offset (route_header.Get_Time (offset_fld [i]));
			period_rec.TTime (route_header.Get_Integer (ttim_fld [i]));

			route_rec.periods.push_back (period_rec);
		}
		map_stat = route_map.insert (Int_Map_Data (route_rec.Route (), (int) route_nodes_array.size ()));

		if (!map_stat.second) {
			Warning ("Duplicate Route Number = ") << route_rec.Route ();
		} else {
			route_nodes_array.push_back (route_rec);
		}
	}
	End_Progress ();

	Print (2, String ("Number of %s Records = %d") % route_header.File_Type () % Progress_Count ());

	//---- process the route nodes file ----

	Show_Message (String ("Reading %s -- Record") % route_nodes.File_Type ());
	Set_Progress ();

	route_fld = route_nodes.Required_Field ("ROUTE", "LINE");
	node_fld = route_nodes.Required_Field ("NODE", "STOP");
	dwell_fld = route_nodes.Optional_Field ("DWELL", "DWELL_TIME", "STOP_TIME", "STOPTIME");
	time_fld = route_nodes.Optional_Field ("TIME", "TTIME", "RUNTIME", "RUN_TIME");
	spd_fld = route_nodes.Optional_Field ("SPEED", "SPD", "RUNSPD", "RUN_SPD", "RUN_SPEED");

	while (route_nodes.Read ()) {
		Show_Progress ();

		route = route_nodes.Get_Integer (route_fld);

		map_itr = route_map.find (route);
		if (map_itr == route_map.end ()) {
			Warning (String ("Route Nodes Route %d was Not Found in the Route Header File") % route);
			continue;
		}
		route_ptr = &route_nodes_array [map_itr->second];

		Route_Node node_rec;

		node = route_nodes.Get_Integer (node_fld);
		if (node < 0) {
			node_rec.Type (NO_STOP);
			node = -node;
		} else {
			node_rec.Type (STOP);
		}
		map_itr = node_map.find (node);
		if (map_itr == node_map.end ()) {
			Warning (String ("Route %d Node %d was Not Found") % route % node);
			continue;
		}
		node_rec.Node (map_itr->second);
		node_rec.Dwell (Dtime (route_nodes.Get_Integer (dwell_fld), SECONDS));
		node_rec.Time (Dtime (route_nodes.Get_Integer (time_fld), SECONDS));
		node_rec.Speed (Internal_Units (route_nodes.Get_Double (spd_fld), MPS));

		route_ptr->nodes.push_back (node_rec);
	}
	End_Progress ();

	Print (2, String ("Number of %s Records = %d") % route_nodes.File_Type () % Progress_Count ());
}
Ejemplo n.º 7
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);
	}
} 
Ejemplo n.º 8
0
void PerfPrep::Smooth_Turn_Delays (void)
{
	int index, period, num_periods;

	Turn_Itr turn_itr;
	Turn_Data *turn_ptr;
	Turn_Period_Itr period_itr;
	Turn_Period *period_ptr;

	num_periods = (int) turn_period_array.size ();
	if (num_periods < 3) return;

	Show_Message ("Smoothing Turn Delay Data -- Record");
	Set_Progress ();

	//---- process each link direction ----

	period_itr = turn_period_array.begin (); 

	for (index=0, turn_itr = period_itr->begin (); turn_itr != period_itr->end (); turn_itr++, index++) {
		Show_Progress ();

		//---- smooth the turn ----

		smooth_data.Input (0, turn_itr->Turn ());

		for (period=1; period < num_periods; period++) {
			period_ptr = &turn_period_array [period];
			turn_ptr = period_ptr->Data_Ptr (index);

			smooth_data.Input (period, (double) turn_ptr->Turn ());
		}
		smooth_data.Smooth ();

		turn_itr->Turn (smooth_data.Output (0));

		for (period=1; period < num_periods; period++) {
			period_ptr = &turn_period_array [period];
			turn_ptr = period_ptr->Data_Ptr (index);

			turn_ptr->Turn (smooth_data.Output (period));
		}

		//---- smooth the travel time ----

		smooth_data.Input (0, (double) turn_itr->Time ());

		for (period=1; period < num_periods; period++) {
			period_ptr = &turn_period_array [period];
			turn_ptr = period_ptr->Data_Ptr (index);

			smooth_data.Input (period, (double) turn_ptr->Time ());
		}
		smooth_data.Smooth ();

		turn_itr->Time (Dtime (smooth_data.Output (0)));

		for (period=1; period < num_periods; period++) {
			period_ptr = &turn_period_array [period];
			turn_ptr = period_ptr->Data_Ptr (index);

			turn_ptr->Time (Dtime (smooth_data.Output (period)));
		}
	}
	End_Progress ();
}
Ejemplo n.º 9
0
bool Db_Base::Read_Field (Db_Field *fld, void *data, Field_Type type)
{
	if (data == 0) return (Status (NULL_POINTER));
	
	//---- initialize the data field ----

	switch (type) {
		case DB_INTEGER:
			*((int *) data) = 0;
			break;
		case DB_DOUBLE:
			*((double *) data) = 0.0;
			break;
		case DB_STRING:
			((string *) data)->clear ();
			break;
		case DB_TIME:
			*((Dtime *) data) = 0;
			break;
		default:
			return (Status (DB_ERROR));
	}
	if (fld == 0) return (Status (NO_FIELD, false));

	Nested (fld->Nested ());

	char *field = Record_String ();

	if (field == 0) return (Status (RECORD_SIZE));

	Field_Type fld_type;
	bool asc_flag = true;
	int len, lvalue = 0;
	double dvalue = 0.0;
	String svalue;
	Dtime tvalue = 0;

	int size = fld->Width ();
	int offset = fld->Offset ();

	switch (Record_Format ()) {
		case BINARY:
			if (fld->Type () != DB_STRING) {
				field += offset;
				asc_flag = false;
				break;
			} else {
				len = (int) strlen (field + offset);
				if (len < size) size = len;
			}
		case FIXED_COLUMN:
			svalue.assign (field + offset, size);
			svalue.Clean ();
			break;
		case COMMA_DELIMITED:
		case SPACE_DELIMITED:
		case TAB_DELIMITED:
		case CSV_DELIMITED:
			svalue (fld->Buffer ());
			size = (int) svalue.size ();
			break;
		default:
			svalue  = Get_Field_Number (offset);
			size = (int) svalue.size ();
			break;
	}

	//---- read the field from the current record ----

	switch (fld->Type ()) {
		default:
			return (Status (DB_ERROR));

		case DB_INTEGER:
			if (asc_flag) {
				lvalue = svalue.Integer ();
			} else if (size == sizeof (int)) {
				lvalue = *((int *) field);
			} else if (size == sizeof (short)) {
				lvalue = *((short *) field);
			} else if (size == sizeof (char)) {
				lvalue = *((char *) field);
			} else {
				return (Status (FIELD_BYTES));
			}
			fld_type = DB_INTEGER;
			break;
			
		case DB_UNSIGNED:
			if (asc_flag) {
				lvalue = svalue.Integer ();
			} else if (size == sizeof (int)) {
				lvalue = *((unsigned int *) field);
			} else if (size == sizeof (short)) {
				lvalue = *((unsigned short *) field);
			} else if (size == sizeof (char)) {
				lvalue = *((unsigned char *) field);
			} else {
				return (Status (FIELD_BYTES));
			}
			fld_type = DB_INTEGER;
			break;
			
		case DB_DOUBLE:
			if (asc_flag) {
				dvalue = svalue.Double ();
			} else if (size == sizeof (double)) {
				dvalue = *((double *) field);
			} else if (size == sizeof (float)) {
				dvalue = *((float *) field);
			} else {
				return (Status (FIELD_BYTES));
			}
			fld_type = DB_DOUBLE;
			break;
			
		case DB_FIXED:
			if (asc_flag) {
				dvalue = svalue.Double ();
				if (svalue.find ('.') == 0) {
					dvalue = dvalue / pow (10.0, fld->Decimal ());
				}
			} else {
				if (size == sizeof (int)) {
					lvalue = *((int *) field);
				} else if (size == sizeof (short)) {
					lvalue = *((short *) field);
				} else if (size == sizeof (char)) {
					lvalue = *((char *) field);
				} else {
					return (Status (FIELD_BYTES));
				}
				dvalue = (double) lvalue / pow (10.0, fld->Decimal ());
			}
			fld_type = DB_DOUBLE;
			break;
			
		case DB_STRING:
			fld_type = DB_STRING;
			break;

		case DB_CHAR:
			if (asc_flag) {
				if (svalue.empty ()) {
					svalue = " ";
				}
			} else {
				if (*field == '\0') {
					svalue = " ";
				} else {
					svalue.insert (0, field, 1);
				}
			}
			fld_type = DB_STRING;
			break;
			
		case DB_TIME:
			if (asc_flag) {
				tvalue.Time_String (svalue, fld->Units ());
			} else if (size == sizeof (Dtime)) {
				tvalue = *((int *) field);
			} else if (size == sizeof (short)) {
				tvalue = *((short *) field);
			} else {
				return (Status (FIELD_BYTES));
			}
			fld_type = DB_TIME;
			break;
	}

	//---- convert to internal units ----

	if (fld->Units () != NO_UNITS) {
		if (fld_type == DB_INTEGER) {
			lvalue = Internal_Units (lvalue, fld->Units ());
		} else if (fld_type == DB_DOUBLE) {
			dvalue = Internal_Units (dvalue, fld->Units ());
		} else if (fld->Units () < SECONDS || fld->Units () > TIME_CODE) {
			if (fld_type == DB_STRING && fld->Units () >= FACILITY_CODE) {
				if (type == DB_INTEGER) {
					lvalue = Internal_Units (svalue, fld->Units ());
					if (lvalue < -1) return (Status (FIELD_UNITS));
					if (lvalue >= 0) fld_type = DB_INTEGER;
				}
			} else {
				return (Status (FIELD_UNITS));
			}
		}
	}

	//---- convert to the output data type ----

	switch (type) {
		case DB_INTEGER:
			switch (fld_type) {
				case DB_INTEGER:
					*((int *) data) = lvalue;
					break;
				case DB_DOUBLE:
					*((int *) data) = DTOI (dvalue);
					break;
				case DB_STRING:
					if (svalue [0] < '0' || svalue [0] > '9' || svalue.find_first_of ("@:") != svalue.npos) {
						*((int *) data) = (int) Dtime (svalue);
					} else {
						*((int *) data) = svalue.Integer ();
					}
					break;
				case DB_TIME:
					*((int *) data) = (int) tvalue;
					break;
				default:
					return (Status (DB_ERROR));
			}
			break;

		case DB_DOUBLE:
			switch (fld_type) {
				case DB_INTEGER:
					*((double *) data) = lvalue;
					break;
				case DB_DOUBLE:
					*((double *) data) = dvalue;
					break;
				case DB_STRING:
					if (svalue [0] < '0' || svalue [0] > '9' || svalue.find_first_of ("@:") != svalue.npos) {
						*((double *) data) = (int) Dtime (svalue);
					} else {
						*((double *) data) = svalue.Double ();
					}
					break;
				case DB_TIME:
					*((double *) data) = (double) tvalue;
					break;
				default:
					return (Status (DB_ERROR));
			}
			break;

		case DB_STRING:
			switch (fld->Type ()) {
				case DB_TIME:
					svalue = tvalue.Time_String ();
					break;
				default:
					if (fld_type == DB_INTEGER) {
						svalue (lvalue);
					} else if (fld_type == DB_DOUBLE) {
						svalue (dvalue, fld->Decimal ());
					}
					break;
			}
			len = (int) svalue.size ();
			if (len > 0) {
				if (len > fld->Width ()) len = fld->Width ();

				*((string *) data) = svalue.substr (0, len);
			} else {
				(*((string *) data)).clear ();
			}
			break;

		case DB_TIME:
			switch (fld_type) {
				case DB_INTEGER:
					*((Dtime *) data) = Dtime (lvalue, fld->Units ());
					break;
				case DB_DOUBLE:
					*((Dtime *) data) = Dtime (dvalue, fld->Units ());
					break;
				case DB_STRING:
					*((Dtime *) data) = svalue;
					break;
				case DB_TIME:
					*((Dtime *) data) = tvalue;
					break;
				default:
					return (Status (DB_ERROR));
			}
			break;
		default:
			return (Status (DB_ERROR));
	}
	return (true);
}
Ejemplo n.º 10
0
	void   Increment (string text)             { Set_Periods (Dtime (text), Start (), End (), Wrap_Flag ()); }
Ejemplo n.º 11
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 ());
}