C ---------------------------------------------------------------------- SUBROUTINE STATS_INIT(sim,net,act) C ---------------------------------------------------------------------- C - INCLUDED FILES: #include "dyna.inc" #include "sim.inc" #include "network.inc" #include "activity.inc" C - MODIFIED ARGUMENTS: RECORD /Sim_Data/ sim RECORD /Road_Network/ net RECORD /Activity/ act C - LOCAL VARIABLES: INTEGER i,j,i1,k,izn C ---------------------------------------------------------------------- net.oldnumcars = 0 net.ngen_tag = 0 net.nin_tag = 0 net.nout_tag = 0 net.nout_info = 0 net.info_time_tag = 0.D0 net.noinfo_time_tag = 0.D0 net.info_dist_tag = 0.D0 net.noinfo_dist_tag = 0.D0 net.ngen_nontag = 0 net.nin_nontag = 0 net.nout_nontag = 0 DO I=1,NU_ZN DO i1 = 1,NU_ZN DO j = 0,1 DO k = 0,1 act.zone(i).nreach(i1,k,j) = 0 act.zone(i).ngen(k,j,i1) = 0 ENDDO act.zone(i).tto(i1,j) = 0.D0 ENDDO ENDDO ENDDO DO i=1,NU_LI DO izn = 1,NU_ZN net.link(i).gentot(izn) = 0 ENDDO ENDDO RETURN END C ---------------------------------------------------------------------- SUBROUTINE VEH_STAT(sim,net,act,veh) C ---------------------------------------------------------------------- C - Updates global statistics for a tagged vehicle exiting the network. C - C - Statistics calculated include: C - C - . Average travel time (with info and without) C - . Average travel delay (with info and without) C - . Average travel distance (with info and without) C - C - . Travel time distribution (with info and without): This is C - . divided into n catgories of duration t C - INCLUDED FILES: #include "dyna.inc" #include "sim.inc" #include "network.inc" #include "activity.inc" #include "vehicle.inc" C - UNMODIFIED ARGUMENTS: RECORD /Sim_Data/ sim RECORD /Vehicle_Data/ veh C - MODIFIED ARGUMENTS: RECORD /Road_Network/ net RECORD /Activity/ act C - MODIFIED GLOBAL DATA: ! NONE C - LOCAL VARIABLES: REAL ttot ! var for totaling travel time INTEGER ttbin ! var for storing the travel time bin the vehicle ! falls into INTEGER i ! link INTEGER i1 ! zone index REAL thold ! temp time value C - FUNCTIONS CALLED: ! NONE C - RETURN VALUE: ! N/A C ---------------------------------------------------------------------- i = veh.curlink C - Set the vehicle's arrival time veh.atime = sim.time.minutes + veh.tocross IF (veh.itag.EQ.1) THEN thold = veh.atime - veh.stime C - update zonal stats i1 = veh.zfrom_index act.zone(net.node(net.link(i).idnod).izone). + tto(i1,veh.info) = act.zone( + net.node(net.link(i).idnod).izone). + tto(i1,veh.info) + thold C - Update network-level stats net.nin_tag = net.nin_tag - 1 net.nout_tag = net.nout_tag + 1 ttot = sim.time.minutes - veh.stime - veh.tleft C - Determine which travel time distribution bin this vehicle falls C - into ttbin = INT(ttot/sim.ttime_bin_length)+1 IF (ttbin.GT.sim.num_ttime_bins) THEN ttbin = sim.num_ttime_bins ELSE IF (ttbin.LT.1) THEN WRITE(ostr,600) ttbin,veh.number,CHAR(0) 600 FORMAT('Invalid travel time ['F7.1'] for vehicle ['I6']'A) CALL DYNA_ERROR(ostr + ,DYNA_NONFATAL_WARNING + ,DYNA_LOGIC_BUG + ,DYNA_UNKNOWN_ERROR) ttbin = 1 ENDIF IF (veh.info.EQ.1) THEN net.info_time_tag = net.info_time_tag + ttot net.info_dly_tag = net.info_dly_tag + veh.tqtot net.info_dist_tag = net.info_dist_tag + veh.distans net.info_trip_len_freq(ttbin) = + net.info_trip_len_freq(ttbin) + 1 net.nout_info = net.nout_info + 1 ELSE net.noinfo_time_tag = net.noinfo_time_tag + ttot net.noinfo_dly_tag = net.noinfo_dly_tag + veh.tqtot net.noinfo_dist_tag = net.noinfo_dist_tag + veh.distans net.noinfo_trip_len_freq(ttbin) = + net.noinfo_trip_len_freq(ttbin) + 1 ENDIF ELSE net.nin_nontag = net.nin_nontag - 1 net.nout_nontag = net.nout_nontag + 1 ENDIF RETURN END C ---------------------------------------------------------------------- SUBROUTINE LINK_STAT(sim,net,l) C ---------------------------------------------------------------------- C - Updates global statistics for a given link C - C - Statistics calculated include: C - C - . Average travel time (with info and without) C - . Average travel delay (with info and without) C - . Average travel distance (with info and without) C - C - . Travel time distribution (with info and without): This is C - . divided into n catgories of duration t C - INCLUDED FILES: #include "dyna.inc" #include "sim.inc" #include "network.inc" #include "vehicle.inc" C - UNMODIFIED ARGUMENTS: RECORD /Sim_Data/ sim INTEGER l ! link number C - MODIFIED ARGUMENTS: RECORD /Road_Network/ net C - MODIFIED GLOBAL DATA: ! NONE C - LOCAL VARIABLES: C - FUNCTIONS CALLED: ! NONE C - RETURN VALUE: ! N/A C ---------------------------------------------------------------------- ! HERE TO T-minute averages of every link in the network: ! . conc, speed, end-of-link queuesq RETURN END C ---------------------------------------------------------------------- SUBROUTINE CALC_STATS(io,sim,net) C ---------------------------------------------------------------------- C - Calculate the current global statistics in the network and report C - them. C - INCLUDED FILES: #include "dyna.inc" #include "io.inc" #include "sim.inc" #include "network.inc" C - UNMODIFIED ARGUMENTS: RECORD /Io_Data/ io RECORD /Sim_Data/ sim RECORD /Road_Network/ net C - MODIFIED ARGUMENTS: ! NONE C - MODIFIED GLOBAL DATA: ! NONE C - LOCAL VARIABLES: INTEGER i REAL ittot,nittot,attot REAL itavg,nitavg,atavg REAL iytot,niytot,aytot REAL iyavg,niyavg,ayavg REAL idtot,nidtot,adtot REAL idavg,nidavg,adavg REAL itlf,nitlf,ttlf C - FUNCTIONS CALLED: ! NONE C - RETURN VALUE: ! N/A C ---------------------------------------------------------------------- ittot = net.info_time_tag/60.0 nittot = net.noinfo_time_tag/60.0 attot = (net.info_time_tag+net.noinfo_time_tag)/60.0 IF (net.nout_info.GT.0) THEN itavg = net.info_time_tag/net.nout_info iyavg = net.info_dly_tag/net.nout_info idavg = net.info_dist_tag/net.nout_info ELSE itavg = 0.D0 iyavg = 0.D0 idavg = 0.D0 ENDIF IF (net.nout_tag-net.nout_info.GT.0) THEN nitavg = net.noinfo_time_tag/(net.nout_tag-net.nout_info) niyavg = net.noinfo_dly_tag/(net.nout_tag-net.nout_info) nidavg = net.noinfo_dist_tag/(net.nout_tag-net.nout_info) ELSE nitavg = 0.D0 niyavg = 0.D0 nidavg = 0.D0 ENDIF IF (net.nout_tag.GT.0) THEN atavg = (net.info_time_tag+net.noinfo_time_tag)/net.nout_tag ayavg = (net.info_dly_tag+net.noinfo_dly_tag)/net.nout_tag adavg = (net.info_dist_tag+net.noinfo_dist_tag)/net.nout_tag ELSE atavg = 0.D0 ayavg = 0.D0 adavg = 0.D0 ENDIF iytot = net.info_dly_tag niytot = net.noinfo_dly_tag aytot = net.info_dly_tag+net.noinfo_dly_tag idtot = net.info_dist_tag nidtot = net.noinfo_dist_tag adtot = net.info_dist_tag+net.noinfo_dist_tag C - Print out the average vehicle ttimes, delays, and distances WRITE(ostr,600) CHAR(0) CALL SIMMSG(STATUS,ostr) WRITE(ostr,601) net.nout_info,net.nout_tag-net.nout_info + ,net.nout_tag,CHAR(0) CALL SIMMSG(STATUS,ostr) WRITE(ostr,602) ittot,nittot,attot,CHAR(0) CALL SIMMSG(STATUS,ostr) WRITE(ostr,603) itavg,nitavg,atavg,CHAR(0) CALL SIMMSG(STATUS,ostr) WRITE(ostr,604) iytot,niytot,aytot,CHAR(0) CALL SIMMSG(STATUS,ostr) WRITE(ostr,605) iyavg,niyavg,ayavg,CHAR(0) CALL SIMMSG(STATUS,ostr) WRITE(ostr,606) idtot,nidtot,adtot,CHAR(0) CALL SIMMSG(STATUS,ostr) WRITE(ostr,607) idavg,nidavg,adavg,CHAR(0) CALL SIMMSG(STATUS,ostr) 600 FORMAT(' INFO NO INFO ALL VEH'A) 601 FORMAT(' REACHED DEST: ' I10 ' ' I10 ' ' I10,A) 602 FORMAT('TIME TOT (HR): 'E10.5 ' 'E10.5 ' 'E10.5,A) 603 FORMAT(' AVG (MIN): 'E10.5 ' 'E10.5 ' 'E10.5,A) 604 FORMAT('DELAY TOT (HR): 'E10.5 ' 'E10.5 ' 'E10.5,A) 605 FORMAT(' AVG (MIN): 'E10.5 ' 'E10.5 ' 'E10.5,A) 606 FORMAT('DIST TOT (MI): 'E10.5 ' 'E10.5 ' 'E10.5,A) 607 FORMAT(' AVG (MI): 'E10.5 ' 'E10.5 ' 'E10.5,A) C - Print out the trip length distribution statistics CALL SIMMSG(STATUS,CHAR(0)) ! Skip a line WRITE(ostr,608) CHAR(0) WRITE(ostr,609) CHAR(0) CALL SIMMSG(STATUS,ostr) DO i = 1,sim.num_ttime_bins IF (net.nout_info.GT.0) THEN itlf = FLOAT(net.info_trip_len_freq(i))/net.nout_info*100.0 ELSE itlf = 0.D0 ENDIF IF (net.nout_tag-net.nout_info.GT.0) THEN nitlf = FLOAT(net.noinfo_trip_len_freq(i)) / + (net.nout_tag-net.nout_info)*100.0 ELSE nitlf = 0.D0 ENDIF IF (net.nout_tag.GT.0) THEN ttlf = FLOAT(net.info_trip_len_freq(i) + + net.noinfo_trip_len_freq(i)) / + net.nout_tag * 100.0 ELSE ttlf = 0.D0 ENDIF WRITE(ostr,610) sim.ttime_bin_length*(i-1) + ,sim.ttime_bin_length*i + ,itlf,nitlf,ttlf,CHAR(0) CALL SIMMSG(STATUS,ostr) ENDDO 608 FORMAT('TRIP LENGTH DISTRIBUTION 'A) 609 FORMAT(' TTIME RANGE: INFO NOINFO ALLVEH'A) 610 FORMAT(3X,F5.1'-'F5.1':'3(' 'F6.1'%')A) RETURN END