PROGRAM STABSURF

A quick program to produce a stabilized spd/acl surface from
Baltimore and LA92 mode-specific surface files:

(1) BFRQ2.DAT (Balt Stabilized) -
(2) LFRQ2.DAT (LA92 Stabilized) ~

=7+> (3) CFRQS.DAT
(Comp Stabilized)

Stabilized portions of total surfaces) are generated by a 50/50
weighting of the Baltimore and LA92 stabilized driving.

Summary of speed & accel bin definitions:

‘Speed (mph): 0, 0 - <5, 5 - <=10, etc.

Accel (mph/s): +0.5 to 0.5 mph/s = 0
71.525 to -0.5 = -1, -2.5>= to -1.5 = -2, etc.
0.5 to <= 1.5 = 1, 1.5 to <=2.5 = 2, etc.

Author: Tom Carlson
Date: 07/14/93

agenAaaaAAAanAAAAAAAAA

INTEGER NBIN(2,-20:20,0:20), NREC(2)
REAL CBIN(-20:20,0:20), WFAC(2)

c
OPEN (UNIT=1, STATUS=/OLD/)
OPEN (UNIT=2, STATUS=/OLD’)
OPEN (UNIT=3, CARRIAGECONTROL='LIST’, STATUS=/NEW’)
c
Coeeeenee eeceere
c Begin processing.
Cc
c
c Read input mode surface files (units 1-2).
c

DO 110 IFILE = 1,2

100 READ (IFILE, *, END=105) IACL, ISPD, NBINCIFILE, ACL, ISPD)
GO TO 100

105 CLOSE (IFILE)

110 CONTINUE

Balt stab “= nrect
LA92 Stab = nrec2

For 50/50 weighting of stabilized data, we need the following
weightings:

wfacl= 1 ("unit weighting)

wfac2 = nrect / nrece

eannaaaaaaea|AA

DO 150 IACL = -20,20
DO 150 ISPD = 0,20
DO 150 IFILE
NRECC(IFILE) = NRECCTFILE) + NBINCIFILE, IACL, ISPD)
150 CONTINUE

WFAC(1) = 1.0
WFAC(2) = FLOAT (NREC(1)) / FLOAT(NREC(2))

Generate total weighted composite surface.

aaa

DO 200 IACL = on

00 200 ISPD =

dO 200 I = 1, 2°

X = WFACCT) * NBINCI, IACL, ISPD)
CBINCIACL, ISPD) = CBINCIACL,ISPD) + X
CREC = CREC + X

CONTINUE

8

201

DO 220 IACL = -20,20
00 220 IPO = 0,20
CPCT = CBINCIACL, ISPD) * 100 / CREC
WRITE (3, 210) IACL, ISPD, CBINCIACL,ISPO), CPCT
210 FORMAT (2(13,',/), F8.0, ',/, F10.6)
220 CONTINUE
A-33


PROGRAM GETBIN

The GETBIN program retrieves microtrips which contain travel in
spd/aci bins specified by the user. If a microtrip contains
travel within the input bin(s), GET8IN retrieves the spd vs. time
for that m-trip and outputs it.

1/0: Unit 1 Cinput) - Second-by-second "archive" of all route
data.
unit 2 (input) -- File containing the spd/acl bins pairs
of interest.
Unit 3 (input) -“MICTRIPS profile statistics output file.
Unit 4 (output) - Speed vs. time records of microtrips
which contain travel in the input bins.

Author: Tom Carlson
Date: 05/24/93

een nAanAAaAAAAADAA

CHARACTER*14 IDLIST(500), ITRIPID

INTEGER*2 MCNT(-20:20,0:20), JTIME, M
INTEGER*4 LBIN(5O,2), IRECLIST(500), MTRIPLIST(500),
+ ITIMELIST(500), KOUNT(500,50)

REAL MSPDLIST(500)

Open all files.

OPEN (UNIT=1, FILE=‘EPACOMP.DAT‘, STATUS="OLD‘)

OPEN (UNIT=2, STATUS=/OLD’)

OPEN (UNIT=3, STATUS=/OLD’, FORM=’UNFORMATTED’, RECL=1760)
OPEN (UNIT=4, STATUS='NEW/)

elected bins from unit 2.

wo1rsr+1
READ (2, *, END=200) (LBINCI,J), J = 1,2)
GO TO 100 -

200 NB = 1-1

c Now read the unformatted mictrip profiles file (unit 3) and
c mark those m-trips which contain travel in the input bin list.

205 READ (3, END=300) M, ITRIPID, JREC, JTIME, SPD_MEAN, SPD_MAX,
+ SPD_STD, ACL_MAX, ((MCNTCIACL,ISPO), ISPD=0,20), IACL=-20,20)

00 210 1 = 1,NB
TA = LBINGI,1)
1S = LBINCI,2)
IF (MCNTCIA,IS) .GT. 0) THEN
C <<< Travel in input bin(s) found >>>
Keke
MTRIPLIST(K) = M
IOLIST(K) = ITRIPID
IRECLIST(K) = JREC
ITIMELIST(K) = JTINE
MSPDLIST(K) = SPD_MAX
KOUNT(K, 1) = MCNTCIA, [S)
Go To 220
ENO IF
210 CONTINUE

220 GO TO 205

300 NTRP =

c

c weeeee eee

c Matching m-trips retrieved. Now lookup second-by-second speed vs.
c time traces in master archive file ROUTEFILE (unit 1) and output

A-97


External Files

LUN 1/0? File Description
1 Input Input SAFD Files
2 Output Weighted SAFD File

Prompted Input

Number of input SAFD files
- Weighting factors for each input SAFD file
Input SAFD filenames

HE

~25-


DRIVING CYCLE DEVELOPMENT SOFTWARE
USER’S GUIDE

prepared for:

United States Environmental Protection Agency
in response to Work Assignment No. 1-10,
Contract No. 68-C1-0079

November 10, 1993

prepared by:

Thomas R. Carlson
John M. Lee

Sierra Research, Inc.
1801 J Street
Sacramento, CA 95814
(916) 444-6666


PROGRAM DIFFSURFWT

‘A quick program to generate a spd/acl surface file in "comma-
delimited" format from the difference between two input spd/acl
surface files (first minus second). Thos is a modified version
of OIFFSURF which applies a weighting factor to the 2nd input
surface:

Qutput SAFD = Input SAFO1 - (Input SAFO2 x WtFac)

Summary of speed & accel bin definitions:

c
c

c

c

c

c

c

c

c

c

c

€ Speed (mph): 0, O - <s5, 5 - <=10, ete.
C Accel (mph/s): —--0.5 to 0.5 mph/s = 0
c
c
c
c
c
c
c
c
c
c
c.
c

71.525 to -0.5 +2.5>= to -1.5 = -2, etc.
0.5 to <= 1.5 = 1, 1.5 to <=2.5 = 2, ete.

“1/0: Unit 1 Cinmput) ~~ Spd/acl surface file 1.
Unit 2 Cinput) - Spd/act surface file 2.
Unit 3 (output) - Spd/acl surface file created fram
(file 1 - file 2).

Author: Tom Car(son
Date: 06/22/93

REAL DFREQ(-20:20,0:20), FREQI(-20:20,0:20), FREQ2(-20:20,0:20)

DATA WIFAC / 0.123 /

c

c Open all files.
c

OPEN (UNIT=1, STATUS=/OLD‘)

LO‘)

OPEN (UNIT=3, STATUS=/NEW’, CARRIAGECONTROL=’LIST’)

File 1.

100 READ (1, “, END=200) IACL, ISPD, RBIN, PCT
FREQICIACL, 1SPO) = PCT
INT = INT +1
GO TO 100

c
c File 2.
c

200 READ (2, *, END=300) IACL, ISPD, RBIN, PCT
FREQ2(IACL, ISPD) = PCT

IN2 = IN2 +1
Go TO 200
c
Coreen enon nee e enn eee
c Now compute difference surface: filel - file2 and output
Coreen neces eecen enews ernnee. eee -

c
300 d0 400 IACL = -20,20
90 400 ISPD = 0,20
DFREQ(IACL, ISPD) = FREQ1(IACL, ISPD) - FREQ2(IACL, ISPD)*WIFAC
WRITE (3, 350) IACL, ISPO, IDUM, DFREQCIACL, ISPD)
350 FORMAT (2(13,",/), 18, ’,", F10.6)
400 CONTINUE

A-93


PROGRAM LA4SURF

c
c A quick Program to generate the speed/accel surface for the LAG
C using "EPA" bins.
c
c Author: Tom Carlson
c 05/04/93
c
INTEGER BINCNT (0? 20,-20:20), ITIME¢1600)
REAL BINPCT(0:20, 20: 20), SPD(1400), ACL(1400)
c
OPEN (UNIT=1, STATUS=/OLD+)-
OPEN (UNIT=2, CARRIAGECONTROL=/LIST’, STATUS=/NEW’)
c
c Begin processing.
c
1Orsl+1
READ (1, *, END=110) ITIME(I), SPOCI)
GO TO 100
c
c Compute accels (assign accel from t to t+1 to time t).
c
WONST- 1

00 120 1 = 1,N
IF CL LT. 4) THEN
ACLCI) = SPDCI+1) > SPO(I)
ELSE
ACL(I) = 0.0
END IF
120 CONTINUE
Cc

00 300 1 = 1,N

© Determine speed bin.

IF (SPO(I) «LT. 0.1) THEN
Is +0

GO TO 220

END IF

DO 210 ISPD = 1,20
11 = (1SPD-1) * 5
2245

IF (SPD(I) .GT. 11 .AND. SPD(I) .LE. 12) THEN
Is = ISPD

GO TO 220

END IF

210 CONTINUE

220 IF (ACL(I) .GE. -0.5 .AND. ACL(I) .LE. 0.5) THEN
1A=0
GO TO 250
END IF

IF (ACL(I) .GT. 0.0) GO TO 235

DO 230 IACL = -20,-1
AL = IACL + 0.5
A2 = IACL - 0.5

IF CACL(I) .LT. Al .AND. ACL(I) .GE. A2) THEN
1A = TACL

GO TO 250

END IF

230 CONTINUE
235 DO 240 IACL = 1,20

Al = TACL - 0.5
A2 = IACL + 0.5

TF CACL(I) .GT. Al .AND. ACL(I) .LE. A2) THEN
TA = TACL
A-42


400 FORMAT (// Records Processed:!//
+ Start Recs --> 1, I7, 5X, "Start Surface Recs => 1177
+! Stabilized Recs --> ', I7, 5X, ‘Stabilized Surface Recs --> ',17/
+ + Total Recs >, 172)

END

A-53


GETBIN (FORTRAN, Composite Cycle Selection-Unlisted)

The program GETBIN retrieves individual "Microtrip Profile" records from
a Microtrips file which contain travel in speed/accel intervals (bins)
specified by the user. If a microtrip contains travel within the input
bin(s), GETBIN retrieves the speed vs. time data for that microtrip and
outputs it. GETBIN was used to find candidate "high speed" microtrips
which were used as "seed" microtrips in generating candidate Composite
cycles.

External Files

LUN 1/0? File Description

1 Input Balt/LA Composite Master Driving Trace File

2 Input Input file of speed/accel bin pairs of interest
3 Input Master Microtrips File

4 Output Speed/time trace of microtrips containing travel

in the user—input speed/accel bins

GETCYCLE (FORTRAN, Composite and Bag 4/Remainder Cycle Selection)

The GETCYCLE program generates a second-by-second speed vs. time driving
cycle trace from the list of microtrip ID's contained in a "Cycle
Summary" output file. A comma-delimited, "SAFD" -speed/accel
distribution file for the cycle is also output.

External Files

LUN 1/0? File Description

1 Input Balt/LA Composite Master Driving Trace File
2 Input User-Specified Cycle Summary File

3 Input Master (or Subset) Microtrips File

9 Output Speed vs. Time Driving Trace File

10 Output Cycle SAFD File

GETMTRIP (FORTRAN, Utility-Unlisted)

GETMTRIP retrieves a speed time trace for a single microtrip from the
Master Driving Trace File based on user-input start record number and
number of seconds.

External Files

LUN 1/0? ‘File Description
1 Input Balt/LA Composite Master Driving Trace File
2 Output - Speed vs. Time Driving Trace File

-15-


00 310 ISKIP = 1, NSKIP
READ (1, FMT=/()/)
310 CONTINUE

c
c Loop thru next selected M-trip.
c
DO 330 N = 1, ITIMECJ)
c Read segment.

READ (1, 320) SPOCJ,N), ACL(J,N), ISPD, IACL
320 FORMAT (18X, 2F6.2, 213)

BINS(J,N) = ISP

BINACJ,N) = TACL

NSEC = NSEC + 1

IF (NSEC LE. ISTART) THEN

CSFREQ(IACL, ISPD) = CSFREQ(IACL, ISPD) + 1

IF (SPD(J,N) .GT. SPEAKSPD) SPEAKSPD = SPD(J,N)
END IF

IF (SPO(J,N) .GT. TPEAKSPD) TPEAKSPD = SPO(J,N)
330 CONTINUE

ds
350 CONTINUE

Speed & accel vs. time traces retrieved for all selected M-trips.

Now re-randomize the "stabilized" M-trips Chills).

Random Reshuffle section commented out -- TRC 5/10/93.
Get system time. Call to LIBSDATE_TIME returns 23-byte character
string which contains hour, minute, second and decimal fraction.

ISTAT = LIBSDATE_TIME (CTIME)
READ (CTIME, FMT=/(11X,4C1X,12))/) HH, MM, SS, OD

Create seed value for random series. Seed ranges from 0 to 10**8.
Make seed odd per VAX-FORTRAN recommendations (FORTRAN Language
Reference Manual V 5.0, pg. 0-49).

ISEED = DD * 1000000 + SS * 16666.67 + MM * 166.67 + HH * 4.1667
IR = MOD (ISEED, 2)
IF CIR .EQ. 0) ISEED

ISEED + 1

aranMAAAANAAAAAAADAADA

DO 400 I = 1, NTRP

MINDX(1)
400 CONTINUE

I

NS = NTRP - NST

00 410 1 = 1, NTRP

Skip re-randomization for start portion (first NST M-trips).
IF (1 .LE. NST) THEN

MRAN(I) = 1

GO TO 410
END IF

L=NsS-1+1

Randomly select a microtrip in the range 0 toNS- 1 +1.
(NOTE: Whenever an M-trip is selected, it’s lifted from the
“selectable M-trips" sample so it’s not picked again.)

XRAN = RAN (ISEED)

IF (XRAN «LT. 1.0) THEN
K = INT (L * XRAN) + 1
ELSE

KEL

END IF

Next Line shifts the random number. For example, for 10 H-trips
with 2 start M-trips, the first pass thru loop 410 selects a
random number in the range 0-8 (10-2-1+1) which represents the

A-102

naneaanAAAAAAAAADAAAAAADAAAAAAND


PROGRAM GETHTRIP

GETMTRIP retrieves a speed vs. time trace from the master file
EPACOMP.DAT based on a user-input start record number and number
of seconds.

GETMTRIP is a modified version of the GETBEST program.

I/O: Unit 1 Cinput) - Master file (e.g., EPACOMP.DAT).
Unit 2 (output) - Retrieved speed vs time trace.

Author: Tom Carlson
Date: 5/26/93

c
c
c
c
c
Cc
c
c
c
c
c
c
c

OPEN (UNIT=1, STATUS=/OLD’)
OPEN (UNIT=2, STATUS=/NEW!)

Coneteneeec ee ec eee ee ene eeeeee ee eceeeceeeeees waenen eee ne een er ner ee en eeee
© Begin execution.
Ceeceeereeee ene
c
c Prompt user for retrieval record numbers.
c
WRITE (*, 2)
2 FORMAT (/1X,
+ ‘Enter start rec number and # of segments (delimited):‘)
READ (*, *) INITREC, NREC .
c
Conc ec eee ec eee eeeeeeeee ee ceeneeeeeneeeneeeeeeeseeeeee ae eeeceeeeeee eeeee
c Retrieve trace.
Coen ee eee eeecece ncn re een een ence cece cece nesaceneceeeeensneecnenenscenes
c
c Skip records until first selected segment is reached.
c

DO 310 ISKIP = 1, INITREC-1
READ (1, FMT=/()‘)
N=N41

310 CONTINUE

c
c Loop thru next selected segments, reading unit 1 and writing to
c unit 2.
c
DO 330 I =-1, NREC
c <<< Read segment >>>

READ (1, 320) SPD, ACL, ISPO, IACL
320 FORMAT (18X, 2F6.2, 213)
NEN41
c <<< Write segment to unit 2 >>>
WRITE (2, 325) 1, IDUM, SPD, ACL, ISPD, [ACL
325 FORMAT (215, 2F6.2, 213)
330 CONTINUE

END

A-108


END

3X, ‘Abs Totals’, 3X, 21F7.3, 14x, F7.3)

A-48


c Determine speed bin.

IF (SPO .LT. 0.1) THEN

1 = (ISPO-1)
221145

TF (SPD .GT. 11 .AND. SPD .LE. 12) THEN
Is = ISPD

GO TO 320

END IF

310 CONTINUE

c Determine acceleration bin.

Ceneeeee enon: - wees,
c
320 IF (ACL .GE. -0.5 .AND. ACL .LE. 0.5) THEN
IAs
GO TO 350
END IF

IF (ACL .GT. 0.0) GO TO 335

DO 330 IACL =
Al = IACL + 0.5
A2 = IACL - 0.5

IF (ACL .LT. A1 .AND. ACL .GE. A2) THEN
TA = TACL

GO TO 350

END IF

‘330 CONTINUE
335 DO 340 TACL

1
Al = IACL - 0.5
A2 = IACL + 0.5

20

IF (ACL .GT. A1 .AND. ACL .LE. A2) THEN

TA = IACL
Go To 350
END IF
340 CONTINUE
c
350 CFREQ(IA,IS) = CFREQ(IA,IS) + (1-WT1)
c
GO TO 300
c
C a
c Total bin count reads finished. Compute cycle surface frequencies
c and "difference" surface frequencies and output
c
c
400 WIN = NI*WT1 + N2*(1-WT1)
DO 410 IACL = -20,20
DO 410 ISPD = 0,20

CFREQ(IACL, ISPD) = CFREQ(IACL, ISPD) * 100 / WIN
PCTDIFCIACL, ISPD) = CFREQ(IACL, ISPD) - PFREQCIACL, ISPD)
410 CONTINUE

Compute row (across spd) and column (across acl) totals.

eee

00 420 IACL = -20,20
DO 420 ISPD = 0,20
SPDSUM(1,IACL) = SPDSUM(1,IACL) + PCTDIFCIACL, ISPD)
SPOSUM(2,1ACL) = SPDSUM(2,IACL) + ABS (PCTDIFC(IACL,ISPD))
420 CONTINUE

DO 425 ISPD = 0,20

DO 425 IACL = -20,20

ACLSUM(1,I1SPD) = ACLSUM(1,I1SPD) + PCTDIF(IACL, ISPD)
ACLSUM(2, ISPD) = ACLSUM(2,ISPD) + ABS (PCTDIF(IACL,ISPD))

A-6


IN) 2 IND +1

GO TO 10
c
c Read in microtrip profiles (unit 2).
c
20 READ (2, END=50) I, MTRIPIDCI), IREC(I), ITIMECI),
+ SPD_MEAN(I), SPD_MAX(I), SPD_STD(I), ACL_MAX(I),
ha CCMCNT (I, IACL, ISPD), ISPO=0 20), TACL: 20)
c 30 a 15, 1X,A14, ix, 17,1X,15, 3€1X, F7.2),1%, F7.3,1X, 861(14))
=In2 +1
GO 10 20

This code section performs selection of microtrips using the

"Hybrid" approach (combination of Random + Best Incremental).
The Hybrid method adds an initial “base of microtrips to the
start "seed" of microtrips using random selection. Additional
microtrips are then added with the Best Incremental technique.

Step 1 - Generate pseudo-random seed value from current system
time.

SEED = DD x 1000000 + SS x 16667 + MM xX 167 + HH x 4.17

where DD = hundredths of seconds
SS = seconds

MM = minutes

HH = hours

Step 2 - Generate a series of randomly selected microtrips from
the population and add these to the start microtrip "seed" until
the total linked microtrip time exceeds a user-specified subset
TIMERAN of the target time limit TIMELIMIT. Compute match of each
randomly added microtrip to the population surface. This set of
microtrips forms the "base" sample.

Step 3 - Pick the "best" single microtrip of those remaining.
“Best" is defined as the minimum integrated difference between the
overall surface and the base + incremental microtrip(s).

Step 4 - Iteratively test the remaining microtrips and add the one
which coupled with the previously selected trip(s), best matches
the overall surface. This incremental approach is repeated until
the total linked microtrip time exceeds target time TIMELIMIT.

1/0: Unit 3 (output) - Selected microtrips and "goodness" stats.

Author: Tom Carlson
Date: 4/23/93

Top-Level loop 500 iterates the selection process to generate
a number of random cycles (NCYCLES). Each cycle is written to a
separate output file on unit 3.

c
c
c
c
c
c
c
c
c
c
c
c
c
Cc
c
c
c
c
Cc
c
c
c
c
c
c
c
c
c
c
c
c
Cc
c
c
c
c
c
c
Cc
ie
c
c
c
c:
c

50 MTRIPS = IN2
DO 500 LOOP = 1,NCYCLES

Initialize cycle sums and counter.

aaa

NTRP = 0
TRIPTIME = 0.0
STIME = 0.0
csPD = 0.0
DO 80 TACL
DO 80 ISPD
TCNTCIACL, ISPD) =
80 CONTINUE

IPRO = INDEX (OUTFILE, ’.‘)

TEND = INDEX (OUTFILE, ’ ’) - 1

WRITE (CLOOP, FMT='(13.3)') ILOOP

OUTNAME = OUTFILE(1:1PRD-1) // '-" // CLOOP // OUTFILECIPRD:IEND)

A-77


PROGRAM REFORMAT_LA92

This program reads the second-by-second LA92_SIERRA driving cycle
file, re-computes accets to a consistent basis w/adopted ARB/EPA
convention and outputs only those fields needed for cycle
selection.

1/0: Unit 1 (input) ~- Sec-by-sec LA92_SIERRA drive cycle data.
Unit 2 (output) - EPA_LA92.DAT output file.

Author: Tom Cartson
Date: 4/13/93

gaaananaaAAAan

CHARACTER®7 ROUTE1D(101000)
INTEGER ISEC( 101000)
REAL PSPD(101000), CSPD(101000)

DATA NS

100 READ (1, 101, END=200) ROUTEID(N), ISEC(N), PSPD(N), CSPO(N)
101 FORMAT a7, 1, 16, T27, F6.2, T48, F6.2)
su+4
IF (PSPD(N) «LT. 0.0) PSPD(N) = 0.0
IF (CSPD(N) «LT. 0.0) CSPD(N) = 0.0

GO TO 100
c
c AU data input. Compute accel (mph/s) and apply to BEGINNING of
c time interval. Also detect occurrences of new routes being
c started to handle accels at route starts - don’t incorrectly
c compute accel from the last obs from previous route and first obs
c from current route.
c
200 D0 300 1 =
IF (ROUTEID(I+1) .NE. ROUTEID(I) .OR. I «EQ. N) THEN
CACL = 0.
PACL = 0.0
ELSE

PACL = PSPD(I+1) ~ PSPO(I)
CACL = CSPO(I+1) ~ CSPO(I)
END IF
READ (ROUTEID(1)(6:7), FMT=/(BN,I2)’) ITRP
RITE (2, 250) ROUTEIDC1)(1:4), ITRP, ISECCI), PSPOCI), PACL,
CSPD(T), CACL
250 FORMAT (/L00192', A, 12. 2, 16, 476.2)
300 CONTINUE

END

A-13


"1 continue
iysivc1)

endif
k=idumy1a
idum=1A*(idum-k*1Q)-1R*k
if Cidum.(t.0) idum=idum+IM
j=1+iy/NDIV
iysivGi)
iv¢j)=idum
rant=mincAM* iy, RNMX)
return .

© (C) Copr. 1986-92 Numerical Recipes Software pLijn>#(.

A-38


00 120 ISPD = 0,20
BINPCT(IACL, ISPD) = BINCNT(IACL,ISPD) * 100. / N
WRITE (2, 115) IACL, ISPD, BINCNTCIACL,ISPD), BINPCTCIACL, ISPD)
145 FORMAT (2(13,",'), 18, ',/,7 F10.6)
120 CONTINUE .
c
CLOSE (1)
CLOSE (2)
c
WRITE (*, 130) N
+ 130 FORMAT (/1X, ‘Processing completed for ’, 15, ' records.'/)
c
END


0 205 IACL = -20,20
00 205 ISPD = 0,20

QUTPCT(IACL, ISPD) = OUTPCT(IACL,ISPO) * 100 / TOTPCT
205 CONTINUE ~

00 220 1ACL = -20,20

DO 220 ISPD = 0,20

WRITE (2, 210) IACL, ISPD, RDUM, OUTPCTCIACL,ISPD)
210 FORMAT (2(13,/,/), F8.0, ',, F10.6)
220 CONTINUE

CLOSE (2)

ND

A-41


PROGRAM GETSTAB

GETSTAB reads the "microtrips profiles" files and the target spd/
acl composite "surface" file for the Baltimore & LA92 data

and selects a subset of linked microtrips which best match the
target speed/accel surface using the Hybrid Method.

GETSTAB is a modified version of earlier GETRIPS/GETHBRD programs.
Prior to execution of this code, another routine, GETSTART was run
to determine the "start" set of microtrips which best matched the
target start surface, These pre-determined microtrips become the
initial "seed" in this program onto which additional microtrips
are added. The sample from which these additional microtrips are
selected consists of alt Baltimore and LA92 microtrips, with
weighting factors which:

(1) allow 50/50 selection probability of stabilized m-trips
between Baltimore and LA92; and

(2) maintain initial weighting of start/stabilized m-trips
encountered in the Saltimore dataset.

This version matches microtrip PATROL data with surface
COMPOSITE data (for LA92 data only).

NOTE:

This version does not use m-trips weightings discussed above, only
the embedded weightings in the composite target surface generated
by the COMPSURF program.

1/0: Unit 1 (input) - Spd/acl target composite "surface" for
sec-by-sec drive cycle data (Balt/LA92).
Unit 2 (input) - Microtrip profile statistics.
Unit 3 (output) - Selected microtrips and "goodness" stats.

Author: Tom Carlson
Date: 4/23/93

naaAAAAAADAANAAAAAAAAAAADAAAAAAAAAAAAAD

PARANETER (MNUM=7283)

CHARACTER*3 CLOOP
CHARACTER*14 MTRIPID(MNUM)
CHARACTER*23 CTIME
CHARACTER*0 OUTFILE, OUTNANE

_ INTEGER"2 HH, MM, SS, DD, MCNT(MNUM,-20:20,0:20),
ITIME CHNUM) , M, MO, I
* wrecer*s TREC(MNUM) , TRIPLIST(1000)

REAL SPD_MEAN(HNUM), SPD_STD(MNUM), ACL_MAX(MNUM) ,
+ SPD_MAX(MNUM), CFREQ(-20:20,0:20), TRIPDIFF(1000),
+ CCNT(-20:20,0:20), PFREQ(-20:20,0:20), TCNT(~20:20,0:20)

DATA START_TIME /4.0/

» STATUS=/OLD!)
' STATUS=/OLD’, RECL=1760, FORM=/UNFORMATTED! )

c Prompt user for output filename and cycle control parameters.

WRITE (*, 2) .
2 FORMAT (/1X, ‘Enter output (selected trips & stats) filename:’)
READ (*, 3) OUTFILE
FORMAT (A)
WRITE (*, 4)
FORMAT (/1X, ‘Enter target cycle time, including start (min):’)
READ (*, *) RTIME
WRITE (*, 5)
FORMAT (/1X, ‘Enter target random "base" cycle time (min):')
READ (*, *) BTIME
TIMERAN = BTIME * 60
WRITE (*, 6)
6 FORMAT (/1X, ‘Enter "best" start trip number:’)

A-78

w

e

w


10 FORMAT (/1X, ‘Enter input M-Trips summary filename:/)
READ (*, 20) INFILE
WRITE (*, 15)

15 FORMAT (/1X, ‘Enter unformatted M-Trips Profile filename:’)
READ (*, 20) MTRIPFILE

20 FORMAT (A)
WRITE (*, 30)

30 FORMAT (/1X, ‘Enter output cycle "root" filename (< 8 chars):/)
READ (*, 20) OUTROOT
WRITE (*, 40)

40 FORMAT (/1X, ‘Enter Z-value (in %) for "envelope boundary" file:’)
READ (*, *) Z ~

c Name all PRN and SURFER files based on OUTROOT.

L = INDEX COUTROOT, / /) - 1
PRNFILE = OUTROOT(1:L) // '.PRN’
BLNFILE(1) = OUTROOT(1:L) // '.BNT’
BLNFILE(2) = QUTROOT(1:L) // '.BNS’
DO 70 J = 1,4
WRITE (CJ, FMT=!(11)/) J
SURFILE(J) = QUTROOT(1:L) // ‘.DA’ // CJ
GROFILE(J) = OUTROOT(1:L) // '.GR‘’ // CJ
PLTFILE(J) = QUTROOT(1:L) // '.PL‘ // CJ
00 701 = 1,2
CHDFILE(I,J) = QUTROOT(1:L) // CTYPE(I) // ‘.CM’ // CJ
70 CONTINUE

c Set up run title names based on OUTROOT.

TITLE(1) =‘ Total Cycle: ’ // OUTROOT(1:L)
TITLE(2) = ¢ Start Cycle: ' // OUTROOT(1:L)
TITLEC3) = ‘Total Difference: ' // OUTROOT(1:L)
TITLE(4) = ‘Start Difference: ’ // OUTROOT(1:L)

c
© Open all files.
c

OPEN
OPEN
OPEN
+ 60)

OPEN FILE=/DRIVGRID.CMD’, STATUS='
OPEN (UNIT=6, FILE=/DRIVSURF.CMD’, STATUS='OLD’)
OPEN (UNITS7, FILE=/CFRQT.DAT’, STATUS=/OLD‘)
OPEN (UNIT=8, FILE=’BFRQ1.DAT’, STATUS=/OLD‘)

FILE=EPACOMP.DAT’, STATUS=OLD’)
FILE=INFILE, STATUS=/QLD!)
FILE=MTRIPFILE, STATUS=/OLD!, FORM=/UNFORMATTED’,

OPEN (UNIT=9, FILE=PRNFILE, STATUS='NEW’, CARRIAGECONTROL=’LIST’,
+ RECORDTYPE=/ VARIABLE!)
OPEN CUNIT=14, FILE=BLNFILE(1), CARRIAGECONTROL=/LIST’,
+ RECORDTYPE=/VARIABLE’, STATUS=/NEW’)
OPEN (UNIT=15, FILE=BLNFILE(2), CARRIAGECONTROL='LIST’,
+ RECORDTYPE='VARIABLE’, STATUS=‘NEW!)
DO 80 J = 1,4
LUN = J +9
OPEN (UNIT=LUN, FILE=SURFILE(J), CARRIAGECONTROL='LIST’,
+ RECORDTYPE= VARIABLE’, STATUS=/NEW’)
00 80 1 = 1,2
LUN = (1-1) "4+ 4 +15
OPEN (UNIT=LUN, FILE=CMDFILE(I,J), CARRIAGECONTROL='LIST’,
+ RECORDTYPE=/ VARIABLE’, STATUS=‘NEW)
80 CONTINUE

100 LINE = LINE + 1

READ (LUN, 105, END=130) CMDS(K, LINE)
105 FORMAT (A55)

Go To 100

130 NL(K) = LINE - 1
150 CONTINUE


Print status summary and end.

e90000

WRITE (*, 500) CYCFILE(1:1€), NTOT
500 FORMAT (// Short Bag 4 analysis completed for cycle ', A//
+ 10x, 15, ' microtrips combinations evaluated’ /)

END
SUBROUTINE COMBOS (N, K, KOMBos, NUMBER)

This routine generates all unique combinations of numbers in the
range 1 to N of choosing K items without replacement from N
elements.

Passed Args:

No ceeeeeeeee the number of elements (and implied range) to
choose from
K ......+2. the count or size of each chosen set

Returned Args:
KOMBOS . a two-dimensional integer array (with dimensions

K x NUMBER) containing NUMBER unique combinations

each of size kK.

NUMBER ..... the total number of unique combinations generated:

N
NUMBER = --- -
KE (N= KDE

Combinations refer to selected number sets in which the order of
selected numbers doesn’t matter. (This differs from permutations’
in which the order establishes a unique set.) For example, 1-2-3
and 1-3-2 are a the same, single combination.

NOTE:

Care should be used in calling this routine when N > 10
since the # of combinations increases rapidly due to the
factorials. As a result, KOMBOS size can get enormous

Author: Tom Carlson
Date 05/05/93

aanAANAAAAAAAAAAAAAANAAAAAAAANAAAAAAAAA

PARAMETER (NMAX = 50, NM = 25)

LOGICAL HOLE

INTEGER I, J, K, L1, M, N, LEAD, NUMBER, C, KOMBOS
DIMENSION C(NMAX), KOMBOS(MM,*)

Begin execution -- initialize the "index" array C with K
left-filled elements = 1 and N-K right filled elements = 0.

eana

LHOLE = .FALSE.

00 10 1 = 1,N
IF (1 LE. K) THEN
cal) = 4
ELSE
cl) = 0
END IF
10 CONTINUE

Return point from either a finished "Migrate LEAD" sequence or
a “Move Elements" operation. (It’s also stepped to from above.)
Call KFILL to "write" currently selected indices in C (those set
to "1") to KOMBOS.

aannaad

20 CALL KFILL (K, N, C, KOMBOS, NUMBER)

a0

Test if "Migrate LEAD" operations have pushed the LEAD pointer

A-19


Bin boundary numbers found -- now generate re-normalized surface
from In-Use activity BEYOND these detected boundaries.

na000

bo 190 ISPD = 0,20

c

c Beyond top FIP speed.

c
IF (1SPO .GT. IS) THEN
00 160 IACL = -20,20
BINCNT(3,IACL,ISPD) = BINCNEC1, IACL, ISPD)
TOTCNT(3) = TOTCNT(3) + BINCNT(3,IACL,ISPO)

160 CONTINUE

GO TO 190
END IF

c

© Within FTP speed range -- decel region.

c
DO 170 IACL = -20, IANEGC(ISPD)-1
BINCNT(3,1ACL,ISPO) = BINCNT(1,IACL, ISPD)
TOTCNT(3) = TOTCNT(3) + BINCNT(3, IACL, ISPD)

170 CONTINUE

c

c Within FTP speed range -- accel region.

c

DO 180 IACL = IAPOSCISPD)+1,20

BINCNT(3,IACL,ISPD)= BINCNT(1,FACL,ISPD)

TOTCNT(3) = TOTCNT(3) + BINCNT(3, IACL,ISPO)
180 CONTINUE

c
190 CONTINUE
c

Coreen nce e nec ee cele ee cee eee ene n cece eeeeneee

c Selected counts (outside the iP boundaries) applied to new
c surface array (first element 3) -- now normalize and output.

c
00 200 IACL = -20,20
00 200 ISPD = 0,20
PCTBIN(3, IACL, ISPD) = BINCNT(3,IACL,ISPO) * 100 / TOTCNT(3)
c WRITE (3, 195) IACL, ISPD,BINCNT(3, IACL,ISPO), PCTBIN(3, IACL, ISPD)
€ 195 FORMAT (2(13,/,/), F8.0, ',/, F10.6)
200 CONTINUE

c
c Compute row (across spd) and column (across acl) totals.
c

310 DO 320 IACL = -20,20

Do 320 ISPD = 0,20

SPOSUNCIACL) = SPDSUM(IACL) + PCTBIN(3, IACL, ISPD)
320 CONTINUE .

00 325 ISPD = 0,20

Do 325 IACL = -20,20

ACLSUM(ISPD) = ACLSUM(ISPD) + PCTBIN(3, IACL, ISPD)
TOT = TOT + PCTBIN(3,JACL, ISPD)

