Esempio n. 1
0
void ConvertTrips::Execute (void)
{
	ConvertTrip_Itr group;

	//---- compile user scripts ----

	Compile_Scripts ();

	//---- read the network ----

	Data_Service::Execute ();

	//---- generate the zone map ----

	Zone_Location ();

	//---- zone summary data ----

	if (zone_sum_flag) {
		org_in.assign (zone_map.size (), 0);
		des_in.assign (zone_map.size (), 0);
		org_out.assign (zone_map.size (), 0);
		des_out.assign (zone_map.size (), 0);
	}

	//---- check the parking lots ----

	if (parking_array.size () > 0) {
		Parking_Check ();
	}

	//---- process group data ----

	Show_Message (1);

	for (group = convert_group.begin (); group != convert_group.end (); group++) {
		group->Read_Diurnal ();
		if (group->Factor_Flag ()) group->Read_Factors (zone_equiv);

		if (group->Mode () == TRANSIT_MODE || group->Mode () == RIDE_MODE || 
			group->Mode () == WALK_MODE || group->Mode () == BIKE_MODE) continue;

		if (veh_type_map.find (group->Veh_Type ()) == veh_type_map.end ()) {
			Error (String ("Vehicle Type %d was Not Found in the Vehicle Type Flle") % group->Veh_Type ());
		}
	}
	if (hhold_id <= max_hh_in) hhold_id = 100 * ((max_hh_in / 100) + 1);

	//---- process the tour file ----

	if (tour_flag) {
		Tour_Processing ();
	}
	if (hhold_id <= max_hh_in) hhold_id = 100 * ((max_hh_in / 100) + 1);

	//---- process trip files ----

	for (group = convert_group.begin (); group != convert_group.end (); group++) {
		if (group->Trip_Flag ()) {
			if (group->Mode () >= 0 && group->Mode () < MAX_MODE && !select_mode [group->Mode ()]) continue;
			if (select_purposes && !purpose_range.In_Range (group->Purpose ())) continue;

			Read_Trip_Table (group);
		}
	}

	//---- new diurnal file ----

	if (diurnal_flag) {
		Diurnal_Results ();
	}

	//---- summarize the results ----

	if (trip_copy > 0 || hhold_copy > 0 || veh_copy > 0) {
		Break_Check (5);

		Write (2, "Number of Trip Records Copied      = ") << trip_copy;
		Write (1, "Number of Household Records Copied = ") << hhold_copy;
		Write (1, "Number of Vehicle Records Copied   = ") << veh_copy;
	}

	Break_Check (10);

	Write (2, "Total Number of Tours Read     = ") << tot_tours;
	Write (1, "Total Number of Trips Read     = ") << tot_trips;
	Write (1, "Total Number of Trips Written  = ") << new_trips;
	if (tot_add > 0.5) {
		Write (1, String ("Total Number of Trips Added    = %.0lf") % tot_add);
	}
	if (tot_del > 0.5) {
		Write (1, String ("Total Number of Trips Deleted  = %.0lf") % tot_del);
	}
	Write (1, "Number of Trips Not Allocated  = ") << tot_errors;

	Write (2, "Number of Households Generated = ") << new_hholds;
	Write (1, "Number of Persons Generated    = ") << new_persons;
	Write (1, "Number of Vehicles Generated   = ") << new_vehicles;

	if (problem_flag) {
		if (problem_file->Num_Trips () > 0) {
			problem_file->Print_Summary ();
		}
	}

	if (zone_sum_flag) {
		Zone_Sum_Report ();
	}

	//---- end the program ----

	Report_Problems (tot_trips);
	Exit_Stat (DONE);
}
Esempio n. 2
0
void CheckSurvey::Execute (void)
{
	
	//---- read the household type script ----

	if (survey_type_flag) {
		Type_Script ();
		Flush ();
	}

	//---- read the household list ----

	if (hhlist_flag) {
		Household_List ();
	}	

	//---- read the survey files ----

	Survey_Households ();

	if (weight_flag) {
		Survey_Weights ();
	}
	Survey_Population ();

	Survey_Activity ();

	//---- print reports ----

	for (int i=First_Report (); i != 0; i=Next_Report ()) {
		switch (i) {
			case SURVEY_TYPE:		//---- Survey Type Summary ----
				Type_Report ();
				break;
			case TRIP_LENGTH:
				trip_length.Report (TRIP_LENGTH, "Trip Length Summary", "Purpose");
				break;
			case TOUR_LENGTH:
				tour_length.Report (TOUR_LENGTH, "Tour Length Summary", "Purpose");
				break;
			case TRIP_PURPOSE:
				trip_purpose.Report (TRIP_PURPOSE, "Trip Purpose Summary", " ", "Purpose");
				break;
			case TOUR_PURPOSE:	
				tour_purpose.Report (TOUR_PURPOSE, "Tour Purpose Summary", "Purpose", "-Stops");
				break;
			case MODE_LENGTH:
				mode_length.Report (MODE_LENGTH, "Mode Length Summary", " Mode");
				break;
			case MODE_PURPOSE:	
				mode_purpose.Report (MODE_PURPOSE, "Mode Purpose Summary", " Mode-", "Purpose");
				break;
			default:
				break;
		}
	}

	//---- end the program ----

	Print (2, "Number of Households = %d", nhhold);
	Print (1, "Number of Persons = %d", nperson);
	Print (1, "Number of Workers = %d", nwork);

	if (nhhold == 0) nhhold = 1;

	Print (2, "Persons per Household = %.2lf", (double) nperson / nhhold);
	Print (1, "Workers per Household = %.2lf", (double) nwork / nhhold);

	if (nperson == 0) nperson = 1;

	if (num_problem > 0 || num_act_gen != num_activity) {
		Print (2, "Number of Activities Generated = %d", num_act_gen);

		if (num_problem > 0) {
			Print (1, "Number of Activities with Problems = %d (%.1lf%%)", num_problem,
				(100.0 * num_problem / num_act_gen));
		}
		Print (1, "Number of Activities Written = %d (%.1lf%%)", num_activity,
			(100.0 * num_activity / num_act_gen));
	} else {
		Print (2, "Number of Activities = %d", num_activity);
	}
	Print (2, "Activities per Household = %.2lf", (double) num_activity / nhhold);
	Print (1, "Activities per Person = %.2lf", (double) num_activity / nperson);

	if (nproblem) {
		Write (2, "Number of Households with Problems = %d (%.1lf%%)", nproblem,
			(100.0 * nproblem / survey_hh_data.Num_Records ()));
	}
	Report_Problems ();

	Exit_Stat (DONE);
}