|
From: subversion c. n. <tra...@li...> - 2018-11-16 14:35:04
|
Revision: 1712
http://sourceforge.net/p/transims/code/1712
Author: davidroden
Date: 2018-11-16 14:35:03 +0000 (Fri, 16 Nov 2018)
Log Message:
-----------
TRANSIMS Version 7.2 -- AECOM branch 1704
SysLib
Additional method was added to Control Services to print default values for unspecified control keys.
Data_Service
A default linear toll function was added for lane-use toll function values that do not have a corresponding user function specification.
LinkSum 7.2.1
NEW_GROUP_SUMMARY_PERIODS and NEW_GROUP_SUMMARY_RATIOS keys were added for custom link group processing of corridor volume, queue and travel time summaries for selected time periods.
Modified Paths:
--------------
version7/branches/aecom/Transims70/Data_Service/Read_Lane_Uses.cpp
version7/branches/aecom/Transims70/Include/Control_Service.hpp
version7/branches/aecom/Transims70/LinkSum/Control.cpp
version7/branches/aecom/Transims70/LinkSum/Execute.cpp
version7/branches/aecom/Transims70/LinkSum/Group_Sum_File.cpp
version7/branches/aecom/Transims70/LinkSum/Group_Summary.cpp
version7/branches/aecom/Transims70/LinkSum/LinkSum.cpp
version7/branches/aecom/Transims70/LinkSum/LinkSum.hpp
version7/branches/aecom/Transims70/LinkSum/LinkSum.vcxproj
version7/branches/aecom/Transims70/LinkSum/LinkSum.vcxproj.filters
version7/branches/aecom/Transims70/SysLib/Service/Control_Service.cpp
Added Paths:
-----------
version7/branches/aecom/Transims70/LinkSum/Custom_Groups.cpp
Modified: version7/branches/aecom/Transims70/Data_Service/Read_Lane_Uses.cpp
===================================================================
--- version7/branches/aecom/Transims70/Data_Service/Read_Lane_Uses.cpp 2018-08-10 16:45:12 UTC (rev 1711)
+++ version7/branches/aecom/Transims70/Data_Service/Read_Lane_Uses.cpp 2018-11-16 14:35:03 UTC (rev 1712)
@@ -460,6 +460,8 @@
if (lane_use_rec.Toll_Func () > 0 && !exe->functions.Function_Check (lane_use_rec.Toll_Func ())) {
Warning (String ("Lane Use %d Toll Function %d was Not Found") % Progress_Count () % lane_use_rec.Toll_Func ());
+ string func = "LINEAR, 0, 1";
+ exe->functions.Add_Function (lane_use_rec.Toll_Func (), func, false);
}
lane_use_rec.Min_Delay (file.Min_Delay ());
lane_use_rec.Max_Delay (file.Max_Delay ());
Modified: version7/branches/aecom/Transims70/Include/Control_Service.hpp
===================================================================
--- version7/branches/aecom/Transims70/Include/Control_Service.hpp 2018-08-10 16:45:12 UTC (rev 1711)
+++ version7/branches/aecom/Transims70/Include/Control_Service.hpp 2018-11-16 14:35:03 UTC (rev 1712)
@@ -64,6 +64,7 @@
bool Set_Control_Flag (int code, int nest1 = 0, int nest2 = 0, int nest3 = 0, int nest4 = 0);
String Get_Control_Text (int code, int nest1 = 0, int nest2 = 0, int nest3 = 0, int nest4 = 0);
+ String Get_Control_Text (int code, bool help);
bool Get_Control_Flag (int code, int nest1 = 0, int nest2 = 0, int nest3 = 0, int nest4 = 0);
int Get_Control_Integer (int code, int nest1 = 0, int nest2 = 0, int nest3 = 0, int nest4 = 0);
double Get_Control_Double (int code, int nest1 = 0, int nest2 = 0, int nest3 = 0, int nest4 = 0);
Modified: version7/branches/aecom/Transims70/LinkSum/Control.cpp
===================================================================
--- version7/branches/aecom/Transims70/LinkSum/Control.cpp 2018-08-10 16:45:12 UTC (rev 1711)
+++ version7/branches/aecom/Transims70/LinkSum/Control.cpp 2018-11-16 14:35:03 UTC (rev 1712)
@@ -410,6 +410,32 @@
group_sum_file.Create (Project_Filename (key));
group_sum_flag = true;
+
+ //---- group summary periods ----
+
+ if (!Control_Key_Empty (NEW_GROUP_SUMMARY_PERIODS)) {
+ group_periods_flag = group_periods.Add_Ranges (Get_Control_Text (NEW_GROUP_SUMMARY_PERIODS));
+
+ if (group_periods.Num_Periods () > num_inc) {
+ Error (String ("Group Summary Periods %d > Summary Increments %d") % group_periods.Num_Periods () % num_inc);
+ }
+ }
+
+ //---- group summary ratios ----
+
+ if (Check_Control_Key (NEW_GROUP_SUMMARY_RATIOS)) {
+ Double_List list;
+ Dbl_Itr dbl_itr;
+
+ Get_Control_List (NEW_GROUP_SUMMARY_RATIOS, list);
+
+ for (i = 0, dbl_itr = list.begin (); dbl_itr != list.end (); dbl_itr++, i++) {
+ if (i > 0 && *dbl_itr >= 1.0) {
+ group_ratios.push_back (Round (*dbl_itr * 100.0));
+ group_ratios_flag = true;
+ }
+ }
+ }
}
//---- speed contour file ----
@@ -474,15 +500,28 @@
//---- 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;
+ if (periods_flag || ratios_flag || group_periods_flag || group_ratios_flag) {
+ num = i = 0;
+
+ 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;
+ }
}
+ if (group_periods_flag || group_ratios_flag) {
+ i = (group_periods_flag) ? (int) group_periods.size () : 1;
+ i += (group_ratios_flag) ? (int) group_ratios.size () : 1;
+ if (num_inc + 1 > i) {
+ i = num_inc + 1;
+ }
+ }
+ if (i > num) num = i;
} else {
num = num_inc + 1;
}
+
sum_bin.assign (num, dbl);
for (itr = sum_bin.begin (); itr != sum_bin.end (); itr++) {
Added: version7/branches/aecom/Transims70/LinkSum/Custom_Groups.cpp
===================================================================
--- version7/branches/aecom/Transims70/LinkSum/Custom_Groups.cpp (rev 0)
+++ version7/branches/aecom/Transims70/LinkSum/Custom_Groups.cpp 2018-11-16 14:35:03 UTC (rev 1712)
@@ -0,0 +1,513 @@
+//*********************************************************
+// Custom_Groups.cpp - network performance data file
+//*********************************************************
+
+#include "LinkSum.hpp"
+
+#define LINKS 0
+#define LENGTH 1
+#define LANES 2
+#define MAX_DEN 3
+#define MAX_QUEUE 4
+#define VMT 5
+#define VHT 6
+#define VHD 7
+#define TIME_RATIO 8
+#define DENSITY 9
+#define QUEUE 10
+#define FAILURE 11
+#define TURNS 12
+#define CONG_VMT 13
+#define CONG_VHT 14
+#define CONG_TIME 15
+#define COUNT 16
+#define PREV 17
+
+//---------------------------------------------------------
+// Custom_Groups
+//---------------------------------------------------------
+
+void LinkSum::Custom_Groups (void)
+{
+ int i, j, k, p, num_p, r, num_r, n, index, use_index, link;
+ int text_field, value_field, compare_field, link_count, num_sum;
+ double length, value, percent, factor, time, lane_len, ratio, hours;
+ String buffer, units, vmt, lane_mi, type;
+ bool connect_flag, first_ratio;
+ Dtime low, high, tod, period, period_low, period_high;
+
+ Link_Data *link_ptr;
+ Dir_Data *dir_ptr;
+ Perf_Period_Itr period_itr;
+ Perf_Period *period_ptr;
+ Perf_Data perf_data;
+ Turn_Period_Itr turn_itr;
+ Turn_Period *compare_ptr;
+ Turn_Data *turn_ptr;
+ Connect_Data *connect_ptr;
+ Doubles_Itr itr;
+ Int_Set *group;
+ Int_Set_Itr group_itr;
+ Int_Map_Itr map_itr;
+ Performance_Data data;
+
+ Show_Message (String ("Writing %s -- Record") % group_sum_file.File_Type ());
+ Set_Progress ();
+
+ text_field = group_sum_file.Field_Number ("MEASURE");
+ value_field = group_sum_file.Field_Number ("VALUE");
+ compare_field = group_sum_file.Field_Number ("COMPARE");
+
+ if (group_periods_flag) {
+ num_p = group_periods.Num_Periods ();
+ } else {
+ num_p = 1;
+ }
+ if (group_ratios_flag) {
+ num_r = (int) group_ratios.size ();
+ } else {
+ num_r = 1;
+ }
+
+ //---- clear the summary bins -----
+
+ if (compare_flag) {
+ connect_flag = System_Data_Flag (CONNECTION) && (turn_period_array.size () > 0) && (compare_turn_array.size () > 0);
+ } else {
+ connect_flag = System_Data_Flag (CONNECTION) && (turn_period_array.size () > 0);
+ }
+
+ type = (person_flag) ? "Person" : "Vehicle";
+
+ //---- process each link group ----
+
+ for (i = link_equiv.First_Group (); i > 0; i = link_equiv.Next_Group ()) {
+
+ group = link_equiv.Group_List (i);
+ if (group == 0) continue;
+
+ header_label ("%d. %s") % i % link_equiv.Group_Label (i);
+
+ //---- clear the summary bins -----
+
+ for (itr = sum_bin.begin (); itr != sum_bin.end (); itr++) {
+ itr->assign (NUM_SUM_BINS, 0.0);
+ }
+
+ //---- process each link in the link group ----
+
+ link_count = 0;
+
+ for (group_itr = group->begin (); group_itr != group->end (); group_itr++) {
+ Show_Progress ();
+ link = *group_itr;
+
+ map_itr = link_map.find (abs (link));
+ if (map_itr == link_map.end ()) continue;
+
+ link_ptr = &link_array [map_itr->second];
+
+ if (select_link_flag && link_ptr->Use () == 0) continue;
+
+ length = UnRound (link_ptr->Length ());
+
+ if (link < 0) {
+ if (link_ptr->Use () == -1) continue;
+ index = link_ptr->BA_Dir ();
+ } else {
+ if (link_ptr->Use () == -2) continue;
+ index = link_ptr->AB_Dir ();
+ }
+ if (index < 0) continue;
+
+ dir_ptr = &dir_array [index];
+ use_index = dir_ptr->Use_Index ();
+
+ link_count++;
+
+ for (j=0, period_itr = perf_period_array.begin (); period_itr != perf_period_array.end (); period_itr++, j++) {
+
+ perf_period_array.periods->Period_Range (j, low, high);
+
+ data.Start (low);
+ data.End (high);
+
+ perf_data = period_itr->Total_Performance (index, use_index);
+
+ if (data.Get_Data (&perf_data, dir_ptr, link_ptr, Maximum_Time_Ratio (), person_flag)) {
+
+ lane_len = data.Lane_Len ();
+
+ for (p=0; p < num_p; p++) {
+ if (group_periods_flag) {
+ group_periods.Period_Range (p, period_low, period_high);
+ } else {
+ period_low = low;
+ period_high = high;
+ }
+ if (low < period_low || high > period_high) continue;
+
+ for (r=0; r < num_r; r++) {
+ if (group_ratios_flag) {
+ ratio = UnRound (group_ratios [r]);
+ } else {
+ ratio = UnRound (Congested_Ratio ());
+ }
+ n = (p * num_r + r);
+
+ sum_bin [n] [LINKS] += 1;
+ sum_bin [n] [LENGTH] += length;
+ sum_bin [n] [LANES] += lane_len;
+ sum_bin [n] [VMT] += data.Veh_Dist ();
+ sum_bin [n] [VHT] += data.Veh_Time ();
+ sum_bin [n] [VHD] += data.Veh_Delay ();
+ sum_bin [n] [TIME_RATIO] += data.Time_Ratio () * data.Veh_Dist ();
+ sum_bin [n] [DENSITY] += data.Density ();
+ sum_bin [n] [MAX_DEN] = MAX (sum_bin [n] [MAX_DEN], data.Max_Density ());
+ //sum_bin [n] [QUEUE] += data.Queue ();
+ sum_bin [n] [QUEUE] += data.Volume ();
+ //sum_bin [n] [MAX_QUEUE] = MAX (sum_bin [n] [MAX_QUEUE], data.Max_Queue ());
+ sum_bin [n] [MAX_QUEUE] = MAX (sum_bin [n] [MAX_QUEUE], data.Volume ());
+ //sum_bin [n] [FAILURE] += data.Failure ();
+ sum_bin [n] [FAILURE] += data.Time ().Minutes ();
+ sum_bin [n] [COUNT] += data.Count () * lane_len;
+
+ if (data.Time_Ratio () >= ratio) {
+ sum_bin [n] [CONG_VMT] += data.Veh_Dist ();
+ sum_bin [n] [CONG_VHT] += data.Veh_Time ();
+ sum_bin [n] [CONG_TIME] += data.Count () * lane_len;
+ }
+
+ }
+ }
+ if (compare_flag) {
+ period_ptr = &compare_perf_array [j];
+
+ perf_data = period_ptr->Total_Performance (index, use_index);
+
+ if (data.Get_Data (&perf_data, dir_ptr, link_ptr, Maximum_Time_Ratio (), person_flag)) {
+
+ lane_len = data.Lane_Len ();
+
+ for (p=0; p < num_p; p++) {
+ if (group_periods_flag) {
+ group_periods.Period_Range (p, period_low, period_high);
+ } else {
+ period_low = low;
+ period_high = high;
+ }
+ if (low < period_low || high > period_high) continue;
+
+ for (r=0; r < num_r; r++) {
+ if (group_ratios_flag) {
+ ratio = UnRound (group_ratios [r]);
+ } else {
+ ratio = UnRound (Congested_Ratio ());
+ }
+ n = (p * num_r + r);
+
+ sum_bin [n] [VMT+PREV] += data.Veh_Dist ();
+ sum_bin [n] [VHT+PREV] += data.Veh_Time ();
+ sum_bin [n] [VHD+PREV] += data.Veh_Delay ();
+ sum_bin [n] [TIME_RATIO+PREV] += data.Time_Ratio () * data.Veh_Dist ();
+ sum_bin [n] [DENSITY+PREV] += data.Density ();
+ sum_bin [n] [MAX_DEN+PREV] = MAX (sum_bin [n] [MAX_DEN+PREV], data.Max_Density ());
+ //sum_bin [n] [QUEUE+PREV] += data.Queue ();
+ sum_bin [n] [QUEUE + PREV] += data.Volume ();
+ //sum_bin [n] [MAX_QUEUE+PREV] = MAX (sum_bin [n] [MAX_QUEUE+PREV], data.Max_Queue ());
+ sum_bin [n] [MAX_QUEUE + PREV] = MAX (sum_bin [n] [MAX_QUEUE + PREV], data.Volume ());
+ //sum_bin [n] [FAILURE+PREV] += data.Failure ();
+ sum_bin [n] [FAILURE + PREV] += data.Time ().Minutes ();
+ sum_bin [n] [COUNT+PREV] += data.Count () * lane_len;
+
+ if (data.Time_Ratio () >= ratio) {
+ sum_bin [n] [CONG_VMT+PREV] += data.Veh_Dist ();
+ sum_bin [n] [CONG_VHT+PREV] += data.Veh_Time ();
+ sum_bin [n] [CONG_TIME+PREV] += data.Count () * lane_len;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ //---- get the turning movements ----
+
+ if (connect_flag) {
+ for (k=dir_ptr->First_Connect (); k >= 0; k = connect_ptr->Next_Index ()) {
+ connect_ptr = &connect_array [k];
+
+ if (connect_ptr->Type () != LEFT && connect_ptr->Type () != RIGHT &&
+ connect_ptr->Type () != UTURN) continue;
+
+ for (j=0, turn_itr = turn_period_array.begin (); turn_itr != turn_period_array.end (); turn_itr++, j++) {
+ turn_ptr = turn_itr->Data_Ptr (k);
+
+ turn_period_array.periods->Period_Range (j, low, high);
+
+ for (p=0; p < num_p; p++) {
+ if (group_periods_flag) {
+ group_periods.Period_Range (p, period_low, period_high);
+ } else {
+ period_low = low;
+ period_high = high;
+ }
+ if (low >= period_low && high <= period_high) {
+ n = (p * num_r);
+ sum_bin [n] [VHD] += turn_ptr->Time () * turn_ptr->Turn ();
+ sum_bin [n] [TURNS] += turn_ptr->Turn ();
+ }
+ }
+ if (compare_flag) {
+ compare_ptr = &compare_turn_array [j];
+ turn_ptr = compare_ptr->Data_Ptr (k);
+
+ for (p=0; p < num_p; p++) {
+ if (group_periods_flag) {
+ group_periods.Period_Range (p, period_low, period_high);
+ } else {
+ period_low = low;
+ period_high = high;
+ }
+ if (low >= period_low && high <= period_high) {
+ n = (p * num_r);
+ sum_bin [n] [VHD+PREV] += turn_ptr->Time () * turn_ptr->Turn ();
+ sum_bin [n] [TURNS+PREV] += turn_ptr->Turn ();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ //---- write the data ----
+
+ if (Metric_Flag ()) {
+ factor = 1.0 / 1000.0;
+ units = "Kilometers";
+ vmt = (person_flag) ? "PKT" : "VKT";
+ lane_mi = "km)";
+ } else {
+ factor = 1.0 / MILETOFEET;
+ units = "Miles";
+ vmt = (person_flag) ? "PMT" : "VMT";
+ lane_mi = "mi)";
+ }
+ tod.Hours (1);
+ if (link_count == 0) link_count = 1;
+
+ group_sum_file.Put_Field (text_field, header_label);
+ group_sum_file.Put_Field (value_field, 0.0);
+ if (compare_flag) group_sum_file.Put_Field (compare_field, 0.0);
+ group_sum_file.Write ();
+
+ for (p = 0; p < num_p; p++) {
+ if (group_periods_flag) {
+ group_periods.Period_Range (p, period_low, period_high);
+ } else {
+ period_low = Model_Start_Time ();
+ period_high = Model_End_Time ();
+ }
+ first_ratio = true;
+ period = period_high - period_low;
+ hours = (double) period / (double) tod;
+
+ buffer = String ("Time Period %12.12s") % group_periods.Range_Format (p);
+
+ for (r = 0; r < num_r; r++, first_ratio = false) {
+ if (group_ratios_flag) {
+ ratio = UnRound (group_ratios [r]);
+ } else {
+ ratio = UnRound (Congested_Ratio ());
+ }
+ n = (p * num_r + r);
+
+ lane_len = sum_bin [n] [LANES];
+
+ num_sum = (int) (sum_bin [n] [LINKS] / link_count);
+
+ if (first_ratio) {
+ group_sum_file.Put_Field (text_field, buffer);
+ group_sum_file.Put_Field (value_field, 0.0);
+ if (compare_flag) group_sum_file.Put_Field (compare_field, 0.0);
+ group_sum_file.Write ();
+
+ group_sum_file.Put_Field (text_field, String ("Number of Links"));
+ group_sum_file.Put_Field (value_field, sum_bin [n] [LINKS] / num_sum);
+ if (compare_flag) group_sum_file.Put_Field (compare_field, sum_bin [n] [LINKS] / num_sum);
+ group_sum_file.Write ();
+
+ buffer = "Number of Roadway " + units;
+ group_sum_file.Put_Field (text_field, buffer);
+ group_sum_file.Put_Field (value_field, sum_bin [n] [LENGTH] * factor / num_sum);
+ if (compare_flag) group_sum_file.Put_Field (compare_field, sum_bin [n] [LENGTH] * factor / num_sum);
+ group_sum_file.Write ();
+
+ buffer = "Number of Lane " + units;
+ group_sum_file.Put_Field (text_field, buffer);
+ group_sum_file.Put_Field (value_field, sum_bin [n] [LANES] * factor / num_sum);
+ if (compare_flag) group_sum_file.Put_Field (compare_field, sum_bin [n] [LANES] * factor / num_sum);
+ group_sum_file.Write ();
+
+ buffer = type + " " + units + " of Travel";
+ group_sum_file.Put_Field (text_field, buffer);
+ group_sum_file.Put_Field (value_field, sum_bin [n] [VMT] * factor);
+ if (compare_flag) group_sum_file.Put_Field (compare_field, sum_bin [n] [VMT + PREV] * factor);
+ group_sum_file.Write ();
+
+ group_sum_file.Put_Field (text_field, String ("%s Hours of Travel") % type);
+ group_sum_file.Put_Field (value_field, sum_bin [n] [VHT] / tod);
+ if (compare_flag) group_sum_file.Put_Field (compare_field, sum_bin [n] [VHT + PREV] / tod);
+ group_sum_file.Write ();
+
+ group_sum_file.Put_Field (text_field, String ("%s Hours of Delay") % type);
+ group_sum_file.Put_Field (value_field, sum_bin [n] [VHD] / tod);
+ if (compare_flag) group_sum_file.Put_Field (compare_field, sum_bin [n] [VHD + PREV] / tod);
+ group_sum_file.Write ();
+
+ group_sum_file.Put_Field (text_field, String ("Number of Queued %ss") % type);
+ group_sum_file.Put_Field (value_field, UnRound (sum_bin [n] [QUEUE]) / (hours * 4));
+ if (compare_flag) group_sum_file.Put_Field (compare_field, UnRound (sum_bin [n] [QUEUE + PREV]) / (hours * 4));
+ group_sum_file.Write ();
+
+ group_sum_file.Put_Field (text_field, String ("Maximum Queued %ss") % type);
+ group_sum_file.Put_Field (value_field, sum_bin [n] [MAX_QUEUE]);
+ if (compare_flag) group_sum_file.Put_Field (compare_field, sum_bin [n] [MAX_QUEUE + PREV]);
+ group_sum_file.Write ();
+
+ group_sum_file.Put_Field (text_field, String ("Number of Cycle Failures"));
+ group_sum_file.Put_Field (value_field, sum_bin [n] [FAILURE] / (hours * 4));
+ if (compare_flag) group_sum_file.Put_Field (compare_field, sum_bin [n] [FAILURE + PREV] / (hours * 4));
+ group_sum_file.Write ();
+
+ group_sum_file.Put_Field (text_field, String ("Number of Turning Movements"));
+ group_sum_file.Put_Field (value_field, sum_bin [n] [TURNS]);
+ if (compare_flag) group_sum_file.Put_Field (compare_field, sum_bin [n] [TURNS + PREV]);
+ group_sum_file.Write ();
+
+ group_sum_file.Put_Field (text_field, String ("Average Link Time Ratio"));
+ value = sum_bin [n] [VMT];
+ if (value <= 0.0) value = 1.0;
+ group_sum_file.Put_Field (value_field, sum_bin [n] [TIME_RATIO] / (value * 100.0));
+ if (compare_flag) {
+ value = sum_bin [n] [VMT + PREV];
+ if (value <= 0.0) value = 1.0;
+ group_sum_file.Put_Field (compare_field, sum_bin [n] [TIME_RATIO + PREV] / (value * 100.0));
+ }
+ group_sum_file.Write ();
+
+ value = sum_bin [n] [LINKS];
+
+ buffer = "Average Link Density (/ln-" + lane_mi;
+ group_sum_file.Put_Field (text_field, buffer);
+ group_sum_file.Put_Field (value_field, UnRound (sum_bin [n] [DENSITY] / value));
+ if (compare_flag) group_sum_file.Put_Field (compare_field, UnRound (sum_bin [n] [DENSITY + PREV] / value));
+ group_sum_file.Write ();
+
+ buffer = "Maximum Link Density (/ln-" + lane_mi;
+ group_sum_file.Put_Field (text_field, buffer);
+ group_sum_file.Put_Field (value_field, UnRound (sum_bin [n] [MAX_DEN]));
+ if (compare_flag) group_sum_file.Put_Field (compare_field, UnRound (sum_bin [n] [MAX_DEN + PREV]));
+ group_sum_file.Write ();
+
+ length = sum_bin [n] [VMT] * factor;
+ time = sum_bin [n] [VHT] / tod;
+ if (time == 0.0) {
+ time = length;
+ } else {
+ time = length / time;
+ }
+ buffer = "Average " + units + " Per Hour";
+ group_sum_file.Put_Field (text_field, buffer);
+ group_sum_file.Put_Field (value_field, time);
+
+ if (compare_flag) {
+ length = sum_bin [n] [VMT + PREV] * factor;
+ time = sum_bin [n] [VHT + PREV] / tod;
+ if (time == 0.0) {
+ time = length;
+ } else {
+ time = length / time;
+ }
+ group_sum_file.Put_Field (compare_field, time);
+ }
+ group_sum_file.Write ();
+ }
+ group_sum_file.Put_Field (text_field, String ("Congested Ratio=%.2lf") % (ratio / 100.0));
+ group_sum_file.Put_Field (value_field, 0.0);
+ if (compare_flag) group_sum_file.Put_Field (compare_field, 0.0);
+ group_sum_file.Write ();
+
+ buffer = "Congested " + type + " " + units;
+ group_sum_file.Put_Field (text_field, buffer);
+ group_sum_file.Put_Field (value_field, sum_bin [n] [CONG_VMT] * factor);
+ if (compare_flag) group_sum_file.Put_Field (compare_field, sum_bin [n] [CONG_VMT + PREV] * factor);
+ group_sum_file.Write ();
+
+ value = sum_bin [n] [VMT];
+ if (value == 0.0) value = 1.0;
+ percent = 100.0 * sum_bin [n] [CONG_VMT] / value;
+
+ buffer = String ("Percent %s Congested") % vmt;
+ group_sum_file.Put_Field (text_field, buffer);
+ group_sum_file.Put_Field (value_field, percent);
+ if (compare_flag) {
+ value = sum_bin [n] [VMT + PREV];
+ if (value == 0.0) value = 1.0;
+ percent = 100.0 * sum_bin [n] [CONG_VMT + PREV] / value;
+
+ group_sum_file.Put_Field (compare_field, percent);
+ }
+ group_sum_file.Write ();
+
+ buffer = "Congested " + type + " Hours";
+ group_sum_file.Put_Field (text_field, buffer);
+ group_sum_file.Put_Field (value_field, sum_bin [n] [CONG_VHT] / tod);
+ if (compare_flag) group_sum_file.Put_Field (compare_field, sum_bin [n] [CONG_VHT + PREV] / tod);
+ group_sum_file.Write ();
+
+ value = sum_bin [n] [VHT];
+ if (value == 0.0) value = 1.0;
+ percent = 100.0 * sum_bin [n] [CONG_VHT] / value;
+
+ buffer = String ("Percent %sHT Congested") % ((person_flag ? "P" : "V"));
+ group_sum_file.Put_Field (text_field, buffer);
+ group_sum_file.Put_Field (value_field, percent);
+ if (compare_flag) {
+ value = sum_bin [n] [VHT + PREV];
+ if (value == 0.0) value = 1.0;
+ percent = 100.0 * sum_bin [n] [CONG_VHT + PREV] / value;
+
+ group_sum_file.Put_Field (compare_field, percent);
+ }
+ group_sum_file.Write ();
+
+ value = factor * hours / num_sum;
+
+ buffer = "Congested Duration (hrs*ln-" + lane_mi;
+ group_sum_file.Put_Field (text_field, buffer);
+ group_sum_file.Put_Field (value_field, sum_bin [n] [CONG_TIME] * value);
+ if (compare_flag) group_sum_file.Put_Field (compare_field, sum_bin [n] [CONG_TIME + PREV] * value);
+ group_sum_file.Write ();
+
+ value = sum_bin [n] [COUNT];
+ if (value == 0.0) value = 1.0;
+
+ percent = 100.0 * sum_bin [n] [CONG_TIME] / value;
+
+ group_sum_file.Put_Field (text_field, String ("Percent Time Congested"));
+ group_sum_file.Put_Field (value_field, percent);
+ if (compare_flag) {
+ value = sum_bin [n] [COUNT + PREV];
+ if (value == 0.0) value = 1.0;
+ percent = 100.0 * sum_bin [n] [CONG_TIME + PREV] / value;
+
+ group_sum_file.Put_Field (compare_field, percent);
+ }
+ group_sum_file.Write ();
+ }
+ }
+ }
+}
Modified: version7/branches/aecom/Transims70/LinkSum/Execute.cpp
===================================================================
--- version7/branches/aecom/Transims70/LinkSum/Execute.cpp 2018-08-10 16:45:12 UTC (rev 1711)
+++ version7/branches/aecom/Transims70/LinkSum/Execute.cpp 2018-11-16 14:35:03 UTC (rev 1712)
@@ -94,7 +94,11 @@
//---- write the group perf file ----
if (group_sum_flag) {
- Group_Sum_File ();
+ if (group_periods_flag || group_ratios_flag) {
+ Custom_Groups ();
+ } else {
+ Group_Sum_File ();
+ }
}
//---- create speed contour file ----
Modified: version7/branches/aecom/Transims70/LinkSum/Group_Sum_File.cpp
===================================================================
--- version7/branches/aecom/Transims70/LinkSum/Group_Sum_File.cpp 2018-08-10 16:45:12 UTC (rev 1711)
+++ version7/branches/aecom/Transims70/LinkSum/Group_Sum_File.cpp 2018-11-16 14:35:03 UTC (rev 1712)
@@ -128,7 +128,8 @@
sum_bin [j] [MAX_DEN] = MAX (sum_bin [j] [MAX_DEN], data.Max_Density ());
sum_bin [j] [QUEUE] += data.Queue ();
sum_bin [j] [MAX_QUEUE] = MAX (sum_bin [j] [MAX_QUEUE], data.Max_Queue ());
- sum_bin [j] [FAILURE] += data.Failure ();
+ //sum_bin [j] [FAILURE] += data.Failure ();
+ sum_bin [j] [FAILURE] += data.Time ().Seconds ();
sum_bin [j] [COUNT] += data.Count () * lane_len;
if (Ratio_Flag ()) {
@@ -153,7 +154,8 @@
sum_bin [j] [MAX_DEN+PREV] = MAX (sum_bin [j] [MAX_DEN+PREV], data.Max_Density ());
sum_bin [j] [QUEUE+PREV] += data.Queue ();
sum_bin [j] [MAX_QUEUE+PREV] = MAX (sum_bin [j] [MAX_QUEUE+PREV], data.Max_Queue ());
- sum_bin [j] [FAILURE+PREV] += data.Failure ();
+ //sum_bin [j] [FAILURE+PREV] += data.Failure ();
+ sum_bin [j] [FAILURE + PREV] += data.Time ().Seconds ();
sum_bin [j] [COUNT+PREV] += data.Count () * lane_len;
if (Ratio_Flag ()) {
Modified: version7/branches/aecom/Transims70/LinkSum/Group_Summary.cpp
===================================================================
--- version7/branches/aecom/Transims70/LinkSum/Group_Summary.cpp 2018-08-10 16:45:12 UTC (rev 1711)
+++ version7/branches/aecom/Transims70/LinkSum/Group_Summary.cpp 2018-11-16 14:35:03 UTC (rev 1712)
@@ -144,7 +144,8 @@
sum_bin [j] [MAX_DEN] = MAX (sum_bin [j] [MAX_DEN], data.Max_Density ());
sum_bin [j] [QUEUE] += data.Queue ();
sum_bin [j] [MAX_QUEUE] = MAX (sum_bin [j] [MAX_QUEUE], data.Max_Queue ());
- sum_bin [j] [FAILURE] += data.Failure ();
+ //sum_bin [j] [FAILURE] += data.Failure ();
+ sum_bin [j] [FAILURE] += data.Time ().Seconds ();
sum_bin [j] [COUNT] += data.Count () * lane_len;
if (Ratio_Flag ()) {
@@ -169,7 +170,8 @@
sum_bin [j] [MAX_DEN+PREV] = MAX (sum_bin [j] [MAX_DEN+PREV], data.Max_Density ());
sum_bin [j] [QUEUE+PREV] += data.Queue ();
sum_bin [j] [MAX_QUEUE+PREV] = MAX (sum_bin [j] [MAX_QUEUE+PREV], data.Max_Queue ());
- sum_bin [j] [FAILURE+PREV] += data.Failure ();
+ //sum_bin [j] [FAILURE+PREV] += data.Failure ();
+ sum_bin [j] [FAILURE+PREV] += data.Time ().Seconds ();
sum_bin [j] [COUNT+PREV] += data.Count () * lane_len;
if (Ratio_Flag ()) {
@@ -268,6 +270,7 @@
Print (1, String ("Number of Roadway %-10.10s %13.2lf") % units % (sum_bin [j] [LENGTH] * factor));
Print (1, String ("Number of Lane %-10.10s %13.2lf") % units % (sum_bin [j] [LANES] * factor));
Print (1, String ("Vehicle %-20.20s %13.2lf") % (units + " of Travel") % (sum_bin [j] [VMT] * factor));
+
if (compare_flag) {
base = sum_bin [j] [VMT+PREV] * factor;
diff = sum_bin [j] [VMT] * factor - base;
@@ -316,10 +319,13 @@
Print (0, String (" %13.2lf %13.2lf (%.2lf%%)") % base % diff % ((base > 0.0) ? (100.0 * diff / base) : 0.0) % FINISH);
}
- Print (1, String ("Average Link Time Ratio %13.2lf") % (sum_bin [j] [TIME_RATIO] / len));
+ length = sum_bin [j] [VMT] * 100.0;
+ if (length == 0.0) length = 1.0;
+
+ Print (1, String ("Average Link Time Ratio %13.2lf") % (sum_bin [j] [TIME_RATIO] / length));
if (compare_flag) {
- base = sum_bin [j] [TIME_RATIO+PREV] / len;
- diff = sum_bin [j] [TIME_RATIO] / len - base;
+ base = sum_bin [j] [TIME_RATIO+PREV] / length;
+ diff = sum_bin [j] [TIME_RATIO] / length - base;
Print (0, String (" %13.2lf %13.2lf (%.2lf%%)") % base % diff % ((base > 0.0) ? (100.0 * diff / base) : 0.0) % FINISH);
}
Modified: version7/branches/aecom/Transims70/LinkSum/LinkSum.cpp
===================================================================
--- version7/branches/aecom/Transims70/LinkSum/LinkSum.cpp 2018-08-10 16:45:12 UTC (rev 1711)
+++ version7/branches/aecom/Transims70/LinkSum/LinkSum.cpp 2018-11-16 14:35:03 UTC (rev 1712)
@@ -13,7 +13,7 @@
LinkSum::LinkSum (void) : Select_Service ()
{
Program ("LinkSum");
- Version (0);
+ Version (1);
Title ("Summarize Link Performance Data");
System_File_Type required_files [] = {
@@ -69,6 +69,8 @@
{ NEW_DATA_SUMMARY_RATIOS, "NEW_DATA_SUMMARY_RATIOS", LEVEL0, OPT_KEY, FLOAT_KEY, "0.0", "0.0, 1.0..5.0", NO_HELP },
{ NEW_GROUP_SUMMARY_FILE, "NEW_GROUP_SUMMARY_FILE", LEVEL0, OPT_KEY, OUT_KEY, "", FILE_RANGE, NO_HELP },
{ NEW_GROUP_SUMMARY_FORMAT, "NEW_GROUP_SUMMARY_FORMAT", LEVEL0, OPT_KEY, TEXT_KEY, "TAB_DELIMITED", FORMAT_RANGE, NO_HELP },
+ { NEW_GROUP_SUMMARY_PERIODS, "NEW_GROUP_SUMMARY_PERIODS", LEVEL0, OPT_KEY, TEXT_KEY, " ", TIME_RANGE, NO_HELP},
+ { NEW_GROUP_SUMMARY_RATIOS, "NEW_GROUP_SUMMARY_RATIOS", LEVEL0, OPT_KEY, FLOAT_KEY, "0.0", "0.0, 1.0..5.0", NO_HELP},
{ NEW_SPEED_CONTOUR_FILE, "NEW_SPEED_CONTOUR_FILE", LEVEL0, OPT_KEY, OUT_KEY, "", FILE_RANGE, NO_HELP },
{ NEW_SPEED_CONTOUR_FORMAT, "NEW_SPEED_CONTOUR_FORMAT", LEVEL0, OPT_KEY, TEXT_KEY, "TAB_DELIMITED", FORMAT_RANGE, NO_HELP },
{ FLIP_SPEED_CONTOUR_OUTPUT, "FLIP_SPEED_CONTOUR_OUTPUT", LEVEL0, OPT_KEY, BOOL_KEY, "FALSE", BOOL_RANGE, NO_HELP },
@@ -112,6 +114,7 @@
compare_flag = group_select = summary_flag = group_sum_flag = turn_flag = turn_compare_flag = false;
select_link_flag = activity_flag = zone_flag = group_flag = person_flag = periods_flag = ratios_flag = false;
link_map_flag = compare_perf_flag = skip_link_flag = speed_contour_flag = flip_flag = false;
+ group_periods_flag = group_ratios_flag = false;
nerror = 0;
minimum_volume = 2.0;
Modified: version7/branches/aecom/Transims70/LinkSum/LinkSum.hpp
===================================================================
--- version7/branches/aecom/Transims70/LinkSum/LinkSum.hpp 2018-08-10 16:45:12 UTC (rev 1711)
+++ version7/branches/aecom/Transims70/LinkSum/LinkSum.hpp 2018-11-16 14:35:03 UTC (rev 1712)
@@ -48,7 +48,8 @@
NEW_LINK_DIRECTION_FILE, NEW_LINK_DIRECTION_FORMAT, NEW_LINK_DIRECTION_FIELD, NEW_LINK_DIRECTION_INDEX,
NEW_LINK_DIRECTION_FLIP, NEW_LINK_DATA_FILE, NEW_LINK_DATA_FORMAT, NEW_LINK_DATA_FIELD,
NEW_DATA_SUMMARY_FILE, NEW_DATA_SUMMARY_FORMAT, NEW_DATA_SUMMARY_PERIODS, NEW_DATA_SUMMARY_RATIOS,
- NEW_GROUP_SUMMARY_FILE, NEW_GROUP_SUMMARY_FORMAT, NEW_SPEED_CONTOUR_FILE, NEW_SPEED_CONTOUR_FORMAT,
+ NEW_GROUP_SUMMARY_FILE, NEW_GROUP_SUMMARY_FORMAT, NEW_GROUP_SUMMARY_PERIODS, NEW_GROUP_SUMMARY_RATIOS,
+ NEW_SPEED_CONTOUR_FILE, NEW_SPEED_CONTOUR_FORMAT,
FLIP_SPEED_CONTOUR_OUTPUT,
};
virtual void Program_Control (void);
@@ -64,7 +65,7 @@
bool select_link_flag, activity_flag, zone_flag, group_flag, person_flag, periods_flag, ratios_flag, compare_perf_flag;
bool compare_flag, group_select, summary_flag, group_sum_flag, turn_flag, turn_compare_flag, link_map_flag, skip_link_flag;
- bool speed_contour_flag, flip_flag, turn_diff_flag;
+ bool speed_contour_flag, flip_flag, turn_diff_flag, group_periods_flag, group_ratios_flag;
int increment, num_inc, nerror;
double header_value, cap_factor, minimum_volume, congested_ratio;
String header_label;
@@ -73,8 +74,8 @@
typedef Doubles_Array::iterator Doubles_Itr;
Doubles_Array sum_bin, zone_vmt, zone_vht;
- Doubles data_ratios;
- Time_Periods data_periods;
+ Doubles data_ratios, group_ratios;
+ Time_Periods data_periods, group_periods;
Performance_File compare_file;
Turn_Delay_File turn_compare_file;
@@ -201,6 +202,7 @@
void Summary_File (void);
void Custom_Summaries (void);
void Group_Sum_File (void);
+ void Custom_Groups (void);
void Speed_Contour (void);
};
Modified: version7/branches/aecom/Transims70/LinkSum/LinkSum.vcxproj
===================================================================
--- version7/branches/aecom/Transims70/LinkSum/LinkSum.vcxproj 2018-08-10 16:45:12 UTC (rev 1711)
+++ version7/branches/aecom/Transims70/LinkSum/LinkSum.vcxproj 2018-11-16 14:35:03 UTC (rev 1712)
@@ -162,6 +162,7 @@
<ItemGroup>
<ClCompile Include="Compare_Links.cpp" />
<ClCompile Include="Control.cpp" />
+ <ClCompile Include="Custom_Groups.cpp" />
<ClCompile Include="Custom_Summaries.cpp" />
<ClCompile Include="Execute.cpp" />
<ClCompile Include="Gap_Report.cpp" />
Modified: version7/branches/aecom/Transims70/LinkSum/LinkSum.vcxproj.filters
===================================================================
--- version7/branches/aecom/Transims70/LinkSum/LinkSum.vcxproj.filters 2018-08-10 16:45:12 UTC (rev 1711)
+++ version7/branches/aecom/Transims70/LinkSum/LinkSum.vcxproj.filters 2018-11-16 14:35:03 UTC (rev 1712)
@@ -121,5 +121,8 @@
<ClCompile Include="Write_Turn_Diff.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="Custom_Groups.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
Modified: version7/branches/aecom/Transims70/SysLib/Service/Control_Service.cpp
===================================================================
--- version7/branches/aecom/Transims70/SysLib/Service/Control_Service.cpp 2018-08-10 16:45:12 UTC (rev 1711)
+++ version7/branches/aecom/Transims70/SysLib/Service/Control_Service.cpp 2018-11-16 14:35:03 UTC (rev 1712)
@@ -588,6 +588,39 @@
}
//-----------------------------------------------------------
+// Get_Control_Text - search for a string parameter
+//-----------------------------------------------------------
+
+String Control_Service::Get_Control_Text (int code, bool help)
+{
+ Control_Key *key_ptr = Get_Control_Key (code);
+ if (key_ptr == 0) return ("");
+
+ bool flag;
+ String key, default_value;
+
+ key = Get_Control_String (code);
+
+ if (key.empty ()) {
+ if (key_ptr->value.empty ()) return ("");
+
+ key = key_ptr->value;
+ flag = false;
+ } else {
+ flag = true;
+ }
+
+ //---- print the key message ----
+
+ if (flag) {
+ default_value = key_ptr->key;
+ Print (1, default_value.To_Title ()) << " = " << key;
+ if (help) Print (0, String (" (%s)") % Get_Range_String (code));
+ }
+ return (key);
+}
+
+//-----------------------------------------------------------
// Get_Control_Flag - search for a flag parameter
//-----------------------------------------------------------
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|