325 CONTINUE
c
(Coenen nc ec ne neeceeenee ee ee ee eneececeeeee!
c Output results in tabular form, echo input surfaces first
Cc - sore
c
c WRITE (4, 330)
C 330 FORMAT (///60X, ¢ “gutside FTP® Driving’
c+ //60X, ‘Speed/Accet Frequency Distribution (%)*
c+ ITOK, "SPD BIN (mph)*/)
c WRITE (4, 340) CISPD*5, ISPD = 0,20)
C340 FORMAT (“ACL BIN (mph/s)/, GX, 16, 3X, 20¢7<",13,3K), * Totals'/
CF Peer ener n ene: nH, AX, ferent, BK, 20(f2- BK), Fo ceeeee
c
DO 350 [ACL = -20,20 :
c WRITE (4, 345) IACL, (PCTBIN(3,IACL,{SPO), [SPD = 0,20),
c+ SPDSUM(IACL)
C 345 FORMAT (6X, 14, 6X, 21F7.3, 4X, F7.3)

350 CONTINUE

WRITE (4, 355) (ACLSUM(ISPD), ISPD = 0,20), TOT
355 FORMAT (/5X, ‘Totals’, 5X, 21F7.3, 4X, F7.3)

aaa

WRITE (*, 360) (TOTCNTCI),

= 1,3)
A-61


Figure 3

Composite Cycle Selection Phase
From Date Proparation Pheso
Baltimore Los Angeles »
Stabilized Stabilized
SAFD File SAFD File
eo) [e 6] (3)
rh

Prompted Inpute
= Cycle Series
+ Cycle Times
- # of Output Cycles

CYCLELIST.TXT Candidate
Listing of Summary Cycle Summary Flas,
Cyclo Filenames (One Per Cych

Prompted inputs

' est Composite | Ranked
Best Composite

Perel | Cee by DFFSLM
toe i le

Master or Any
Gubsst Microtrips File
(Unformatted)

Prompted Inputs
+ Selected Composite Cycle ID
+ Microtrips Filename

- Output Cycle Filename

Prompted Inputs

= Cycle Trace PRN.
Filename

- VEHSIM Part Name

VEHSIM - Ready
‘Compo: rece:
File

—8-

Master / Subset From Data
Micratrips File Preparation
(Unformatted) Phase

Run Status



1. INTRODUCTION

Since the 1972 model year, passenger car and light truck emissions have
been measured using a Federal Test Procedure (FTP) that includes a
second-by-second driving trace or "driving cycle" called the "LA-4"
cycle. Recent evidence indicates that the LA-4 cycle is not
representative of the full range of driving conditions under which
vehicles are operated (and produce emissions) in metropolitan areas.
Using data collected from vehicles in customer service, Sierra Research
has developed a set of driving cycles designed to initially supplement,
and eventually replace, the current LA-4 test cycle.” This User's Guide
describes a series of software programs which were used to generate the
driving cycles.

This document is organized as follows.

Section 2 discusses the computer system requirements needed to operate
the cycle development software.

Section 3 presents a conceptual overview of the software package.
Summaries of the key programs in the package are given and the flow of
program and data files are illustrated here.

Section 4 provides more detailed descriptions of each of the programs in
the package and the data files they access. .

Appendix A contains complete program code listings of all the software.

Appendix B contains several "sample" driving cycle development data
files.

dHHE

“T.C. Austin, et al., “Development of Driving Cycles to Represent Light-
Duty Vehicle Operation in Urban Areas," Sierra Research, Inc.,
August 31, 1993.

-1-


Check the m-trip # of each record & keep only those records which
are found in the MTRP list read from unit 3 for the input cycle.

ean

bo 45 1 = 1,N

IF (KK EQ. MTRP(I)) THEN
WN = NN + 1

SPD_STO(I) = SPDSTD
ACL_STD(I) = ACLSTD

bo 42 1sPo = 0,20
DO 42 IACL = -20,20 —-
MCNT(I,IACL, ISPD) = KCNTCIACL,ISPO)
42 CONTINUE 7
IF (NN .EQ. N) GO TO 50
GO TO 40
END IF

45 CONTINUE

GO TO 40

c Input completed. Now call subroutine COMBOS within a loop which
c controls the number of m-trips to choose (1 to N-NS) to generate
c all possible combinations of m-trips.

50 00 300 K = 1,M

NK = 0
CALL COMBOS (M, K, KOMBOS, NK)
c
€ Loop thru all combinations generated for size kK.
c
DO 200 J = 1,NK
c
c Initialize sums and counter before each combo is tested.
c
DIFFS = 0.0
TIMES = 0.0
TIMEL = 0.0
00 55 IACL = -20,20
00 55 ISPD = 0,20
B4S(IACL,ISPD) = 0.0
BL(IACL,ISPD) = 0.0
55 CONTINUE
c
C Loop thru and process bin counts for each m-trip in current combo.
c

00 60 1 = 1,k

ITRP = KOMBOS(1,J)
TIMES = TIMES + ITIMECITRP)

00 60 IACL =
DO 60 ISPD = 0,
BGSCIACL, ISPD) = B4S(IACL, ISPD) + MCNT(ITRP, IACL, ISPD)

60 CONTINUE

Compute the summed diff DIFFS for the current combo,

aaa

DO 65 IACL = -20,20

DO 65 ISPD = 0,20

B4S(IACL,ISPD) = B4S(IACL, ISPD) / TIMES

DIFFS = DIFFS + ABS (B4S(IACL,ISPD) - NFFREQ(IACL,ISPD))
65 CONTINUE

c
IF (K £0. M) GO TO 85
c
C OK, evaluation of non-FTP for current combo complete. Now get
€ the remaining m-trips in the input PCC which are NOT in the
C current combo.
c
Do 80 L = 1,4
00 70 1 = 1,K

IF (L «EQ, KOMBOS(I,J)) GO TO 80
A-16


PROGRAM MAKETBL3.

c
c A quick program to generate tabular “Watson plots" from
c input spd/act surface files’ in "comma-delimited" format.
c
€ Summary of speed & accet bin definitions:
c
© Speed (mph): 0, 0 - <5, 5 - <=10, etc.
C — Accel(mph/s): —--0.5 to 0.5 mph/s = 0
c =1,.5>= to -0.5 = -1, -2.5>= to -1.5 = -2, etc.
c 0.5 to <= 1.5 = 1, 1.5 to <2.5 = 2, etc.
€ _
C Author: Tom Carlson
c Date: 05/10/93
c
c
c
CHARACTER*80 FNAME
REAL PCTBIN(-20:20,0:20), SPOSUM(2,-20:20), ACLSUM(2,0:20)
c

OPEN (UNIT=1, STATUS=/OLD‘)
OPEN (UNIT=2, CARRIAGECONTROL=/LIST’, STATUS='NEW’, RECL=186,

+ RECORDTYPE=’ VARIABLE‘)

Prompt for table title.

WRITE (*, 50)

50 FORMAT (/1X, ‘Enter title for spd/acl surface:’)
READ (*, 60) FNAME

60 FORMAT (A80)

Read input mode surface file (unit 1).

aneo

100 READ (1, *, END=110) IACL, ISPD, DUMMY, PCTBIN(IACL, ISPD)
TOT = TOT + PCTBIN(IACL, ISPD)
GO TO 100

Compute row (across spd) and column (across acl) totals.

aaa

110 00 120 IACL = -20,20
DO 120 ISPD = 0,20
SPDSUM(1,IACL) = SPDSUM(1,IACL) + PCTBINCIACL, ISPD)
SPOSUM(2,IACL) = SPDSUM(2,IACL) + ABS (PCTBINCIACL,ISPD))
120 CONTINUE

00 125 IsPo = 0,20
DO 125 IACL = -20,20
ACLSUM(1,1SPD) = ACLSUM(1,1SPO) + PCTBINCIACL, ISPD)
ACLSUM(2,ISPD) = ACLSUM(2,1SPD) + ABS (PCTBIN(IACL,ISPD))
TOTNET = TOTNET + PCTBINCIACL, ISPD)
TOTABS = TOTABS + ABS (PCTBINCIACL,ISPD))

125 CONTINUE

c
c Output results in tabular form, echo input surfaces first.
c

WRITE (2, 130) FNAME
130 FORMAT (///40X, A80//60X, ‘Speed/Accel Frequency Distribution (%)!

+ /170X, 'SPD BIN (mph)! /)
WRITE (2, 140) CISPD*5S, ISPD = 0,20)
140 FORMAT (166X,! Net Abs'/
+ ACL BIN (mph/s)’, 4X, 14, 3X, 20(7<',13,3X), 2¢/  Totals’)/
A latte eee eecee ee WAX, beeeet, 3K, WC ee BK), 2C0 eee ee "y)

Do 150 IACL = -20,20
WRITE (2, 145) IACL, (PCTBINCIACL,1SPD), ISPD = 0,20),
+ CSPDSUM(I,ITACL), I = 1,2)

145 FORMAT (6X, 14, 6X, 21F7.3, 5X, F7.3, 2X, F7.3)

150 CONTINUE

WRITE (2, 155) CACLSUM(1,1SPD), ISPD = 0,20), TOTNET,
(ACLSUM(2,1SPD), ISPD ="0,20), TOTABS
15" FORMAT (/3X, ‘Net Totals’, 3X, 21F7.3, 5X, 7.3," 2X/

A-47


+! Start Recs --> ', 17, SX,'Start Surface Recs <> 17
+! Stabilized Recs --> ’, 17, 5X,'Stabilized Surface Recs --> ',17/
+ * Total Recs 24, 17)

END

b-56


id

6 )

FA

bs

(oe

ees \
SNC

e
L

Feats
)

Report No. SR93-11-01b

Driving Cycle Development
Software User’s Guide

prepared for:

U.S. Environmental Protection Agency

November 10, 1993

prepared by:

Sierra Research, Inc.

1801 J Street

Sacramento, California 95814
(916) 444-6666


++++ BEST INCREMENTAL SECTION +++++
+

Big loop 301 adds "next best" microtrips till the total time
exceeds TIMELIMIT.
300 BASETIME = TRIPTIME / 60 ~~
IF (TRIPTIME .GE. TIMELIMIT) GO TO 400
301 NTRP = NTRP + 1
DIFFMIN = 999.

Qa9P9AAAAM.0A0A

Loop thru all microtrips in search of best incremental trip.

aaa

Do 350 I = 1, MTRIPS
C Skip microtrips which have already been selected.

DO 310 J = 1,NTRP-1
IF (I .EQ. TRIPLIST(J)) GO TO 350
310 CONTINUE

Add acl/spd bin counts for current microtrip to "current" count
array CCNT and express as frequency. Compute integrated
difference between the population surface and the best
incremental surface CFREQ. (Use abs value of the difference.)

ana

DIFF = 0.0

00 320 IACL = -20,20

00 326 ISPD = 0,20

CCNTCIACL, ISPD) = TCNT(IACL,ISPO) + MCNT(I, IACL, ISPD)

CFREQCIACL, ISPD) = CCNTCIACL,ISPD) / (TRIPTIME + ITIME(I))

DIFF = DIFF + ABS (CFREQ(IACL, ISPD) - PFREQ(IACL,ISPD))
320 CONTINUE

Test integrated difference DIFF of current incremental M-trip.
If smatler than "best" of earlier incremental M-trips, then
"mark" (M=I1) and replace as new best difference.

aQea

IF (DIFF .LT. DIFFMIN) THEN
DIFFMIN = DIFF

Mel

END IF

350 CONTINUE

TRIPLISTCNTRP) = M
TRIPTIME = TRIPTIME + ITIME(M)
TRIPOIFFCNTRP) = DIFFMIN

DO 360 TACL

DO 360 ISPD = 0,20

TCNT(IACL, ISPD) = TCNTCIACL, ISPD) + MCNT(M, IACL, ISPD)
360 CONTINUE :

+20,20

c Print statistics for current M-trip.
c Print statistics for current M-trip.

WRITE (3, 370) NTRP, M, MTRIPID(M), IREC(M), ITIME(M),SPD_NEAN(M),

+ SPD_MAX(M), SPD_STD(M), ACL_MAX(M), TRIPDIFF(NTRP)
370 FORMAT (13, 1X, ‘17, 1X, 15, 1%, A146, 1X, 17, 1X, 14,

+ 31x, F7.2), 1X, F7.3, 1X, F9.5)

Terminate main “trip adding" loop when the desired cycle time
TIMELIMIT is reached.

no

IF (TRIPTIME .GT. TIMELIMIT) GO TO 400
© Loop back and find another M-trip.

GO To 301

Current cycle completed. Compute cycle summary statistics and

aeo

print totals.
A-82


660 13 = 10+ 1

DO 662 ISPO = 20,0,-1
IF (SPDSUM(ISPD) .GT. 2) THEN
IsPpOQ = ISPD + 1
GO TO 663
END IF
662 CONTINUE

c Envelope locations determined. Output to unit 14.
663 00 690 IREG = 1,2

WRITE (14, 665) 13
665 FORMAT (14, ' 07)

DO 680 ISPD = 0, 10

SPDBIN = ISPD * 5

ACLBIN = BACL(IREG, ISPD)

WRITE (14, 670) ACLBIN, SPDBIN.
670 FORMAT (F4.1, 14)
680 CONTINUE

SPDBIN = 10 * (ISPDO - 1 - (Z - SPDSUMCISPDO)) /
+ (SPOSUM(ISPDO-1) - SPDSUM(ISPD0))) + 0.5
WRITE (16, 685) SPOBIN

685 FORMAT (' 0.0’, 14)

690 CONTINUE

Start surface boundary

anaca

Do 700 ISPD = 0,20
SPDSUM(SSPD) = CSFREQ(O, ISPD)
ACLSUM(ISPD) = 0.0
DO 700 IACL = -20,20
ACLSUMC(ISPD) = ACLSUMCISPD) + CSFREQ(IACL,ISPO)
700 CONTINUE
c
1D = 0,20

IF CACLSUMCISPD) .EQ, 0.0) GO TO 740
Cc Check negative accel region.

DO 710 IACL = -20,0
SUM1 = CSFREQ(IACL, ISPD)
705 IF (SUM1 .GT. Z) THEN
115 IACL - 1
GO TO 720
END IF
SUMIL = SUM1

710 CONTINUE

3

c Check positive accel region.
72
72!

8

DO 730 IACL = 0,20

SUM2 = CSFREQ(IACL,ISPD)
IF (SUM2 .GT. 2) THEN
12 = TACL +1

Go To 740

END IF

SUM2L = SUM2

730 CONTINUE

740 TF (11 .£Q. 0 .AND. 12 EQ. 0) THEN
10 = IsPD - 1
GO To 760
ELSE

IF (SUM1 = SUMIL .NE. 0.0) THEN
A-105


List of Figures

Data Preparation Phase ......... cc eee cece eee e eee eens
Start Cycle Selection Phase ........... ccc cece cece e eee eee
Composite Cycle Selection Phase ............ cee ee eee eee

Bag 4/Remainder Cycle Selection Phase .....................

-ii-


c
400 TOTTIME = TRIPTIME / 60
csPD = 0.0
00 410 I = 1,NTRP
M = TRIPLIST(I)
CSPD = CSPD + SPD_MEAN(M) * ITIME(M) / TRIPTIME
410 CONTINUE

WRITE (3, 450) NTRP, NST, TOTTIME, STIME, BASETIME, CSPD, DIFFMIN
450 FORMAT (81¢"_/)//

+ 8X, ‘Total Microtrips: ', 13, 150, ‘Start Microtrips: ', 13/

+ 8X, / Total Trip Time: ', F6.2, ' min’, 150,’ Start Trip Time: ',

+ F6.2, ¢ min’/

+ 8X, ‘ Total Base Time: ', F6.2, ' min’/
+ 8X, ‘Mean Cycle Speed: ', F6.2, / mph!/
+ 8X, ‘Total Difference: ‘, F9.5/)

c

c Close "current" filename.

c

CLOSE (3)

(Csceszsesssesssssseee: saeseszse: sass
500 CONTINUE
c

WRITE (*, 510) MTRIPS, NCYCLES
510 FORMAT (/’ Cycle generation complete: '/
+ 'M-Trips Input .....+
+ * Cycles Generated ...

END

A-83


ganeAAAAnAaAnAaNnAAAAAAAAAAAD

PROGRAM PRNOIFF2

A modified version of SHOWDIFF program, PRNDIFF2 inputs
2 "PRN" cycle files and target surface file and computes
a difference spd/acl array in tabular form.

This program is primarily used to test the effects of editing
a cycle file by chopping/adding cruise, accel, etc.

Summary of speed & accel bin definitions:

Speed (mph): 0, 0 - <=5, 5 - <=10, etc.
Accel(mph/s):  -0.5 to 0. 0

-1.5>= to -0.5 , 72.522 to -1.5 = -2, etc.
0.5 to <= 1.5 = 1, 1.5 to <=2.5 = 2, etc.

1/0: Unit 1 input) - edited PRN cycle file.
selected cycle.
Unit 2 (input) + Speed/accel target surface created from
sec-by-sec drive cycle data.
Unit 3 (output) - Tabular "Watson Plot" of the spd/acl fit
between selected cycle & target surface.

Author: Tom Carlson
Date: = 05/17/93

CHARACTER MTYPE(50)
CHARACTER*14 MTRIPID(50), ITRIPID
CHARACTER*80 INFILE1, INFILE2, TARGFILE, TITLE, OUTFILE

REAL CFREQ(-20:20,0:20), ACLSUM(2,0:20), PFREQ(-20:20,0:20),
+ SPOSUM(2,-20:20), PCTDIF(-20:20,0:20)

DATA THOR / 7 /

c

aan

Prompt user for input and output filenames.

WRITE (*, 10)
10 FORMAT (/1X, ‘Enter input PRN cyclel filename:’)
READ (*, 20) INFILE1
WRITE (*, 15)
15 FORMAT (/1X, ‘Enter input PRN cycle2 filename:’)
READ (*, 20) INFILEZ
20 FORMAT (A)
WRITE (*, 30)
30 FORMAT (/1X, ‘Enter target surface filename:!)
READ (*, 20) TARGFILE
WRITE (*, 40)
40 FORMAT (/1X, ‘Enter Cycle 1 weight factor:/)
READ (*, *) WTT
Name QUTFILE and TITLE based on INFILE and TARGFILE.
U1 = INDEX CINFILET, 417) +1
INDEX CINFILET(L1:80), 7.1) + L1- 2
LB = INDEX (INFILE2, /]4) +1
L4 = INDEX CINFILE2(L1:80), /.°) + L1- 2
OUTFILE = INFILE1(L1:L2) // 1 .DF2!
K = INDEX (TARGFILE, /./) = 1
TITLE = ‘Difference Between Cycles ’ // INFILEN(LI:L2) // '/! //
+ INFILE2(L3:L4) // ' And Target Surface ’ // TARGFILE(1:K)
UL = INDEX (TITLE, © 4) = 1
ILEN = 87 - LL/2

Open all files.

OPEN (UNIT=1, FILESINFILE1, STATUS=’OLD’)
OPEN (UNIT=2, FILE=INFILE2, STATUS=/OLD’)
OPEN (UNIT=3, FILE=TARGFILE, STATUS=/OLD’)

OPEN (UNIT=4, FILESOUTFILE, STATUS='NEW’, RECL=186,
+ CARRIAGECONTROL="LIST!)

Read target population surface (unit 3).


c
c
c
c
c
c
c
c
c
c
Cc
c
c
c
c
Cc
c
c
Cc
c
c
c
c
c
Cc
c
c
c
c

aaa

ana

PROGRAM GETOUT75

GETOUT reads the "microtrips profiles" files and the target spd/
acl "Beyond FTP" surface file for the Baltimore & LA92 data

and selects a subset of Linked microtrips which best match the
target speed/accel surface using the Best Incremental.

GETOUT is a modified version of the GETSTAB program.
The sample from which these additional microtrips are
selected consists of ail Baltimore and LA92 microtrips, with
weighting factors which:
(1) allow 50/50 selection probability of stabilized m-trips
between Baltimore and LA92; and
(2) maintain initial weighting of start/stabilized m-trips
encountered in the Baltimore dataset.

NOTE:
This version does not use m-trips weightings discussed above, only
the embedded weightings in the input target surface.

1/0: Unit 1 Cinput) - Spd/acl target "surface" for sec-by-sec
drive cycle data (Balt/LA92).
Unit 2 Cinput) - Microtrip profile statistics.
Unit 3 (output) - Selected microtrips and "goodness" stats.

Author: Tom Carlson
Date: 5/11/93

PARAMETER (MNUM=7283, NBST=75)

CHARACTER*3 CLOOP
CHARACTER*14 MTRIPIDCMNUM), IDBST(NBST)
CHARACTER*80 OUTFILE, OUTNAME

INTEGER*2 MCNT(MNUM,-20:20,0:20), ITIME(MNUM), M,I, ITIMEBST(NGST)
INTEGER*4 IREC(MNUM), TRIPLIST(1000), IRECBST(NBST), MTRPBST(NBST)

REAL SPD_MEAN(MNUH), SPD_STD(MNUM), ACL_MAX(MNUM), DIFF(4),
SPD_MAX(HNUM), CFREQ(-20:20,0:20), TRIPDIFF(1000),
CCNT(~20:20,0:20), PFREQ(-20:20,0:20), TCNT(-20:20,0:20),
ASPDBST(NBST), TSPOBST(NBST), SSPDBST(NST), TACLBST(NBST),
DIFFBST(NBST,4)

eet

DATA NCYCLES / 1 /
DATA DIFFBST / NBST*999., NBST*999., NBST*999., NBST*999. /

OPEN (UNIT=1, STATUS=/OLD’)
OPEN (UNIT=2, STATUS=/OLD’, RECL=1760, FORM=/UNFORMATTED! )

Prompt user for output filename and cycle control parameters.

WRITE (*, 2)

2 FORMAT (/1X, ‘Enter output (selected trips & stats) filename:’)
READ (*, 3) OUTFILE .

3 FORMAT (A)

WRITE (*, 4)

FORMAT (/1X, ‘Enter target cycle time (min):’)

READ (*, *) RTIME

5

TIMELIMIT = RTIME * 60
Read in target surface (unit 1).

10 READ (1, *, END=20) IACL, ISPD, NFREQ, PCT
PFREQ(IACL, ISPD) = PCT / 100
INT = INT +1
Go To 10
Read in microtrip profiles (unit 2).

20 READ (2, END=50) I, MTRIPID(I), IREC(I), ITIMECI).

A-63


c Bin boundary numbers found -- now generate re-normalized surface
from In-Use activity BEYOND these detected boundaries.

DO 190 isPD = 0,20

c
c Beyond top FIP speed.
c
IF CISPD .GT. 1S) THEN
BO 160 IACL = -20,20
BINCNT(3, IACL, ISPD) = BINENT(1, IACL, ISPD)
TOTCNT(3) = TOTCNT(3) + BINCNT(3, IACL, ISPD)
160 CONTINUE
GO TO 190
END IF
c
c Within FTP speed range -- decel region.
c

DO 170 IACL = -20,1ANEGCISPD)-1

BINCNT(3, IACL, ISPD) = BINCNT(1,IACL, ISPD)

TOTCNT(3) = TOTCNT(3) + BINCNT(3,IACL, ISPD)
170 CONTINUE

c
C Within FTP speed range -- accel region.
c

DO 180 1ACL = IAPOSCISPD)+1,29
BINCNT(3, IACL,LSPD)= BINCNT(1,IACL,ISPD)
TOTCNT(3) = TOTCNT(3) + BiNCHT(3,JACL, SPO)
180 CONTINUE
c
190 CONTINUE

c

c:

ct Selected counts (outside the FTP boundaries) applied to new
c surface array (first element 3) -- now normalize and output.
C:

c

DO 200 TACL
00 200 ISPD = 0,
PCTBIN(3, IACL, ISPD) = BINCNT(3,ZACL,ISPD) * 100 / TOTCNT(3)
WRITE (3, 195) IACL, ISPD,BINCNT(3, IACL, ISPD), PCTBIN(3, ACL, ISPD)
195 FORMAT (2(13,",'), F8.0, ',/, F10.6)
200 CONTINUE

c
Cc Compute row (across spd) and column (across acl) totals.
c

310 DO 320 IACL = -20,20
00 320 1sPD = 0,
SPOSUM(IACL) = SPDSUM(IACL) + PCTBIN(3, IACL, ISPD)

320 CONTINUE

DO 325 ISPD = 0,20
DO 325 IACL = -20,20
ACLSUM(ISPD) = ACLSUM(ISPD) + PCTBIN(3, JACL, ISPD)
TOT = TOT + PCTBIN(3, [ACL, ISPD)
325 CONTINUE

WRITE (4, 330)

330 FORMAT (///60X, ‘ “Outside FIP" Driving’
+ //60X, 'Speed/Accel Frequency Distribution (%)!
+ HIL70X, SPO BIN (mph)! /)

WRITE (4, 340) (ISPD*S, ISPD = 0,20)
340 FORMAT ("ACL BIN (mph/s)’, 4X, 14, 3X, 20¢'<",13,3K), ’ Totals’/
to leet eseeseneeeee 1 GK, ferent, BK, 2006-294 3KD, Freee ")
c
DO 350 IACL = -20,20
WRITE (4, 345) IACL, (PCTBINC3,IACL,ISPD), ISPD = 0,20),
+ SPDSUM(IACL )
345 FORMAT (6X, 14, 6X, 21F7.3, 4X, F7.3)
350 CONTINUE
c
WRITE (4, 355) (ACLSUM(ISPD), ISPD = 0,20), TOT
38S FORMAT (/SX, ‘Totals’, 5X, 21F7.3, 4X, F7.3)
c

WRITE (*, 360) (TOTCHT(I), I = 1,3)
A-58


4. PROGRAM DESCRIPTIONS

This section contains summaries of each of the programs used to generate
driving cycles. The program summaries are ordered alphabetically to
enable easy lookup. The program language (FORTRAN, SAS, etc.) and the
cycle development "phase" in which the program was used (see Section 3)
are shown in parenthesis. Several programs which were used but are not
shown in the flow charts in Section 3 are described in this section.
These programs are noted as "Unlisted". In addition, some of the
programs were used in several cycle development phases. These programs
are marked as "Utility". .

Each summary consists of a description of the program, any user—prompted
input and a list of the external input and output files accessed by the
program. External files in FORTRAN programs are referenced by logical
unit number (LUN). External files accessed by SAS program are listed by
file reference name.

COMPARE (FORTRAN, Data Preparation-Unlisted)

This program was used to generate tabulated comparisons of the Baltimore
"cold" and "hot" SAFD files and the Baltimore and Los Angeles stabilized
SAFD files to determine if the speed/acceleration distributions for
Balt-Cold vs. Balt—Hot and Balt-Stabilized vs. LA-Stabilized showed any
significant differences. (The comparisons showed close similarity.
Stabilized travel was nearly identical in both cities. Hot and cold
start distributions were quite similar, except for longer initial idling
for cold starts.)

External Files

LUN 1/0? File Description

1 Input Baltimore Cold Start SAFD File

2 Input Baltimore Hot Start SAFD File

3 Input Baltimore Stabilized SAFD File

4 Input Los Angeles Stabilized SAFD File

5 Output File containing tabular comparisons

COMPSURE (FORTRAN, Data Preparation)

COMPSURF produces a weighted composite speed/accel "SAFD" file from the
Baltimore and Los Angeles Stabilized SAFD files and the Baltimore Start
SAFD file. Weighting factors are necessary since there are roughly 40
times more data collected in Baltimore than Los Angeles. The

-12-


aaa

naneanAAAAAANAAAAAAAAA

aaa

annan aane

ane

eano

Increment LEAD and reset it and its left-most neighbor to "1".
Then go back to 20 to do a KFILL and a range test.

c(N) = 0
C(LEAD+1) = 1
C(LEAD) = 1
CC(LEAD-1) = 0
LEAD = LEAD + 1
GO TO 20

Move Elements Section —-

Perform a backward scan of C (i.e., starting at element N) using
the loop variable M. In the scan, detect:

> the first occurrence of an element = 0 (sets LHOLE to .TRUE.)

+ with LHOLE .TRUE., the next element = 1 (final M value)
- # of elements between N & final M for which C = 1 (final L1)

When final M is found, the "1" value for the final M element is
moved to the right and remaining non-zero elements to the right
(indicated by L1) are reset just to the right of the moved final
M element.

The test for subroutine termination is also performed in this
section. Terminate when L1 equals K (all "1" elements will now)
be right-justified in the index array C.

4011-0
LHOLE = .FALSE.
MeN
SO IF (C(M) .£Q. 0) GO To 70
L1st1+1
IF (.NOT. LHOLE) GO TO 80
us. - 1
ccm) = 0
JEMeliet
DO 60 I = M+1,J
cl) = 14
60 CONTINUE
DO 65 I = J+1,N
cc) = 0
65 CONTINUE
LEAD = J
GO To 20
Subroutine terminate test -- is C now right-justified with "1/s"?
70 IF (L1 .£Q. K) GO TO 100
Zero value detected in backward search thru array C. This is
called a "hole".
LHOLE = . TRUE.
Decrement "move" variable M and re-test for element to move.
Element to move is the first non-zero element found by backward
searching C after a hole has been detected (LHOLE true).
BOM =M- 1
Go TO 50
Return condition.
100 RETURN

END
SUBROUTINE KFILL (K, N, C, KOMBOS, NUMBER)

A companion routine called by COMBOS to fill the "current"
numbers indexed in array C into the selection array KOMBOS.

PARAMETER (MM = 25)

INTEGER K, N, NUMBER, C, KOMBOS
DIMENSION C(*), KOMBOS(MM,*) A-28


PROGRAM GETREST

GETREST reads the "microtrips profiles" files and the target spd/
acl composite "surface" file for the Baltimore & LA92 data

and selects a subset of linked microtrips which best match the
target speed/accel surface using the Hybrid Method.

GETREST seeds" the cycle with user-selected start and “outside
FIP" m-trips.

GETREST is a modified version of the earlier GETSTAB program.
Prior to execution of this.code, another routine, GETSTART was run
to determine the "start" set of microtrips which best matched the
target start surface. These pre-determined microtrips become the
initial "seed" in this program onto which additional microtrips
are added. The sample from which these additional microtrips are
selected consists of all Baltimore and LA92 microtrips, with
weighting factors which:

(1) allow 50/50 selection probability of stabilized m-trips
between Baltimore and LA92; and

(2) maintain initial weighting of start/stabilized m-trips
encountered in the Baltimore dataset.

This version matches microtrip PATROL data with surface
COMPOSITE data (for LA92 data only).

NOTE:

This version does not use m-trips weightings discussed above, only
the embedded weightings in the composite target surface generated
by the COMPSURF program.

1/0: Unit 1 Cinput) - Spd/acl target composite "surface" for
sec-by-sec drive cycle data (Balt/LA92).

Unit 2 input) - Microtrip profile statistics.
Unit 3 (output) - Selected microtrips and “goodness” stats.

Author: Tom Carison
Date: 4/23/93

ananaaaaaAAAAAAAAA AAA AAAAAAAAAAA BA AAAOAG

PARAMETER (MNUM=7283)

CHARACTER*3 CLOOP
CHARACTER*14 MTRIPID(MNUM)
CHARACTER*23 CTIME
CHARACTER*80 OUTFILE, OUTNAME

INTEGER*2 HH, MM, SS, DD, MCNT(MNUM,-20:20,0:. 20).
+ ITIME(MNUM), M, MO, I, MOUT
INTEGER*4 IREC(MNUM), TRIPLIST(1000)

REAL SPD_MEAN(MNUM), SPO_STD(MNUM), ACL_MAX(MNUM),
+ ‘SPD_MAX(MNUM), CFREQ(-20:20,0:20), TRIPOIFF(1000),
+ CCNT(-20:20,0:20), PFREQ(-20:20,0:20), TCNT(~20: 20, 0:20)

DATA START_TIME /4.0/

OPEN (UNIT=1, STATUS=/OLD’, READONLY)
OPEN (UNIT=2, STATUS=/OLD’ ,RECL=1760, FORM='UNFORMATTED’, READONLY)

Prompt user for output filename and cycle control parameters.

WRITE (*, 2)

FORMAT (/1X, ‘Enter output (selected trips & stats) filename:’)
READ (*, 3) OUTFILE

FORMAT (A)

WRITE (*, 4)

FORMAT (/1X, ‘Enter target cycle time, including start (min):‘)
READ (*, *) RTIME

WRITE (*, 5)

FORMAT (/1X, ‘Enter target random "base" cycle time (min):’)
READ (*, *) BTIME

ews

w

A-70


PROGRAM MICTRIPS

c
© ‘This program reads a second-by-second driving cycle for a region
c and develops speed/acceleration profiles by microtrip. A
c microtrip is defined as travel between distinct stops.
c
© This version operates on PATROL not COMPOSITE data.
c
Cc 1/0: Unit 1 Cinput). - Sec by sec drive cycle data.
Cc Unit 2 (output) - Microtrip profile statistics.
c Unit 3 (output) - Route start profile statistics.
c
c Author: Tom Carlson
c Date: 4/20/93
c
Conn ene en ec eee eee e eee eee n eee ee eect eee ee eee ee center nee ee eee neeeee

CHARACTER*2_ CTRIP

CHARACTER*12 TRIPID, LTRIPID

CHARACTER*14 MTRIPID

INTEGER*2 CRUS, MTIME, LCRUS

INTEGER*4 FREQ(-20:20,0:20)

REAL SPO_SUM, SPD_SUM2, ACL_SUN2,

+ SPD_NEAM, SPO_STD, ACL_MAX, SPD_MAX
Creec en ee een cen ence ener eee weet ee ne cece ete e tence een tere r ee eneee nee eee

OPEN (UNIT=2, STATUS=/NEW!, RECL=3512, CARRIAGECONTROL=/LIST‘,
+ RECORDTYPE="VARIABLE’, FORM=/ FORMATTED’)

WRITE (2, 50)
50 FORMAT (4X,

+! MTRP INIT TIME AVG SPD MAX SPD STD SPD ',
+!MAX ACL SPO/ACL'/ °

+1X,

+7 NO MTRIP ID REC = (s) (mph) (mph) = (mph) ',

+*(mph/s) FREQ -->"/)

100 READ (1, 101, END=200) TRIPID, ISEC, SPD, ACL, ISPD, TACL
101 FORMAT (A12, 16, 2F6.2, 213)
NREC = NREC + 1

IF (SPD, -6T. 0.0) THEN

CRUS =
IFLAG = 1
ELSE
crus = 0
END 1F
c
IF (TRIPID .NE. LTRIPID .OR. CRUS .£Q. 0 .AND. LCRUS .EQ. 0 .AND.
+ TFLAG .£Q. 1) THEN
c ase i.
TFLAG = 0
IF (TRIPID .NE. LTRIPID) THEN
c If a “trailing idle" microtrip is detected at the end of a route,
c remove it (re-zero sums and decrement microtrip counter MTRIP).
C0000 wee eee eee ee ee ee ee eee
If (NREC.GT.1 .AND. SPD_MAX.LE.O.5 .AND. NTRIP.GT.1) THEN
MTRIP = MTRIP - 1
ITRP = ITRP + 1
NTRIP = 0
GO TO 122
END IF
Co nt ee ee ee eee eee ee ee eee
ITRP = ITRP + 4
NTRIP = 0
END IF
Co see teeeee eee pete eee ee eee eeeeeee Seeeecceceeeeenceneteccsecoeaes
c
c New microtrip detected. Generate statistics for "last* microtrip
c and output them to unit 2, then zero sums and increment counters.
c

IF (NREC EQ. 1) GO TO 130
A-49


PROGRAM REFORMAT_BALT

This program reads the second-by-second Radian Baltimore ASCII
driving data file, computes accels on a basis w/adopted ARB/EPA
convention and outputs those fields needed for cycle

selection (See companion program REFORMAT_LA92).

c

c

c

c

c

c

c 1/0: Unit 1 (input) + Sec-by-sec Balt ASCII driving data.
c Unit 2 (output) - EPA_BALT.DAT output file.

Cc Unit 3 (output) - BALTSOAK.DAT output file.

c
c
c
c
Cc:

Author: Tom Carlson ae
Date: = 4/13/93

CHARACTER*4 VID, LVID +
INTEGER JTIME(3), JOATE(3), LDATE(3), TRIPFLAG
REAL LSPD, LACL, NSPD

J¥ = JULDAY (1,1,1992) - 1

100 READ (1, 101, END=200) VID, CJDATECI), I = 1,3),
+ CJTIMECI), I = 1,3), SPO
101 FORMAT (AS, 19X, 312, 1X, 3¢12,1X), F6.2)
NEN+1
IF (SPD .LT. 0.0) SPD = 0.0

c
c Convert JTIME (HHMMSS) into seconds since midnight.
c

JD = JULDAY (JDATE(2), JOATE(3), JDATE(1)+1900)

JDAY = JD - JY

MSEC = JDAY*86400 + JTIME(1)*3600 + JTIME(2)*60 + JTIME(3)
c
c Set new trip flag, TRIPFLAG, when discontinuity observed in MSEC.
c

IF (N EQ. 1) THEN

LVID = VID

SOAK = 70.0

WRITE (3, 105) VID, (JDATE(I), I = 1,3), ITRIP, SOAK

GO TO 125

END IF

TSOAK = MSEC - LMSEC

IF (ISOAK .GT. 30) THEN

TRIPFLAG = 1
SOAK = ISOAK / 60.

END IF
c
C Test if new vehicle or trip.
c

IF (VID .NE. LVID) GO TO 130

IF (TRIPFLAG .EQ. 1) GO TO 140

110 ACL = SPD - LSPD

c
C Accel computed from current and last speeds. Check that- it's
c reasonable:
c
c
c
c If computed accel is not OK. Then “synthesize” it from an
Cc interpolation of tast and next speeds.
c

IF (ABS (ACL) .GT. 12.0) THEN
READ (1, 111) NSPD
111 FORNAT (39K, F6.2)
BACKSPACE 1
IF (SPD .£@, 0.0 .AND. NSPD .GT. 0.0) THEN
XSPD = (LSPD + NSPD) / 2
XACL = XSPD - LSPD
WRITE (*, 112) N, LSPD, SPD, NSPD, ACL, XSPD, XACL
112 FORMAT (110, 6F8.2)
SPD = XSPD
ACL = XACL

A-10


AAAMAAANAAAANRF AAO AAAAANAAAAAAAAAAAAAA

