void ActivityPattern::Read_Scripts (void) { Print (1); //---- read the household type script ---- if (hhold_type_flag) { Write (1, "Compiling Household Type Script"); if (Report_Flag (HOUSEHOLD_SCRIPT)) { Header_Number (HOUSEHOLD_SCRIPT); if (!Break_Check (10)) { Print (1); Page_Header (); } } hhold_type.Set_Files (1, Demand_Db_Base (HOUSEHOLD)); if (!hhold_type.Compile (&hhold_type_file, Report_Flag (HOUSEHOLD_SCRIPT))) { Error ("Compiling Household Type Script"); } if (Report_Flag (HOUSEHOLD_STACK)) { Header_Number (HOUSEHOLD_STACK); hhold_type.Print_Commands (false); } } //---- read the survey type script ---- if (survey_type_flag) { Write (1, "Compiling Survey Type Script"); if (Report_Flag (SURVEY_SCRIPT)) { Header_Number (SURVEY_SCRIPT); if (!Break_Check (10)) { Print (1); Page_Header (); } } survey_type.Set_Files (1, &survey_hh_file); if (!survey_type.Compile (&survey_type_file, Report_Flag (SURVEY_SCRIPT))) { Error ("Compiling Survey Type Script"); } if (Report_Flag (SURVEY_STACK)) { Header_Number (SURVEY_STACK); survey_type.Print_Commands (false); } } Header_Number (0); Show_Message (1); }
void GISNet::Execute (void) { //---- read the conversion script ---- if (convert_flag) { if (Report_Flag (SCRIPT_REPORT)) { Header_Number (SCRIPT_REPORT); if (!Break_Check (10)) { Print (1); Page_Header (); } } convert.Set_Files (2, &gis_file, Network_Db_Base (NEW_LINK)); if (!convert.Compile (&script_file, Report_Flag (SCRIPT_REPORT))) { Error ("Compiling Conversion Script"); } if (Report_Flag (STACK_REPORT)) { Header_Number (STACK_REPORT); convert.Print_Commands (false); } Header_Number (0); } //---- gis node file ---- if (node_flag) { Read_Node (); } //---- gis link file ---- Read_Link (); //---- end the program ---- Exit_Stat (DONE); }
void ActivityPattern::Read_Survey (void) { //---- read the survey household weights ---- if (weight_flag) { Survey_Weights (); } //---- read the survey household data ---- Survey_Households (); //---- survey type summary report ---- if (Report_Flag (SURVEY_TYPE)) { Header_Number (SURVEY_TYPE); if (!Break_Check (type_data.Num_Records () + 4)) { Print (1); Page_Header (); } Type_Data *type_ptr; for (type_ptr = type_data.First_Key (); type_ptr; type_ptr = type_data.Next_Key ()) { Print (1, "%4d %8d %15.6lf %14.6lf", type_ptr->Type (), type_ptr->Num_Survey (), type_ptr->Cum_Weight (), type_ptr->Cum_Weight () / ((type_ptr->Num_Survey () > 0) ? type_ptr->Num_Survey () : 1)); } Header_Number (0); } //---- read the survey popoulation data ---- Survey_Population (); //---- read the survey activity data ---- Survey_Activity (); }
void LocationData::Set_Files (void) { int i, nfld, key; bool binary; Db_Field *fld; Db_Base *file; Db_Sort_Array *data; Data_Itr data_itr; Polygon_Itr poly_itr; //---- create the program data structure ---- data_rec.push_back (input_file); data_rec.push_back (output_file); //---- convert each data file to binary ---- for (data_itr = data_group.begin (); data_itr != data_group.end (); data_itr++) { file = data_itr->file; data = data_itr->data_db; data_rec.push_back ((Db_Base *) data); data->File_ID (file->File_ID ()); data->File_Type (file->File_Type ()); nfld = file->Num_Fields (); key = data_itr->join_field; binary = (file->Record_Format () == BINARY); fld = file->Field (key); data->Add_Field (fld->Name (), DB_INTEGER, 10); data->Add_Field ("AL_COUNT", DB_INTEGER, 10); for (i=0; i < nfld; i++) { if (i == key) continue; fld = file->Field (i); if (fld != 0) { data->Add_Field (fld->Name (), fld->Type (), fld->Size (), fld->Units (), binary); } } } //---- read the arcview boundary file ---- for (poly_itr = polygons.begin (); poly_itr != polygons.end (); poly_itr++) { file = poly_itr->file; data = poly_itr->data_db; data_rec.push_back ((Db_Base *) data); data->File_ID (file->File_ID ()); data->File_Type (file->File_Type ()); nfld = file->Num_Fields (); binary = (file->Record_Format () == BINARY); data->Add_Field ("INDEX", DB_INTEGER, 10); for (i=0; i < nfld; i++) { fld = file->Field (i); if (fld != 0) { data->Add_Field (fld->Name (), fld->Type (), fld->Size (), fld->Units (), binary); } } } Write (1, "Compiling Conversion Script"); if (Report_Flag (PRINT_SCRIPT)) { Header_Number (PRINT_SCRIPT); if (!Break_Check (10)) { Print (1); Page_Header (); } } program.Initialize (data_rec, random.Seed () + 1); if (!program.Compile (program_file, Report_Flag (PRINT_SCRIPT))) { Error ("Compiling Conversion Script"); } if (Report_Flag (PRINT_STACK)) { Header_Number (PRINT_STACK); program.Print_Commands (false); } Header_Number (0); }
void TPPlusNet::Execute (void) { //---- read the conversion script ---- if (convert_flag) { int num; Db_Base *files [3]; if (Report_Flag (SCRIPT_REPORT)) { Header_Number (SCRIPT_REPORT); if (!Break_Check (10)) { Print (1); Page_Header (); } } if (link_shape_flag) { files [0] = &link_shape_file; } else { files [0] = &link_file; } files [1] = Network_Db_Base (NEW_LINK); if (detail_flag) { files [2] = &detail_file; num = 3; } else { num = 2; } convert.Set_Files (num, files); if (!convert.Compile (&script_file, Report_Flag (SCRIPT_REPORT))) { Error ("Compiling Conversion Script"); } if (Report_Flag (STACK_REPORT)) { Header_Number (STACK_REPORT); convert.Print_Commands (false); } Header_Number (0); } //---- setup network data ---- Network_Service::Execute (); //---- read the speed capacity file ---- if (spdcap_flag) { Read_SpdCap (); } //---- read the node file ---- Read_Node (); //---- read the link file ---- Read_Link (); //---- write the link file ---- Write_Link (); //---- end the program ---- Exit_Stat (DONE); }
void ConvertTours::Execute (void) { int hhold1, vehicle1; File_Group *group; //---- compile the tour group script ---- if (script_flag) { Show_Message (1); script_base.File_ID ("GROUP"); script_base.Dbase_Format (BINARY); script_base.File_Access (MODIFY); script_base.Add_Field ("GROUP_OUT", INTEGER, 2, 0, -1, true); script_base.Add_Field ("GROUP_IN", INTEGER, 2, 0, -1, true); script_base.Add_Field ("DIURNAL_OUT", INTEGER, 2, 0, -1, true); script_base.Add_Field ("DIURNAL_IN", INTEGER, 2, 0, -1, true); script_base.Add_Field ("MODE_OUT", INTEGER, 2, 0, -1, true); script_base.Add_Field ("MODE_IN", INTEGER, 2, 0, -1, true); script_base.Add_Field ("WORK_CODE", INTEGER, 2, 0, -1, true); if (!group_script.Set_Files (2, &tour_file_db, &script_base)) { Error ("Initializing Tour Group Script Files"); } group_script.Random_Seed (random_org.Seed () + 4); if (Report_Flag (SCRIPT_REPORT)) { Header_Number (SCRIPT_REPORT); if (!Break_Check (10)) { Print (1); Page_Header (); } } if (!group_script.Compile (&script_file, Report_Flag (SCRIPT_REPORT))) { Error ("Compiling Tour Group Script"); } if (Report_Flag (STACK_REPORT)) { Header_Number (STACK_REPORT); group_script.Print_Commands (Report_Flag (STACK_REPORT)); } Header_Number (0); } Show_Message (1); for (group = file_group.First (); group != NULL; group = file_group.Next ()) { Time_Processing (group); } //---- read the network ---- Demand_Service::Execute (); //---- generate the zone map ---- Zone_Location (); //---- check the parking lots ---- Parking_Check (); //---- check the vehicle types ---- if (Demand_File_Flag (VEHICLE_TYPE)) { for (group = file_group.First (); group != NULL; group = file_group.Next ()) { if (veh_type_data.Get (group->Type (), group->SubType ()) == NULL) { Error ("Vehicle Type %d-%d was Not Found in the Vehicle Type Flle", group->Type (), group->SubType ()); } } } //---- read the household list ---- if (hhlist_flag) { Read_HHList (); } //---- process each trip table ----- if (hhold_id <= max_hh_in) hhold_id = 100 * ((max_hh_in / 100) + 1); if (vehicle_id <= max_veh_in) vehicle_id = 100 * ((max_veh_in / 100) + 1); hhold1 = hhold_id; vehicle1 = vehicle_id; //---- travel time skim ---- if (skim_flag) { Skim_Processing (); } //---- read the tour file ---- Tour_Processing (); //---- diurnal allocation file ---- if (diurnal_flag) { Diurnal_Results (); } //---- summarize the results ---- if (trip_copy > 0 || hhold_copy > 0 || pop_copy > 0 || veh_copy > 0) { Break_Check (5); Write (2, "Number of Trip Records Copied = %d", trip_copy); Write (1, "Number of Household Records Copied = %d", hhold_copy); Write (1, "Number of Person Records Copied = %d", pop_copy); Write (1, "Number of Vehicle Records Copied = %d", veh_copy); } Break_Check (10); Write (2, "Total Number of Tours Read = %d", tot_trips); Write (1, "Total Number of Trips Written = %d", num_trip); if (tot_add > 0.5) { Write (1, "Total Number of Trips Added = %.0lf", tot_add); } if (tot_del > 0.5) { Write (1, "Total Number of Trips Deleted = %.0lf", tot_del); } Write (1, "Number of Trips Not Allocated = %d", tot_errors); Write (2, "Number of Households Generated = %d", nhhold); Write (1, "Number of Persons Generated = %d", nperson); Write (1, "Number of Vehicles Generated = %d", (vehicle_id - vehicle1)); Exit_Stat (DONE); }