aananna

°

PROGRAM SHORTB4

SHORTB4 (Short Bag 4) retrieves the m-trip profile information for
auser input cycle and finds the subset of m-trips which best
represent non-FTP operation. This logic is laid out as follows:

(1). A "target" FIP spd/acl surface is input (LAGFRQ.DAT).
(2). Two subset arrays are set up: FTP & leftover or non-FTP

(3). The m-trips at the beginning of the input cycle which are
designated as start m-trips are placed into the
FIP array. Then all remaining m-trips are iteratively
added to the FTP subset IN ALL POSSIBLE COMBINATIONS and
each combination is tested against the FTP target surface
(see subroutine COMBOS).

(4). Combinations of all sizes from 1 to N-1 are
considered (N=# of cycle m-trips).

(6). Top NBEST m-trips combinations (based on minimum DIFFSUM)
for FTP are then saved and output along with their
"Leftovers". These leftover m-trips make up Short Bag 4.

1/0: Unit 1 Cinput) - "ALL Driving! composite surface.
Unit 2 Cinput) - LAS surface.
Unit 3 (input) - Selected M-trips & goodness stats file.
Unit 4 (input) - M-trips profile file (binary).
Unit 6 (output) - Listing of the best m-trip combinations
jin the FTP subset and the corresponding
"leftovers" in the Short Bag 4 subset.
unit 7 (output) - Best Short Bag 4 spd/act surfaces.
Unit 8 (output) - Best Long 8ag 4 spd/acl target surfaces.

Author: Tom Carlson
Date: 5/4/93

Set run size. +> Max # of m-trips allowed in a cycle.
-> Max # of start m-trips allowed in a cycle.
NBST --> # of "best" short bag 4 combos to output.

NMAX --> # of total m-trip combinations allowed.

PARAMETER (MM = 25, MS = 10, NBST = 10, NMAX = 5000)

CHARACTER TYPE(MM), TYPES(MM)

CHARACTER*2 CNUM

CHARACTER*14 MTRIPID(MM), KTRIPID, MTRIPIDS(MM)
CHARACTER*25 CYCFILE, B4TFILE

INTEGER*2 MCNT(MM,-20:20,0:20), KTIME, KK, LISTBST(NBST,MM),
+ ITIME(MM), KCNT(-20:20,0:20), MTRP(MM), ITIMES(MS),
+ MTRPS(MS)

INTEGER*4 IREC(MM), KREC, KOHBOS(MM,NMAX), IRECS(MS)

REAL SPD_MEAN(MM), SPO_STDCMH), ACL_MAX(MM), DIFFBST(NBST),
FFREQ(-20:20,0:20), B4F(-20:20,0:20), B4T(-20:20,0:20),
SPD_MAX(MM), TIMEBST(NBST), B4TBST(-20:20,0:20,NBST),
TFREQ(-20:20,0:20), B4S(-20:20,0:20), B4L(-20:20,0:20),
B4FBST(-20:20,0:20,NBST), B4SBST(-20:20,0:20,NBST),
SPD_MAXS(MS), SPD_MEANS(HS)

beets

DATA DIFFBST / NBST*999, /

OPEN (UNIT=2,
OPEN (UNIT=3, STATUS=/OLD’)

 STATUS='OLD‘, RECL=1760, FORM=‘UNFORMATTED’ )
OPEN (UNIT=6, STATUS=/NEW’, CARRIAGECONTROL='LIST’)

c.
Cc
c
c

Read in total "ALL Driving” surface (unit 1).

A-22


00 220 IACL = -20,20
00 220 ISPD = 0,20
CPCT = CBINCIACL, ISPD) * 100 / CREC
WRITE (4, 210) IACL, ISPD, CBINCIACL, ISPD), CPCT
210 FORMAT (2(13,',/), F8.0, ',/, F10.6)
220 CONTINUE

CLOSE (4)
WRITE (*, 230) CREC, (WFAC(I), I = 1,3)

230 FORMAT (/‘Processing completed:  Crec =’, F8.0//
+ ' ~ Wfacl =", F5.1/
+ ' Wfac2 = ') F5.1/
+ ' Wfac3 =", F5.1/)

END

A-91


MgnNaANAAAAAAADAAANAAAAAAAAAAAAAA

eana

nanann

anane

aanaanaaana

o00

Returned Args:
KOMBOS . a two-dimensional integer array (with dimensions

K x NUMBER) containing NUMBER unique combinations

each of size K.

NUMBER ..... the total number of unique combinations generated:

NUMBER = -----------
~~ KI (N - KOE

Combinations refer to selected number sets in which the order of
selected numbers doesn’t matter. (This differs from permutations
in which the order establishes a unique set.) For example, 1-2-3
and 1-3-2 are a the same, single combination.

NOTE: Care should be used in calling this routine when N > 10

since the # of combinations increases rapidly due to the
factorials. As a result, KOMBOS size can get enormous.

Author: Tom Carlson
Date 05/05/93

PARAMETER (NMAX = 50, NM = 25)

LOGICAL HOLE

INTEGER I, J, K, L1, M, N, LEAD, NUMBER, C, KONBOS
DIMENSION CCNMAX), KOMBOS(MM,*)

Begin execution -- initialize the "index" array C with K
left-filled elements = 1 and N-K right filled elements = 0.

LHOLE = .FALSE.

pO 10 1 = 1,N
IF (1 .LE. K) THEN
ctl) = 1
ELSE
CCI) = 0
END IF
10 CONTINUE

Return point from either a finished "Migrate LEAD" sequence or
@ "Move Elements" operation. (It’s also stepped to from above.)
Call KFILL to "write" currently selected indices in C (those set
to "1") to KOMBOS.

2

8

CALL KFILL (K, N, C, KOMBOS, NUMBER)

Test if "Migrate LEAD" operations have pushed the LEAD pointer
to our range limit given by N. If so, branch to "Move Elements"
section.

IF (LEAD .£Q. N) GO TO 40

Migrate LEAD Section

We're still within range. Perform a shift sequence for the LEAD
pointer only. Migrate it until out of range, calling KFILL after
each shift. "

DO 30 [ = LEAD+1,N

ct) 21

C(I-1) = 0

CALL KFILL (K, N, C, KOMBOS, NUMBER)
30 CONTINUE

Apply special termination condition test when K = 1.

IF (K .€Q. 1) GO TO 100
A-27


MTRI
NO.

P
MTRIP ID

1 B0849203100101
2 B0849203100201

INIT
REC

1
35

Master Microtrips File (excerpt)

TIME AVG SPD MAX SPD STD SPD MAX ACL
(s) (mph) — ¢mph) = (mph) (mph/s)

32 4.13 10.29 3.33 3.470 0 0
28 2.29 8.99 3.25 2.050 0

‘SPD/ACL
FREQ -->

0 0 0
0 0 66

B-3

°°

°°

co

°°

oo

oo

oo

oo

oo

co

co


aon

aaa

aneo

anee

e000

20

30
yn

32
33

READ (1, *, END=20) IACL, ISPD, NFREQ, PCT
TFREQCIACL,1SPO) = PCT / 100

IN) = INT +1

GO TO 10

Read in LA4 surface (unit 2).

READ (2, *, END=30) IACL, ISPO, NFREQ, PCT
FFREQ(IACL, ISPD) = PCT / 100

IN2 = IN2 +1

Go To 20

Read in selected cycle stats file (unit 3).

READ (3, 31) CYCFILE
FORMAT (//23X, A)
1 = INDEX (CYCFILE, ‘.4) - 1

DO 32 ISKIP = 1,4
READ (3, FMT=!()‘)
CONTINUE

IN3 = INS + 1
READ (3, 34, ERR=35) N, TYPECN), MTRPCN), MTRIPID(N), IREC(N),

+ ITIME(N), SPD_MEANCN), SPD_MAX(N)

3

35.N

36

FORMAT (13, 1X, At, 1X, 15, 1X, A14, 1X, 17, 1X, 14, 2C1X, F7.2))
GO To 33

= IN3- 1

Now detect and move the start m-trips to the back of the pack so
the COMBOS routine can be called over the range 1 to N-NS.

po 36 1 = 1,N

IF (TYPE(1) .NE. 'S') THEN
NS= 1-1

GO TO 37

ENO IF

MTRPS(I) = MTRPCI)
TYPES(I) = TYPE(I)
MIRIPIOS(1) = MTRIPIOCI)
TRECS(I) = IREC(I)
ITIMES(1) = ITIME(T)
SPD_MEANS(I) = SPD_MEAN(I)
SPD_MAXS(I) = SPD_HAX(1)
CONTINUE

37M =N- NS

38

vo 38.1 = 1,4
MTRP(I) = MTRPC(I+NS)

TYPECI) = TYPECI+NS)
MTRIPIO(I) = MTRIPIDCI4NS)
TRECCT) = IRECCI+NS)
ITIME(T) = ITIME(I#NS)
‘SPO_MEAN(I) = SPD_MEANCI+NS)
SPO_MAX(1) = SPD_MAX(I+NS)
CONTINUE

DO 39 1 = MFI,N

MTRP(T) = MTRPSCI-M)

TYPE(I) = TYPES(I-M)
MTRIPID(1) = MTRIPIDSCI-M)
IREC(I) = IRECS(I-M)
ITIME(I) = ITIMES(I-M)
SPD_MEAN(I) = SPD_MEANS(I-M)
SPD_MAX(1) = SPO_MAXS(I-M)

39 CONTINUE

40

Read in microtrip profiles binary records one at a time (unit 4).

READ (4, END=50) KK, KTRIPID, KREC, KTIME, SPOMEAN, SPDMAX,
+ SPDSTD, ACLMAX, ((KCNT(IACL,ISPD), ISPD=0,20), IACL=-20,20)
IN4 = ING +1

Check the m-trip # of each record & keep only those records which
are found in the MTRP list read from unit 3 for the input cycle.

00 45 1 = 1,N
A-23°


DO 210 IsPD = 1,20
qISsPD-1) * 5
211+5
TF (SPO .GT. 11 .AND. SPD .LE. 12) THEN
IS = ISPD
GO TO 220
END IF

210 CONTINUE

IF (ACL .GT. 0.0) GO TO 235

DO 230 IACL = -20,-1
AL = IACL + 0.5
A2 = IACL - 0.5

IF (ACL .LT. Al .AND. ACL .GE. A2) THEN
JA = TACL

GO TO 250

END IF

23

38

CONTINUE

235 00 240 IACL = 1,
Al = IACL - 0.5
2 = IACL + 0.5

TF (ACL .GT. A1 .AND. ACL .LE. A2) THEN
JA = TACL

GO TO 250

END IF

240 CONTINUE

250 IF CITIME .LE. ‘START_TIME) THEN
BINCNT(1,1S,1A) = BINCNT(1,1S,1A) + 1
NST(1) = NSTC1) + 1
ELSE
BINCNT(2,1S,IA) = BINCNT(2,IS,IA) + 1
NST(2) = NST(2) + 1
END IF

NMODE(IMODE) = NMODECIMODE) + 1

TOUT = IMODE + 1

WRITE (IOUT, 270) TRIPID, ITIME, SPD, ACL, IS, IA
FORMAT (A12, 16, 2F6.2, 213)

GO TO 100

7

3

Bin counting complete. Print spd/acl counts and percentages for
each output file (cold, hot, stabilized).

aa00

300 DO 320 IST = 1,2
IOUT = IST +3

DO 320 IACL = -20,20

DO 320 ISPD = 0,20

BINPCTCIST, ISPD, IACL) = BINCNTCIST,ISPD,IACL) * 100. /

+ NSTCIST)

WRITE (IOUT, 315) IACL, ISPD, BINCNT(TST,ISPD,IACL),

+ BINPCT(IST, ISPD, IACL)
315 FORMAT (2(13,',/), 18, ,/, F10.6)
320 CONTINUE

CLOSE (1)
CLOSE (2)
CLOSE (3)
CLOSE (4)
CLOSE (5)

WRITE (*, 400) (NNODE(J), NSTCJ), J = 1,2), 1
A-52


360 FORMAT (// Distribution Counts: Composite -----> ‘, F8.0/
+ : 4 > 1) F8.0/
+ ’ >") FB.0/)

END

A-62


aaneaane ean0 ane

aanaAan

ae

ane

70 CONTINUE
IF statement always false .-- we/ve found a leftover m-trip.

ITRP = L
TIMEL = TIMEL + ITIMECITRP)

DO 75 IACL = -20,20

00 75 ISPD = 0,20

B4LCIACL, ISPD) = B4LCIACL,ISPO) + MCNTCITRP,IACL,ISPD)
75 CONTINUE .

80 CONTINUE

ALL leftovers processed. Don’t forget to include "trailing"
start m-trips.

85:00 90 1 = M+I,N

itrp = 1
TIMEL = TIMEL + ITIMECITRP)

DO 90 TACL

00 90 ISPD = 0,20

B4LCIACL, ISPD) = B4LCIACL, ISPD) + MCNTCITRP, IACL, ISPD)
90 CONTINUE

-20,20

Compute the new target Long Bag 4 surface from leftover m-trips:
Long Bag4 Target Surface = "ALl Driving" - “Leftover” Bag 4
where "Leftover" Bag 4 = PCC - Short Bag 4

DO 95 IACL = -20,20

DO 95 ISPD = 0,20

BGLCIACL,ISPD) = B4LCIACL, ISPD) / TIMEL

BGTCIACL, ISPD) = TFREQ(TACL, ISPD) - B4LCIACL, ISPD)
95 CONTINUE

Alt stats for this m-trip combo (and its leftovers) complete.
Now check current DIFFS against "top-NBST" array. If current
DIFFS is smatler than any element in the DIFFBST array, push it
in and shift the subsequent elements, moving the last one out.
00 120 1 = 1,NBST

IF (DIFFS .LT. DIFFBST(1)) THEN
MOVE = I

OK, smaller DIFFS found -- do the element shift first.

DO 100 L = NBST,MOVE+1,-1
TIMEBST(L. TIMEBST(L-1)
DIFFBSTCL. DIFFBST(L-1)
DO 98 LIST

14M
LISTBST(L,LIST) = LISTBST(L-1,LIST)

98 CONTINUE
DO 100 TACL 20,20
D0 100 ISPD = 0,20
B4SBST(IACL,ISPD,L) = B4SBSTCIACL,ISPD,L-1)
BGTBSTCIACL,ISPD,L) = BGTBST(IACL, 1SPD,L-1)

100 CONTINUE

And now the "push".

TIMEBST(MOVE) = TIMES / 60
DIFFBST(MOVE) = DIFFS

Do 102 LIST = 1,K

LISTBST(MOVE,LIST) = KOMBOS(LIST,J) + NS

102 CONTINUE

DO 110 TACL

DO 110 ISPD = 0,

B4SBST(IACL, ISPD,MOVE) = B4S(IACL, ISPD)
BGTBST(IACL, ISPD, MOVE) = B4T(IACL, ISPD)

110 CONTINUE

Go To 200
END IF
A-17


stabilized N-trips 2 thru 10.
= K + NST

MRAN(I) = MINDX(K)

DO 410 J = K, NTRP-1
= MINDX(J+1)

=
3s

CONTINUE

Write sec-by-sec speed and’ accel to PRNFILE (unit 9) in
re-shuffled order.

c
Cc
c
c
c
c
c
Cc MINDX(J)
c
c
Cc
c
Cc
c:
Cc

DO 450 1 = 1, NTRP
“00 440 N = 1, ITIMECI)
C Write speed and accel for current segment.
sM+1
ate (9, 435) M, ITRIPCI), SPOCI,N), ACLCI,N), BINSCI,N),
435 FORMAT (4, 13, siuact WP. 3, 214)
440 CONTINUE

450 CONTINUE
c

C-e-e--+
C — Sec-by-sec cycle speed profile created and output to unit 9. Now
Cc read speed/accel bin frequency counts data for selected M-trips

C created by the MICTRIPS program from unit 3. After each M-trip is
c input, increment bin counts for that M-trip.

00 530 1 = 1, NTRP
= IPNTCI)

IF CL .GT. 1) THEN
NSKIP = MTRIPS(J) - (MTRIPS(J1) + 1)

ELSE
NSKIP = MTRIPS(J) - 1
END IF -
c Skip records until next selected M-trip is reached.

DO 510 ISKIP = 1, NSKIP

READ (3) M, TRIPID, JREC, JTIME, SPD_MEAN, SPD_MAX,

+ SPD_STD, ACL_} MAX, CQMCNTCTACL, 1sPD), ISPD=0;; 20), TACL=-20,20)
510 CONTINUE

© Read segment.

READ (3) M, ITRIPID, JREC, JTIME, SPD_MEAN, SPD_MAX,
+ SPD_STD, ACL_MAX, ((MCNTCIACL, ISPD), ISPD=0,20), IACL=-20,20)

wed
c Now increment bin counts with current M-trip counts.

DO 520 IACL = -20,20

DO 520 ISPD = 0, 20

CFREQ(IACL, 1sPp) = CFREQCIACL, ISPD) + MCNTCIACL, ISPD)
520 CONTINUE

TOTTIME = TOTTIME + ITIME(J)
530 CONTINUE

c

C

c Total bin count reads finished. Compute cycle total and start
c frequencies and differences from population surfaces (in %) from
c
c
c

the accumulated sums and output to SURFILEs (units 10-13).

DO 540 IACL = -20,20
ACLBIN = IACL

DO 540 ISPD = 0,20
SPDBIN = ISPD * 5

A-103


END

1X, ‘Records kept:
1X, ‘Microtrips:
1X, ‘Vehicle trips:

A-87


* *
* GETBALT.SAS program *
* *
options (s=132 ps=80 missing=! ';

libname rad ‘fujia: lepa.drivecycle] ‘;

data a;
set rad.vehs;
IF (SAMPLE=:/s’ or SAMPLE=:/S‘) then delete;
keep SAMPLE VIN;

proc sort;

by VIN;

DATA E;

rename MPH = SPD;
MERGE A CIN=11)
rad.opns (1N=12);
BY VIN;

IF (11 AND 12);

file drivdat;
put 21 SAMPLE $ 4.
6 VIN $17.

24 DATE YYMMDDS.
@31 HHMMSS TIMES.
40 SPD 6.25

A-96


nae aeaee

nonaen

eananeA

eo02000

170

180

Read total population and start population surfaces (units 7 & 8).

Total population surface.

READ (7, *, END=180) IACL, ISPD, NBIN, PCT
PFREQ(IACL, ISPD) = PCT

IN7 = INT +1

Go To 170

Start population surface (first 240 seconds of total surface).

READ (8, *, END=190) IACL, ISPD, NBIN, PCT
SFREQCIACL,ISPD) = PCT

INS = INB + 1

GO TO 180

Get list of selected M-trips from INFILE, skipping IHDR header
records (unit 2).

190 DO 199 ISKIP = 1,IHDR

19
20

9
10

+

READ (2, FMT=/()!)
CONTINUE

ITRP = ITRP + 1

READ (2, 205, ERR=210) ITRIPCITRP), MTYPECITRP), MTRIPSCITRP),
MTRIPIOCITRP), IRECCITRP), ITIMECITRP)

205 FORMAT (13, 1X, Al, 1X, I5, 1X, A16, 1X, 17, 1X, 14)
IF (MTYPECITRP) «EQ, 'S) NST = NST + 1
Go To 200

231

241
25

0

0
0

305

30:

&

ALL M-trips read fron INFILE. Now sort ‘em by increasing initial
record number IREC. Use indirect sorting, storing pointer
rankings in IPNT.

NTRP = ITRP - 1

DO 220 I = 1, NTRP
IPNT(I) =
CONTINUE

Do 250 { =-1, NTRP-1
= IPNTCI+1)

bo 230 N= 1, I
el+i-J
IF CIREC(L) .GT. IRECCIPNT(K))) GO TO 240
IPNT(K+1) = IPNT(K)
CONTINUE

kK=0
IPNT(K+1) =
CONTINUE

Pointer sorted. Now lookup second-by-second speed vs. time
traces in master archive file ROUTEFILE (unit 1).

DO 350 ITRP = 1, NTRP

00 305 K = 1, NTRP

IF CIPNT(K) «EQ. ITRP) THEN
sek

GO TO 308

END IF

CONTINUE

JINDXCITRP) =
= IPNTCITRP)
IF CITRP .GT. 1) THEN
NSKIP = IRECCJ) - CIRECCJ1) + ITIMECJ1))
ELSE
NSKIP = IREC(J) - 1
END IF

Skip records until next selected M-trip is reached.

4-101


DRIVING CYCLE DEVELOPMENT SOFTWARE
USER’S GUIDE

Table of Contents

page
1. Introduction ........ 0. eee eee teen tenet eee 1
2. System Requirements .. 2
3. Software Overview 2.0... cece eee teen eens 3
3.1 Data Preparation Phase 4
3.2 Start Cycle Selection Phase .. 6
3.3 Composite Cycle Selection Phase . 6
3.4 Bag 4/Remainder Cycle Selection Phase 9
4. Program Descriptions 12

Appendix A: Program Code Listings

Appendix B: Sample Cycle Development Files


Initialize cycle sums and counter.

f°

NTRP = 0

TRIPTIME = 0.0

STIME = 0.0

CSPD = 0.0

DO 80 IACL = -20,20

DO 80 IsPD = 0,20

TCNTCIACL, ISPD) = 0.0
80 CONTINUE

IPRD = INDEX (OUTFILE, ‘.7)

TEND = INDEX COUTFILE, ' ') - 1

WRITE (CLOOP, FMT='(13.3)!) ILOOP

QUTNAME = OUTFILE(1:1PRD-1) // ‘=! // CLOOP // OUTFILE(IPRD:IEND)
TOUT = INDEX (OUTNAME, ‘ 4) - 1

c Get system time. Call to LIBSDATE_TIME returns 23-byte character
c string which contains hour, minute, second and decimal fraction.

ISTAT = LIBSOATE_TIME (CTIME)
READ (CTIME, FMT=/(11X,4(1X,12))/) KH, MM, SS, OD

c Create seed value for random series. Seed ranges from 0 to 10**8,
c Make seed odd per VAX-FORTRAN recommendations (FORTRAN Language
€ Reference Manual V5.0, pg. 0-49).
ISEED = DD * 1000000 + SS * 16666.67 + MM * 166.67 + HH * 4.1667
IR = MOD (ISEED, 2)
TF CIR .£Q. 0) ISEED = ISEED + 1
c
c Open "current" filename.
c
OPEN (UNIT=3, FILE=QUTNAME, STATUS='NEW’, CARRIAGECONTROL=/LIST’,
+ RECORDTYPE=’ VARIABLE!)
c
c Write output file header.
c

RTIME = TIMELIMIT / 60.0
BTIME = TIMERAN / 60.0
WRITE (3, 90) RTIME, ISEED, BTIME, OUTNAME(1:10UT), START_TIME
90 FORMAT (5X, ‘HYBRID Trip Selection Method’, 154,

+ ‘Target Time: *, F5.2, ' min’/

+ 13X, "Ist Seed: ’, 19, 154,

+ "Base Time: ', F5.2, ' min’/

+ 13X, ‘Filename: ‘, A, 154,

+ ' Start Time: ', F5.2, ‘ min’//8X,

+*NTRP INIT TIME AVG SPD MAX SPD STD SPD MAX ACL’
+ /2X, '#

+7 NO MTRIP ID REC (s) (mph) (mph) (mph) (mph/s)*

+ ,' DIFFSUN’/)

c
c
c +tt+++ “START SEED" SECTION  ++++++
c
c

Start" microtrip(s) seeding section. Use input “best” start
microtrips and use the MO & MSTART "pointers" to extract them.

Big loop 150 adds sequentially selected M-trips till all start
M-trips read and processed (NTRP = MSTART).

DO 150 M = MO, MO+MSTART-1

c .

c Add act/spd bin counts for current microtrip to “current” count
c array CCNT and express as frequency. Then, compute integrated
c difference between the population surface PFREQ and the best

c incremental surface CFREQ. (Use abs value of the difference.)
c

DIFF = 0.0

DO 120 IACL = -20,20

DO 120 ISPD = 0,20

CCNTCIACL,ISPO) = TCNT(IACL,ISPD) + MCNT(M, IACL, ISPD)
CFREQ(IACL,ISPO) = CCNTCIACL,ISPO) / (TRIPTIME + ITIME(M))
DIFF = DIFF + ABS (CFREQ(IACL,ISPD) - PFREQCIACL,ISPD))
TCNTCIACL, ISPD) = TCNTCIACL, ISPD) + MCNT(M, LACL, ISPD)

A-80


PROGRAM WTDSURF

A quick program to produce a weighted spd/acl surface from
input FRO surface files and weighting factors.

Qutput Surface = Input Surface 1 * Wtl + Input Surface 2 * Wt2 +
aeees + Input Surface N * WtN

where N = is the # of surfaces (bags).
The output surface is then renormalized to 100%.
Summary of speed & accel bin definitions:
Speed (mph): 0, 0 - <5, 5 - <=10, ete.
Accel (mph/s): °0.5 to 0

71.525 to -0.5 ‘ = -2, etc.
0.5 to <= 2.5 = 2, etc.

Author: -Tom Carlson
Date: 07/22/93

manana aAAnAAAAAAAAAAAAAA

PARAMETER (NMAX=10)

c
CHARACTER*80_ INFILE(NMAX)
INTEGER NREC(NMAX)
REAL PCT(NMAX,-20:20,0:20), OUTPCT(-20:20,0:20), WFAC(NMAX)
¢ ;
DATA ROUM / 0.0 /
c
OPEN (UNIT=2, CARRIAGECONTROL='LIST’, STATUS=/NEW’)
c

WRITE (*, 10)
10 FORMAT (// Enter # of surfaces to be weighted together:/)
READ (*, *) NFAC
WRITE (*, 20) NFAC
20 FORMAT (/' Enter the ', 12, ‘ weighting factors separated by ’,
+ ‘spaces: /)
READ (*, *) (WFAC(I), I = 1,NFAC)
WRITE (*, 30) NFAC
30 FORMAT (/' Enter the ‘, 12, ‘ surface filenames (one per line):‘)
DO 40 1 = 1, NFAC
READ (*, FMT=/(A)!) INFILECI)
40 CONTINUE

© Loop for each input surface.

c
DO 150 1 = 1,NFAC
c
c Read input surface file (unit 1).
c

OPEN (UNIT=1, FILESINFILE(I), STATUS='0LD‘)

100 READ (1, *, END=140) IACL, ISPD, IDUM, PCT(1,IACL, ISPD)
GO To 100 :

140 CLOSE (1)

150 CONTINUE

Generate total weighted composite surface.

DO 200 IACL
DO 200 ISPD = 0,20
OO 190 [ = 1,NFAC
OUTPCTC(IACL, ISPD) = OUTPCT(IACL,ISPD) + WFAC(I) * PCT(I,IACL,ISPD)
190 CONTINUE
TOTPCT = TOTPCT + OUTPCT(IACL,ISPD)
200 CONTINUE

ana

Re-normalize new weighted surface to 100%.

A-40


aaa

aoa

ergenane00

noe

ee0e900

naanaanaAAe

Update total combos counter.
NTOT = NTOT + NK

Go back on outer loop K (the combo size variable).

300 CONTINUE

8

Write top NBST summary table.

WRITE (6, 402) NBST, CYCFILEC1:1E)
402 FORMAT (‘TOP ', 12, ' “FTP! MICROTRIP COMBINATIONS FOR’,
"CYCLE ', A///

' FIP FIPY/
‘Rank DIFFSUM Time (min)

Feces eeeeeee aeeeeeeeee

ttee

bo 410 1 = 1, NBST

po 405 L = 1,
IF (LISTBST(I,L) .€@. 0) THEN
Ket-1
GO TO 408
END IF
405 CONTINUE

408 WRITE (6, 409) 1, DIFFEST(I), TIMEBST(1), (LISTBST(I,LIST),
+ UIST = 1,K)
409 FORMAT (13, 3X, F8.5, 6X, F5.2, 3X, <K>14)

410 CONTINUE
Write Tbag4 surfaces to unit 7.
DO 420 I = 1,NBST

WRITE (CNUM, FMT="(12.2)/)
B4TFILE = ‘T4FRQ_! // CYCFILE(1:1E) // *_* // CNUM // '.DAT!
OPEN (UNIT=7, FILE=B4TFILE, STATUS='NEW’, CARRIAGECONTROL=/LIST/)

00 417 IACL = -20,20

Do 417 ISPD = 0,20

PCT = B4TBST(IACL,ISPD,1) * 100

WRITE (7, 415) IACL ,ISPD, IDUM, PCT
41S FORMAT (2(13,',/), 18, ',', F10.6)
417 CONTINUE

CLOSE (7)

420 CONTINUE

Print status summary and

WRITE (*, 500) CYCFILE(1:1E), NTOT
500 FORMAT (// Short Bag 4 analysis completed for cycle ‘, A//
+ 10x, 15, ' microtrips combinations evaluated’ /)

END

SUBROUTINE COMBOS (N, K, KOMBOS, NUMBER)

This routine generates all unique combinations of numbers in the
range 1 to N of choosing K items without replacement from N
elements.

Passed Args:

seeseees the number of elements (and implied range) to
choose from
K cece eee eee the count or size of each chosen set

A-26



c
c

ne

anee

ane

If smaller than "best" of earlier incremental H-trips, then
"mark" (M21) and replace as new best difference.

TF (OLFF .LT. DIFFMIN) THEN
DIFFMIN = DIFF

Met

END IF

350 CONTINUE

TRIPLIST(NTRP) = M

TRIPTIME = TRIPTIME + ITIME(M)

TRIPDIFFCNTRP) = DIFFMIN

DO 360 IACL = -20,20

00 360 ISPD = 0,20

TCNTCIACL, ISPD) = TCNT(IACL, ISPD) + MCNT(M, IACL, ISPD)
360 CONTINUE

Print statistics for current M-trip.

Print statistics for current M-trip.

WRITE (3, 370) NTRP, M, MTRIPID(M), IREC(M), ITIME(M),SPD_MEAN(M),

+ SPD_MAX(M), SPD_STD(M), ACL_MAX(M), TRIPOIFF(NTRP)
370 FORMAT (13, 1X, ‘1’, 1X, 15, 1X, A14, 1X, 17, 1X, 14,

+ 3C1X, F7.2), 1X, F7.3, 1X, F9.5)

Terminate main "trip adding" loop when the desired cycle time
TIMELIMIT is reached.

IF CTRIPTIME .GT. TIMELIMIT) GO TO 400
Loop back and find another M-trip.

GO TO 301

Current cycle completed. Compute cycle summary statistics and
print totals.

400 TOTTIME = TRIPTINE / 60

CPD = 0.0

00 410 1 = 1,NTRP

M = TRIPLIST(I)

CSPD = CSPD + SPD_MEAN(M) * ITIME(M) / TRIPTIME
410 CONTINUE

WRITE (3, 450) NTRP, NST, TOTTIME, STIME, BASETIME, CSPD, DIFFMIN
450 FORMAT (81¢/_!)//

+ 8X, ‘Total Microtrips: ', 13, 150, ‘Start Microtrips: ’, 13/

+ 8X, / Total Trip Time: ', F6.2, ' min’, T50,/ Start Trip Time: ',
+ F6.2, ¢ mint/

+ 8X, / Total Base Time: ', F6.2, ¢ min’/

+ 8X, ‘Mean Cycle Speed: ', F6.2, ' mph'/

+ 8X, ‘Total Difference: , F9.5/)

Close "current" filename.

CLOSE (3)

500 CONTINUE

WRITE (*, 510) MTRIPS, NCYCLES
510 FORMAT (/’ Cycle generation complete:'/
+ ' M-Trips Input
+ * Cycles Generated ........

1, 15/
*, 15/)

END


APPENDIX A

Program Code Listings


PRNDIFF (FORTRAN, Utility-Unlisted)

PRNDIFF is a modified version of the SHOWDIFF program and inputs a "PRN"
Driving Cycle Trace File and any target SAFD file and computes the
difference between the input cycle speed/accel distribution and that of
the target distribution. Output is in tabular "Watson Plot" form.

External Files

LUN 1/0? File Description

1 Input Driving Cycle Trace PRN File

2 Input Any Target SAFD File

3 Output Tabular "Watson Plot" of difference between PRN

file and SAFD file

PRNSURE (FoRTRAN, Bag 4/Remainder Cycle Selection)

PRNSURF is a short program used to generate a speed/accel “SAFD" file
from an input Driving Cycle Trace PRN file.

External Files

LUN 1/0? File Description
1 Input Any Driving Cycle Trace PRN file
2 Output Speed/Accel Distribution in "SAFD" comma—

delimited format

REFORMAT BALT (FORTRAN, Data Preparation)

This program reads the Baltimore second-by—second speed vs. time driving
data file and reformats the fields and computes second-by—second
accelerations. Computed accelerations between two adjacent speeds are
assigned to the beginning of the time step.

In addition to the reformatted output driving data file, a second file
containing computed soak times prior to each trip is also output.

A companion program, REFORMAT_LA92 performs the same function on the Los
Angeles second-by-second driving data (except no "Soak Time" file is
created).

External Files

LUN 1/0? File Description

1 Input Second-by-second speed vs. time driving data
2 Output Speed & Accel vs Time File

3 Output Soak Time by Trip ID File

-22-


READ (*, *) MO
WRITE (*, 7)

7 FORMAT (/1X, ‘Enter its number of M-trips:')
READ (*, *) MSTART

WRITE (*, 8)
FORMAT (/1X, ‘Enter number of cycles to generate (1-999):')
READ (*, *) NCYCLES

TIMELIMIT = RTIME * 60

Read in total surface (unft 1).

aoa

10 READ (1, *, END=20) IACL, ISPO, NFREQ, PCT
PFREQCIACL, ISPD) = PCT / 100

IN = INT +1
60 To 10
c
C Read in microtrip profiles (unit 2).
c
20 READ (2, END=50) I, MTRIPID(I), IREC(I), ITIMECI),
+ SPD_MEAN(I), SPO_MAX(I), SPD_STD(I), ACL_MAX(I),
+ CCMENTCT , IACL,1SP0), ISPD=0,20), TACL=-20,20)
© 30 FORMAT (15,1X,A14, 1X, 17, 1X, 15, 3¢1X, F7.2),1X, F7.3,1X, 861(14))
1N2 = IN2 +1
Go To 20

Input completed. Begin microtrip selection using Hybrid Method.

This code section performs selection of microtrips using the

"Hybrid" approach (combination of Random + Best Incremental).
The Hybrid method adds an initial "base" of microtrips to the
start "seed" of microtrips using random selection. Additional
microtrips are then added with the Best Incremental technique.

Step 1 - Generate pseudo-random seed value from current system

time.
SEED = DD x 1000000 + ss x 16667 + MM x 167 + HH x 4.17
where DD =-hundredths of seconds
SS = seconds
MM = minutes
HH = hours

Step 2 - Generate a series of randomly selected microtrips from
the population and add these to the start microtrip "seed" until
the total Linked microtrip time exceeds a user-specified subset
TIMERAN of the target time limit TIMELIMIT. Compute match of each
randomly added microtrip to the population surface. This set of
microtrips forms the “base” sample.

Step 3 - Pick the "best" single microtrip of those remaining.
"Best" is defined as the minimum integrated difference between the
overall surface and the base + incremental microtrip(s).

Step 4 - Iteratively test the remaining microtrips and add the one
which coupled with the previously selected trip(s), best matches
the overall surface. This incremental approach is repeated until
the total Linked microtrip time exceeds target time TIMELIMIT.
1/0: Unit 3 (output) - Selected microtrips and "goodness" stats.

Author

Tom Carlson

Date: 4/23/93

neNnAAAAAAAAAAAAANRAAOAAAAAAAAAAAAAAAAAAD

Top-tevet loop 500 iterates the selection process to generate
a number of random cycles (NCYCLES). Each cycle is written to a
separate output file on unit 3.

agaan

50 MTRIPS = IN2
00 500 [LOOP = 1,NCYCLES

A-79


PROGRAM PRNSURF

A quick program to generate the speed/accel surface for any "PRN"
speed vs time file. -

Author: Tom Carlson
05/25/93

INTEGER BINCNT(-20:20,0:20)
REAL BINPCT(-20:20,0:20)

OPEN (UNIT=1, STATUS=/OLD+}
OPEN (UNIT=2, CARRIAGECONTROL=/LIST’, STATUS="NEW’)

C Begin processing.

WO1sI+1
READ (1, *, END=110) ITIME, MTRP, SPD, ACL

€ Determine speed bin.
Coreeeeec erence eceneeeeeeerene eeeeeeee

IF (SPD .LT. 0.1) THEN
Is =o

GO TO 220

END IF

DO 210 ISPD = 1,20
11 = (ISPD-1) * 5
2511+5

IF (SPD .GT. 11 .AND. SPD .LE. 12) THEN
S$ = ISPO

GO TO 220

END IF

210 CONTINUE

IF (ACL .GT. 0.0) GO TO 235

DO 230 IACL = -20,-1
Al = TACL + 0.5
A2 = IACL - 0.5

IF (ACL LT. Al .AND. ACL .GE. AZ) THEN
TA = TACL

GO TO 250

END IF

230 CONTINUE

235 DO 240 IACL = 1,20
Al = IACL - 0.5
A2 = IACL + 0.5

IF (ACL .GT. Al .AND. ACL .LE. A2) THEN

TA = TACL
Go To 250
END IF

240 CONTINUE

c
250 BINCNT(IA,IS) = BINCNTCIA,IS) + 1

GO TO 100
c
c Bin counting complete. Print spd/acl counts and percentages for
c each output file (cold, hot, stabilized).
c
MONET - 1

DO 120 IACL = -20,20
A-8


DO 250 IACL = -20,20
WRITE (5, 145) IACL, (PCTDIFCIOUT,IACL,ISPD), ISPD = 0,20)
250 CONTINUE
Cc
300 CONTINUE

CLOSE (5)
END

A-89


Sample Cycle Summary File

HYBRID Trip Selection Method
Ist Seed: 83900569
Filename: €18-394.0UT

MTRP INIT
# NO MTRIP ID REC

S 513 b0729203140401 258980
S 514 bO729203140602 259173
0 6176 b1639203210102 3008050
R 3012 63379203200203 1459018
R 3741 b1309203120713 1824012
R 904 0589203161503 457935
R 2768 83659203200401 1347283
R 4624 B3819203270725 2217353
R 257 4829203260404 123706
R 6029 b2109203170201 2909578
I 792 B3299203240601 383631
1 641% 3959203310102 3116648
I

1
2
3
4
3
6
7
8
9
0
+
2
3 2108 b0379203110303 1017680

1
1
1
1

TIME
(s)

193
83
446
87
19

30.00 min
18.00 min
4.00 min

(imph/s} DIFFSUM

3.600,

5.050
8.460
3.560
0.940
8.410
7.720

"2,100

5.720
3.870
2.550
4.870
3.580

Target Time:

Base Timez

Start Time:

AVG SPD MAX SPO STD SPD MAX ACL

~ (mph) — (mph) (mph)
18.46 38.55 12.97
17.07 40.97 16.16
61.463 74.06 12.86
9.64 28.82 10.04
0.10 0.96 0.30
32.17 54.79 20.97
24.70 39.27 10.89
1.73 3.47 1.44
22.24 33.40 12.74
25.60 35.84 10.70
8.00. 28.73 10.27
26.31 46.54 19.93
22.01 41.24 | 14.21

0.75267
0.62903
0.97822
0.86261
0.83554
0.77295
0.67577
0.66582
0.64347
0.64210
0.41068
0.32079
0.28048

Total Microtrips: 13

Total Trip Time: 33.97 min
Total Base Time: 20.37 min
Mean Cycle Speed: 27.73 mph
Total Difference: 0.28048

Start Microtrips: 2

Start Trip Time:

4.60 min


TOTTIME = TOTTIME + ITIMECJ)
300 CONTINUE

00 310 IACL = -20,20
00 310 ISPD = 0,20
CFREQ(IACL, ISPD) = CFREQCIACL,ISPD) * 100 / TOTTIME
PCTDIFCIACL, ISPD) = CFREGEIACL, ISPD) - PFREQ(IACL, ISPD)
310 CONTINUE

Compute row (across spd) and column (across acl) totals.

aaa

00 320 IACL = -20,20

00 320 ISPD = 0,20

SPDSUM(1,IACL) = SPOSUM(1,IACL) + PCTDIFCIACL, ISPD)

‘SPDSUM(2,IACL) = SPDSUM(2,IACL) + ABS (PCTDIFCIACL,ISPO))
320 CONTINUE

00 325 ISPD = 0,20
DO 325 IACL = -20,20
ACLSUM(1, ISPD) = ACLSUM(1, ISPD) + PCTDIFCIACL, ISPD)
ACLSUM(2, ISPD) = ACLSUM(2, ISPD) + ABS (PCTDIFCIACL, ISPD))
TOTNET = TOTNET + PCTDIFCIACL, ISPD)
TOTABS = TOTABS + ABS (PCTDIF(IACL,1SPD))

325 CONTINUE

Output results in tabular form, echo input surfaces first.

naaaa

WRITE (4, 330) TITLE(1:LL)
330 FORMAT (///<ILEN>X,A//68X,'Speed/Accet Frequency Distribution (%)!
+ ///78X, "SPD BIN (mph)! )
WRITE (4, 340) CISPD*5, ISPD = 0,20)
340 FORMAT (166X,’ Net Abs! /
+ aad BIN (mph/s)", 4X, 14, 3X, 20¢'<',13,3X), 2¢/ — Totals’)/
weseaeeeeneneee WAR, Patent, BX, 2007-997) 3K), 20 een =e=))

DO 350 IACL = -20,20
WRITE (4, 345) IACL, (PCTDIF(IACL,ISPD), ISPD = 0,20),
(SPOSUM(I,IACL), I = 1,2)
365. FoRdar (OX; 14, 6X, 2167.3, 5X, F7.3, 2X, F7.3)
350 CONTINUE
c
(WRITE (4, 355) (ACLSUM(1, ISPD), ISPD = 0,20), TOTNET,
(ACLSUM(2, ISPD), ISPD = 0,20), TOTABS
355" FORMAT (/3X, ‘Net Totals’, 3X, 21F7.3, 5X, F7.3,. 2X/
+ 3X, ‘Abs Totals’, 3X, 21F7.3, 14x, F7.3)
STIME = TOTTIME
WRITE (4, 360) JTIME
360 FORMAT (/1X, ‘Cycle Time (sec): ’, 14)

stop

END

A-32


ane

anao

305 TRIP_TIME = 0

IDLE = 0
LTRIPID = TRIPID
NTRIP = NTRIP + 1

DO 310 IACL = -20,20

DO 310 ISPO = 0,20

FREQ(IACL, ISPD) = 0.0
310 CONTINUE

FREQ(IA,IS) = FREQ(IA,IS) + 1
TRIP_TIME = TRIP_TIME + 1
GO TO 200

Process “hanging trip", print best trip and end,

500 DIFFSUM = 0.0
do 580 IACL
DO 580 ISPD = 0,
FREQCIACL, ISPD) = FREQCIACL, ISPD) / TRIP_TINE
DIFFSUM = DIFFSUM + ABS (FREQ(IACL, ISPD) - TFREQ(IACL, ISPD))
580 CONTINUE

TRIP_TIME = TRIP_TIME + NOM_TIME - 1

Output results to unit 3.

WRITE (3, 300) NTRIP, TRIPID, OIFFSUM, TRIP_TIME, IDLE_TIME
Check for best fitting start trip. Reset when better trip found.

IF (DIFFSUM .LT. DIFFMIN) THEN
DIFFMIN = DIFFSUM

NMIN = NTRIP
NTIME = TRIP_TIME
END IF

WRITE (3, 590) NMIN, DIFFMIN, NTIME
590 FORMAT (/I5, 4X, ‘Best Trip’, 6X, F9.6, 10X, 14)

WRITE (*, 600) IN1, IN2

600 FORMAT (// Processing completed for ‘, I7, ' target surface ',
+ ‘records! /
+ ' +, 17, ' driving records’/)

END

A-86


If (MTIME .LT. 2 .OR. SPD_MAX .LE. 0.5) THEN
MTRIP = MTRIP - 1

GO TO 122

END IF
c

‘SPO_MEAN = SPD_SUM / MTIME

SPD_STD = SQRT ((SPD_SUM2 - MTIME * SPD_MEAN**2) / (MTIME - 1))
c

WRITE (2, 120) MTRIP, MTRIPID, IREC, MTIME, SPD_MEAN, SPD_MAX,
+ SPD_STD, ACL_MAX, ((FREQ(IA,IS), 1S=0,20), IA=~20,20)

120 FORMAT (15, 1X,A14, 1X,17, 115, 3C1X, F7.2), 1X, F7.3, 1X, 861(14))
NGOOD = NGOOD'+ MTIME

c
c The stats for “last" m-trip have been output. Re-initialize
c sums and counters for current m-trip.
c
122 SPD_SUM
SPD_SUM2
SPD_MAX =
ACL_MAX = 0.
MTIME = 0
DO 125 1A
00 125 Is
FREQ(IA,IS) = 0
125 CONTINUE
c
130 MTRIP = MTRIP + 1
NTRIP = NTRIP + 1
IREC = NREC
L = INDEX (TRIPID, ! *) > 1
IF (L .LE. 0) L = 12
WRITE (CTRIP, FMT=/(12.2)4) NTRIP
MIRIPID = TRIPID(1:L) // CTRIP
Go To 150
END IF
c sacss=s: 3 =

LCRUS = CRUS
150 LTRIPID = TRIPID

C Increment statistical sums and counters for each microtrip.
IF (SPD .GT. SPD_MAX) SPD_MAX = SPD
IF (ACL .GT. ACL_MAX) ACL_MAX = ACL
SPD_SUM = SPD_SUM + SPD
SPD_SUM2 = SPD_SUM2 + SPD**2
MTINE = MTIME + 1
€ —-++ Increment speed/accel bin ---

FREQ(IACL, ISPD) = FREQCIACL,ISPD) + 1
© Loop back and process the next record.

GO TO 100

Write "hanging" m-trip record, (og summary results and end.

c
c
c If a "trailing idle" microtrip is detected at the end of a route,
c remove it (re-zero sums and decrement microtrip counter MTRIP).
c .
200 IF (NREC .GT. 1 .AND. SPD_MAX .LE. 0.5 .AND. NTRIP .GT. 1) THEN
MTRIP = MTRIP - 1
GO To 300
END IF

SPD_MEAN = SPD_SUM / MTIME
SPD_STD = SORT ((SPD_SUM2 - MTIME * SPD_MEAN**2) / (MTIME - 1))
ACL_STD = SQRT (ACL_SUM2 / (MTIME - 1))

WRITE (2, 120) MTRIP, MTRIPID, IREC, MTIME, SPD_MEAN, SPO_MAX,
+  SPD_STD, ACL_MAX, ((FREQCIA,IS), IS=0,20), IA=-20,20)
NGOOD = NGOOD + MTIME

300 WRITE (*, 400) NREC, NGOOD, MTRIP, ITRP

400 FORMAT (/1X, ‘Processing Summary’ /
+ 1 1

+

A-50


Get second by second trace from input PRN cycle file Cunit 1).

200 READ (1, *, END=300) ITIME, NTRP, SPD, ACL
NSN4T

Determine speed bin.

IF (SPO .LT. 0.1) THEN —-

DO 210 IsPO = 1,20
11 = (1SPD-1) * 5
245

IF (SPD .GT. 11 .AND. SPD .LE. 12) THEN
Is = ISPD

GO TO 220

END IF

210 CONTINUE

IF (ACL .GT. 0.0) GO TO 235

DO 230 IACL = -20,-1
Al = IACL + 0.5
AZ = IACL - 0.5

TF (ACL .LT. A1 WAND. ACL .GE. A2) THEN
TA = TACL

GO TO 250 _

END IF

230 CONTINUE
235 00 240 IACL =

= IACL - 0.
A2 = IACL + 0.5

IF (ACL .GT. Al .AND. ACL .LE, A2) THEN
= TACL

GO TO 250

END IF

240 CONTINUE
250 CFREQ(IA,IS) = CFREQCIA,IS) + 1

GO To 200

Total bin count reads finished. Compute cycle surface frequencies
and "difference" surface frequencies and output.

300 DO 310 IAC = -20,20
Do 310 ISPD = 0,20
CFREQCIACL, ISPD) = CFREQCIACL,1SPD) * 100 / N
PCTOIF(IACL, ISPD) = CFREQ(IACL, ISPD) - PFREQCIACL, ISPD)
340 CONTINUE

c
c Compute row (across spd) and column (across acl) totals.
c

DO 320 IACL = -20,20

do 320 IsPD = 0, 20

SPDSUM(1, ACL) = SPDSUM(1,IACL) + PCTDIFCIACL, ISPD)

A-2


oe

aene90

eae

anae

ana

TRIPLIST(NTRP) = M

TRIPTIME = TRIPTIME + ITIME(M)

dO 125 II = 1,

TRIPOIFFCNTRP, 11) = DIFFCIT)
125 CONTINUE

Print statistics for current M-trip.

WRITE (3, 170) NTRP, M, MTRIPID(M), IREC(M), ITIME(M),SPD_MEAN(M),
+ ‘SPO. _MAXCH), SPO_STD(M), ACL_MAX(M),
+ Pee ia TE), If = 1,4)
170 FORMAT (13, 4", 1X, 45, 1X, A146, 1X, 17, 1X, 16,
+ scx. “tr. 2), 1x, F7.3, 40x, Fg. 5))

Terminate main “trip adding" loop when the desired cycle time
TIMELIMIT is reached.

IF C(TRIPTIME .GT. TIMELIMIT) GO TO 400

Big loop 301 adds "next best" nicrotrips till the total time
exceeds TIMELIMIT.

301 NTRP = NTRP + 1

Loop thru all microtrips in search of best incremental trip.
DO 350 I = 1, HTRIPS
Skip microtrips which have already been selected.

00 310 J = 1,NTRP-1
IF (1 .£Q. TRIPLIST(J)) GO TO 350

310 CONTINUE

Add acl/spd bin counts for current microtrip to "current" count
array CCNT and express as frequency. Compute integrated
difference between the population surface and the best
incremental surface CFREQ. (Use abs value of the difference.)

00 315 11 =
DIFF(II) =

315 CONTINUE

DO 320 IACL = -20,20
DO 320 ISPD = 0,20
CCNTCIACL, ISPD) = TCNTCIACL,ISPO) + MCNTCI,IACL, ISPD)
CFREQC(IACL,ISPD) = CCNT(IACL,ISPD) / (TRIPTIME + ITIME(I))
DIFF(1) = DIFFC1) + ABS (CFREQ(IACL, ISPD) - PFREQ(IACL, 1SPD))
IF CIACL .EQ. 0) THEN
DIFF(2) = DIFF(2) + ABS (CFREQ(IACL, ISPD) - PFREQCIACL,1SPD))
ELSE IF C(IACL .GT. 0) THEN
DIFF(3) = DIFF(3) + ABS (CFREQ(IACL, ISPD) - PFREQ(IACL, ISPO))
ELSE IF CIACL «LT. 0) THEN
DIFF(4) = DIFF(4) + ABS (CFREQ(IACL, ISPD) - PFREQCIACL,1SPD))
END IF

320 CONTINUE

Test integrated difference DIFF of current incremental M-trip.
If smaller than "best" of earlier incremental N-trips, then
"mark" (M=1) and replace as new best difference.

IF (DIFE(1) «LT. DIFFMINC1)) THEN
00 330 IT = 1,4
DIFFMINCIT) = DIFF(II)
330 CONTINUE
Mel
END IF

350 CONTINUE

TRIPLISTCNTRP) = M

TRIPTIME = TRIPTIME + ITIME(M)

Do 355 11 = 1,4

TRIPDIFFCNTRP, IT) = DIFFMINCII)
355 CONTINUE

DO 360 IACL = -20,20

00 360 ISPD = 0,20 .
TCNTCIACL, ISPD) = TCNTCIACL,ISPD) + MCNT(M,IACL,ISPD)

A-68


As shown, these target SAFD files representing composite (i.e., all
driving) and stabilized travel populations are then input to GETSTAB.
GETSTAB then generates a series (up to 1,000 per run) of candidate
driving cycles and computes DIFFSUMs between each cycle and the target
population SAFD. The microtrip IDs and DIFFSUMs for each cycle are
output into small "Cycle Summary Files". These files are then scanned
by the FINDBEST program, which ranks those cycles with the lowest
DIFFSUMS and reports them in the "Ranked Cycles by DIFFSUM" File.

Once the most representative cycles have been found, their ID names are
then fed to the GETCYCLE program which inputs the Master (or Subset)
Microtrips File and retrieves the speed/time trace for each input cycle
and stores them in files referred to as "PRN" files. In turn, the
MAKE CYCLE program converts these PRN files into VEHSIM-ready Driving
Schedule Files.

3.4 Bag 4/Remainder Cycle Selection Phase

A number of the elements used to generate the "Bag 4" and "Remainder"
cycles are similar to those used in Composite Cycle development. The
Bag 4 cycle is generated first.

As illustrated in Figure 4, Bag 4 cycle development begins with the
GETOUT75 program. GETOUT75 is a modified version of the GETSTAB program
discussed earlier. GETOUT75 individually compares each microtrip in the
input Microtrips File to a target speed/accel "Outside FTP" (i.e.,
travel beyond the bounds of the FTP) distribution. The 75 microtrips
with the lowest DIFFSUMS are written to the "Best Outside LA4 Microtrips
File". From this list, a single microtrip is selected and input to the
GETOUTSEED program. GETOUTSEED performs identically to GETOUT75 program
except the input microtrip is used as an initial "seed" microtrip and
additional microtrips are incrementally added which, when added, yield
the lowest DIFFSUM. These microtrips form the initial "Bag 4" cycle.

As shown, GETCYCLE is then run on this collection of microtrips to
generate speed/time "Cycle Trace PRN File". Manual editing of
individual portions of this trace produced the final "Bag 4" cycle.

Remainder cycle development then began by converting the Bag 4 driving
trace into a SAFD file with the PRNSURF program, as shown. WTDSURF then
subtracts the Bag 4 SAFD file (with a weighting factor applied) from the
Stabilized SAFD file to produce the Remainder Target SAFD File. The
GETRMNDS program (a modified version of GETSTAB) then generates a series
of candidate remainder cycles and computes DIFFSUMS based on the
Remainder target speed/accel distribution.

Finally, as in the Composite Cycle Selection Phase, the FINDBEST and
GETCYCLE programs are then executed to identify the best cycles and
generate speed/time traces for them.

HH

~9-


PROGRAM MODSPLIT_8ALT

A quick program to split the Baltimore file (EPABALT.DAT) into
two separate "mode" files: (1) start and (2) stabilized. Target
start (first START_TIME secs) and stabilized start surfaces are
also generated.

eaneaa

CHARACTER*12 TRIPID, LTRIPID
INTEGER START_TIME, NMODE(2), CRUS, BINCNT(2,0:20,-20:20), NST(2)
REAL BINPCT(2,0:20,-20:20)

DATA START_TIME /240/ ~

OPEN (UNIT=1, STATUS=‘OLD/)

OPEN (UNIT=2, CARRIAGECONTROL=’LIST’, STATUS=/NEW!)
OPEN (UNIT=3, CARRIAGECONTROL=’LIST’, STATUS='NEW!)
OPEN (UNIT=4, CARRIAGECONTROL=/LIST’, STATUS=/NEW!)
OPEN (UNIT=5, CARRIAGECONTROL=/LIST’, STATUS='NEW’ )

Begin processing.

ean

100 READ (1, 101, END=300) TRIPID, ITIME, SPD, ACL
101 FORMAT (A12, 16, 2F6.2)
T=st+1

Check if this record is the beginning of a trip.

ena

IF CITIME .£Q. 0) THEN
IWAIT = 0

IMODE = 1

END IF

Detect when microtrip has ended (MFLAG = 1).

ae

MFLAG =.0

IF (SPD .GT. 0.0) THEN
cRUS = 1

IFLAG = 1

ELSE

CRUS = 0

END IF

IF (CRUS .EQ. 0 .AND. LCRUS .£Q. 0 .AND. IFLAG .£0. 1) IFLAG = 1

IF (TRIPID .NE. LTRIPID .OR. CRUS .£Q. 0 .AND. LCRUS .EQ. 0 .AND.
+ IFLAG .€Q. 1) THEN

IFLAG =
MFLAG = 1
GO TO 105
END 1F

LCRUS
105 LTRIPID = TRIPID

Determine emission mode (start/stabilized) as follows: Is this a
start or stabilized record? (IMODE: 1 - Start, 2 - Stabilized).

anno

IF CITIME .EQ. START_TIME) IWAIT = 1

Just beyond START_TIME, continue marking the records as starts
until the end of the current microtrip is reached (MFLAG = 1).

nano

IF (IWAIT EQ. 1) THEN
IMODE = 1
IF (MFLAG .EQ. 1) THEN
IWAIT = 0
IMODE = 2
END IF
END IF

A-51


PROGRAM OUTFTP.

c
c A quick program to generate a “outside of FIP" spd/acl surface
c from the "Composite" and “LA4" input spd/acl surface files.
c The new surface contains only travel beyond the boundaries of the
c FTP (in spd/act space) and is re-normalized.
c
c ALL input and output surfaces are in “conma-delimited" format.
c
c Summary of speed & accel bin definitions:
c
C Speed (mph): 0, 0 - <o5, 5 - <=10, ete.
c Accel (mph/s): -0.5 to 0.5 mph/s = 0
c =1,5>= to -0.5 +2.5>= to -1.5 = -2, ete.
c 0.5 to <= 1.5 = 1, 1.5 to <=2.5 = 2, etc.
c
c Author: Tom Carlson
c Date: 05/10/93.
c
Cc
c
INTEGER IANEG(O:20), IAPOS(0:20)
REAL PCTBIN(3,-20:20,0:20), SPDSUM(-20:20), ACLSUM(0:20),
+ BINCNT(3,-20:20,0:20), TOTCNT(3)
c
OPEN (UNIT=1, FILE=/CFROT.DAT’, STATUS=/OLD‘)
OPEN (UNIT=2, FILE=/LAGFRQ.DAT’, STAT!
OPEN CUNIT=3, FILE=/OUTFRQ.DAT’, STAT
+ CARRIAGECONTROL=/LIST’)
OPEN CUNIT=4, FILE=/OUTFRQ.TBL’, CARRIAGECONTROL='LIST’,
+ STATUS=‘NEW’, RECL=175, RECORDTYPE=/ VARIABLE’)
c
Cc
c
c
c
c Read "Composite In-Use" surface file (unit 1).
c

100 READ (1, *, END=110) IACL, ISPD, BINCNT(1, ACL, 1SPD),
+ PCTBIN(1, IACL,ISPD)
TOTCNT(1) = TOTCNT(4) + BINCNT(1, ACL, ISPD)

GO To 100

c

c Read "LAG" surface file (unit 2).

c

110 READ (2, *, END=120) IACL, ISPD, BINCNT(2,1ACL, ISPD),

+ PCTBIN(2, [ACL, ISPD)
TOTCNT(2) = TOTCNT(2) + BINCNT(2, IACL,1SPO)
GO To 110

© Loop across speed bins -- from big to small speed bins.

120 DO 150 ISPD = 20,0,-1

c

c Check decel region -- scan from big ta small negative bins.
c

DO 130 IACL = -20,-1
IF (BINCNT(2,IACL,ISPD) .GT. 0.0) THEN
TANEGCISPD) = IACL
GO To 135
END IF
130 CONTINUE

13:

a

bo 140 ACL = 20,0,-1

TF (BINCNT(2,1ACL, ISPD) .GT. 0.0) THEN
TAPOS(ISPD) = IACL

Go To 145

END IF

140 CONTINUE

145 IF (IS .£Q. 0 .AND. (IANEGCISPD) .NE. 0 .OR. IAPOSCISPD) .NE. 0))
+ Is = ISPD

150 CONTINUE

A-57


Figure 1
Data Preparation Phase

VEHS
On-Road Driving
‘SAS Dataset

Baltimore Los Angeles
‘Speed ve. Time File Speed va. Time File
ASCII Data File ASCII Data File

o °

[run Status
©} So. Start
Stabilized SAFD File, SAFD File Baltimore Stablized — file i. er abiteed Sa = File
(Trip > 4 min) (Trip <= 4 min) Trace File Stace File (Trip >3 min)
! Bata \ @
Composite
1 Trace File
oe Master
Microtripe File
{ (ASCII File)

e

Run Status

(mn ‘Status

Prompted Inputs <3 @
+ Subset Fraction ET
- Start Microtripe ia Run Statue
+ # of Microtrips
e
‘Subset
Microtripe File
(Unformatted)
To Cycle Selection Phases

-5-


NOM_TIME = NOM_TIME + 1

IF (SPD .GT. 0.0) THEN
crus = 1
FLAG
ELSE
cRUs = 0
END IF

IF (CRUS .EQ. 0 .AND. LCRUS .EQ. 0 .AND. IFLAG .EQ. 1) IFLAG = 1

IF (TRIPID .NE. LTRIPID .OR. CRUS .EQ. O .AND. LCRUS .£Q. 0 .AND.
+ TFLAG .EQ. 1) THEN

TFLAG = 0

MFLAG = 1

GO TO 220

END IF

LCRUS = CRUS
LTRIPID = TRIPID

END IF

aan0

aanaaeno

25

4)

280

anaaena

300

ao

Increment sum & counter for current trip, scan for “nominal”
termining microtrip and process next record.

IF (TRIP_TINE .LE. START_TIME) THEN
FREQ(IA,TS) = FREQ(IA,IS) + 1
TRIP_TIME = TRIP_TIME + 1

END TF

Detect time at which vehicle motion begins. Trips will be
tater rejected from consideration if initial idle < 15 sec.

TF (IDLE .EQ. 0 .AND. SPD .GT. 0.0) THEN
IDLE = 1

IDLE_TIME = ISEC - 1

END TF

GO TO 200

Compute Trip Fit. ===

Input currently positioned at beginning of a trip. Compute the
spd/acl frequency distribution for "last" trip and determine its
“goodness-of-fit value DIFFSUM.

IF (IN2 .£Q. 1) GO TO 305

DIFFSUM = 0.0

DO 280 IACL = -20,20

Do 280 ISPD = 0,20

FREQ(IACL, ISPD) = FREQCIACL,ISPO) / TRIP_TIME

DIFFSUM = DIFFSUM + ABS (FREQ(IACL,ISPD) - TFREQCIACL,ISPD))
CONTINUE

TRIP_TIME = TRIP_TIME + HOM_TIME - 1
Output results to unit 3.

Modification (4/23/93 TRC) - Give up on trips whose initial idle
time is less than 15 seconds or whose "nominal" start time
exceeds MOST_TINE.

TF C(IDLE_TIME.LT.MIN_IDLE .OR. TRIP_TIME.GT.MOST_TIME) GO TO 305

WRITE (3, 300) NTRIP, LTRIPID, DIFFSUM, TRIP_TIME, IDLE_TIME
FORMAT (15, 4X, A12, 3X, F9.6, 10X, 14, 17x, 14)

Check for best fitting start trip. Reset when better trip found.

IF (DIFFSUM .LT. OIFFMIN) THEN
DIFFMIN = DIFFSUM

NMIN = NTRIP-

NTIME = TRIP_TIME

END LF

Reset sum and counter for "next" (current) trip and loop back to
increment them w/ current values.

A-85


DO 210 IsPD = 1,20
11 = (ISPD-1) * 5
1251145

IF (SPD .GT. 11 .AND. SPD .LE. 12) THEN
Is = ISPD

GO TO 220

ENO IF

210 CONTINUE

c Determine acceleration bin.

Cre ee eee nee, eeeeeseceeee
c
220 IF (ACL .GE. -0.5 .AND. ACL .LE. 0.5) THEN

IF (ACL .GT. 0.0) GO TO 235

DO 230 IACL = -20,-1
Al = IACL + 0.5
A2 = IACL - 0.5

TF (ACL «LT. A1 .AND. ACL .GE. A2) THEN
TA = TACL

GO TO 250

END IF

23

r

CONTINUE

235 00 240 IACL = 1,
Al = IACL - 0.5
A2 = IACL + 0.5

20

IF (ACL .GT. Al .AND. ACL .LE. A2) THEN
TA = TACL

GO TO 250

END IF

240 CONTINUE

250 IF CITIME .LE. START_TIME) THEN
BINCNT(1,1S,IA) = BINCNT(1,IS,IA) + 1
NST(1) = NST(1) + 1
ELSE
BINCNT(2,1S,IA) = BINCNT(2,IS,IA) + 1
NST(2) = NST(2) + 1
END IF

NMODECIMODE) = NMODE(IMODE) + 1

IF CIMODE .EQ. 2) WRITE (3, 270) TRIPID, ITIME, SPD, ACL, IS, IA
FORMAT (A12, 16, 2F6.2, 213) .

GO TO 100

a7

3

Bin counting complete. Print spd/acl counts and percentages for
each output file (cold, hot, stabilized).

eaae

30

8

Do 320 Ist = 1,2

lout = IsT +3

DO 320 IACL = -20,20

DO 320 ISPD = 0,20

BINPCT(IST, ISPD, IACL) = BINCNT(IST,ISPD,IACL) * 100. /
+ NSTCIST) :

WRITE (IOUT, 315) IACL, ISPD, BINCNTCIST, ISPD, IACL),
+ BINPCTCIST, ISPD, IACL)
315 FORMAT (2(13,/,/), 18, ',", F10.6)
320 CONTINUE

c
CLOSE (1)
c CLOSE (2)
CLOSE (3)
c CLOSE (4)
CLOSE (5)

WRITE (*, 400) (NMODE(J), NST(J), J = 1,2), 1
400 FORMAT (/' Records Processed:'//

A-55


120 CONTINUE
c
NTRP = NTRP + 1
TRIPLIST(NTRP) = M
TRIPOIFF(NTRP) = OLFF
TRIPTIME = TRIPTIME + ITIME(M)

c Print statistics for current M-trip.

WRITE (3, 140) NTRP, M, MTRIPIDCM), IREC(M), IT{ME(M),SPD_MEAN(M),

+ SPD_MAX(M), SPO_STO(M), ACL_MAX(M), TRIPOLFF(NTRP)
140 FORMAT (13, 1X, 'S’, 1X, TS, 1X, Alb, 1X, 17, 1X, 14,
+ 3X, F7.2), 1X, €7.3, 1X, F9.5)

c
150 CONTINUE

STIME = TRIPTIME / 60
NST = NTRP
IF CTRIPTIME .GE. TIMERAN) GO TO 300

Big loop 200 adds randomly selected microtrips till the total time

200 NTRP = NTRP + 1

c Randomly select a microtrip in the range 1 to MTRIPS.

20!

a

XRAN = RAN (ISEEO)

TF CXRAN WLT. 1.0) THEN

M = INT (MTRIPS * XRAN) + 1
ELSE

M = MTRIPS

END IF

Once a H-trip is selected, it’s not allowed to be picked again.

aoe

DO 210 11 = 1, NTRP
IF CTRIPLIST(II) .EQ, 4) GO TO 205
210 CONTINUE

Add acl/spd bin counts for current microtrip to "current count
array CCNT and express as frequency. Compute integrated
difference between the population surface PFRE@ and the best
incremental surface CFREQ. (Use abs value of the difference.)

aanaca

DIFF = 0.0
DO 220 IACL = -20,20
DO 220 IsPO = 0,20
CCNTCIACL,ISPD) = TCNT(IACL, ISPD) + MCNT(M,IACL,ISPD)
CFREQCIACL, ISPD) = CCNTCIACL, ISPD) / CTRIPTIME + ITIME(N))
DIFF = DIFF + ABS (CFREQCIACL, ISPD) - PFREQC(IACL, 1SPO))
TCNTCIACL {SPO} = TCNT(IACL, ISPD) + MCNT(M, IACL, ISPD)

220 CONTINUE

TRIPLIST(NTRP) = M
TRIPTIME = TRIPTIME + [TIME(M)
TRIPOIFFCNTRP) = DIFF

c Print statistics for current M-trip.
WRITE (3, 270) NTRP, M, MTRIPID(M), IREC(M), ITIME(M),SPO_MEAN(M),
+ SPD_MAX(M), SPD_STD(M), ACL_MAX(M), TRIPDIFFCNTRP)
270 FORMAT (13, 1X, ‘R’, 1X, 15, 1X, A14, 1X, 17, 1X, 14,
+ 31x, F7.2), 1X, F7.3, 1X, F9.5)

c Terminate main “trip adding" loop when the desired cycle time
c TIMELIMIT is reached,

IF (TRIPTIME .GE. TIMERAN) GO TO 300

c Loop back and find another M-trip.

GO TO 200
c
c .
€ “Base” of random M-trips complete. Add subsequent N-trips using
c Best Incremental logic.

A-81


PROGRAM GETOUTSEED

GETOUT reads the "microtrips profiles” files and the target spd/
acl "Beyond FIP" surface file for the Baltimore & LA92 data

and selects a subset of linked microtrips which best match the
target speed/accel surface using the Best Incremental.

aaanaad

GETOUT is a modified version of the GETSTAB program.

The sample from which these additional microtrips are
selected consists of all Baltimore and LA92 microtrips, with
weighting factors which

(1) allow 50/50 selection probability of stabilized m-trips
between Baltimore and LA92; and

(2) maintain initial weighting of start/stabilized m-trips
encountered in the Baltimore dataset.

NOTE:
This version does not use m-trips weightings discussed above, only
the embedded weightings in the input target surface.

1/0: Unit 1 Cinput) - Spd/acl target "surface" for sec-by-sec
drive cycle data (Balt/LA92).
Unit 2 (input) - Microtrip profile statistics.
Unit 3 (output) - Selected microtrips and "goodness" stats.

Author: Tom Carlson
Date: 5/11/93

gaaaaAAAAAAAAAAAAAAAAA

PARAMETER (MNUM=7283, NN=50)

CHARACTER*3 CLOOP
CHARACTER*14 MTRIPID(MNUM)
CHARACTER*80 OUTFILE, OUTNAME

INTEGER*2 MCNT(MNUM, -20:20,0:20), ITIME(MNUM), M, MO, I
INTEGER*4 IREC(MNUM), TRIPLIST(NN)

REAL SPD_MEAN(MNUM), SPD_STD(MNUM), ACL_MAX(MNUM), DIFFMIN(4),
+ SPO_MAX(MNUM), CFREQ(-20:20,0:20), TRIPOIFF(NN,4), DIFF(4),
+ CCNT(~20:20,0:20), PFREQ(-20:20,0:20), TCNT(-20:20,0:20)

DATA NCYCLES / 1 /
DATA DIFFMIN / 4*999, /

C Prompt user for output filename and cycle control parameters.

WRITE (*, 2)

FORMAT (/1X, ‘Enter output (selected trips & stats) filename:’)
READ (*, 3) OUTFILE

FORMAT (A)

WRITE (*, 4)

FORMAT (/1X, ‘Enter target cycle time (min):‘)

READ (*, *) RTIME

WRITE (*, 5)

row oN

5 FORMAT (/1X, ‘Enter "seed" m-trip number:')
READ (*, *) NSEED
c
TIMELIMIT = RTIME * 60
c
c Read jn target surface (unit 1).
c

10 READ (1, *, END=20) IACL, ISPD, NFREQ, PCT
PFREQCIACL, ISPD) = PCT / 100
INT = INT +1
Go To 10

eno

Read in microtrip profiles (unit 2).
A-66


CLOSE (3)

WRITE (*, 230) CREC, (WFACCI), I = 1,2)

230 FORMAT (/! Processing completed:
+ ,
+ ,

END

Crec
Wfact
Wfac2

1, F8.0//
1, 65.1
", FSM)

A-34


PROGRAM SHOWDIFF

A quick program to generate tabular "Watson plots" from
input spd/acl surface files in "comma-delimited" format.

Summary of speed & accel bin definitions:

Speed (mph): 0, 0 - <=5, 5 - <=10, etc.

Accel(mph/s):  -0.5 to 0.5 mph/s = 0
-1.5>= to -0.5 = -1, -2.5>= to -1.5 = -2, etc.
0.5 to <2 1.5 = 1, 1.5 to <=2.5 = 2, etc.

1/0: Unit 1 (input) - GETSTAB output table of microtrips for a
selected cycle.
Unit 2 (input) - MICTRIPS profile statistics output file.
Unit 3 (input) - Speed/accel target surface created from
sec-by-sec drive cycle data.
Unit 4 (output) - Tabular "Watson Plot" of the spd/acl fit
between selected cycle & target surface.

Author: Tom Carlson
Dati 05/13/93

QaaNManAAAAMAAAAAAAAAAADA

CHARACTER = MTYPE(50)
CHARACTER*14 MTRIPID(50), ITRIPID
CHARACTER*80 INFILE, MTRIPFILE, TARGFILE, TITLE, OUTFILE

INTEGER*2 MTRIPS(50), ITIME(SO), MCNT(-20:20,0:20), JTIME, M
INTEGER*4 IREC(5O), IPNT(50), JREC, ITRIP(5O)

REAL CFREQ(-20:20,0:20), MAXSPO, ACLSUM(2,0:20) , PFREQ(-20:20,0:20),
+ SPDSUM(2,-20:20), SPD_MEAN, SPD_MAX, SPD_STD, ACL_MAX,
+ © PCTDIF(-20:20,0:20)

DATA IHDR / 7 /

Begin execution.

Prompt user for input and output filenames.

WRITE (*, 10)
10 FORMAT (/1X, ‘Enter input M-Trips summary filename:!)
READ (*, 20) INFILE
WRITE (*, 15)
15 FORMAT (/1X, ‘Enter unformatted M-Trips Profile filename:’)
READ (*, 20) MTRIPFILE
20 FORMAT (A)
WRITE (*, 30)
30 FORMAT (/1X, ‘Enter target surface filename:’)
READ (*, 20) TARGFILE

c Name OUTFILE and TITLE based on INFILE and TARGFILE.

L1 = INDEX CINFILE, 41’) + 1

L2 = INDEX CINFILE(L1:80), /./) + L1 - 2

OUTFILE = INFILECL1:L2) // ’.DIF!

K = INDEX (TARGFILE, ‘./) - 1

TITLE = ‘Difference Between Cycle ' // INFILE(L1:L2) //
+ ‘ And Target Surface ' // TARGFILE(1:K)

LL = INDEX (TITLE, ‘ 4) - 1

ILEN = 87 - LL/2

c
€ Open all files.
c
OPEN (UNIT=1, FILE=INFILE, STATUS=’OLD‘)

OPEN ‘1 FILESMTRIPFILE, STATUS=‘OLD’, FORM=/UNFORMATTED’,
+ RECL=1760)

OPEN CUNIT=3, FILE=TARGFILE, STATUS="0LD’)
OPEN (UNIT=4, FILE=OUTFILE, STATUS=‘NEW’, RECL=186,
+ CARRIAGECONTROL=/LIST‘)



GETSTAB (FORTRAN, Composite Cycle Selection)

The program GETREST reads a Master or Subset Microtrips File and the
target speed/acceleration composite SAFD file and builds and outputs a
series (up to 1000 per run) candidate composite driving cycle using the
"Hybrid" microtrip selection method.

The Hybrid method adds an initial "base" of microtrips to the start
"seed" of microtrips using random selection. Additional microtrips are
then added with the Best Incremental technique.

The program algorithm is outlined below.
Step 1 — Generate pseudo-random seed value from current system time.

Step 2 — Generate a series of randomly selected microtrips from the
population and add these to the start microtrip "seed" until the total
linked microtrip time exceeds a user-specified subset TIMERAN of the
target time limit TIMELIMIT. Compute match of each randomly added
microtrip to the population surface. This set of microtrips forms the
“base" sample.

Step 3 ~ Pick the "best" single microtrip of those remaining. "Best" is
defined as the minimum summed difference between the overall surface and
the base + incremental microtrips (i.e., DIFFSUM).

Step 4 - Iteratively test the remaining microtrips and add the one
which coupled with the previously selected trip(s), best matches the
overall surface. This incremental approach is repeated until the total
linked microtrip time exceeds target time TIMELIMIT.

External Files

LUN 1/02 File Description

1 Input Balt/LA Composite "All Driving" SAFD File

2 Input Master or Subset Microtrips File

3 Output Composite Cycle Summary Files (one per candidate
cycle)

Prompted Input

- Output cycle series name

- Target cycle total time (TIMELIMIT) .

- Target cycle "base" (random m-trip selection): time (TIMERAN)
- Start microtrip IDs

- Number of candidate cycles to generate (up to 1,000)

GETSTART (FORTRAN, Start Cycle Selection)
GETSTART is another revised version of GETSTAB. This program reads the

target "Start" SAFD file (the speed/accel distribution compiled from the
first 4 minutes of each driving trip) and then compares the speed/accel

-18-


anana

a0

aa00

80 M

100

10
20

LHOLE = .TRUE.

Decrement "move" variable M and re-test for element to move.

Element to move is the first non-zero element found by backward

searching C after a hole has been detected (LHOLE true).

zMet
Go To 50

Return condition.

RETURN
END

SUBROUTINE KFILL (K, N, C, KOMBOS, NUMBER)

A companion routine called by COMBOS to fill the “current
numbers indexed in array C into the selection array KOMBOS.

PARAMETER (MM = 25)

INTEGER K, N, NUMBER, C, KOMBOS
DIMENSION C(*), KOMBOS(MM,*)

J=0
NUMBER = NUMBER + 1

dO 101 = 1,N

TF (C(I) .£Q. 1) THEN
Jesed
KOMBOS(J,NUMBER) = I
IF (J .EQ. K) GO TO 20

“END IF

CONTINUE

RETURN -
END

A-21


aaaanane aaa

aancaa

aea

one

aa0

do 80.L = 1,4

0 701 = 1,k ;
IF (L .EQ. KOMBOS(I,J)) GO TO 80
70 CONTINUE

IF statement always false -- we/ve found a leftover m-trip.

ITRP =

TIMEL = TIMEL + ITIMECITRP)

DO 75 IACL = -20,20

00 75 ISPD = 0,20

BGLCIACL, ISPD) = BGL(IACL, ISPD) + MCNTCITRP, IACL, ISPD)
75 CONTINUE

80 CONTINUE

All leftovers detected and processed. Now, compute the new
target Long Bag 4 surface from FTP-matched m-trips:

Long Bag4 Target Surface = "All Driving" - "FTP" Bag 4
where "FTP" Bag 4 = PCC - Short Bag 4
DO 95 1ACL = -20,20
Do 95 ISPD = 0,20
B4FCIACL, ISPD) = B4FCIACL, ISPD) / TIMEF
BGT(IACL, ISPD) = TFREQ(IACL, ISPD) - B4F(IACL, ISPD)
95 CONTINUE
All stats for this m-trip combo (and its leftovers) complete.
Now check current DIFFS against "top-NBST" array. If current
DIFFS is smaller than any element in the DIFFBST array, push it
in and shift the subsequent elements, moving the last one out.
Do 120 1 = 1,NBST

IF (DIFFS .LT. DIFFBST(I1)) THEN
MOVE = 1

OK, smaller DIFFS found -- do the element shift first.
DO 100 L = NBST,MOVE+1,-1

TIMEBST(L) = TIMEBST(L-1)
DIFFBST(L) = DIFFBST(L-1)
DO 98 LIST = 1,MM
LISTBST(L,LIST) = LISTBST(L-1,LIST)
98 CONTINUE
DO 100 ACL
DO 100 ISPD
B4FBST(IACL,ISPD,L) = B4FBSTCIACL,ISPD,L-1)

B4TBSTCIACL, ISPD,L)
100 CONTINUE

B4TBSTCIACL,ISPD,L-1)

‘And now the "push".

TIMEBST(MOVE) = TIMEF / 60

DIFFBST(MOVE) = DIFFS

LISTBST(MOVE,1) = 1

LISTBST(MOVE,2) = 2

DO 102 LIST = 1,K

LISTBSTCMOVE ,LIST+NS) = KOMBOS(LIST,J) + NS
102 CONTINUE

DO 110 ACL = -20,20

D0 110 ISPD = 0,20

B4FBST(IACL, ISPD ,MOVE) = B4F(IACL,ISPD)

BGTBST(IACL, ISPD ,MOVE) = B4T(IACL,ISPD)
110 CONTINUE

GO TO 200
END IF
120 CONTINUE
Go back on J loop and try next combination.

200 CONTINUE A-25


aanea

°

ano

a00

nace

aa00

100
101

PROGRAM MODSPLIT_LA92

A quick program to filter the LA92 file (EPALA92.DAT), selecting
only stabilized operation. (Stablized = Start Time - 1 minute).
The target stabilized surface is also computed.

CHARACTER*12 TRIPID, LTRIPID
INTEGER START_TIME, NMODE(2), CRUS, BINCNT(2,0:20,-20:20), NST(2)
REAL BINPCT(2,0:20, -20:20)

DATA START_TIME /180/

OPEN (UNI
OPEN (UNIT:
OPEN (UNIT=:
OPEN (UNIT:
OPEN (UNIT=!

1 STATUS=/OLD‘)

, CARRIAGECONTROL=/LIST’, STATUS=/NEW!)
, CARRIAGECONTROL=/LIST’, STATUS="NEW’)
4, CARRIAGECONTROL=/LIST’, STATUS="NEW’)
» CARRIAGECONTROL=/LIST’, STATUS=/NEW!)

Begin processing.

READ (1, 101, END=300) TRIPID, ITIME, SPD, ACL
FORMAT (A12, 16, 2F6.2)
Tete

Check if this record is the beginning of a trip.

IF CITIME .£Q. 0) THEN
IWAIT = 0

IMODE = 1

END IF

Detect when microtrip has ended (MFLAG = 1).
MFLAG = 0

IF (SPO .GT. 0.0) THEN
CRUS = 1

IFLAG = 1

ELSE

CRUS = 0

END IF

IF (CRUS .EQ. O .AND. LCRUS .EQ. 0 AND. IFLAG .EQ. 1) IFLAG = 1

IF (TRIPID_.NE. LTRIPID .OR. CRUS .£Q. 0 .AND. LCRUS .EQ. 0 .AND.

+ IFLAG .EQ. 1) THEN

105

IFLAG = 0
MFLAG = 1
GO TO 105
END IF
LCRUS = CRUS
LTRIPID = TRIPID

Determine emission mode (start/stabilized) as follows: Is this a
start or stabilized record? (IMODE: 1 - Start, 2 - Stabilized).

IF (ITIME .£Q. START_TIME) IWAIT = 1

Just beyond START_TIME, continue marking the records as starts
until the end of the current microtrip is reached (MFLAG = 1).

IF CIWAIT .EQ. 1) THEN
IMODE = 1
TF (MFLAG .EQ, 1) THEN
IWAIT = 0
IMODE = 2
END IF
END IF

IF (IMODE .€Q. 1) GO TO 250

A-54


Sample Ranked Cycles by DIFFSUM File

BEST OF SUB25 SERIES E CYCLES

CYCLE FILE

E22-655 .0u"
22-654 .0U
£18-396 .0U'
E22-423.0U
E20-19%4.

22-759.

£18-9B5 .OU’
E20-036,
&20-035.
£18-602.
£22-496,
E22-893..
E22-099,
E22-183.
E22-220.
£22-215.
E22-639.1
E22- 842.1
£20-307.
E22-030.
E22-029.01
E22-824 .01
20-151 .UT
E22-348.0uT;
£22-176.0UT;
18-363.0UT
€22-872.0UT,
E20-433.0U
€22-710.0u'
E 22-424.
£18-300.!
E18-426.
€22-858.!
E20-388
E22-005
£20-963.
E 20-344.
E20-343.!
E22-852.
E20-314.
£18-815.
22-447.
E22-063..
£20-600.
20-137.
£20-037.
E20-732.0U'
E20-459.0U'
£ 18-844 .0U'
€22-277.0U

gegceegeeeegecegeeeess

ee

SSSSS55
WEHED HGH NO DIBNARDAR NAO NENN NN ENN NGONNNNANENNE ON

eeeereeeeeeee2zeee

G

T
iT
IT
IT
fT,
T,
IT.
iT;
T,
IT
iT.
iT
IT
iT.
iT
IT

TIME MEAN SPD MAX SPD
TOTAL DIFF M-TRIPS = (min) mph) mph) STOPS/MIN
0.26886 5 31.17 41.16 74.06 0.160
0.26886 15 33.08 27.26 74.06 0.453
0.27601 13 33.97 27.73 74.06 0.383
0.27675 10 36.72 27.34 74.06 0.272
0.27822 1% 42.50 25.37 74.06 0.376
0.27868 10 37.28 28.05 74.06 0.268
0.28068 10 36.88 27.89 74.06 0.271
0.28072 8 33.40 41.82 74.06 0.240
0.28072 ah] 35.68 27.41 74.06 0.308
0.28245 10 33.88 27.96 74.06 0.295
0.28251 13 35.37 27.04 74.06 0.368
0.28297 1 36.08 27.462 76.06 0.305
0.28476 9 35.43, 28.30 74.06 0.254
0.28482 10 39.63, 26.57 76.06 0.252
0.28504 16 36.43 26.87 74.06 0.439
0.28511 ant 35.02 27.39 74.06 0.314
0.28514 3 37.55 27.35 74.06 0.346
0.28579 9 36.20 27.13 74.06 0.249
0.28658 10 37.83 28.08 74.06 0.264
0.28688 6 37.25 49.00 74.06 0.161
0.28688 13 34.57 26.99 74.06 0.376
0.28694 8 34.60 26.98 74.06 0.231
0.28797 13 32.72 27.68 74.06 0.397
0.28830 12 34.75 27.44 74.06 0.345
0.28855 10 37.43 27.36 74.06 0.267
0.28894 9 35.50 27.06 74.06 0.254
0.28892 17 44.00 26.00 74.06 0.386
0.28901 af] 39.30 27.85 74.06 0.280
0.28909 12 35.97 27.50 74.06 0.334
0.29040 3 37.28 28.13 74.06 0.349
0.29060 12 33.35 28.46 74.06 0.360
0.29070 9 36.53 28.24 74.06 0.266
0.29135 14 35.30 26.51 74.06 0.397
0.29197 10 32.50 28.51 74.06 0.308
0.29205 n 36.80 26.99 74.06 0.299
0.29227 8 35.20 27.94 74.06 0.227
* 0.29268 8 31.75 19.45 74.06 0.252
0.29268 10 36.58 28.49 74.06 0.273
0.29295 1 36.53 27.02 74.06 0.301
0.29321 15 33.50 27.40 74.06 0.448
0.29351 6 36.35 27.49 74.06 0.165
0.29356 12 32.03 27.26 74.06 0.375
0.29372 12 33.53 28.86 74.06 0.358
0.29412 12 35.93 27.89 76.06 0.334
0.29414 13 43.465 25.58 74.06 0.299
0.29458 13 35.60 27.50 74.06 0.365
0.29465 12 38.15 27.50 74.06 0.315
0.29488 13 42.30 26.55 74.06 0.307
0.29523 12 37.60 28.05 74.06 0.319
0.29560 9 35.83 28.50 74.06 0.251


APPENDIX B

Sample Cycle Development Files


"stabilized" portions of the composite speed/accel distribution are
generated by a 50/50 weighting of the Baltimore and Los Angeles
stabilized driving. The "start" portion of the composite is based on
Baltimore data only. The Baltimore start data are weighted into the
composite with the same frequency of "start" vs. "total" travel observed
in Baltimore.

The output composite speed/accel distribution is used as a "target" to
compare against candidate driving cycles. Cycles are selected from a
set of candidates based on how well their individual speed/accel
distributions match that of the composite "All Driving" distribution.

External Files

LUN Ifo? File Desc tion

1 Input Baltimore Start SAFD File

2 Input Baltimore Stabilized SAFD File

3 Input Los Angeles Stabilized SAFD File
4 Output Composite "All Driving" SAFD File

DIFFSURFE (FORTRAN, Utility)

The DIFFSURF program generates an output SAFD file from the difference
between individual frequencies in two input SAFD files (first minus
second). It is used in the cycle selection phases to compare the "fit"
of one distribution to another, showing where the second ("Candidate")
speed/accel distribution either over- or under-represents the
frequencies in the first ("Target").

External Files

LUN 1/02 File Description

1 Input Any SAFD "Target Distribution" File

2 Input Any SAFD "Candidate Distribution" File
3 Output Candidate - Target SAFD File

DIFFSUREFWT (FoRTRAN, Utility)

This is a modified version of the DIFFSURF program. DIFFSURF generates
an output SAFD file by taking a simple difference between frequencies at
each speed/accel interval between two input SAFD files. In the example
below, the 0.123 weighting factor represents the fraction of all travel
that occurs beyond the boundaries of the LA4. DIFFSURFWT applies a
weighting factor to the second input SAFD. Mathematically,

Output SAFD = Input SAFD1 - (Input SAFD2 x WtFac)

where WtFac = 0.123

-13-


Master Trace File (excerpt)

828792031801 0 0.00 0.00 0 0
828792031801 1 0.00 0.00 0 0
B28792031801 2 0.00 0.00 0 oO
828792031801 3.0.00 0.00 0 0
828792031801 4 0.00 0.00 0 0
828792031801 5 0.00 0.00 0 0
828792031801 6 0.00 0.00 0 0
B28792031801 7 0.00 0.00 0 0
B28792031801 8 0.00 0.00 0 0
B28792031801 9 0.00 0.00 0 0
828792031801 10 0,00 0.00 0 0
828792031801 11 0.00 0.00 0 0
B28792031801 12 0.00 0.00 0 0
828792031801 13 0.00 0.00 0 0
828792031801 14 0.00 0.00 0 0
828792031801 15 0.00 0.00 0 0
828792031801 16 0.00 0.00 0 0
828792031801 17 0.00 0.00 0 0
828792031801 18 0.00 0.06 0 0
828792031801 19 0.04 3.20 0 3
828792031801 20 3.24 1.55 1 2
828792031801 21 4.79 1.34 11
828792031801 22 6.13 0.40 2 0
828792031801 23 6.53 0.50 2 0
828792031801 24 7.03 0.87 2 1
828792031801 25 7.90 0.36 2 0
828792031801 26 8.26 -0.36 2 0
828792031801 27 7.90 -0.92 2-1
828792031801 28 6.98 -0.67 2 -1
828792031801 29 6.31 -1.48 2-1
828792031801 30 4.83 -2.26 1 -2
828792031801 3 7 -0.40 1 0
B28792031801 32 2.17 0.40 1 0
828792031801 33° 2.57 -1.05 1-1
828792031801 34 1,52 -0.31 1 0
828792031801 35 1.21 11
828792031801 36 2.39 11
828792031801 37 2.91 11
828792031801 38 (3.47 10
828792031801 39 3.11 10
828792031801 40 2.98 10
828792031801 41 2.80 10
B28792031801 42 2.62 1-4
828792031801 43° 2.01 1-1
828792031801 44 1.10 1-1
828792031801 45 0.00 00
B28792031801 46 0.31 13
828792031801 47 3.06 12
828792031801 48 4.92 10
828792031801 49 4.61 1-4


y20
NUMBER = NUMBER + 1

00 101 = 1,N
TF (C(1) EQ. 1) THEN
deuet

KOMBOS(J,NUMBER) = I
IF (J .£Q. K) GO TO 20
END IF

10 CONTINUE

20 RETURN
END

A-29


2. SYSTEM REQUIREMENTS

Almost all the cycle development programs are written in VAX/VMS—
FORTRAN77 (Version 6.0). A few short programs are written in SAS and
VMS DCL (operating system command language). This software will operate
with little initial configuration on a VAX mini-computer running the VMS
operating system. The FORTRAN programs can be easily ported to any non-
VAX system which has a "VAX-FORTRAN77" compatible compiler. The SAS and
DCL programs are few in number and simple in design and can be readily
re-coded on a non-VAX system. However, the amount of driving data used
under this effort (requiring substantial disk storage) and the
computational and memory intensive nature of several key programs
severely limit the ability to port this package to a "typical" PC
system.

The following system requirements are recommended:
- 32-bit CPU and operating system;

- minimum 24 megabytes (MB) of physical memory (RAM), with 64 MB
recommended; and

— disk storage capacity of 2 gigabytes (GB).

HH

-2-


eag9AFAMAAAAAAAAA

mangagn

aaaa

oanan

PROGRAM MAKETBL2

A quick program to generate tabular "Watson plots" from
input spd/acl surface files in "comma-delimited" format.

Summary of speed & accel bin definitions:

Speed (mph): 0, 0 - <=5, 5 - <=10, etc.
Accel(mph/s):  -0.5 to 0.5 mph/s = 0

-1,5>= to -0.5 2.5>= to -1.5 = -2, etc.
0.5 to <= 1.5 to <=2,5 = 2, etc.
Author: Tom Carlson

Date: 05/10/93

CHARACTER*80 FNAME

INTEGER CNTBIN(-20:20,0:20), SPDSUM(-20:20), ACLSUM(0:20), TOT

OPEN (UNIT=1, STATUS=/OLD’)
OPEN (UNIT=2, CARRIAGECONTROL=/LIST’, STATUS=/NEW’, RECL=175,
+ RECORDTYPE=! VARIABLE! )

Prompt for table title.

WRITE (*, 50)

50 FORMAT (/1X, ‘Enter title for spd/acl surface:’)
READ (*, 60) FNAME

60 FORMAT (A80)

Read input mode surface file (unit 1).

100 READ (1, *, END=110) IACL, ISPD, RCNT -
CNTBINCTACL, ISPD) = RCNT
TOT = TOT + CNTBIN(IACL, ISPD)
60 To 100

Compute row (across spd) and column (across act) totals.

110 DO 120 IACL = -20,20
DO 120 ISPD = 0,20
SPDSUM(IACL) = SPDSUMCIACL) + CNTBINCIACL, ISPD)
120 CONTINUE

00 125 ISPD = 0,20

DO 125 IACL = -20,20

ACLSUMCISPD) = ACLSUM(ISPD) + CNTBINCIACL, ISPD)
425 CONTINUE

Output results in tabular form, echo input surfaces first.

WRITE (2, 130) FNAME

130 FORMAT (///65X, A80//60X, 'Speed/Accel Frequency Distribution (#)/
+ 7/170X, "SPD BIN. (mph)! /)
WRITE (2, 140) (ISPD*S, ISPD = 0,20)

140 FORMAT (‘ACL BIN (mph/s)', 4X, 14, 3X, 20(/<',13,3X), ' Totals'/
Ho Nese eeeceee eect 1 OK, eet, BK, 20028213), fonts eee By

DO 150 IACL = -20,20

WRITE (2, 145) TACL, (CNTBINCIACL,ISPD), ISPD = 0,20),SPDSUM(IACL)
145 FORMAT (6X, 4, 6X, 2117, 3X, 18)
150 CONTINUE

WRITE (2, 155) (ACLSUM(ISPD), ISPD = 0,20), TOT
155 FORMAT (/5X, ‘Totals’, 5X, 2117, 3X, 18)

END

A-46


PROGRAM PRNDIFF

A modified version of SHOWOIFF program, PRNDIFF inputs a
"PRN" cycle file and target: surface file and computes
a difference spd/acl array in tabular form.

This program is primarily used to test the effects of editing
a cycle file by chopping/adding cruise, accel, etc.

Summary of speed & accel bin definitions:

Speed (mph): 0, 0- <5, 5- 10, etc.
Accel (mph/s): +0.5 to 0.5 mph/:
71.5>= to -0.5
0.5 to <= 1.5

oe S>= to -1.5 = -2, etc.
1 1,5 to «2,5 = 2, etc.

1/0: Unit 1 (input) - edited PRN cycle file.
selected cycle.
Unit 2 (input) - Speed/accel target surface created from
sec-by-sec drive cycle data.
Unit 3 (output) - Tabular “Watson Plot" of the spd/acl fit
between selected cycle & target surface.

Author: Tom Carlson
Date: 05/17/93

QennenAAFAARAAAAAAAAAAAAAADA

CHARACTER MTYPE(SO)
CHARACTER*14 MTRIPID(50), ITRIPID
CHARACTER*80 INFILE, TARGFILE, TITLE, OUTFILE

REAL CFREQ(-20:20,0:20), ACLSUM(2,0:20), PFREQ(-20:20,0:20),
+ SPDSUM(2,-20:20), PCTDIF(-20:20,0:20)

DATA IHDR / 7 /

Begin execution.

Prompt user for input and output filenames.

eanea9n

WRITE (*, 10)

10 FORMAT (/1X, ‘Enter input PRN cycle filename:’)
READ (*, 20) INFILE

20 FORMAT (A)
WRITE (*, 30)

30 FORMAT (/1X, ‘Enter target surface filename:’)
READ (*, 20) TARGFILE

c Name OUTFILE and TITLE based on INFILE and TARGFILE.

L1 = INDEX CINFILE, 1]/) + 14

L2 = INDEX (INFILE(L1:80), ‘./) + L1- 2

OUTFILE = INFILECL1:L2) // ‘.DIF’

K = INDEX (TARGFILE, ‘./) - 1

TITLE = ‘Difference Between Cycle ‘ // INFILE(L1:L2) //
+ + And Target Surface ‘ // TARGFILE(1:K)

LL = INDEX (TITLE, 4) - 1

ILEN = 87 - LL/2

c

c Open all files.

c
OPEN (UNIT=1, FILE=INFILE, STATUS=/OLD’)
OPEN (UNIT=2, FILI IRGFILE, STATUS=/OLD!)
OPEN (UNIT=3, FILE=OUTFILE, STATUS=/NEW’, RECL=186,
+ CARRIAGECONTROL=/LIST’)

c

Cc

c

Cc

c

c Target population surface.

c

100 READ (2, *, END=200) IACL, ISPD, RBIN, PCT
PFREQ(IACL, ISPD) = PCT
iN2 = IN2 +1
GO To 100

A-1


PROGRAM MAKE_CYCLE

A quick program to make a VEHSIN-ready master driving schedule
file from the GETCYCLE .PRN files.

Unit 1 - Input .PRN file from a GETCYCLE run.
Unit 2 - VEHSIM-ready output file.

Author: Tom Carlson
Date: 04/28/93

eananaaaanna

CHARACTER*4 CITY
CHARACTER*80 PRNFILE, OUTFILE, HEADER(3), HOR(3), PART*6

DATA CITY //BTLA‘/, ACLAST /0.0/

DATA HEADER / ‘*DRIVING SCHEDULE ',

+ * COMPOSITE BALT/LA92 - CYCLE ',

+ ‘INITIAL COND 0.0 0.0 0.0 0.0'/

WRITE (*, 10)

10 FORMAT (/1X, ‘Enter input GETCYCLE .PRN files’)
READ (*, 20) PRNFILE

20 FORMAT (A)
WRITE (*, 30)

30 FORMAT (/1X, ‘Enter cycle VEHSIM part name (< 7 chars):’)
READ (*, 35) PART

35 FORMAT (A6)
WRITE (*, 38)

38 FORMAT (/1X, ‘Enter output VEHSIM-ready file name:’)
READ (*, 20) OUTFILE

L = INDEX (PRNFILE, ’./) - 1

OPEN (UNIT=1, STATUS='OLO’, FILE=PRNFILE)
OPEN (UNIT=2, STATUS='NEW’, FILE=OUTFILE, CARRIAGECONTROL='LIST’)

HDR(1) = HEADER(1)(1:18) // PART
HOR(2) = CITY // HEADER(2)(1:29) // PART
HOR(3) = HEADER(3)
bo 60 L = 1,3
WRITE (2, 55) HOR(L)
55 FORMAT (A)
60 CONTINUE

100 READ (1, *, END=200) ISEG, MTRP, SPD, ACL
NEN+4

c Convert ACL from mph/s to ft/s2 & use the t-1 value (EPA places
c the accel at the beginning of the time interval, VEHSIM expects
c it at the end).

VACL = ACLAST * 5280 / 3600.

WRITE (2, 150) ISEG, VACL, SPD, GRADE
150 FORMAT (‘SEGMENT ', 14, F6.2, 149, ’ .1.0’, T73, 2F6.2)

ACLAST = ACL
GO To 100

200 WRITE (*, 210) N
210 FORMAT (/1X, ‘Processing completed: *, 16, ‘ seconds’/)

END

A-44


do 12 j=l+1,ir

iftarr(i). le. a)goto 2.
arrci+t)sarrci)

1 continue
i=0
2 arrci+1)=a
12 continue
if jstack.eq.0)return

stack( jstack)
(sistack(jstack-1) _
jstack=jstack-2
else
ke(l+iry/2
temp=arr(k)
arc(k)=arr(l+1)
arr(l+1)=temp
ifCare(l+1).gt.arr(ir))then
temp=arr(l+1)
arr(l+1)=arr(ir)
arrcir)=temp
endif
ifCarr(l).gt.arr(ir))then
tempzarr(l)
arr(l)sarrcir)
arr(ir)=temp
endif
ifCarr(l+1).gt.arr¢l))then
temp=arr((+1)
arr(l+1)sarr(l)
arr(tj=temp

azarr(l)
3 continue

ifCarr(i).(t.adgoto 3
4 continue
iej-1
ifCarr(j).gt.a)goto 4
if(j.lt.idgoto 5
temp=arr(i)
arr(i)=arr(j)
arr(j)=temp
goto 3
5 arr(l):
arr(j)
jstack=jstack+2
if(jstack.gt.! NSTACK pause ’NSTACK too small in sort’
ifCir-i+1.ge.j
Crete ieeades
istack( jstack-1)=i
ir=j-4
else
istack( jstack)=j-1
istack( jstack-1)=l

=arr(j)

endif
endif
goto 1
END
© (C) Copr. 1986-92 Numerical Recipes Software pLijn>#(.

FUNCTION rani(idun)
INTEGER idum,1A,1M,10,1R,NTAB,NOIV
REAL rant, AM, EPS, RNMX
PARAMETER’ (TA= 16807, IM=2147483647, AMe1 ./1M, 10=127775, 1R=2836,
*NTAB=32, NDI (CIM-1)/NTAB, EPS=1.2e-7,RNMX=1.-EPS)
INTEGER j,k, iv(NTAB),iy
SAVE iv,iy
DATA iv /NTAB*O/, iy /0/
if Cidum.le.0.or.iy.eq.0) then
idum=max(- idum, 1)
do 11 j=NTAB+8,1,-1
k=idum/1Q
idum=1A*(idum-k*1Q)-1R*k
if Cidum.tt.0) idum-idum+IM
if (j.le.NTAB) iv¢j)=idum

A-37


matrix shows the frequency of travel (expressed in percent). for that
speed-acceleration interval combination. Modified versions of MAKETBL
called MAKETBL2 and MAKETBL3 show row and column totals and net plus
absolute totals.

External Files

LUN 1/0? File Description
1 Input Any comma-delimited SAFD File
2 Output Tabular Watson Plot File

Prompted Input

- Title (appears at top of table)

MICTRIPS (FORTRAN, Data Preparation)

This program reads the Balt/LA Master Driving Trace File (second-by—
second data) and develops “speed/acceleration profiles" by microtrip and
outputs them into the Master Microtrips File. A microtrip is defined as
travel between distinct stops. MICTRIPS scans the Balt/LA driving data
and for each identified microtrip, computes the frequency distribution
(expressed as number of seconds) of speed/accel for that microtrip.

External Files

LUN 1/0? File Description
1 Input Balt/LA Master Driving Trace File
2 Output Master Microtrips File (ASCII)

MODSPLIT BALT (FoRTRAN, Data Preparation)

The MODSPLIT_BALT program inputs the entire Baltimore Speed & Accel vs.
Time File and separates the second-by-second records into either of two
output "mode" files: (1) Start and (2) Stabilized. Start mode is
defined as the first 4 minutes of driving during each trip; stabilized
mode is travel after 4 minutes. Speed and acceleration intervals (which
are used extensively in the cycle development software) are computed and
also written to the output files. The speed and acceleration interval
are defined below.

Spd Int Spd Range (mph Acl Int Acl Range (mph/s)
te) 0 wae cose
1 >0Oto 5 -2 -2.5 to > -1.5
2 > 5 to 10 -1 -1.5 to > -0.5
3 >10 to 15 0 -0.5 to 0.5
4 >15 to 20 1 >0.5 to 1.5
5 2.5

>20 to 25 2 >1.5 to

-20-


GO TO 115
ENO IF
WRITE (*, 112) N, LSPD, ‘SPD, NSPD, ACL
END IF
c
151 WRITE (2, 120) LVID, (LDATECI), 1 = 1,3), ITRIP, LSEC, LSPD, ACL,

Uspo, ACL

120" FORMAT (A4, 412.2, 16, 4F6.2)
125 LSEC = ISEC

ISEC = ISEC + 1

LDATE(1) = JDATEC1)

LDATE(2) = JDATE(2)

LDATE(3) = JOATE(3)

LMSEC = MSEC

LsPD = SPO

Go To 100

nao

New vehicle (and therefore new trip) section.

130 ACL = 0.0
WRITE (2, 120) LVID, (LDATE(I), 1 = 1,3), ITRIP, LSEC, LSPO, ACL,

+ LSPD, ACL
TTRIP =

IVEH = IVEH + 1

LVID = VID

SOAK = 70.0

WRITE (3, 105) VID, (JDATE(1), I = 1,3), ITRIP, SOAK

105 FORMAT (AS, 412.2, F6.1)
GO TO 145
c
C New trip section.
140 ACL = 0.0
RITE (2, 120) LVID, (LOATE(I), [ = 1,3), ITRIP, LSEC, LSPD, ACL,
SPD, ACL
"r (JDATE(3) .NE. LDATE(3)) THEN
ITRIP = 1
ELSE
ITRIP = ITRIP + 1
END IF

WRITE (3, 105) VID, CJDATECI), I = 1,3), ITRIP, SOAK
145 TRIPFLAG = 0

ISEC = 0
GO TO 125
c -
200 ACL = 0.0
TRITE, (2, 120) VID, (JDATE(I), 1 = 1,3), ITRIP, ISEC, SPD, ACL,
spo, ACL
“eno
FUNCTION julday (mm, dd, yyyy)
c
c This function returns the Julian Day Number beginning at noon of
c the input calendar date specified by month mm, day dd, and year
c yyyy (all integer variables). Positive year indicates A.D.;
c negative, 8.C. Remember the year after 1B.C. was 1 A.D.
c
c Source: Numerical Recipes (2nd Edition), 1992.
c
INTEGER julday, mm, dd, yyyy, igreg, ja, jm, jy
PARAMETER (igreg=15+31*(10+12*1582))
c

ly = wy '
if (jy .eq. 0) pause ‘JULDAY: There is no year zero.’
if Gy .lt. 0) jy = iy +1

if (mm .gt. 2) then

im =mm+1
else
jy =iy-1
jm = mm + 13

end if
julday = int (365.25*jy) + int (30.6001*jm) + dd + 1720995
if (dd + 31*¢mm + 12*yyyy) .ge. igreg) then
ja = int (0.01*jy)
julday = julday + 2 - ja + int (0,.25*ja)
end if

A-11


100 READ (3, *, END=190) IACL, ISPD, RBIN, PCT
PFREQ(IACL, ISPD) = PCT
IN3 = 1N3 + 1
Go To 100

Creeeee

c Get list of selected M-trips from INFILE, skipping THOR header
c records (unit 1).

190 00 199 ISKIP = 1,1HDR
READ (1, FMT=!()/)
199 CONTINUE

200 ITRP = ITRP + 1
READ (1, 205, ERR=210) ITRIP(ITRP), MTYPECITRP), MTRIPSCITRP),
+ MIRIPIDCITRP), IRECCITRP), ITIMECITRP)
205 FORMAT (13, 1X, Al, IX, 15, 1X, A16, 1X, 17, 1X, 16)

GO TO 200
c
Core ee cece nee e ence cn ee nee ee enn neeee nee ecneeee nec ncecneneeeceee _—
c ALU M-trips read from INFILE. Now sort ‘em by increasing initial
c record number IREC. Use indirect sorting, storing pointer

c rankings in IPNT.

210 NTRP = ITRP - 1
DO 220 I NTRP
IPNTCI)

220 CONTINUE

Do 250 1 = 1, NTRP-1
= IPNTCI+1)

DO 230 J =
slet-J
IF (IREC(L) .GT. IRECCIPNT(K))) GO TO 240
IPNT(K+1) = TPNT(K) *
230 CONTINUE

1

kK=0
240 IPNT(K+1) =
250 CONTINUE

Cc Pointer sorted. Now read speed/accel bin frequency counts data
c for selected M- trips created by the MICTRIPS program from unit 2.
C After each H-trip is input, increment bin counts for that N-trip.

00 300 1 = 1, NTRP
= IPNT(I)

IF (I .GT. 1) THEN

NSKIP = MTRIPSCJ) - (MTRIPSCJ1) + 1)
ELSE

NSKIP = MTRIPS(J) - 1

END IF

© Skip records until next selected M-trip is reached.

DO 280 ISKIP = 1, NSKIP

READ (2) M, ITRIPID, JREC, JTIME, SPD_MEAN, SPD_MAX,

+ SPD_STD, ACL_MAX, (CMCNT(IACL, ISPD), ISPO=0,20), IACL=-20,20)
280 CONTINUE

C Read segment.

READ (2) M, ITRIPID, JREC, JTIME, SPD_MEAN, SPD_MAX,
+ SPD_STD, ACL_MAX, ((MCNT(IACL,ISPD), ISPD=0,20), IACL=-20,20)

DO 290 IACL

DO 290 ISPO

CFREQCIACL,ISPO) = CFREQCIACL, ISPD) + MCNTCIACL, ISPD)
290 CONTINUE

A-31


SEL _BESTART (vaX-vMS Command Proc, Start Cycle Selection)

This is a VMS operating system command language procedure that employs a
VAX system sorting utility to retrieve the second-by-second driving
trace for the selected "best start" microtrips. The utility simply
scans the trip ID field in the Master Driving Trace File and outputs the
records for the selected trip that contained the best start microtrips.
The output file was then manually edited to retain only the "start"
microtrips.

SHOWDIFE (ForTRAN, Utility-Unlisted)

SHOWDIFF computes and outputs a tabular "Watson Plot" showing the
speed/accel frequency differences between an input cycle and a target
speed/accel distribution. SHOWDIFF generates the cycle SAFD from an
input list of microtrips contained in a Cycle Summary file. The
speed/accel frequencies for each of the microtrips in the input list are
retrieved from the Master or Subset Microtrips File. This cycle SAFD is
then compared to the target SAFD.

External Files

LUN 1/0? File Description

1 Input Any Cycle Summary File

2 Input Master or Subset Microtrips File

3 Input Target SAFD File

4 Output Tabular "Watson Plot" of difference between

cycle and target SAFD’s

Prompted Input

Cycle Summary filename
- Master or Subset Microtrips filename
Target SAFD filename

SORT STARTS (VAX-VMS Command Proc, Start Cycle Selection)

SORT_STARTS is a simple VMS command procedure that invokes the VAX
system SORT utility to order the Start DIFFSUMS by Trip ID File by
ascending DIFFSUM.

STABSURF (FoRTRAN, Composite Cycle Selection)

STABSURF is a companion to the COMPSURF program. It inputs Baltimore
and Los Angeles Stabilized SAFD files, weights their frequencies evenly
(50/50) and outputs a weighted Balt/LA Stabilized SAFD file.

~23-


+ SPO_MEAN(I), SPD_MAX(I), SPD_STD(1), ACL_MAX(I),

+ CCMCNT(I,IACL, ISPD), 1SPD=0,20), IACL=-20,20)

C 30 FORMAT (15, 1X,A14,1X,17,1X,15, 3¢1X, F7.2), 1X, F7.3,1X, 861(14))
IW2 = IN2 +1 -
Go TO 20

c Input completed. Begin microtrip selection using Best Incremental
c logic.

c Top-level loop 500 iterates the selection process to generate
c a number of cycles (NCYCLES). Each cycle is written to a
c separate output file on unit 3.
¢: =:
c

50 MTRIPS = IN2
DO 500 ILooP = 1,NCYCLES

Initialize cycle sums and counter.

ana

NTRP = 0

TRIPTIME = 0.0

STINE = 0.0

CsPD = 0.0

DO 80 IACL = -20,20

DO 80 ISPD = 0,20

TCNT(IACL,ISPO) = 0.0
80 CONTINUE

IPRD = INDEX (OUTFILE, ‘./)

TEND = INDEX (OUTFILE, ‘ ')- 1

WRITE (CLOOP, FMT=/(13.3)') ILOOP

QUTNAME = OUTFILE(1:IPRD-1) // ‘=! // CLOOP // OUTFILE(IPRD:1END)
TOUT = INDEX (OUTNAME, ‘ ‘) - 1

Open "current" filename.

pan

OPEN (UNIT=3, FILESOUTNAME, STATUS=/NEW!, CARRIAGECONTROL=/LIST’,
+ RECORDTYPE=/ VARIABLE’)

c
C Write output file header.

WRITE (3, 90) RTIME, QUTNAME(1: IOUT)
90 FORMAT (SX, ‘BEST INCREMENTAL Trip Selection Method’, 154,
+ "Target Time: ', F5.2, ¢ min'//
+ 13X, ‘Filename: 4, A // 8X,
+!MTRP INIT TIME AVG SPD MAX SPD STD SPD MAX ACL‘
+! TOTAL CRUISE ACCEL DECEL'/2X, ‘# 5
+) NO MTRIP ID REC (s) (mph) (mph) == (mph) (mph/s)!
+ ,/ OLFFSUM DIFFSUM DIFFSUM DIFFSUM’/)

DIFFMIN = 999,

Loop thru all microtrips ‘in search of best incremental trip(s).

ane

DO 350 1 =

+ MTRIPS

Add act/spd bin counts for current microtrip to "current" count
array CCNT and express as frequency. Compute integrated
difference between the population surface and the best
incremental surface CFREQ. (Use abs value of the difference.)

aanean

0 305 11 = 1,4
DIFFCII) = 0.0

305 CONTINUE
DO 320 TACL = -20,20
DO 320 ISPD = 0,20 .
CCNT(IACL, ISPD) = TCNT(IACL, ISPD) + MCNT(I, IACL, 1SPO)
CFREQ(IACL, ISPD) = CCNTCIACL,ISPD) / (TRIPTIME + ITIME(I))
DIFF(1) = DIFF(1) + ABS (CFREQ(IACL, ISPD) - PFREQ(IACL,ISPO))
IF (TACL .€Q. 0) THEN
DIFF(2) = DIFF(2) + ABS (CFREQ(IACL,ISPD) - PFREQ(IACL,ISPD))
ELSE IF (IACL .GT. 0) THEN
DIFF(3) = DIFF(3) + ABS (CFREQ(IACL,ISPD) - PFREQ(IACL,ISPD))
ELSE IF (IACL .LT. 0) THEN

A-64


120 CONTINUE
C Go back on J loop and try next combination.
. 200 CONTINUE
C Update total combos counter.
. NTOT = NTOT + NK
¢ Go back on outer loop K (the combo size variable).

Cc
300 CONTINUE
c

Cc Processing completed, output all results and end.

c Write non-FTP surface distribution.

DO 400 IACL = -20,20

DO 400 ISPD = 0,20

PCT = NFFREQ(IACL,ISPD) * 100

WRITE (5, 315) IACL, ISPD, IDUM, PCT
315 FORMAT (2(13,",/), 18, ',", F10.6)

400 CONTINUE
c
c Write top N8ST summary table.
c

WRITE (6, 402) NBST, CYCFILE(1:1E)
402 FORMAT (/TOP ', 12, ‘ "SHORT BAG 4" MICROTRIP COMBINATIONS FOR’,
‘ CYCLE ', A///
’ Non-FTP = Short Bag4’/
‘Rank DIFFSUM Time (min) Microtrips (#)'/
2)

+
+
+
+ Peers ceeeeee cee ece eee e towne eeeeeeeee
DO 410 I = 1, NBST

do 405 L = 1, 4
UF (LISTBST(I,L) .EQ. 0) THEN

kKetb-1
GO TO 408
END IF

405 CONTINUE

408 WRITE (6, 409) 1, DIFFBST(I), TIMEBST(I), (LISTBST(I,LIST),
+ LIst = 1,K)

409 FORMAT (13, 3X, F8.5, 6X, F5.2, 3X, <K>14)

410 CONTINUE

Write Sbag4 and Tbag4 surfaces to units 7 and 8, respectively.

aca

DO 420 1 = 1,NBST

WRITE (CNUM, FMT=/(12.2)') I

B4SFILE = ‘S4FRQ_' // CYCFILE(1:1E) // '_’ // CNUH // ‘DAT’
BGTFILE = ‘T4FRQ_! // CYCFILE(1:1E) // '_' // CNUM // '.DAT!
OPEN (UNIT=7, FIL! SFILE, STATUS=/NEW', CARRIAGECONTROL=/LIST’)
OPEN (UNIT=8, FILE=B4TFILE, STATUS=/NEW', CARRIAGECONTROL=/LIST!)

00 417 IACL = -20,20

00 417 1sPD = 0,20

PCT = B4SBST(IACL,ISPD,I) * 100
WRITE (7, 315) IACL ,ISPD, IDUM, PCT
CONTINUE

CLOSE (7)

4a

g

DO 418 IACL = -20,20

DO 418 ISPD = 0,20

PCT = B4TBSTCIACL,ISPD,1) * 100

WRITE (8, 315) IACL ,1SPD, IDUM, PCT
418 CONTINUE

CLOSE (8)

420 CONTINUE
c A-18


360 FORMAT (/’ Distribution Counts: Composite , F8.0/
+ ' LAS = >, F8.0/
+ ’ Outside FTP ---> "| F8.0/)

END

A-59


c Now order the random #'s array NRAN.

CALL QSORT (NSUB, NRAN)

c OK, you’ve got the ordered random #'s. Now retrieve & selectively
c output the records.

bo 100 1 = 1, MTRIPS

c Terminate loop early when all NRANS have been processed.
IF (K .GT. NSUB) GO TO 200

© Read an m-trips profile record.

80 READ (1) M, MTRIPID, IREC, ITIME, SPO_NEAN, SPD_MAX,
+ SPD_STD, ACL_MAX, ((FREQCIACL,ISPD), ISPD=0,20), IACL=-20,20)

Test it against "current" element K of ordered NRANS. If no match,
loop back and read next record.

°°

IF (I .NE. NRAN(K)) GO TO 100
c Match found. Check & "mark" NSTART M-trips starting at MSTART.
IF (I .EQ. MSTART) KSTART =

c Set spd and acl max variables.
IF (SPD_MAX .GT. SMAX) SMAX = SPD_MAX
TF CACL_MAX .GT. AMAX) AMAX = ACL_MAX

00 95 ISPD = 0,20
DO 90 IACL = 20,0,-1
IF (FREQ(IACL,ISPD) .GT. 0 .AND.
+ TACL .GT. POSACL(ISPD)) THEN
POSACL(ISPD) = IACL
GO TO 95
END IF
90 CONTINUE
95 CONTINUE

C Output the matched record.

WRITE (2) K, MTRIPID, IREC, ITIME, SPD_MEAN, SPD_MAX,
+ SPD_STD, ACL_MAX, ((FREQ(IACL, ISPD), 1SPO=0, 20), IACL=-20,20)

K=K+1
100 CONTINUE
c Processing complete. Print short rec counts summary and end.
. 200 WRITE (*, 210) ISEEDO, MTRIPS, NSUB, KSTART, NSTART
210 FORMAT a M-trip Profile file subsett ing complete: MW

+ Initial Seed . 1, 15/
+ ' Total Mtrips 1, 15/
+ ' Selected Mtrips .... ', 15/
+ ' New Start Num .. 1, 15/
+ U # Starts .. ‘, 15)

WRITE (*, 220) SMAX, AMAX, CISPD*5, POSACL(ISPD), [SPD = 0,20)
220 FORMAT uv Speed and Accel Extremes:'//

+ Max Speed . 2, #52, 1 mph'/

+ ' Max Accel . ", F5.2, ¢ mph/s!//

+ 21 Spd --> ', 13, Max Pos Acl Bin --> *, 13/))
END

SUBROUTINE qsort(n,arr)
INTEGER n,M,NSTACK
INTEGER*2 arr(n)
PARAMETER (M=7,NSTACK=50)

INTEGER i, ir, j, jstack,k, |, istack(NSTACK)
INTEGER*2’ a, temp

jstack=0

(=1

a
1 ifCir-L.Le.M)then A-36


PROGRAM OUTFTPSTAB

A quick program to generate a “outside of FTP" spd/acl surface
from the "Composite" and "LAG" input spd/acl surface files.

The new surface contains only travel beyond the boundaries of the
FIP (in spd/act space) and is re-normalized.

AUL input and output surfaces are in "comma-delimited" format.
Summary of speed & accel bin definitions:

Speed (mph): 0, 0 - <5-5 - <=

Accel(mph/s):  -0.5 to 0.5 mph/s
-1,52= to -0.5 , 72.52 to -1.5 = -2, etc.
0.5 to <2 1.5 = 1, 1.5 to <=2.5 = 2, etc.

10, etc.
0

Author: Tom Carlson
Date: 05/10/93

Ngee AnAAAAAAAAAAAAAAA

INTEGER IANEG(O:20), IAPOS(0:20)

REAL PCTBIN(3,-20:20,0:20), SPDSUM(-20:20), ACLSUM(0:20),
+ BINCNT(3,-20:20,0:20), TOTCNT(3)

OPEN CUNIT=1, FILE=/CFRQS.DAT’, STATUS=’OLD‘)

OPEN (UNIT=2, FI LAGFRQ.DAT’, STATUS=/OLD’)

OPEN (UNIT=3, FILE=/QUTFRQ.DAT’, STATUS=/NEW’,

+ CARRIAGECONTROL=/LIST’)

OPEN (UNIT=4, FILE=/OUTFRQ.TBL’, CARRIAGECONTROL=’LIST’,
IEW’, RECL=175, RECORDTYPE=’ VARIABLE’)

Begin processing.

Read "Composite In-Use" surface file (unit 1).

100 READ (1, *, END=110) IACL, ISPD, BINCNT(1,IACL,ISPD),
+ PCTBIN(1, TACL, SPO)
TOTCNT(1) = TOTCNT(1) + BINCNT(1, IACL, ISPD)
Go TO 100

c
c Read "LAG" surface file (unit 2).
c

110 READ (2, *, END=120) IACL, ISPD, BINCNT(2, IACL, ISPD),
+ PCTBIN(2, IACL, ISPD)
TOTCNT(2) = TOTCNT(2) + BINCNT(2, IACL, ISPD)
GO To 110

120 DO 150 ISPD = 20,0,-1

c
c
Cc
Cc
c
c Loop across speed bins -- from big to small speed bins.
c
c
c Check decel region -- scan from big to small negative bins.
c
DO 130 IACL = -20,-1
IF (BINCNT(2,IACL,ISPD) .GT. 0.0) THEN
TANEG(ISPD) = IACL
GO TO 135
END IF
130 CONTINUE

135 DO 140 IACL = 20,0,-1
IF CBINCNT(2,1ACL,ISPD) .GT. 0.0) THEN
TAPOS(ISPO) = IACL
GO TO 145,
END IF
140 CONTINUE

145 IF CIS .EQ. 0 .AND. (IANEG(ISPD) .NE. 0 .OR. IAPOSCISPD) .NE. 0))
+ 18 = 18P0

150 CONTINUE
A-60


GO TO 200

“Underlines" found, now read stats info for current cycle.
(Note: Embedded record "Base Time" for HYBRID is skipped.)

nano

210 READ (2, 220) MTRIPSCIFILE), STRIPSCIFILE), CYCTIMECIFILE),
+ STIMECIFILE), CYCSPOCIFILE), DIFFSUMCIFILE)

220 FORMAT (/26X, 13, T68, 13/26X, F6.2, T68, F6.2//26X, F6.2/
+ 26x, F9.S)

Scanning completed for current cycle file. Close current file
then loop back to 100 and start on next file.

anea

CLOSE (2)
GO To 100

C----- ee eee eneeeen nnn ne pene eee eeeeeeeee:

€ Input complete, processing and ranking follow.
c-- aesencennaceceenee

300 CLOSE (1)
IFILE = IFILE - 1

c Compute stops/min.
bo 310 1 = 1, IFILE

STOPS(I) = MTRIPS(I) / CYCTIMECI)
310 CONTINUE

Sort arrays by descending difference. Use indirect
sorting algorithm, storing the "pointer" rankings in IPNT.

Initialize IPNT array with ascending pointers.

neanan

DO 320 1 = 1, IFILE
IPNT(I) = 1
320 CONTINUE
c

00 350 1 = 1, IFILE-1
L = IPNT(I+1)

00 330 J =1, 1
Kel+e1-J
IF (DIFFSUM(L) .GT. DIFFSUM(IPNT(K))) GO TO 340
IPNT(K+1) = IPNTC(K)

330 CONTINUE -

kK=0
340 IPNT(K+1) = L
350 CONTINUE

Pointer sorted. Now compute PKE for the NBEST cycles. Second-by
second velocities are retrieved from master file LA92_SIERRA.DAT.

Print first NBEST values in output arrays.

oann00

WRITE (3, 390) TITLE
390 FORMAT (5X, A80///T30,

+ U TIME MEAN SPD MAX SPD'/
+ YRANK CYCLE FILE’, T30, ’ TOTAL DIFF M-TRIPS¢
+ (min) (mph) (mph) STOPS/MIN’/

+ , +, 130,’ 5
+ r 1)

DO 400 I = 1, NBEST

J = IPNTCI)

WRITE (3, 395) I, CYCFILE(J), DIFFSUM(J), MTRIPS(J), CYCTIMECJ),
+ CYCSPD(J), MAXSPD(J), STOPSCJ)

395 FORMAT (13, 4X, A20, T30, F12.5, 111, 3F10.2, F9.3)
400 CONTINUE

CLOSE (3)
STOP

END

A-95


c to unit 4.

Cree enone eee

c

DO 350 J = 1, NTRP

IF (J .GT, 1) THEN

NSKIP = IRECLIST(J) - CIRECLIST(J~1) + ITIMELIST(J-1))
ELSE

NSKIP = IRECLIST(J) - 1

END IF

© Skip records until next selected M-trip is reached.

DO 310 ISKIP = 1, NSKIP
READ (1, FMT=()/)
310 CONTINUE

c Loop thru next selected M-trip.

DO 330 N= 1, ITIMELIST(J)
c <<< Read segment >>>
READ (1, 320) SPD, ACL, ISPD, IACL
320 FORMAT (18X, 2F6.2, 213)
c <<< Write segment to unit 4 >>>
WRITE (4, 325) N, J, SPD, ACL, ISPD, IACL
325 FORMAT (219, 2F6.2, 213)
330 CONTINUE

350 CONTINUE

c AL processing and output complete. Print summary and end.

WRITE (*, 390)
390 FORMAT (//
1X, ' # M-Trip No Microtrip [0 Start Rec Time (s)',
1 Max Spd (mph) Bin Count’/

Moe
DO 400 J = 1,NTRP
WRITE (*, 395) J, MTRIPLIST(J), IDLIST(J), IRECLISTCJ),

+ ITIMELISTCJ), MSPOLIST(J), CKOUNT(J,1), I = 1,NB)
395 FORMAT (13, 5X, I5, 5X, A14, 4X, 17, 5X, 14, 7X, F6.2, 9X, 1015)
400 CONTINUE

+eee

END

A-98


c
c Target population surface,
t -

100 READ (3, *, END=Z00) IACL, ISPD, RBIX, PCT
PFREQ(IACL, ISPD) = PCT
IN3 = IN3 +1
co To 100

c Get second by second traces from input PRN cycle files (units 1
c and 2). =_

Crees cence een eee ee ence eens

200 READ (1, *, END=300) ITINE, NTRP, SPD, ACL
Nt = NT +4

DO 210 ISPD = 12 20

11 = (ISPD-t) *

25 1+5

IF (SPD .GT, 11 .AND. SPD .LE, 12) THEN
IS = ISPD

GO TO 220

END IF

210 CONTINUE

c
¢
c Determine acceleration bin.
c
c

IF (ACL .GT. 0.0) GO TO 235

DO 230 IACL = -
Al = IACL + 0.5
A2 = IACL - 0.5

20,-1

IF (ACL «LT, A1 .AND, ACL .GE. AZ) THEN
1A = TACL

GO TO 250

ENO IF

230 CONTINUE
235 DO 240 IACL = 1,20
a = IACL - 0.5
= JACL + 0.5
IF CACL .GT. Al .AND. ACL .LE. A2) THEN
TA = TACL
GO TO 250
END IF
240 CONTINUE
250 CFREQCIA, 1S) = CFREQCIA,IS) + WIT

GO TO 200

300 READ (2, *, END=400) ITIME, NTRP, SPD, ACL
N22 N2+1

Cree cree e eee eee e eee eee ee ee seen eee ee


Figure 2

Start Cycle Selection Phase
Baltimore Start
‘SAFO File Run Status:
From Data Preparation Phase
teteteieted 4 ietetetaated 5
' BestStat | ‘Sorted Start 1 BestStart 1
Trip 1D ' DIFFSUMS File i Trip1D i}

Trace File . Selected
for Selected Start Microtripa
Best Start File (ASCif)


124

Unsorted Start DIFFSUMS File (excerpt)

Trip ID

828792031802
828792031901
828792031902
28792031904
828792031905
828792031906
828792031909
828792031911
828792031913
828792031914
828792032002
828792032005
828792032014
828792032103
828792032104
828792032105
B28792032106
828792032107
B28792032116
828792032119
B28792032120
828792032201
828792032202
828792032304
828792032305
828792032307
828792032311
828792032401
28792032402
828792032403
828792032404
828792032406
828792032410
828792032412
B28792032506
42092032406
42092032503
42092032601
42092032602
42092032702
42092032703
42092033001
642092033002
42092033101
816492031202
816492031203
816492031205
816492031206

Start Diff
0.635317
0.876384
0.866611
0.655594
1.454049
1.454049
0.669565
1.454049
0.667696
1.454049
0.838230
0.835857
0.995160
1.454049
0.996096
0.820255
1.454049
1.454049
0.746645
0.965498
0.624720
0.754790
0.962310
0.702186
0.767728
1.097152
0.695920
0.791174
0.951929
0.954662
0.937454
0.983172
0.871525
0.814550
0.790892
1.065885
0.879350
0.787035
0.797378
0.685250
0.861200
0.917643
0.782114
0.752631
0.573831
0.958284
0.814033
0.787444

Start Time (sec)

Initial Idle (sec)


aaa

enananaan

oaa

aa00

anaaanannAAAAAAAAANAAAADA

eae

ane

30

40

50

6

3

6

&

70

to our range limit given by N. If so, branch to “Move Elements"
section.

IF (LEAD .£Q. N) GO TO 40 ~

Migrate LEAD Section

We're still within range. Perform a shift sequence for the LEAD
pointer only. Migrate it until out of range, calling KFILL after
each shift. -

00 30 I = LEAD+1,N

cd) =1

C(I-1) = 0

CALL KFILL (K, N, C, KOMBOS, NUMBER)
CONTINUE

Apply special termination condition test when K = 1.
IF (K .£Q. 1) GO TO 100

Increment LEAD and reset it and its left-most neighbor to "1".
Then go back to 20 to do a KFILL and a range test.

c(N) = 0
CCLEAD+1) = 1
CC(LEAD) = 1
CCLEAD-1) = 0
EAD = LEAD + 1
GO TO 20

Perform a backward scan of C (i.e., starting at element N) using
the loop variable M. In the scan, detect:

- the first occurrence of an element = 0 (sets LHOLE to .TRUE.)
> with LHOLE .TRUE., the next element = 1 (final M value)
> # of elements between N & final M for which C = 1 (final 11)

When final M is found, the "1" value for the final M element is
moved to the right and remaining non-zero elements to the right
(indicated by L1) are reset just to the right of the moved final
4 element.

The test for subroutine termination is also performed in this
section. Terminate when L1 equals K (all "1" elements will now)
be right-justified in the index array C.

l1=0
LHOLE = .FALSE.
MoN

IF (CCM) .£@. 0) GO To 70
Listt+]

IF (.NOT. LHOLE) GO To 80
Lt=et 1

ccm 0

JsMelted

Do 60 1 = M+1,J

cI) = 1

CONTINUE

00 65 I = J+1,N

cI) = 0

CONTINUE

LEAD = J

GO TO 20
Subroutine terminate test -- is C now right-justified with "1/s"2
IF (L1 .£Q. K) GO TO 100

Zero value detected in backward search thru array C. This is
called a "hole".

A-20


selected Subset File are then input to several cycle selection programs
discussed in the following sub-sections.

3.2. Start Cycle Selection Phase

In generating representative driving cycles, it was recognized that a
separate evaluation of the representativeness of the "start" portion of
a candidate driving cycle (when cold engine/catalyst emission levels are
elevated) was required. As a result, a separate selection process to
identify those microtrips occurring at the beginning of a trip which
best represented all "start" travel was developed.

Figure 2 shows the "Start Cycle Selection" flow chart. (Only Baltimore
data were used to find representative start cycles due to the
aforementioned lack of "trip ends" in the Los Angeles data.) The
GETSTART program inputs the "All Start Travel" speed/acceleration
frequency distribution (SAFD) file created earlier and the Baltimore
Start Driving Trace File (second-by-second speed and acceleration) and
computes and outputs "DIFFSUMS" for each trip start. DIFFSUM is the
statistic of representativeness. DIFFSUM is defined as the summed
differences between the speed/accel frequency distribution for an
individual driving trace and a target population of driving. In this
ease, the individual driving traces are the microtrips that make up the
first nominal 4 minutes of each trip and the target population is the
composite SAFD of the first 4 minutes of all trips. Output DIFFSUMS by
trip ID from GETSTART are then sorted by ascending DIFFSUM with the
SORT_STARTS program. From this sorted list, the "best" trip ID is
identified and the SEL_BESTART and SEL_START programs are used to
generate a speed/time "Trace File" and "Start Microtrips File",
respectively.

3.3_ Composite Cycle Selection Phase

Similar to Start Cycle Selection, the selection of a Composite Cycle
requires initially defining a "target" population speed/accel frequency
distribution. As shown in Figure 3, the Composite Cycle Selection Phase
begins by generating sample-weighted "Composite" and "Stabilized" target
SAFD files using the COMPSURF and STABSURF programs. These programs
input the city- and mode (start/stabilized)-specific SAFD files
generated earlier. These frequency distributions (input as counts) must
then be weighted to account for the fact that there are nearly 40 times
more data in the Baltimore database than in the Los Angeles database.
The COMPSURF and STABSURF programs were set up to achieve the following
sample weighting:

- Stabilized travel from each city must be weighted equally
(i.e., 50/50); and

- Start travel (in COMPSURF only) is then weighted into the
composite with the frequency of "start" vs. “all driving"
observations collected in Baltimore.


PROGRAM SBAG4

SBAG4 (Short Bag 4) retrieves the m-trip profile information for
a user input cycle and finds the subset of m-trips which best
represent non-FTP operation. This logic. is laid out as follows:

(1). A target "non-FTP" spd/acl surface is generated from the
difference between the composite "All Driving" surface
and the LAG surface (CFRQT.DAT - LA4FRQ.DAT).

(2). Two subset arrays are set up: Non-FTP and Quasi-FTP

(3). The m-trips at the beginning of the input cycle which are
designated as start m-trips are placed into the
Quasi-FTP array. ‘

(4). ALL remaining non-start m-trips are then iteratively
added to the Non-FTP subset IN ALL POSSIBLE COMBINATIONS
and each combination is tested against the non-FTP target
surface. (see subroutine COMBOS).

(5). Combinations of all sizes from 1 to N-MS+1 are
considered (N=# of cycle m-trips, NS=# of start m-trips).

(6). Top NBEST m-trips combinations (based on minimum DIFFSUM)
for Non-FTP and Quasi-FTP are saved and output.

1/0: Unit 1 Cinput) - "ALL Driving" composite surface.
Unit 2 Cinput) - LAS surface.
Unit 3 (input) - Selected M-trips & goodness stats file.

1
2
3
Unit 4 Cinput) M-trips profile file (binary).
Unit 5 (output) - non-FTP surface.
Unit 6 (output) - Listing of the best m-trip combinations
in the Non-FTP subset.
7 (output) - Best Short Bag 4 spd/acl surfaces.
7 (output) - Best Long Bag 4 spd/acl target surfaces.

Unit
Unit

Author: Tom Cartson
Date: = 5/4/93

aeanAAAAAANAAAAAANMAAAAAANAAAAAAAAARAAAAAAAAA

Cc

c

c Set run size. MM ----> Max # of m-trips allowed in a cycle.

c MS ----> Max # of start m-trips allowed in a cycle.
c "  NBST --> # of "best" short bag 4 combos to output.
c NMAX --> # of total m-trip combinations allowed.

c

PARAMETER (MM = 25, MS = 10, NBST = 10, NMAX = 5000)

°

CHARACTER TYPE(MM), TYPES(MS)

CHARACTER*2 CNUM

CHARACTER*14 MTRIPIO(HM), KTRIPID, MTRIPIDS(MS)
CHARACTER*25 CYCFILE, B4SFILE, B4TFILE

INTEGER*2 MCNT(MM,-20:20,0:20), KTIME, ITIMES(MS), MTRPS(MS), KK,
+ ITIME(MM), KCNT(-20:20,0:20), MTRP(MM),

+ LISTBST(NBST ,MM)

INTEGER*4 IREC(MM), KREC, IRECS(MS), KOMBOS(MM,NMAX)

REAL SPD_MEAN(MM), SPD_STO(MM), ACL_STD(MM), DIFFBST(NBST),
+ FFREQ(-20:20,0:20), SPO_MEANS(MS), SPO_MAXS(MS),

+ SPD_MAX(MM), NFFREQ(-20:20,0:20), TIMEBST(NBST),

+ TRREQ(-20:20,0:20), B4S(-20:20,0:20), B4L(-20:20,0:20),
+ B4T(-20:20,0:20), B4SBST(-20:20,0:20,NBST),

+ BGTBST(-20:20,0:20,NBST)

DATA DIFFBST / NBST*999. /

OPEN (UNIT=1,
OPEN (UNIT=2,
OPEN (UNIT=3,
OPEN (UNIT=4, STATUS=/OLD’, RECL=1760, FORM='UNFORMATTED! )
OPEN (UNIT=5, STATUS=/NEW’, CARRIAGECONTROL=’LIST’)
OPEN (UNIT=6, STATUS='NEW’, CARRIAGECONTROL='LIST‘)

Input required data.

Begin execution


PROGRAM FINOBEST

FINDBEST reads a VMS directory listing of drive cycle files and
finds the best cycles based on minimum DIFFSUM. The user inputs
the number of cycles to be listed. The program can scan up-to
10,000 files.

1/0: Unit 1 Cimput) - Text file directory listing of the cycles
to be scanned. The text file is created
in batch driver procedure FINDBEST.COM.

Unit 2 (input) - The candidate cycle files.
Unit 3 (output) - Ranked list of top cycles. Stops/min
also computed ans printed for top cycles.

Author: Tom Carlson
Date: 9/23/92

geenenananaaaaAaana

CHARACTER*6 CDUMMY, METHOD
CHARACTER*20 CYCFILE(10000)
CHARACTER*80 OUTFILE, TITLE, CYCNAME

INTEGER*2 HTRIPS(10000), IPNT(10000), STRIPS(10000)

REAL CYCTIME(10000), CYCSPD(10000), DIFFSUM(10000), STOPS(10000),
+ STIME(10000), MAXSPD( 10000)

Prompt user for number of top cycles to be ranked and printed.

WRITE (*, 10)

10 FORMAT (/1X, ‘Enter number of "best" cycles to find:')
READ (*, *) NBEST
WRITE (*, 20)

20 FORMAT (/1X, ‘Enter output filename:’)
READ (*, 30) OUTFILE

30 FORMAT (A)
WRITE (*, 40)

40 FORMAT (/1X, ‘Enter run title (up to 80 chars):')
READ (*, 30) TITLE

c
c Open CYCLELIST file which contains the directory listing of drive
c cycles to be processed. Output file (unit 3) opened here also.
c
OPEN (UNIT=1, FILE=/CYCLELIST.TXT’, STATUS=/OLD’)
OPEN CUNT FILESOUTFILE, STATUS=‘NEW’, CARRIAGECONTROL=/LIST’,
+ RECORDTYPE=/ VARIABLE! )
c
c
c ame List loop (100).
Coneee nen ee eee en sence eee, eneeeeeeseeeeees eeeeee
c
c Read CYCLELIST one record (cycle filename) at a time to get the
C "current" cycle file to be scanned.
c

100 IFILE = [FILE + 1
READ (1, 110, END=300, ERR=100) CYCFILECIFILE)
110 FORMAT (A)

c Open current cycle file (unit 2) and read METHOD in first record.

CYCNAME = /[.CYCLES]’ // CYCFILECIFILE)
OPEN (UNI FILE=CYCNAME, STATUS=/OLD’)
READ (2, 190) METHOD

190 FORMAT (5X, A6//////)

Now read current cycle file, scanning for ‘__' record.
Cycle summary statistics data follow the ‘__’ Line.

aene

200 READ (2, 201) CDUMMY
201 FORMAT (49x, A6)

TF (COUMMY .EQ. ” *) GO TO 210
READ (COUMMY, FMT='(F6.2)’) SPDMAX
IF (SPDMAX .GT. MAXSPOCIFILE)) MAXSPD(IFILE) = SPOMAX

A-94


distribution of the microtrips at the beginning of each trip to it.
Output consists of a file of DIFFSUMS by trip ID which is later sorted
to find the best start microtrips. GETSTART rejects start trips that
have less than 15 seconds of initial idle or contain long microtrips
that terminate after 5 minutes from trip start.

External Files

LUN 1/0? File Description

1 Input Start Target SAFD File

2 Input Start Trace File

3 Output Start DIFFSUMS by Trip ID File

LA4SURE (FORTRAN, Utility-Unlisted)

This is a quick program used to generate the comma delimited, "LA4" SAFD
file from the LA~4 speed vs. time driving trace.

External Files

LUN 1/0? File Description
1 Input La-4 Speed vs. Time Driving Trace File
2 Output LA4 SAFD File

MAKE_CYCLE (FORTRAN, Composite Cycle Selection)

The MAKE CYCLE program is a short reformatting program that inputs a
speed/time driving cycle trace "PRN" file created by the GETCYCLE
program and converts it into a VEHSIM-ready "Driving Schedule" file.

External Files

LUN 1/0? File Description
1 Input Speed/Time Cycle Trace "PRN" File
2 Output VEHSIM-ready Driving Schedule File

Prompted Input

Driving Cycle Trace PRN filename
VEHSIM part name
VEHSIM Driving Schedule filename

MAKETBL (FORTRAN, Utility-Unlisted)

MAKETBL is a short program used to reformat comma-delimited SAFD files
into two-way tabular form called a tabular "Watson Plot" (velocity-
acceleration probability density function). Speed intervals are by
column and acceleration intervals by row. Each element in the output

-19-


External Files

LUN 1/0? File Description

1 Input Any SAFD “Target Distribution" File

2 Input Any SAFD “Candidate Distribution" File
3 Output Candidate - Target SAFD File

FINDBEST (FORTRAN, Data Preparation)

The program FINDBEST reads a directory listing of driving cycle files
and finds the best cycles based on the DIFFSUM statistic. (DIFFSUM is
the summed absolute difference between the cycle SAFD and target SAFD.)
The directory listing file contains the ID names of each candidate drive
cycle to be evaluated (one filename per record). From this input cycle
ID list, FINDBEST retrieves cycle statistics from the Cycle Summary File
for each cycle. The user inputs the number of "best" cycles to be
output. The output file is a ranked list (by increasing DIFFSUM) of the
top cycles. The program is dimensioned to scan up to 10,000 cycles per
run.

External Files

LUN 1/0? File Description

1 Input Listing of candidate cycle ID names
2 Input Candidate Cycle Summary Files

3 Output Ranked “best" cycles list

Prompted Input

— Number of "best" cycles to list
Output (ranked cycle list) filename
- Run title (appears at top of output list)

GETBALT sas, Data Preparation)

GETBALT is a short SAS program which is used to convert the Instrumented
Vehicle (IV) Database (received as SAS-dataset files) into ASCII files.
The program accesses 2 of the 4 IV datasets, VEHS and OPNS and filters
and outputs Baltimore-only driving records (given by vehicle ID in the
VEHS dataset) by VIN-matched merging of VEHS and OPNS records.

External Files

FILEREF 1/02 File Description

RAD. VEHS Input Instr. Vehicle VEHS File (SAS—dataset)
RAD.OPNS Input Instr. Vehicle OPNS File (SAS—dataset)
DRIVDAT Output Baltimore Driving Database File (ASCII)

-14-


3. SOFTWARE OVERVIEW

This section provides an overview of the software programs developed and
used to construct driving cycles. A series of flow charts are presented
to illustrate key programs and data flow. Individual program
descriptions for all programs are given in Section 4.

Nearly 40 separate programs were written to perform cycle selection and
development. Over 90% of these are written in VAX/VMS—FORTRAN (Version
6.0). The other non—FORTRAN programs are simple, short programs written
in either SAS or VMS DCL (VAX operating system command language) that
can easily be re-coded in another language on a non—-VAX/VMS computer
system.

The programs (and their associated data files) were organized into four
separate phases:

(1). Data Preparation ~ Organization, consistency checking,
reformatting and combining of Instrumented Vehicle and Chase
Car driving databases;

(2). Start Cycle Selection — Evaluation and selection of the most
representative initial (i.e., start) segments of each trip
in the combined Baltimore/Los Angeles database;

(3). Composite Cycle Selection - Generation and evaluation of
candidate "Composite" driving cycles representing all
driving; and

(4). Bag 4/Remainder Cycle Selection - Generation and selection
of additional candidate "Bag-4" and "Remainder" cycles
representing "Outside FIP" and "All Driving minus Bag 4"
-travel distributions, respectively.

Summaries of the key programs and data flow in each of these four phases

are presented in the following sub-sections. A key to symbols and
notations used in the flow charts is given below.

Flow Chart Key

~ Shaded boxes represent programs. The language in which
the program was written is given in
parentheses.

- Circled numbers indicate FORTRAN logical unit numbers

associated with the data file beside which

=3-


BACL(1, ISPD) = 11 + (2 - SUMIL) / (SUM1 - SUMIL)
ELSE

BACL(1,1SPD) = 11

END IF

TF (SUM2 - SUM2L .NE. 0.0) THEN -
BACL(2,I1SPD) = 12 - (Z - SUM2L) / (SUM2 - SUM2L
ELSE

BACL(2,1SPO) = 12

END IF

END IF
750 CONTINUE
760 13 = 10 +1

D0 762 ISPD = 20,0,-1
IF (SPDSUM(ISPD) .GT. Z) THEN
ISPDO = ISPD + 1
GO TO 763
END IF
762 CONTINUE

C Envelope locations determined. Output to unit 15.
763 DO 790 IREG = 1,2

WRITE (15, 665) 13
765 FORMAT (14, ' 0%)

DO 780 ISPD = 1, 10
SPOBIN = ISPD * 5
ACLBIN = BACL(IREG, ISPD)
WRITE (15, 770) ACLBIN, SPOBIN
770 FORMAT (F4.1, 14)
780 CONTINUE

SPDBIN = 10 * (ISPDO - 1 - (2 - SPDSUM(ISPDO)) /

+ (SPDSUM(ISPDO-1) - SPDSUM(ISPDO))) + 0.5
WRITE (15, 785) SPOBIN
785 FORMAT ( 0.0’, 14)

790 CONTINUE
Cc

c Create run-specific SURFER command files from the "templates"

c input into the CMDS array and output to units 16-23.
Greene neon sence ne ec eee eeeecneeee seen ec eseeeecescee!

DO 850 I
DO 850 u
LUN = 15

+o

GO TO (810, 820) I
c GRID module command files.

810 LG = INDEX (GROFILECJ), 4°) - 1
Us = INDEX (SURFILEGJ), 4) - 1
CMDS(I,14) = ‘groname="* // GROFILECJ)(1:LG) // 1"
CMDS(I,73) = ‘griname="* // SURFILECJ)(1:LS) // 1""

DO 815 LINE = 1,NLCI)

WRITE (LUN, 812) CMDS(T,LINE)
812 FORMAT (ASS)
815 CONTINUE

GO TO 850
c SURF module command files.
820 LG = INDEX (GRDFILE(J), ' 4) - 1

CMDS(I,12) = ‘inmame="" // GRDFILECJ)(1:LG) // 1"!
CMDS(1,35) = ‘titstr="! // TITLE(I) // 1"

IF (J «LE. 2) THEN

LB = INDEX (BLNFILE(J), ' ’) - 1

CMDS(1,98) = ‘xyname="" // BLNFILECJ)(1:LB) // ‘"!
ELSE

A-106


PROGRAM GETSTART

GETRIPS reads the "microtrips profiles" files and the target spd/
act bins "surface" file for the Baltimore cold and hot trips files
and selects the trip start (and its linked microtrips) which best
match the target surface.

1/0: Unit 1 (input) - Spd/acl target "surface" for first 4 min
of sec-by-sec Balt driving; includes
% and # bin frequencies.
Unit 2 (input) - Sec-by-sec drive start data.
Unit 3 (output) - Tisting of "goodness" by trip.

Author: Tom Carson
Date: 4/21/93

4/23/92 - Modified code to reject start trips with either initial
idle < 15 seconds or with a trailing microtrip from
t=240 sec which continued beyond t=300 sec. (TRC)

gaeananaaanAaaaaanaanaa

CHARACTER*12 TRIPID, LTRIPID
CHARACTER*14 MTRIPID

INTEGER START_TIME, TRIP_TIME, CRUS
REAL FREQ(-20:20,0:20), TFREQ(-20:20,0:20)

DATA START_TIME /240/, MOST_TIME /300/, DIFFMIN /9999./,
+ MIN_IDLE /15/

OPEN (UNIT=2, STATUS=/OLD’)
OPEN (UNIT=3, STATUS='NEW’, CARRIAGECONTROL='LIST’)

c Read in target start surface (unit 1).
c

100 READ (1, *, END=150) IACL, ISPD, NCNT, PCT
TFREQ(IACL, ISPD) = PCT / 100
INT = INT +1
Go To 100

c Write output file header.

150 WRITE (3, 160)

160 FORMAT (’Trip # Trip ID Start Diff Start Time (sec)’,
+ 4 Initial Idle (sec)’/
+ fee - eee teen ee tee e ene e eee eeee ,

+ .

Main

processing lo:

Read in sec-by-sec start data file (EPABLT1.DAT).

200 READ (2, 201, END=500) TRIPID, ISEC, SPD, ACL, IS, IA
201 FORMAT (A12, 16, 2F6.2, 213)

IN2 = IN2 +1
c
C First thing to check after a record read is if it is the beginning
C of new trip (ISEC = 0). If so, go to "Compute Trip Fit" section.
c
IF CISEC .£0. 0) GO TO 250
c
C Skip further summing of this record if the running trip time
c exceeds the defined start time. However, still increment the
c nominal time until terminating microtrip detected (MFLAG = 1)
c

IF (ISEC .GT. START_TIME .AND. MFLAG .EQ. 0) THEN

Detect when microtrip has ended (MFLAG = 1).

ana

A-84


GO TO 250
END IF

260 CONTINUE
c

250 BINCNT(IS,IA) = BINCNT(IS,IA) + 1
c

300 CONTINUE

Bin counting complete. Print spd/acl counts and percentages for
each output file (cold, hot, stabilized).

naan

0 320 IACL = -20,20
DO 320 ISPD = 0,20
BINPCTCISPD,IACL) = BINCNT(ISPD,IACL) * 100. / N
WRITE (2, 315) IACL, ISPD, BINCNTCISPD,IACL), BINPCT(ISPD, IACL)
315 FORMAT (2¢13,/,/), 18, ',/, F10.6)
320 CONTINUE
c
CLOSE (1)
CLOSE (2)

END

A-43


External Files

LUN 1/0? File Description

1 Input Baltimore Stabilized SAFD File

2 Input Los Angeles Stabilized SAFD File

3 Output Balt/LA Combined Stabilized SAFD File

SUBSET (FORTRAN, Data Preparation)

SUBSET generated a randomly selected subset of microtrips from the
Master Microtrips File ("Unformatted" version) and outputs them to a
"Subset" Microtrips file (with the same unformatted records structure).
(This program was written and run in order to pare down the database of
available microtrips for cycle selection to a manageable number based on
Sierra's VAX physical memory limitations.) The user has the option to
choose the size of the subset. The program also ensures that previously
determined "best" start microtrips are not written to the Subset file.

External Files

LUN 1/0? File Description
1 Input Master Microtrips File (Unformatted)
2 Output Subset Microtrips File (Unformatted)

Prompted Input

- Subset size (as a fraction)
- Start microtrip ID

UNF _MTRIPS (FORTRAN, Data Preparation)

This is a simple program that reads and converts the Master Microtrips
File from a formatted ASCII file to an "unformatted" (binary) file.
(The Master Microtrips File was converted to "unformatted" form for
faster retrieval and more efficient disk storage.)

External Files

LUN 1/0? File Description
1 Input Formatted Master Microtrips File
2 Output Unformatted Master Microtrips File

WTDSURF (FORTRAN, Bag 4/Remainder Cycle Selection-Unlisted)

The WIDSURF program computes and outputs a weighted SAFD file from any
number of input SAFD files and weighting factors for each input SAFD.

-24-


Speed and Accel Trace PRN File (excerpt)

1 1 0,00 0,000 0 O
2 1 0.00 0.000 0 Oo
3.1 «0.00 0.000 0 @
4 1 0.00 0.000 0 0
5 1 0.00 0.000 0 Oo
6 1 0.00 0.000 0 O
7 1 0.00 0.000 0 0
8 1 0.00 0.000 0 O
9 1 0.00 0.000 0 O
10 1 0.00 0.000 0 0
11,1 0.00 0.000 0 0
12 1 0.00 0.000 0 O
13,1 0.00 0.000 0 0
14 1 0.00 0.000 0 0
15 1 0.00 0.000 0 0
16 1 0.00 0.000 0 0
17 1 0.00 0.000 0 0
18 1 0.00 0.000 0 O
19 1 0.00 0.000 0 Q@
20 1 0.00 0.000 0 oO
21:1 0.00 0.000 0 0
22 1 0.00 0.000 0 oO
23.1 0.00 0.000 Oo 0
24 1 0.00 0.000 0 O
25 1 0.00 0.000 0 0
26 1 0.00 0.000 0 0
27 1 «0.00 0.000 0 0
28 1 0.00 0.000 0 0
29° 1 +»0.00 0.000 0 O
30 1 «40.00 0.000 0 0
31.1 0.00 0.000 0 0
32.1 0.00 0.000 0 0
33.1 «40.00 0.000 0 0
34 1 0.00 0.000 0 0
35 1 0.00 0.000 0 O
36 1 «0.00 0.000 0 0
37 1 «0.00 0.020 0 oO
38 1 0.02 -0.020 0 0
39 1 «0.00 0.400 0 0
40 1 0.40 2.910 1 3
41 1 3.31 2.660 1 3
42 1 5.97 2.000 2 .2
43.1 7.97 0.690 2 1°
44 1 8.66 1.340 2 1
45 1 10.00 2.440 2 2
46 1 12.44 1.320 3 1
47° 1 13.76 0.980 3 1
48 1 14.74 0.090 3 0
49° 1 146.83 1.790 3 2
50 1 16.62 1.660 4 2


Bag 4/R

Prompted Inputs

+ Output Microtrip
Filename

= Target Time

Figure 4

emainder Cycle Selection Phase

Prompted Inpute

- Output Filename
+ Cycle Time
- # of Seed Mlerotrips,

Prompted Inputa

+ Bag 4 Cycle Summary
Filename

+ Microtrips Filename

+ Output Cycie Filename

Prompted inputs
+ SAFD File and
Weighting Factor,

Pram Statue

Bag 4 Cycle
Summary File

——

{Segment Editing '

‘ Final Bag 4 \
Cycle Trace
File

(run stun

Continued on Next Page

-10-


Sample SAFD File (excerpt)

“1,0, 0., 0.000000
-1, 1, 85261., 1.260847
-1, 2, 45051., 0.666216
-1, 3, 42617., 0.630220
“1, 4, 45028., 0.665885
-1, 5, 56506., 0.806045
“1, 6, 72928., 1.078464
1, 7, 84196., 1.245075
1, 8, 72847., 1.07276
=1, 9, 52070., 0.770014
=1, 10, 34407., 0.508811
+1, 11, 28515., 0.421675
-1, 12, 30927., 0.457348
-1, 13, 29262., 0.432628
-1, 1%, 15483., 0.228970
-1, 15,  4045., 0.059811
-1, 16, 846., 0.012513
-1, 17, 209., 0.003095
-1, 18, 10., 0.000148
“1, 19, 2., 0.000030
-1, 20, 0.; 9.000000
0, 0,1571948., 23.246101
0, 1, 183311., 2.710824
0, 2, 62063., 0.917789
0, 3, 68662., 1.015384
0, %, 79177., 1.170879
0, 5, 119259., 1.763607
0, 6, 202305., 2.991707
0, 7, 273327., 4.041977
0, 8, 255804., 3.782844
0, 9, 192051., 2.840063
0, 10, 134994., 1.996299
0, 11, 123501., 1.826343
0, 12, 179237., 2.650568
0, 13, 180888., 2.674986
0, 14, 95883., 1.417932
0, 15, 28466., 0.420923
0, 16, 4235., 0.062622
0, 17, 367., 0.005429
0, 18, — 61., 0.000902
0, 19, 4., 0.000059
0, 20, 0., 0.000000
4, 0, 22694, 0.335604
1, 1, 52481., 0.776101
1, 2, 42262.) 0.624676
1, 3, 95760., 0.824591
1, 4, 67585., 0.999460
1, 5, 92966., 1.376465
1, 6, 123790., 1.830621
1, 7, 128082., 1.894091
1, 8, 100224., 1.482116
1, 9, 66130., 0.948365
1,10, 41544., 0.614357
1, 11, 33702., 0.498393
4, 12, 32319., 0.477929
1, 13, 28060., 0.414948
1, 14, 12576., 0.185978
1, 15,  3351., 0.049558
1, 16, —619., 0.009147
1,17, 114, 0.001682
1,18, 12., 0.000177
1, 19, 4., 0.000059
1, 20, 0., 0.000000


SPOSUM(2,IACL) = SPDSUM(2,IACL) + ABS (PCTDIF(IACL,ISPD))
320 CONTINUE

DO 325 ISPD = 0,20

DO 325 IACL = -20,20

ACLSUM(1, [SPD ACLSUM(1,{SPD) + PCTDIFCIACL, ISPD)
ACLSUM(2, ISPD) = ACLSUM(2,I1SPD) + ABS (PCTDIF(IACL,ISPD))
TOTNET = TOTNET + PCTOIFCIACL, ISPD)

TOTABS = TOTABS + ABS (PCTDIFCIACL,1ISPD))

325 CONTINUE
c
Creeeeeeeneee weeeeeeee eeeeee eevee cetecensescenncesesescereseeseceenere
c : +
c Output results in tabular form, echo input surfaces first.
c

WRITE (3, 330) TITLEC1:LL) .

330 FORMAT (///<ILEN>X,A//68X,'Speed/Accel Frequency Distribution (%)!
¢ /1/78X, *SPO BIN (mph)’)
WRITE (3, 340) (ISPD*5, ISPD = 0,20)

340 FORMAT (166X,/ Net Abs!/
+ TACL BIN- (mph/s)!, 4X, 14, 3X, 20(/<!,13,3X), 2¢" _ Totals’)/
+ lenses seeceeeeee VAX, Parent, BK, 2001 = 3K), ACF eee eee)
DO 350 IACL = -20,20
WRITE (3, 345) IACL, (PCTDIFCIACL,ISPD), ISPD = 0,20),
+ (SPDSUM(I,IACL), I = 1,2)

345 FORMAT (6X, 14, 6X, 21F7.3, 5X, F7.3, 2X, F7.3)

350 CONTINUE

c

WRITE (3, 355) (ACLSUM(1,1SPD), ISPD = 0,20), TOTNET,
+ CACLSUM(2, ISPD), ISPD = 0,20), TOTABS

355 FORMAT (/3X, ‘Net Totals’, 3X, 21F7.3,°5X, F7.3, 2X/
+ 3X, ‘Abs Totals’, 3X, 21F7.3, 14X, F7.3)
WRITE (3, 360) N

360 FORMAT (/1X, ‘Cycle Time (sec): ', 14)

sToP

‘END


50 ISTAT = LIBSOATE_TIME (CTIME)
READ (CTIME, FMT=/(11X,4C1X,12))/) HH, MM, SS, DD

Create seed value for random series. Seed ranges from 0 to 10**8.
Wake seed odd per VAX-FORTRAN recommendations (FORTRAN Language
Reference Manual V 5.0, pg. 0-49).

aaa

ISEED = DD * 1000000 + SS * 16666.67 + MM * 166.67 + HH * 4.1667
IR = MOD (ISEED, 2)
TF CIR .€Q. 0) ISEED = ISEED + 1

c: =
c Top-level loop 500 iterates the selection process to generate

c a number of random cycles (NCYCLES). Each cycle is written to a
© separate output file on unit 3.

cesses: : sscezeesess
c
MTRIPS = IN2
DO 500 ILOOP = 1,NCYCLES
c
C Initialize cyete sums and counter.
c
NTRP = 0
TRIPTIME = 0.0
STINE = 0.0
csPD = 0.0
Oo 80 TACL 20,20
dO 80 ISPD = 0, 2
TCNTC(IACL, ISPD) =
80 CONTINUE
c
TPRD = INDEX (OUTFILE, ‘.‘)
TEND = INDEX (OUTFILE, ' /) - 1
WRITE (CLOOP, FMT=/(13.3)') ILOOP.
QUTNAME = OUTFILE(1:IPRD-1) // ‘-' // CLOOP // OUTFILE(IPRD:IEND)
TOUT = INDEX (OUTNAME, ‘ ') - 1
c
© Open "current" filename.
c
OPEN (UNIT=3, FILE=OUTNAME, STATUS=‘NEW’, CARRIAGECONTROL=‘LIST’,
+ RECORDTYPE=/ VARIABLE’)
c

C Write output file header.
c

RTIME = TIMELIMIT / 60.0

BTIME = TIMERAN / 60.0

WRITE (3, 90) RTIME, ISEED, BTIME, OUTNAME(1:10UT), START_TIME
90 FORMAT (5X, ‘HYBRID Trip Selection Method’, 154,

+ "Target Time: ‘, F5.2, ° min’/
+ 13X, ‘Ist Seed: ’, 19, 154,
+ ‘ Base Time: ‘, F5.2, / min’/
+ 13X, ‘Filename: ', A, 154,
+ ‘ Start Time: /, F5.2, / min’//8X,
+!MTRP INIT TIME AVG SPD MAX SPD STD SPD MAX ACL’
+ (2X, '# ',
+ NO MITRIP ID REC (s) (mph) (mph) (mph) (mph/s)’
+," DIFFSUM!/)
c
c
c +t+++ INITIAL SEED" SECTION = +++++
c +
c
Coveeeeee seeeeee wees seeeee
c "Start" and "Outside FTP" microtrip(s) seeding section. Use input
c “best start and outside FTP microtrips and use the MO, MSTART
c and MOUT "pointers" to extract them.
c wees
c
c START SECTION.
c
c Big loop 150 adds sequentially selected M-trips till all start
c M-trips read and processed (NTRP = MSTART).
c

DO 150 M = MO, MO+MSTART-1

Add acl/spd bin counts for current microtrip to "current" count
array CCNT and express as frequency. Then, compute integrated
difference between the population surface PFREQ and the best

A-72


Sorted Start DIFFSUMS File (excerpt)

Trip # Trip ID Start Diff Start Time (sec) Initial Idle (sec)
778 07292031404 0.464825 275 36
4402 14392031201 0.481371 296 26
2369 09892031101 0.495158 281 28
2404 846792032805 0.519660" 263 30
4826 —_b12392031801 0.520682 261 37
2865, 06692031601 0.521281 292 28
3740 620892031401 0.523204 283 63
3321 B31792032801 0.524827 255 38
723 08692031503 0.530022 234 18
1002 844192040103 0.534939 259 37
2190 05092031511 0.537994 290 15
521 13092031603 0.551134 241 18
3779 = 41092032303 §=—-0.558891 248 19
3514 b21092031901 0.560766 253 45
969 844192032402 0.566265 241 17
4883 b24392032001 0.567987 296 15
4595  B32592032704 =: 0.568013 289 . 64
3057 03792031405 0.568537 260 68
1481 631492032105 0.569526 279 Kr
2924 37592032601 0.570456 269 20
695 08692030906 0.571474 263 47
2695 23692031701 0.571717 277 29
2894 624792032301 0.572722 262 38
120 816492031202 0.573831 253 20
3794 41092032501 0.578166 272 19
3945 B39592032303 0.583963 257 16
2530 b29792031901 0.584501 265 23
2891 24792031905, 0.584670 283 24
4154 46892032708 0.585328, 285 61
3501 21092031601 0.586425 266 . 33
2539 29792032104 0.586927 297 28
2177 05092031307, 0.591083 241 23
1033 601992030506 0.595122 298 57
4123 27592032403 0.597135 270 15
128 816492031402 0.599864 201 3
1810 833892032602 0.603924 262 68
497 13092031106 0.605395, 261 60
3976 839592032805 0.606008 222 37
3216 843692040202 0.606599 271 16
951 31592032703, 0.608864 230 39
3942 B39592032202 0.610940 245 15
4765 12392031201 0.610959 254 33
2874 24792031701 0.611120 259 59
3229 01092030603 0.613501 241 19
2556 29792032504 0.615276 290 7
1708 844792032701 0.617385 290 29
1692 13992031804 0.617564 172 25
3128 841992032404 0.617992 243 16


enaan

ane

e000

320

100

DIFF(4) = DIFF(4) + ABS (CFREQ(IACL,[SPD) - PFREQCIACL,ISPD))
END IF
CONTINUE

Now check current DIFF against "top-NBST" array. If current
DIFF is smaller than any element in the DIFF8ST array, push it
in and shift the subsequent elements, moving the last one out.

DO 120 K = 1,NBST

IF (DEFF(1) .LT. DIFFBST(K,1)) THEN
MOVE = K —

OK, smaller DIFFS found -- do the element shift first.

D0 100 L = NBST,MOVE+t,-1
MTRPBST(L MTRPBST(L-1)
IDBST(L) = IDBST(L-1)
ITIMEBST(L) = ITIMEBST(L-1)
IRECBST(L’ TRECBST(L-1)
ASPDBST(L) = ASPDBST(L-1)
TSPDBST(L) = TSPOBST(L-1)
SSPOBST(L) = SSPOBST(L-1)
TACLBST(L) = TACLBST(L~1)

0 100 11 = 1,4

DIFFBST(L,II) = DIFFBST(L-1,11)
CONTINUE

And now the "push".

MTRPBST(MOVE) = I
IDBST(MOVE) = MTRIPIO(I)
ITIMEBST(MOVE) = ITIME(1)

IRECBST(MOVE) = IREC(I)
ASPOBST (MOVE) = SPO_MEAN(1)
TSPDBST (MOVE) = SPD_MAX(I)
SSPDBST(MOVE) = SPD_STD(I)
TACLBST(MOVE) = ACL_MAX(1)

00 119 11 = 1,4
DIFFBST(MOVE, 11) = DIFFCII)

119 CONTINUE

GO TO 350
END IF

120 CONTINUE

350 CONTINUE

Print statistics for best individual M-trips.

DO 400 M = 1, NBST

WRITE (3, 370) M, MTRPBST(M), IDBST(M), IRECBST(M), ITIMEBST(M),
+ ASPDBST(M), TSPDBST(M), SSPDBST(M), TACLBST(M),
+ (DIFFBST(M,II), 11 = 1,4)

370 FORMAT (13, 1X, ‘I’, 1X, 15, 1X, Al6, 1X, 17, 1X, 14,

+ 3CIX, F7.2), 1X, F7.3, 4C1X, F9.5))

400 CONTINUE

CLOSE (3)

500 CONTINUE
c

WRITE (*, 510) MTRIPS, NCYCLES

510 FORMAT (/! Cycle generation complete: '/

+ 1 M-Trips Input ..
+ * Cycles Generated .

~ 4, WSS
~ 4, 1S/)

END

A-65


Figure 4 continued...

Bag 4 / Remainder Cycle Selection Phase
(continued)

Continued from Previous Page

Prompted Inputs

- Cycle Series
= Cycle Times
- Start Tip #

-# of Cycles

Run Status

Master or Any
Subset Microtripe
File Bin

Prompted Inputs:
- Selected Remainder Cycle ID
+ Microtrips Filename

- Output Cycle Filename

Selected
Remainder Cycle
Trace "PRN’ File

-1l-


TIMERAN = BTIME * 60
WRITE (*, 6)

6 FORMAT (/1X, ‘Enter “best” start trip number:’)
READ (*, *) MO -
WRITE (*, 7)

7 FORMAT (/1X, ‘Enter its number of M-trips:’)
READ (*, *) MSTART
WRITE C*, 8)

8 FORMAT (/1X, ‘Enter “Outside FIP" trip number:’)
READ (*, *) MOUT
WRITE (*, 9) .

9 FORMAT (/1X, ‘Enter number-of cycles to generate (1-999):')
READ (*, *) NCYCLES

TIMELIMIT = RTIME * 60

c
c Read in total surface (unit 1).
c
10 READ (1,.*, END=20) IACL, ISPD, NFREQ, PCT
PFREQCIACL, ISPD) = PCT / 100
IN1 = INT +1
GO TO 10
c
c Read in microtrip profiles (unit 2).
c
20 READ (2, END=50) 1, MTRIPID(1), IREC(I), ITIME(I),
+ SPD_MEAN(I), SPO_MAX(I), SPD_STD(I), ACL_MAX(I),
+ COMCNTCI,IACL, ISPD), ISPO=0,20), IACL=-20,20)
C 30 FORMAT (15, 1X,A14, 1X, 17, 1X,15, 3C1X, F7.2),1X, F7.3,1X, 861(14))
IN2 = IN2 +1
GO To 20

Input completed. Begin microtrip selection using Hybrid Method.

This code section performs selection of microtrips using the

“Hybrid! approach (combination of Random + Best Incremental).
The Kybrid method adds an initial "base" of microtrips to the
start "seed" of microtrips using random selection. Additional
microtrips are then added with the Best Incremental technique.

Step 1 - Generate pseudo-random seed value from current system
time.

SEED = DD x 1000000 + SS x 16667 + MM x 167 + HH x 4.17

where DD = hundredths of seconds
= seconds
MM = minutes
HH = hours

Step 2 - Generate a series of randomly selected microtrips from
the population and add these to the start microtrip "seed" until
the total Linked microtrip time exceeds a user-specified subset
TIMERAN of the target time limit TIMELIMIT. Compute match of each
randomly added microtrip to the population surface. This set of
microtrips forms the "base" sample.

Step 3 - Pick the "best" single microtrip of those remaining.
"Best" is defined as the minimum integrated difference between the
overall surface and the base + incremental microtrip(s).

Step 4 - Iteratively test the remaining microtrips and add the one
which coupled with the previously selected trip(s), best matches
the overall surface. This incremental approach is repeated until
the total Linked microtrip time exceeds target time TIMELIMIT.

1/0: Unit 3 (output) - Selected microtrips and "goodness" stats.

Author: Tom Carlson
Date: 4/23/93

NON ANMAAAAAAAAADAAAAAAAAAAAAANAAANANAAAAAANAAAAAD

Get system time. Call to LIBSDATE_TIME returns 23-byte character
string which contains hour, minute, second and decimal: fraction.

A-71

eo


gaananAAAAAAMAAAAAAGAAD

PROGRAM GETRMNDS

GETRMNDS reads the "microtrips profiles" files and the target spd/
acl composite "surface" file for the Baltimore & LA92 data

and selects a subset of linked microtrips which best match the
target speed/accel surface using the Hybrid Method.

GETRNMOS is a modified version of the GETRMND program which uses
the CFRQR.DAT SAFD file as its target surface.

CFRQR =° CFRQ Stabilized - LBag4-4 x WtFac
where WtFac = 0.2067
1/0: Unit 1 Cinput) - Spd/act target composite “surface” for
sec-by-sec drive cycle data (Balt/LA92).

Unit 2 (input) - Microtrip profile statistics.
Unit 3 (output) - Selected microtrips and "goodness" stats.

Author: Tom Carlson
Date: 7/14/93

PARAMETER (MNUM=7283)

CHARACTER*3 CLOOP
CHARACTER*14 MTRIPIOCMNUM)
CHARACTER*23 CTIME
CHARACTER*80 OUTFILE, OUTNAME

INTEGER*2 HH, MM, SS, DD, MCNT(MNUM, -20:20,0:20),
+ ITIMECHNUM), My MO, I
INTEGER*4 IREC(MNUM), TRIPLIST(1000)

REAL SPD_MEAN(MNUM), SPD_STD(MNUM), ACL_MAX(MNUM),
+ SPD_MAX(MNUM), CFREQ(-20:20,0:20), TRIPDIFF(1000),
+ CCNT(-20:20,0:20), PFREQ(-20:20,0:20), TCNT(-20:20,0:20)

DATA START_TIME /4.0/

Prompt user for output filename and cycle control parameters.

WRITE (*, 2)
2 FORMAT (/1X, ‘Enter output (selected trips & stats) filename:’)
READ (*, 3) OUTFILE
3 FORMAT (A)
WRITE (*, 4)
4 FORMAT (/1X, ‘Enter target cycle time, including start (min):’)
READ (*, *) RTIME
WRITE (*, 5)
5 FORMAT (/1X, ‘Enter target random "base" cycle time (min):/)
READ (*, *) BTIME
TIMERAN = BTIME * 60
WRITE (*, 6)
6 FORMAT (/1X, ‘Enter "best" start trip number:’)
READ (*, *) MO
WRITE (*, 7)
7 FORMAT (/1X, ‘Enter its number of M-trips:/)
READ (*, *) MSTART

WRITE (*, 8)

8 FORMAT (/1X, ‘Enter number of cycles to generate (1-999):')
READ (*, *) NCYCLES
TIMELIMIT = RTIME * 60

Read in total surface (unit 1).

10 READ (1, *, END=20) IACL, ISPD, NFREQ, PCT
PFREQ(IACL, ISPD) = PCT / 100

A-76


PROGRAM DIFFSURF

A quick program to generate.a spd/acl surface file in "comma-
delimited" format from the difference between two input spd/acl
surface files (first minus second).

Summary of speed & accel bin definitions:

Speed (mph): 0, 0 - <5, 5 - <=10, etc.
Accel (mph/s): -0.5 to 0.5 mph/s = 0
+1.5>= to -0.5 = -1, -2.5>= to -1.5 = -2, ete.
0.5 to 5 = 1, 1.5 to <=2.5 = 2, etc.

1/0: Unit 1 (input) - Spd/acl surface file 1.
unit 2 Cinput) - Spd/acl surface file 2.
Unit 3 (output) - Spd/acl surface file created from
(file 1+ file 2).

Author: Tom Carlson
Date:

06/22/93

nananaAAAAAAAAAAAAADAAA

Cc

c

c

Cc

c

c

c
OPEN
OPEN
OPEN

c

c

c

c

c

c File 1,

c

100 READ (1, *, END=200) IACL, ISPD, RBIN, PCT
FREQICIACL, ISPD) = PCT
INT = INT +1
GO TO 100

Cc
c File 2.
c

200 READ (2, *, END=300) IACL, ISPD, RBIN, PCT
FREQ2(IACL, ISPD) = PCT
IN2 = IN2 +1
GO TO 200

c Now compute difference surface: filel - file2 and output.

300 DO 400 TACL
00 400 IsPD = 0,20
DFREQ(IACL, ISPD) = FREQICIACL, ISPD) - FREQ2CIACL,ISPD)
WRITE (3, 350) IACL, ISPD, IDUM, DFREQ(IACL, ISPD)

350 FORMAT (2(13,',’), 18, ',’, F10.6)

400 CONTINUE

A-92


eanannAanAaAaAA

PROGRAM UNF_MTRIPS.

This program inputs a formatted "Microtrips Profile" file and
outputs the records to a sequential unformatted file. This code
was written and the GETSTAB/GETHBRD program were modified to
accomodate the -50 MB addressing of the Composite Baltimore

and LA92 microtrip data.

Author: Tom Carlson
Date: 04/24/93

CHARACTER*14 MTRIPID

INTEGER*2 ITIME, FREQ(-20:20,0:20), M, N
INTEGER*4 IREC

REAL SPD_MEAN, SPD_STD, ACL_MAX, SPD_MAX

LO’, RECL=3512)
='NEW!, FORM=‘UNFORMATTED’, RECL=1760)

Crean cence eee n eee e ee eeeeee eeeeeee ee seer eee ee nee een ee ee ee, seneeeeeees eee

ene

eano

00 SO ISKIP = 1,3
READ (1, FMT=/()/)
50 CONTINUE

Sequential formatted input, one rec at a time.

100 READ (1, 110, END=200) M, MTRIPID, IREC, ITIME, SPD_MEAN,

+ SPD_MAX, SPD_STD, ACL_MAX,

+ (CFREQCIACL, ISPD), ISPO = 0,20), IACL=-20,20)
140 FORMAT (15,, 1X, A14, 1X, 17, 1X, 15, 3¢1X,F7.2), 1X, F7.3,

+ 1X, 861(14))

NSN+

IF (M .NE. N) THEN
WRITE (*, 120) M,N
120 FORMAT (/' M-TRIP NUMBER MISMATCH: M =
GO TO 300
END IF

WRITE (2) M, MTRIPID, IREC, ITIME, SPD_MEAN, SPO_MAX,
+ — SPD_STD, ACL_MAX, ((FREQCIACL, ISPD), ISPD=0,20), IACL=-20,20)

GO TO 100

Sequential input and binary output complete. Print short
rec counts summary and end.

200 WRITE (*, 210) N
210 FORMAT (/! Binary M-trip Profile file complete: ',15,
+ ' records’/)

300 CONTINUE
END

A-39


PROGRAM MAKETBL

A quick program to generate tabular "Watson plots" from
input spd/act surface files’ in "comma-delimited" format.

Summary of speed & accel bin definitions:

Speed (mph): 0, O- <=5,5- $1, etc.
Accel(mph/s): -0.5 to 0.
+1,5>= to
0.5 to <= 1.5

Author: Tom Carlson
Date: 05/10/93

eaneanaAaaaAaAAnaA|A

CHARACTER*80 FNAME

REAL PCTBIN(-20:20,0:20), SPDSUM(-20:20), ACLSUM(0:20)

OPEN (UNIT=1, STATUS=/OLD’)
, CARRIAGECONTROL=/LIST', STATUS='NEW!, RECL=175,
+ RECORDTYPE=' VARIABLE! )

Conceee en ec eens ee sence eee eeee, a eceteeceeeseeeeee eee aeeeeeeee, aeceeee scene
c Begin Processing.
c

c
C. Prompt for table title.
c

WRITE (*, 50)

SO FORMAT (/1X, ‘Enter title for spd/acl surface:’)
READ (*, 60) FNAME

60 FORMAT (A80)

c
c
c Read input mode surface file (unit 1).
c
100 READ (1, *, END=110) IACL, ISPD, DUMMY, PCTBINCIACL, ISPD)
TOT = TOT + PCTBINCIACL, ISPD)
GO TO 100
c Compute row (across spd) and column (across acl) totals.
c
110 Do 120 IAcL = -20,20
DO 120 ISPD = 0,20
SPDSUMCIACL) = SPDSUMCIACL) + PCTBIN(IACL, ISPD)
120 CONTINUE
DO 125 ISPD = 0,20
Do 125 IACL = -20,20
ACLSUM(ISPD) = ACLSUM(ISPO) + PCTBINCIACL, ISPD)
125 CONTINUE
c
c.
c
c Output results in tabular form, echo input surfaces first.
c :

WRITE (2, 130) FNAME ,
130 FORMAT (///65X, A80//60X, /Speed/Accel’ Frequency Distribution (%)’
+ //170X, *SPD BIN (mph)! /)
WRITE (2, 140) (ISPD*5, ISPD = 0,20)
140 FORMAT C/ACL BIN (mph/s)!, 4X, 14, 3X, 20¢1<",13,3X), * Tovals//
Fo Paste ee eres ee ees 14K, Patent, BX, 20¢==2-! 3K),

neeeeel

00 150 IACL = -20,20

WRITE (2, 145) IACL, (PCTBINCIACL, ISPD), ISPD = 0,20),SPDSUM(IACL)
145 FORMAT (6X, 14, 6X, 21F7.3, 4X, 7.3)
150 CONTINUE

WRITE (2, 155) (ACLSUM(ISPD), SPO = 0,20), TOT
155 FORMAT (/5X, ‘Totals’, 5X, 21F7.3, 4X, F7.3)

END

A-45


Prompted Input

- Starting record number
- Number of seconds (segments)

GETOUT75 (FORTRAN, Bag 4/Remainder Cycle Selection)

The program GETOUT75 reads a Microtrip file and the target speed/accel
"Outside FTP" SAFD file and finds the 75 microtrips that individually
"best" match the target speed/accel distribution, using the "Best
Incremental" microtrip selection method. The "best" statistic is
minimum DIFFSUM.

External Files

LUN 1/0? File Description

1 Input "Outside FIP" SAFD File

2 Input Master or Subset Microtrips File

3 Output Selected best individual microtrips and DIFFSUMS

GETOUTSEED (FORTRAN, Data Preparation)

GETOUTSEED is a modified version of GETOUT75 except the microtrip
selection is "seeded" with the single best microtrip determined from
executing GETOUT75 and then microtrips are added using the “Best
Incremental" microtrips selection method.

External Files

LUN 1/0? File Description

1 Input “Outside FTP" SAFD File

2 Input Master or Subset Microtrips File

3 Output Selected best linked microtrips and DIFFSUMS

GETREST (FORTRAN, Composite Cycle Selection)

The program GETREST reads a Master or Subset Microtrips File and the
target speed/acceleration composite SAFD file and builds and outputs a

series (up to 1000 per run) candidate composite driving cycles using the
“Hybrid” microtrip selection method.

GETREST is a modified version of the GETSTAB program described below in

that it "seeds" each candidate cycle with user-input best start and best
"outside FIP" microtrips determined prior to running GETREST.

-16-


incremental surface CFREQ. (Use abs value of the difference.)

ao

DIFF = 0.0
DO 120 IACL = -20,20
DO 120 ISPD = 0,20
CCNTCIACL, ISPD) = TCNTCIACL, ISPD) + MCNT(M, IACL, ISPD)
CFREQCIACL, ISPD) = CCNTCIACL,ISPO) / (TRIPTIME + ITIME(M))
DIFF = DIFF + ABS (CFREQC(IACL,ISPD) - PFREQCIACL,ISPD)) ~-
TCNT(IACL, ISPD) = TCNT(IACL, ISPD) + MCNT(M, IACL, ISPD)

120 CONTINUE

NTRP = NTRP + 1

TRIPLIST(NTRP) = M
TRIPOIFFCNTRP) = OIFF
TRIPTIME = TRIPTIME + ITIME(M)

C Print statistics for current M-trip.
WRITE (3, 140) NTRP, M, MTRIPIO(M), IREC(M), ITIME(M),SPD_MEAN(M),
+ SPD_MAX(M), SPD_STD(M), ACL_MAX(M), TRIPDIFFCNTRP)
140 FORMAT (13, 1X, 'S’, 1X, 15, 1X, AIS, 1X, 17, 1X, 14,
+ 3CIX, F7.2), 1X, F7.3, 1X, F9.5)

150 CONTINUE
Cc

STIME = TRIPTIME / 60

NST = NTRP
c
c OUTSIDE FIP SECTION.
c

M = MOUT
c
c Add acl/spd bin counts for current microtrip to “currentTM count
c array CCNT and express as frequency. Then, compute integrated
C difference between the population surface PFREQ and the best
c incremental surface CFREQ. (Use abs value of the difference.)
c

DIFF = 0.0
DO 160 IACL = -20,20
DO 160 ISPD = 0,20
CCNTCTACL, ISPD) = TCNTCIACL, ISPD) + MCNT(M, IACL, ISPD)
CFREQ(IACL,ISPD) = CCNT(IACL, ISPD) / (TRIPTIME + ITIME(M))
DIFF = DIFF + ABS (CFREQ(IACL,ISPD) - PFREQ(IACL,1SPD))
TCNTCIACL, ISPD) = TCNTCIACL, ISPD) + MCNT(M, IACL, ISPD)

160 CONTINUE

c
NTRP = NTRP + 1
TRIPLIST(NTRP) = M
TRIPDIFF(NTRP) = DIFF
TRIPTIME = TRIPTIME + ITIME(M)
c Print statistics for current M-trip.

WRITE (3, 170) NTRP, M, MTRIPID(M), IREC(M), ITINE(M),SPD_MEAN(M),

+ SPD_MAX(H), SPD_STD(M), ACL_MAX(M), TRIPOIFF(NTRP)
170 FORMAT (13, 1X, 70", 1X, 15, 1X, Al, 1X, 17, 1X, 14,

+ 3CIX, F7.2), 1X, F7.3, 1X, F9.5)

TF CTRIPTIME .GE. TIMERAN) GO TO 300

c Big loop 200 adds randomly selected microtrips till the total time
c exceeds TIMERAN.
Conc eee en en eet n ee eee ee ee ene eee nance nen e nen eee eee neeee en enee

200 NTRP = NTRP + 1
c
Cc Randomly select a microtrip in the range 1 to MTRIPS.
c

205 XRAN = RAN (ISEED)
IF (XRAN .LT. 1.0) THEN
M = INT (MTRIPS * XRAN) + 1
ELSE
M = MTRIPS
END IF

Once a M-trip is selected, it’s not allowed to be picked again.

aa

bo 210 11 = ¥, NTRP
If (TRIPLISTCIL) .£@. M) GO TO 205

A-73


MODSPLIT_BALT also generates and outputs spéed/accel frequency
distribution ("SAFD") files for all start and all stabilized Baltimore
driving.

External Files

LUN 1/0? File Description

1 Input Baltimore Speed & Accel vs. Time File
2 Output Baltimore Start Trace File

3 Output Baltimore Stabilized Trace File

4 Output Baltimore Start SAFD File

5 Output Baltimore Stabilized SAFD File

MODSPLIT_LA92 (FORTRAN, Data Preparation)

This is a companion program to MODSPLIT_BALT except the Los Angeles data
start time is defined as 3 minutes. (It was assumed that there was 1
minute of "trip start" travel not picked up in the Los Angeles Chase Car
dataset.) In addition, only the stabilized portions of LA trips were
kept. LA "start" travel was not used.

External Files

LUN 1/0? File Description

1 Input Los Angeles Speed & Accel vs. Time File
2 Output Los Angeles Start Trace File

4 Output Los Angeles Start SAFD File

QUTFTP (FORTRAN, Bag 4/Remainder Cycle Selection-Unlisted)

OUTFTP is a quick program used to generate an "Outside FTP" spd/accel
distribution from the "Composite" and "LA4" input spd/accel distribution
files. The output distribution contains only travel beyond the
boundaries of the FTP (in speed/accel space) and is re-normalized.

A revised version of OUTFTP called OUTFTPSTAB was also written. The
revised version substituted the "Stabilized" distribution file for the
Composite "All Driving" input file.

External Files

LUN 1/0? File Description

1 Input Composite "All Driving" SAFD File

2 Input LAG SAFD File

3 Output “Outside FIP" SAFD File

4 Output Tabular "Outside FTP" Watson Plot File

-21-


ee9gnanaaa

aaanm aan

aoa

feo

nano

42

45

50

52

55

58

60

62

65

IF (KK .EQ. MTRP(I)) THEN
NN = WN + 1

SPO_STD(1) = SPOSTD
ACL_MAX(1) = ACLMAX

bo 42 ISPD = 0,20

00 42 IACL = -20,20

MCNT(I, IACL, ISPD) = KCNTCIACL, ISPD)
CONTINUE

IF (WN EQ. .N) GO To 50

Go TO 40

END IF

CONTINUE
GO TO 40

Input completed. Now call subroutine COMBOS within a loop which
controls the number of m-trips to choose (1 to N-NS) to generate
all possible combinations of m-trips.

DO 300 K = 0, M-t

NK =0

IF (K .EQ. 0) GO TO 52

CALL COMBOS (M, K, KOMBOS, NK)

Loop thru alt combinations generated for size K.
DO 200 J = 1,NK

Initialize sums and counter before each combo is tested. "Seed"
FTP subset with the NS start m-trips.

DIFFS = 0.0
TIMEF = 0.0
TIMEL = 0.0
DO 55 IACL

DO 55 ISPD = 0,20
B4S(TACL, ISPD
B4L(TACL, ISPD
B4FCIACL, ISPD)
CONTINUE

00 58 1 = M1,

TIMER = TIMEF + ITIMECI)

DO 58 IACL = -20,20

DO 58 ISPD = 0,20

B4FCIACL, ISPD) = B4FCIACL, ISPD) + MCNT(I, IACL, ISPD)
CONTINUE

Loop thru and process bin counts for each m-trip in current combo.
TF (K .EQ. 0) GO TO 62
00 60 1 = 1,K

ITRP = KOMBOS(I,J)
TIMEF = TIMEF + ITIMECITRP)

DO 60 IACL = -20,20

DO 60 ISPD = 0,20

BGF(IACL, ISPD) = B4FCIACL, ISPD) + MCNTCITRP, IACL, ISPD)
CONTINUE

Compute the summed diff DIFFS for the current combo.

00 65 IACL = -20,20

00 65 ISPD = 0,20

BGFCIACL ISPD) = B4F(IACL, ISPD) / TIMEF

DIFFS = DIFFS + ABS (BGF(IACL, ISPD) - FFREQ(IACL, ISPD))
CONTINUE

OK, evaluation of FTP for current combo complete. Now get
the remaining m-trips in the input PCC which are NOT in the
current combo. These non-FTP leftovers are "Short Bag 4'.

A-24


c

Cy

360 CONTINUE

Print statistics for current M-trip.

WRITE (3, 370) NTRP, M, MTRIPIO(M), IREC(M), ITIME(M),SPD_MEAN(M),
+ SPD_MAX(M), SPD_STD(M), ACL_MAX(M),
+ CTRIPOLFFCNTRP, TI), 11 = 1,4)

370 FORMAT (13, 1X, ‘1, 1X, 15, 1X, A14, 1X, 17, 1X, 14,

+ 3C4X, F7.2), 1X, F7-3, SCX, F9.5))

Terminate main "trip adding" loop when the desired cycle time
TIMELIMIT is reached. ~-

IF CTRIPTIME .GT. TIMELIMIT) GO TO 400

Loop back and find another M-trip.

GO To 301

Current cycle completed. Compute cycle summary statistics and
print totals.

TOTTIME = TRIPTIME / 60

00 410 I = 1,NTRP

M = TRIPLISTCI)

CSPD = CSPD + SPD_MEAN(M) * ITIME(M) / TRIPTIME

410 CONTINUE

WRITE (3, 450) NTRP, TOTTIME, CSPD, DIFFMIN(1)

450 FORMAT (111(/_')//

+ 8X, 2 13/
+ 8X, 1 F6.2, 1 mint //
+ 8x, + 6.2, mph’/

+ 8X, ‘Total Difference: ', F9.5/)
Close "current" filename.

CLOSE (3)

c=:

c

500 CONTINUE

WRITE (*, 510) MTRIPS, NCYCLES

510 FORMAT (/’ Cycle generation complete://

+ ' M-Trips Input ... 1, 1S/

+ ‘ Cycles Generated

END

A-69


TOTNET = TOTNET + PCTOIFCIACL,ISPO)
TOTABS = TOTABS + ABS (PCTDIFCIACL, ISPD))
425 CONTINUE
c
Cereeeeee
c
c Output results in tabular form, echo input surfaces first.
c

WRITE (4, 430) TITLECT3LL)
430 FORMAT (///<ILEN>X,A//68X, *speed/Accel. Frequency Distribution (%)/

+ 7/778X, *SPD BIN (mph)*)
WRITE (4, 440) CISPD*S, ISPD = 0,20)
440 | FORMAT (166X,' Net Abs'/
+ 7ACL BIN mph/s)?, 4x, 1, 3X, 20¢5<',13,3%), 2(' — Totals’)/
oa TH BK, 200229!) 3K), 200 eeeteet))

00 450 IACL = -20,20
(jaTE (4, 445) IACL, (PCTDIFCIACL, ISPD), ISPO = 0,20),
(SPDSUM(J,JACL), I = 1,2)
us FORMAT (6X, 14, 6X, 21F7.3, 5X, 77.3, 2X, F7.3)
450 CONTINUE

WRITE (4, 455) CACLSUM(1, ISPD), ISPD = 0,20), TOTNET,
+ (ACLSUM(2, ISPD), ISPD = 0,20), TOTABS
455 FORMAT (/3X, ‘Net Totals’, 3X, 21F7.3, 5X, F7.3, oxy
* 3X, ‘Abs Totals’, 3X, 21F7.3, 14X, F7.3)
NWT = HINT CWTN) .
NN = NI + N2
WRITE (4, 460) NWT, WI1, NN, 1-WT1
460 FORMAT (/2X, ‘Weighted Cycle Time (sec): ‘, I4, 5X,

+ ‘Weightings: Cycle 1 -> /, F5.3/

+ 1X, ‘Aggregate Cycle Time (sec): ‘, 14, 18%,
+ Cycle 2 -> %, F5.3)

‘STOP

END


1000

CMDS(I,98) = ’xyname=""*
END IF

LS = INDEX (SURFILE(J), ' ’) - 1
LP = INDEX (PLTFILE(J), ' ') - 1
CMDS(1,100) = ‘postnar // SURFILECJ)C1:LS) // 1"
CMDS(I,112) = ‘outname="" // PLTFILECJ)(1:LP) // 1"¢

DO 825 LINE = 1,NL(I)

WRITE (LUN, 822) CMOS(I,LINE)
FORMAT (A55)

CONTINUE

CONTINUE

ALL processing and output complete. Close all 1/0 units and end.

DO 1000 LUN = 1,23 ©

IF (LUN .EQ@. 4) GO TO 1000
CLOSE (LUN)

CONTINUE

‘STOP

END

A-107


External Files

LUN 1/0? File Description

1 Input Balt/LA Composite "All Driving" SAFD File

2 Input Master or Subset Microtrips File

3 Output Composite Cycle Summary Files (one per candidate
cycle)

Prompted Input

- Output cycle series name

- Target cycle total time

- Target cycle "base" (random m-trip selection) time
- Start microtrip ID's

- "Outside FTP" microtrip ID's

- Number of candidate cycles to generate (up to 1,000)

GETRMNDS (FoRTRAN, Bag 4/Remainder Cycle Selection)

GETRMNDS is a slightly modified version of the GETSTAB/GETREST programs
used create candidate "Remainder" cycles by comparing the selected
microtrips to a target Remainder speed/accel distribution. In the
example shown below, the 0.2067 factor represents the fraction of
stabilized travel outside the LA4 divided by the fraction of Long Bag 4
travel occurring outside the LA4. (This was used to generate a weighted
surface for the remnant cycle.) The target Remainder distribution is
defined as follows: .

Remainder SAFD = Stabilized SAFD - (Long Bag 4 SAFD x WtFac)
where WtFac = 0.2067

External Files

LUN 1/0? File Description

1 Input Target Remainder SAFD File

2 Input Master or Subset Microtrips File

3 Output Remainder Cycle Summary Files (one per candidate
cycle)

Prompted Input

- Output cycle series name

- Target cycle total time

- Target cycle "base" (random m-trip selection) time
- Number of candidate cycles to generate (up to 1,000)

-17-


ePonnAAAAA

c
C
c
c
c

aa nao

ena

c

PROGRAM SUBSET

This program generates a randomly selected subset of the
composite LA92 and Baltimore microtrip profiles dataset.

Author: Tom Carlson
Date: 04/26/93

CHARACTER*14 MTRIPID
CHARACTER*23 CTIME _

INTEGER*2 ITIME, FREQ(-20:20,0:20), K, M, N, NRAN(30000), LTINE,
+ HH, MM, DD, SS
INTEGER*6 IREC, ISEED, ISEEDO, POSACL(0:20)

REAL SPO_MEAN, SPO_STD, ACL_MAX, SPD_MAX, AMAX, SMAX

DATA MTRIPS /29133/

OPEN (UNIT=1, STATUS=/OLD’, FORM=/UNFORMATTED’, RECL=1760)
OPEN (UNIT=2, STATUS=/NEW’, FORM=/UNFORMATTED’, RECL=1760)

Prompt user for subset factor (e.g., 0.10 = get 10% of full file).

WRITE (*, 10)

FORMAT (/1X, ‘Enter subset fraction:’)
READ (*, *) SFRAC

NSUB = NINT (MTRIPS * SFRAC)

1

3

WRITE (*, 12)

FORMAT (/1X, ‘Enter start M-trip number:!)
READ (*, *) MSTART

WRITE (*, 14)

FORMAT (/1X, ‘Enter # of start M-trips:’)
READ (*, *) NSTART

1

x

1

eB

Seed selected subset array with the start mtrips.

DO 15 M = MSTART, MSTART+NSTART-1
bet+*
NRANCI) = M

45 CONTINUE

Get system time. Call to LIBSDATE_TIME returns 23-byte character
string which contains hour, minute, second and decimal fraction.

ISTAT = LIBSDATE_TIME (CTIME)
READ (CTIME, FMT=/(11X,4(1X,12))') HH, MM, SS, DD

Create seed value for random series. Seed ranges from 0 to 10**8,
Make seed odd per VAX-FORTRAN recommendations (FORTRAN Language
Reference Manual V 5.0, pg. 0-49).

ISEED = - (DD*100 + SS*1.666667)
IR = MOD (ISEED, 2)

IF (IR .£Q. 0) [SEED = ISEED + 1
ISEEDO = ISEED

Generate NSUB-NSTART unique random numbers.

DO SO I = NSTART+1, NSUB
XRAN = RAN1 (ISEED)

IF (XRAN LT. 1.0) THEN

M = INT (MTRIPS * XRAN)

ELSE

M = MTRIPS

END IF

2

8

030) =1, 1-1

IF (NRAN(J) .£Q. M) GO TO 20
30 CONTINUE

NRANCL) = 4
50 CONTINUE

A-35


CFREQCIACL, ISPD) = CFREQ(IACL,ISPD) * 100 / TOTTIME
CSFREQ(IACL, ISPD) = CSFREQCIACL, ISPD) * 100 / ISTART
DIFFT = CFREQ(TACL, ISPD) - PFREQCIACL, ISPD)
DIFFS = CSFREQCIACL, ISPD) ~" SFREQCIACL, ISPD)
WRITE (10, 535) ACLBIN, SPDBIN, CFREQ(IACL, ISPD)
WRITE (11, 535) ACLBIN, SPDBIN, CSFREQCIACL, ISPD)
WRITE (12, 535) ACLBIN, SPOBIN, DIFFT
WRITE (13, 535) ACLBIN, SPOBIN, DIFFS

535 FORMAT (F7.2, 17, F10.6)

540 CONTINUE

Cycle "surface" frequency file output complete. Determine the
“envelope boundary" for the input Z-value and output results to
BLNFILEs (units 14 and 15)

0 600 ISPD = 0,20
SPOSUM(ISPD) = CFREQ(O, ISPD)
ACLSUM(ISPD) = 0.0
DO 600 IACL = -20,20
ACLSUM(ISPD) = ACLSUM(ISPD) + CFREQCIACL,ISPD)
600 CONTINUE

DO 650 ISPD = 0,20

TF CACLSUM(ISPD) .EQ. 0.0) GO TO 640
c Check negative accel region.

DO 610 IACL = -20,0
‘SUM1 = CFREQ(IACL, ISPD)
605 IF (SUM1 .GT. 2) THEN
It = ACL - 1
GO TO 620 _
END IF
‘SUM1L = SUM1
610 CONTINUE

c Check positive accel region.

620 DO 630 IACL = 0,20
SUM2 = CFREQ(IACL, ISPD)
625 IF (SUM2 .GT. Z) THEN
125 TACL + 1
GO TO 640
ENO IF
SUM2L = SUM2
630 CONTINUE

640 IF (11 .£Q. 0 .AND. 12 .£Q. 0) THEN
10 = ISPD - 1
GO TO 660
ELSE

IF (SUM1 - SUMIL .NE. 0.0) THEN

BACL(1, ISPD) = 11 + (Z - SUM1L) / (SUM1 - SUMIL)
ELSE

BACL(1,1SPD) = 11

END IF

IF (SUM2 - SUM2L .NE. 0.0) THEN

BACL(2, ISPD) = 12 - (2 - SUM2L) / (SUM2 - SUM2L)
ELSE

BACL(2, ISPD) = 12

END IF

END IF

650 CONTINUE A-104


PROGRAM COMPARE

c
C A quick program to generate tabulate comparisons of the Balt Cold
© and Hot surfaces and the Bait and LA92 Stabilized surfaces.
c
€ Summary of speed & accel bin definitions:
c
© Speed (mph): 0, 0 = <=5, 5 - <=10, ete.
C — Accel(mph/s): 0.5 to 0.5 mph/s = 0
c -1,5>= to -0.5 = -1, -2.5>= to -1.5 = -2, ete.
c 0.5 to <= 1.5 = 1, 1.5 to <e2.5 = 2, etc.
c
© Author: Tom Carlson
C Date: 04/21/93
c
C-ee-e-- aneeeeeeceeeee ences aeceeeee eeeeeee aa neeceeeeecesseceeecceseeees
c
CHARACTER*80 FNAME, OUTNAME(2)
REAL PCTBIN(4,-20:20,0:20), PCTOIF(2,-20:20,0:20)
c
DATA QUTNAME /
+ ‘SURFACE DIFFERENCE COMPARISON: BALT HOT - BALT COLO’,
+ ‘SURFACE DIFFERENCE COMPARISON: LA92 STAB - BALT STAB’/
c
OPEN (UNIT=1, STATUS=/OLD/)
OPEN (UNIT=2, STATUS=/OLD’)

‘OPEN (UNI
OPEN (UNIT:

STATUS=‘OLD‘)
STATUS=/OLD!)

OPEN CUNIT=5, CARRIAGECONTROL=/LIST’, STATUS=/NEW’, RECL=164,
* RECORDTYPE= VARIABLE’ )

c
c Read input mode surface files (units 1-4).
c

DO 110 IFILE = 1,4

100 READ CIFILE, *, END=110) IACL, ISPD, IDUM, PCTBIN(IFILE, IACL, ISPD)
Go To 100

110 CONTINUE

c

¢

c

€ Generate difference comparisons: (1) Hot vs. Cold

c (2) LA92 vs. Balt Stabilized

c
DO 120 IACL =
00 120 IsPO .
PCTDIF(1,IACL,ISPD) = PCTBIN(2,IACL, ISPD) - PCTBIN(1,IACL, ISPD)
PCTDIF(2,IACL,ISPD) = PCTBIN(4,IACL, ISPD) - PCTBIN(3,IACL, ISPD)

120 CONTINUE

c

c -

c

c Output results in tabular form, echo input surfaces first.

c

00 200 [FILE = 1,4

°

INQUIRE (UNIT=IFILE, NAME=FNAME)
CLOSE (IFILE)
WRITE (5, 130) FNAME
130 FORMAT (///65X, A80//60X, ‘Speed/Accel Frequency Distribution (%)!
+ /1170X, "SPD BIN (mph)! /)
WRITE (5, 140) (ISPD*5S, ISPD = 0,20)
140 FORMAT (‘ACL BIN (mph/s)!, 4X, 14, 3X, 20¢'<',13,3K)/
+ Peseeeneeeneeeee 1 OX, foes24, 3X, 20(/----",3X))

DO 150 IACL = -20,20
WRITE (5, 145) IACL, (PCTBINCIFILE,IACL, ISPD), ISPD = 0,20)
145 FORMAT (6X, 14, 6X, 21F7.3)
150 CONTINUE
c
200 CONTINUE
DO 300 10UT = 1,2

WRITE (5, 130) OUTNAMECIOUT)
WRITE (5, 140) (ISPD*5, ISPD = 0,20)

A~88


PROGRAM COMPSURF

A quick program to produce a composite spd/acl surface from the
Baltimore and LA92 mode-specific surface files:

(1) BFRQ1.DAT (Balt Start) ------
(2) BFRQ2.DAT (Balt Stabilized) |--->. (4) CFRQT.DAT (Comp Totl)
(3) LFRQ2.DAT (LA92 Stab) --

Start portions of total surfaces based on Baltimore data only.
Stabilized portions of total surfaces) are generated by a 50/50
weighting of the Baltimore and LA92 stabilized driving.

Summary of speed & accel bin definitions:

Speed (mph): 0, 0 - <5, 5 - <
Accel(mph/s):  -0.5 to 0.5 mph/s
71.5>= to -0.5
0.5 to < 1.521,

1.5 to <92.5 = 2, etc,

Author: Tom Car{son
Date: 04/21/93

aaaAnAAAAAAAAAAAAAAAAAA

ao

INTEGER NBIN(3,-20:20,0:20), NREC(3)
REAL CBIN(-20:20,0:20), WFAC(3)

STATUS='OLD’)
STATUS=/OLD!)
STATUS=’OLD‘)

Read input mode surface files (units 1-3).

aenaann

00 110 IFILE = 1,3

100 READ (IFILE, *, END=105) IACL, ISPD, NBINCIFILE,IACL, ISPD)
GO TO 100

405 CLOSE (IFILE)

110 CONTINUE

Balt Start = nrect
Balt Stab = nrec2

LA92 Stab nrec3.

weightings:
wfacl = 2 (by specification of the 50/50
weighting of nrec2 and nrec3)
wfac2 = 1 (Yunit" weighting)

c

c

c

Cc

c

c

c

c

c For 50/50 weighting of stabilized data, we need the following

c

c

c

c

c

c wfac3 = nrec2 / nrec3

c
DO 150 TACL
bo 150 ISPD
DO 150 IFILE .
NRECCIFILE) = NRECC(IFILE) + NBINCIFILE,IACL, ISPD)

150 CONTINUE

-20,20
0,20

c

WFAC(1) 0

WFAC(2) 0

WFAC(3) = FLOAT (NREC(2)) / FLOAT(NREC(3))
c
c Generate total weighted composite surface.
c

DO 200 IACL
00 200 ISPD
0 200 I =
X = WFAC(I) * NBIN(T,IACL, ISPD)
CBINCIACL, ISPD) = CBINCIACL,ISPD) + X
CREC = CREC + X

200 CONTINUE

4-90


they appear. Circled asterisks refer to
system-default input and output logical
units.

3.1 Data Preparation Phase

Two basic datasets were used in the cycle development: (1) Radian's
Instrumented Vehicle (3-Parameter) database of driving data collected in
Baltimore and Spokane and (2) Sierra's 1992 Los Angeles Chase Car
driving database. Both of these databases attempted to capture
representative samples of driving in each of the regions in which data
were collected. However, due to the nature of each effort, the data
cannot be trivially combined. For example, the Instrumented Vehicle
(IV) data contain measured vehicle speed/time information from the
moment the vehicle is started up. Time idling in a driveway or
traveling on "neighborhood" streets is contained in the IV data.
Conversely, Chase Car data does not contain this "trip end" travel.

Figure 1 illustrates the programs that were used and the steps employed
to produce a composite driving database and to re-organize the data into
several forms used in subsequent cycle selection. First, the IV
database (contained in SAS-datasets) was converted to a single ASCII
file containing Baltimore-only records using the GETBALT program.
REFORMAT _BALT was then used to compute second-by-second accelerations
from the speeds and reformat the output records, retaining needed fields
only. (A similar program, REFORMAT_LA92 was applied to the Los Angeles
Chase Car dataset.) Programs titled MODSPLIT_BALT and MODSPLIT_LA92
were then used to break out the second-by-second driving data into
"Start" and "Stabilized" files. As discussed above, the Chase Car (Los
Angeles) database did not contain "trip end" travel. Based on trip
start activity data collected and analyzed by Sierra,” it was estimated
that one minute of trip end travel occurred prior to initiated trips in
the Chase Car database. As a result, Baltimore data "Start" travel was
defined as the first 4 minutes of each trip while Los Angeles data
"Start" travel was defined as the initial 3 minutes (4 minus 1).

The driving data were then combined into a single file referred to in
Figure 1 as "Balt/LA Composite Trace File". From this file, the
speed/time traces for each trip were broken up into a series of
"microtrips" using the MICTRIPS program. A microtrip is defined as
travel between two points in a driving trace where the vehicle comes to
a stop (zero velocity), including the leading idle period, if any.
These microtrips, and their speed and acceleration profiles,were stored
in the "Master Microtrips File" shown. The UNF_MTRIPS and SUBSET
programs were then used to create a binary (i.e., unformatted) version
of the Microtrips File and randomly select a user-sized subset of
microtrips from it. The Master Microtrips File and it’s randomly

“T.C. Austin, et al., "Characterization of Driving Patterns and
Emissions from Light-Duty Vehicles in California," Draft Final Report,
Sierra Research, Inc., March 5, 1993.

=4-


20 READ (2, END=50) 1, MTRIPID(I), IREC(1), ITIME(I),
+ SPD_MEAN(I), SPD_MAX(I), SPD_STD(1), ACL_MAX(I),
+ CCMCNTCT, IACL, ISPD), ISPD=0,20), IACL=: 2

0,20)
C 30 FORMAT (15, » Als, x, 17,1%, 15, 30x, F7.2),1X, F7.3,1X, 861(14))
IN2 = IN2 +
GO TO 20

c Input completed. Begin microtrip selection using Best Incremental
c logic.

c Top-level loop 500 iterates the selection process to generate

c a number of cycles (NCYCLES). Each cycle is written to a

c separate output file on unit 3.

sss: a oe = sess
c

50 MIRIPS = IN2
DO 500 ILOOP = 1,NCYCLES

Initialize cycle sums and counter with "seed" values.

ano

NTRP = 1

TRIPTIME = 0.0

csPp = 0.0

DO 80 IACL

00 80 ISPD = 0,20

TCNTCIACL, 1sPD) = MCNT(NSEED, IACL, ISPD)
80 CONTINUE

-20,20

IPRD = INDEX (OUTFILE, ’.1)

TEND = INDEX (OUTFILE, ' 4) - 1

WRITE (CLOOP, FMT=/(13.3)/) ILOOP.

OUTNAME = OUTFILE(1:IPRO-1) // ‘-' // CLOOP // OUTFILECIPRD:IEND)
TOUT = INDEX (QUTNAME, ' /) - 1

Open "current" filename.

aoe

OPEN (UNIT=3, FILE=OUTNAME, STATUS=/NEW’, CARRIAGECONTROL=/LIST’,
+ RECORDTYPE=/ VARIABLE!)

C Write output file header.
c u

WRITE (3, 90) RTIME, OUTNAME(1:10UT)
90 FORMAT (SX, ‘BEST INCREMENTAL Trip Selection Method’, 154,

+ ‘Target Time: ‘', F5.2, ‘ min’//

+ 13x, ‘Filename: ’, A // 8X,

+!MTRP INIT TIME AVG SPD MAX SPD STD SPD MAX ACL‘
+,’ TOTAL CRUISE ACCEL DECEL’/2x, ‘#

+! NO MTRIP ID REC (s) (mph) (mph) = (mph) (mph/s)

+,’ DIFFSUM OIFFSUM DIFFSUM  DIFFSUM’/)

c Add acl/spd bin counts for current microtrip to "current" count
c array CCNT and express as frequency. Compute integrated

Cc difference between the population surface and the best

c incremental surface CFREQ. (Use abs value of the difference.)

bo 115.11 =
DIFFCII) = 0.0

115 CONTINUE
DO 120 IACL = -20,20
DO 120 ISPD = 0,20
CCNTCIACL, ISPD) = TCNT(IACL,ISPD)
CFREQ(IACL, ISPD) = CCNTCIACL,ISPD) / (TRIPTIME + ITIME(NSEED))
DIFF(1) = DIFF(1) + ABS (CFREQ(IACL, ISPD) - PFREQ(IACL,ISPD))
IF (IACL .£Q. 0) THEN
DIFF(2) = DIFF(2) + ABS (CFREQ(IACL,ISPD) - PFREQ(IACL,ISPD))
ELSE IF (IACL .GT. 0) THEN
DIFF(3) = DIFF(3) + ABS (CFREQ(IACL, ISPD) - PFREQ(IACL,1SPD))
ELSE IF (IACL .LT. 0) THEN
DIFF(4) = DIFF(4) + ABS (CFREQ(IACL,ISPD) - PFREQCIACL,ISPD))
END IF

120 CONTINUE

M = NSEED
A-67


return
END

A-12


PROGRAM GETCYCLE

The GETCYCLE
driving cyct
output file.
“envelope bo

output cycle

1/0: Unit

Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit

Unit
unit

Date: 04s

anaAnAnAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAARAAAAAADAA

CHARACTER
CHARACTER*3
CHARACTER*6
CHARACTER*14
CHARACTER*23
CHARACTER*25
CHARACTER*40

+

+

CHARACTER*55
INTEGER*2 MT!

Unit 3 (input)
Unit 5 Cinput)
Unit 6 Cinput)
Unit 7 Cinput)

Unit 8 Cinput)

program generates a second-by-second speed vs. time

e from the list of microtrips contained in a GETSTAB
An accel/speed % distribution file and an

undary" file which are used later by SURFER to plot

the accel/speed surface are also output.

Trip start and trip end profiles are attached to the

as well.

1 Cinput) -~Second-by-second "archive" of all route
data.

Unit 2 Cimput) - GETSTAB output table of microtrips for a

selected cycle.
MICTRIPS profile statistics output file.
SURFER-GRID template command file.
SURFER-SURF template command file.
Speed/accel total "surface" created from
sec-by-sec drive cycle data.
Speed/accel start "surface" for first
120 sec of sec-by-sec drive cycle data.

Unit 9 (output) - Speed vs. time driving cycle (with trip

ends included).
10 (output) - ASCII acl/spd bin % distribution total
file (later surface plotting w/SURFER).
11 output) - ASCII acl/spd bin % distribution start
file (later surface plotting w/SURFER).
12 (output) - ASCII acl/spd bin % dist total diff
file (later surface plotting w/SURFER).
13 (output) - ASCII acl/spd bin % dist start diff
file (later surface plotting w/SURFER).
14 (output) - ASCII acl/spd bin total "boundary"
file (later surface plotting w/SURFER).
15 Coutput) - ASCII acl/spd bin start "boundary"
file (later surface plotting w/SURFER).

16 (output) - SURFER-GRID total surface command file.
17 (output) - SURFER-GRID start surface command file.
18 Coutput) - SURFER-GRID total diff command file.
19 (output) - SURFER-GRID start diff command file.
20 (output) - SURFER-SURF total surface command file.

21 (output) - SURFER-SURF start surface command file.
22 (output) - SURFER-SURF total diff command file.
23 (output) - SURFER-SURF start diff command file.

Author: Tom Carlson
27/93

CJ, CTYPE(2), MTYPE(5O)

CDUMNY

METHOD

NTRIPID(50), ITRIPID

CTIME

TITLE(4)

INFILE, OUTROOT, SURFILE(4), FREQFILE, PRNFILE,
BLNFILE(2), CMDFILE(2,4), GROFILE(4), PLTFILE(4),
MTRIPFILE

CMDS(2, 200)

RIPS(5O), ITIME(SO), HH, MM, SS, DD, JINDX(50),

+ SPDBIN, NL(2), MCNT(-20:20,0:20), JTIME, M,

+ BI
INTEGER*4 IRI

REAL SPD(5O,
+ MAXSPO,
+ CSFREQC
+ SPD_STD

DATA IHDR /

Begin executi

Prompt .user

NS(50,5000), BINA(50,5000)
EC(SO), IPNT(5O), MRAN(5O), MINDX(50), JREC, ITRIP(5O)

5000), ACL(50,5000), CFREQ(-20:20,0:20), BACL(2,0:20),
ACLSUM(0:20), PFREQ(-20:20,0:20), SFREQ(-20:20,
+20:20,0:20), SPDSUM(0:20), SPD_MEAN, SPD_MAX,

» ACL_MAX

7 /, CTYPE / 'G*, 'S’ /, ISTART / 240 /

on.

for input and output filenames.

WRITE (*, 10) A-99


210 CONTINUE

Add acl/spd bin counts for current microtrip to "current" count
array CCNT and express as frequency. Compute integrated
difference between the population surface PFREQ and the best
incremental surface CFREQ. (Use abs value of the difference.)

ananaa

OIFF = 0.0
00 220 IACL
DO 220 ISPD
CCNTCIACL, ISPD) = TCNT(IACL,1SPD) + MCNT(M, IACL,ISPO)
CFREQCIACL, ISPD) = CCNTCIACL,ISPD) / (TRIPTIME + ITIME(M))
DIFF = DIFF + ABS (CFREQ(IACL, ISPD) - PFREQ(IACL,ISPD))
TCNTCIACL, ISPD) = TCNTCIACL, ISPD) + MCNT(M, IACL,1SPD)
220 CONTINUE

20,20
20

TRIPLIST(NTRP) = M
TRIPTIME = TRIPTIME + ITIMECM)
TRIPDIFFCNTRP) = DIFF

c Print statistics for current M-trip.

WRITE (3, 270) NTRP, M, MTRIPID(M), IREC(M), ITIME(M),SPO_MEAN(M),

+ SPD_MAX(M), SPD_STD(M), ACL_MAX(M), TRIPOIFFCNTRP)
270 FORMAT (13, 1X, ‘R’, 1X, I5, 1K, A14, 1X, 17, 1X, 14,

+ 3C4X, F7.2), 1X, F7.3, 1X, F9.5)

Terminate main "trip adding" (oop when the desired cycle time
TIMELIMIT is reached.

90

IF (TRIPTIME .GE. TIMERAN) GO TO 300
© Loop back and find another M-trip.

GO TO 200

"Base" of random H-trips complete. Add subsequent M-trips using
Best Incremental logic.

+

+++++ BEST INCREMENTAL SECTION +++++

Big loop 301 adds “next best" microtrips till the total time
exceeds TIMELIMIT.

meanananaaaaaAaG

300 BASETIME = TRIPTIME / 60
IF CTRIPTIME .GE. TIMELIMIT) GO TO 400

301 NTRP = NTRP + 1
DIFFMIN = 999,
c Loop thru all microtrips in search of best incremental trip.
. DO 350 1 = 1, NTRIPS
c Skip microtrips which have already been selected.

DO 310 J = 1,NTRP-1
IF (1 .8Q. TRIPLIST(J)) GO TO 350
310 CONTINUE

Add acl/spd bin counts for current microtrip to “current" count
array CCNT and express as frequency. Compute integrated
difference between the population surface and the best
incremental surface CFREQ. (Use abs value of the difference.)

enea0

DIFF = 0.0

00 320 IACL = -20,20

00 320 1SPO = 0,20

CCNT(IACL, ISPD) = TCNTCIACL, ISPD) + MCNT(I, IACL, ISPD)

CFREQ(IACL,ISPD) = CCNT(IACL,ISPD) / (TRIPTIME + ITIME(I))

DIFF = DIFF + ABS (CFREQCIACL, ISPD) - PFREQ(IACL, ISPD))
320 CONTINUE

c Test integrated difference DIFF of current incremental M-trip.
A-74


aane

aoo

ane

oon

Read in total "All Driving

surface (unit 1).

10 READ (1, *, END=20) IACL, ISPD, NFREQ, PCT
TFREQCIACL, ISPD) = PCT / 100
INT = INT + 1
GO TO 10

Read in LAG surface (unit 2). While reading compute the "non-FTP!
surface.
20 READ (2, *, END=30) IACL, ISPD, NFREQ, PCT
FFREQCIACL, ISPD) = PCY / 100
WFFREQ(IACL, ISPD) = TFREQ(IACL, ISPD) - FFREQCIACL, 1SPD)
IW2 = 12 + 1
GO TO 20

Read in selected cycle stats file (unit 3).

30 READ (3, 31) CYCFILE
34 FORMAT (//23X, A}
= INDEX (CYCFILE, ‘./) - 1

DO 32 ISKIP = 1,4
READ (3, FMT="()/)
32 CONTINUE

33 IN3 = IN3 +1
READ By 3h, EROS) N TYPEQHD, MTRPCHD, MTRIPIDOND, SRECCN),
TTIME(N), SPO_MEAN(N), SPO_MAXCH)
36, roRnaT (13, 1X, a1, 1%, 15, 1k, a1, 1X, 17, 1X, 14, 20K, £7.29)
GO To 33

35 N= INS - 1
Now detect and move the start m-trips to the back of the pack so
the COMBOS routine can be called over the range 1 to N-NS.
00361 = 1,N
IF (TYPECI) .NE. #8) THEN
sl-4
Go To 37
END IF
MTRPS(1) =_MTRPCI)
TYPES(1) = TYPE(I)
MTRIPIOS(I) = MTRIPID(I)
IRECS(I} = IREC(1)
ITIMES(I) = ITIMECI)
‘SPO_MEANS(I) = SPD_MEAN(I)
SPD_MAXS(I) = SPO_MAX(I)
36 CONTINUE
37M =N~ NS
00 38 1 =
MTRPCI) =
TYPECI) = TYPE(T+NS)
MTRIPID(I) = MTRIPID(I+NS)
IREC(1) = IREC(I14NS)
ITIMECT) = [TIMECI+NS)
SPD_MEAN(I) = SPD_MEANCI+NS)
‘SPD_MAX(1) = SPD_MAX(I+NS)
38 CONTINUE
00391
MTRPCT)
TYPE(I) = TYPES(I-M)
WTRIPID(I) = MTRIPIDS(I-m)
IRECCT) = IRECS(I-M)
ITIMECT) = [TIMES(I-M)
‘SPD_MEAN(I) = SPD_MEANS(I-M)
SPD_MAX(I) = SPD_MAXS(I-M)
39 CONTINUE
Read in microtrip profiles binary records one at a time (unit 4).

40 READ (4, END=50) KK, KTRIPID, KREC, KTIME, SPDMEAN, SPDMAX,
+ SPDSTD, ACLSTD, ((KCNTCIACL,ISPD), ISPO=0,20), IACL=-20,20)
ING = IN6 + 7

A-15