From 9764e730b835937a0cc72a4ffce38e2e0a958471 Mon Sep 17 00:00:00 2001 From: jim Date: Wed, 29 Apr 2020 11:13:06 -0600 Subject: [PATCH] updates for writing file names preserve original file naming if separate.cav.trip.matrices is missing or set to false. Separate CAV and empty tables if true. MAG writer writes all tables to single time period files. Ohio writer writes tables to separate cav and nonCav files. --- build.gradle | 2 +- src/main/java/appLayer/CarAllocatorMain.java | 2 +- .../WriteCarAllocationOutputFilesIf.java | 18 +++ .../WriteCarAllocationOutputFilesMag.java | 73 +++++----- .../WriteCarAllocationOutputFilesOhio.java | 132 ++++++++++-------- 5 files changed, 133 insertions(+), 94 deletions(-) diff --git a/build.gradle b/build.gradle index 5cbbb9e..f63bc29 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'java' jar { baseName = 'carTracker' - version = '24Apr2020_v1.03' + version = '28Apr2020_v1.08' } repositories { diff --git a/src/main/java/appLayer/CarAllocatorMain.java b/src/main/java/appLayer/CarAllocatorMain.java index 022b35b..bc08800 100644 --- a/src/main/java/appLayer/CarAllocatorMain.java +++ b/src/main/java/appLayer/CarAllocatorMain.java @@ -260,7 +260,7 @@ public static void main( String[] args ) { CarAllocatorMain mainObj = new CarAllocatorMain(); - System.out.println ( "CarTracker, 24Apr2020, v1.03, starting." ); + System.out.println ( "CarTracker, 28Apr2020, v1.08, starting." ); ResourceBundle rb = null; if ( args.length >=0 ) { diff --git a/src/main/java/appLayer/WriteCarAllocationOutputFilesIf.java b/src/main/java/appLayer/WriteCarAllocationOutputFilesIf.java index 615115a..462f862 100644 --- a/src/main/java/appLayer/WriteCarAllocationOutputFilesIf.java +++ b/src/main/java/appLayer/WriteCarAllocationOutputFilesIf.java @@ -84,6 +84,24 @@ default float[][] getTripTableOrderedByExternalTazValues( int[] externalTazOrder } + default float[][] getTripTableOrderedByExternalTazIndices( int[] externalTazOrder, float[][] tripTable, int[] tazIndices ) { + + float[][] orderedTripTable = new float[tazIndices.length][tazIndices.length]; + for ( int i=0; i < tazIndices.length; i++ ) { + if(tazIndices[i]>=0){ + int k = externalTazOrder[tazIndices[i]]; + for ( int j=0; j < tazIndices.length; j++ ) { + if(tazIndices[j]>=0){ + int m = externalTazOrder[tazIndices[j]]; + orderedTripTable[i-1][j-1] = tripTable[k][m]; + } + } + } + } + return orderedTripTable; + } + + default double[] getProbabilityOfChangingCarOwnership(String probFileName,String hhidName,String probField) { int[] hidWoSampleValues = Parsing.getIntArrayFromCsvFile( probFileName, hhidName ); diff --git a/src/main/java/appLayer/WriteCarAllocationOutputFilesMag.java b/src/main/java/appLayer/WriteCarAllocationOutputFilesMag.java index c06363d..c8b5dae 100644 --- a/src/main/java/appLayer/WriteCarAllocationOutputFilesMag.java +++ b/src/main/java/appLayer/WriteCarAllocationOutputFilesMag.java @@ -78,8 +78,8 @@ public void writeCarAllocationOutputFile( Logger logger, HashMap threhsoldRoundUp = Float.parseFloat(propertyMap.get(GlobalProperties.ROUND_UP_THRESHOLD.toString())); tripExpansionFactor = 1.0f/Float.parseFloat(propertyMap.get("global.proportion")); ifExternalStationsIncluded = Boolean.valueOf(propertyMap.get("include.external.stations")); - - + + String separateCavFilesString = propertyMap.get( SEPARATE_CAV_TRIP_TABLES_KEY ); if ( separateCavFilesString != null ) separateCavFiles = Boolean.valueOf( separateCavFilesString ); @@ -141,19 +141,19 @@ public void writeCarAllocationOutputFile( Logger logger, HashMap MatrixType matrixType = MatrixType.lookUpMatrixType( formatString ); MatrixDataServer matrixDataServer = new MatrixDataServer(); matrixHandler = new MatrixDataLocalHandler(matrixDataServer, matrixType); - - int[] tazIndices = geogManager.getTazIndices(); - - int[] tazValues = geogManager.getTazValues(); - int[] tazValuesOrder = IndexSort.indexSort( tazValues ); - int[] extNumbers = new int[tazValues.length+1]; - - for ( int i=0; i < tazValues.length; i++ ) { - int k = tazValuesOrder[i]; - extNumbers[i+1] = tazValues[k]; - } - - String[] periodLabels = new String[]{ "early", "am", "midday", "pm", "late" }; + + int[] tazIndices = geogManager.getTazIndices(); + + int[] tazValues = geogManager.getTazValues(); + int[] tazValuesOrder = IndexSort.indexSort( tazValues ); + int[] extNumbers = new int[tazValues.length+1]; + + for ( int i=0; i < tazValues.length; i++ ) { + int k = tazValuesOrder[i]; + extNumbers[i+1] = tazValues[k]; + } + + String[] periodLabels = new String[]{ "early", "am", "midday", "pm", "late" }; int globalLoop = Integer.parseInt(propertyMap.get("global.loop")); @@ -300,8 +300,8 @@ else if(numAuto > 0 && numAuto == hh.getPersons().length ) //int votCat = getVotCategoryIndex( float vot ); //if(mode == Integer.parseInt(propertyMap.get("taxi.mode.code"))){ - // if(!ifExternalStationsIncluded ||(!ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(trip.getDestMaz())) && !ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(hh.getHomeMaz())))) - // autoTripTables[getTripTablePeriod(period)][4-1][tazIndices[geogManager.getMazTazValue(trip.getDestMaz())]][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]] += tripExpansionFactor; + // if(!ifExternalStationsIncluded ||(!ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(trip.getDestMaz())) && !ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(hh.getHomeMaz())))) + // autoTripTables[getTripTablePeriod(period)][4-1][tazIndices[geogManager.getMazTazValue(trip.getDestMaz())]][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]] += tripExpansionFactor; //} } @@ -358,8 +358,7 @@ else if(numAuto > 0 && numAuto == hh.getPersons().length ) int emptyCarVotCat = 1; int emptyTripMode= 1; if ( separateCavFiles ) - emptyTripMode= EMPTY_TRIP_MODE; - + emptyTripMode= EMPTY_TRIP_MODE; for( int j = 0; j < carAllocationForTrip.length; j ++){ double[] SikForTrip = carLinkingResults[CarAllocation.INDEX_SameTripParkDi][j][i]; double[] GikForTrip = carLinkingResults[CarAllocation.INDEX_SameTripParkOk][j][i]; @@ -485,11 +484,11 @@ record = hh.getId()+","+ totalAutoNonAVTrips++; } - period = getTripTablePeriod(CommonProcedures.convertMinutesToInterval(scheduleDepart+depLate-depEarly, constants), periodIntervals); + period = getTripTablePeriod(CommonProcedures.convertMinutesToInterval(scheduleDepart+depLate-depEarly, constants), periodIntervals); //logger.info(tripMode + " " + votCat + " " + period + " " + origTaz + " " + destTaz); if(!ifExternalStationsIncluded ||(!ArrayUtils.contains(geogManager.getExternalStations(),origTaz) && !ArrayUtils.contains(geogManager.getExternalStations(),destTaz))) { if(ifAvHh == 1 && separateCavFiles) - cavTripTables[period][(tripMode-1)*numberOfVotCategories+(votCat-1)][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]][tazIndices[geogManager.getMazTazValue(trip.getOrigMaz())]] += tripExpansionFactor; + cavTripTables[period][(tripMode-1)*numberOfVotCategories+(votCat-1)][tazIndices[origTaz]][tazIndices[destTaz]] += tripExpansionFactor; else nonCavTripTables[period][(tripMode-1)*numberOfVotCategories+(votCat-1)][tazIndices[origTaz]][tazIndices[destTaz]] += tripExpansionFactor; } @@ -664,10 +663,10 @@ record = hh.getId()+","+ period = getTripTablePeriod(CommonProcedures.convertMinutesToInterval(departureTime, constants), periodIntervals); if(!ifExternalStationsIncluded ||(!ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(hh.getHomeMaz())) && !ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(nextTrip.getOrigMaz())))) { - if ( separateCavFiles ) - cavTripTables[period][(emptyTripMode-1)*numberOfVotCategories+(emptyCarVotCat-1)][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]][tazIndices[geogManager.getMazTazValue(nextTrip.getOrigMaz())]] += tripExpansionFactor; - else - nonCavTripTables[period][(emptyTripMode-1)*numberOfVotCategories+(emptyCarVotCat-1)][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]][tazIndices[geogManager.getMazTazValue(nextTrip.getOrigMaz())]] += tripExpansionFactor; + if ( separateCavFiles ) + cavTripTables[period][(emptyTripMode-1)*numberOfVotCategories+(emptyCarVotCat-1)][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]][tazIndices[geogManager.getMazTazValue(nextTrip.getOrigMaz())]] += tripExpansionFactor; + else + nonCavTripTables[period][(emptyTripMode-1)*numberOfVotCategories+(emptyCarVotCat-1)][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]][tazIndices[geogManager.getMazTazValue(nextTrip.getOrigMaz())]] += tripExpansionFactor; } break; @@ -723,14 +722,14 @@ record = hh.getId()+","+ - period = getTripTablePeriod(CommonProcedures.convertMinutesToInterval(departureTime, constants), periodIntervals); - - if(!ifExternalStationsIncluded ||(!ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(trip.getDestMaz())) && !ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(hh.getHomeMaz())))) { - if ( separateCavFiles ) - cavTripTables[period][(emptyTripMode-1)*numberOfVotCategories+(emptyCarVotCat-1)][tazIndices[geogManager.getMazTazValue(trip.getDestMaz())]][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]] += tripExpansionFactor; - else - nonCavTripTables[period][(emptyTripMode-1)*numberOfVotCategories+(emptyCarVotCat-1)][tazIndices[geogManager.getMazTazValue(trip.getDestMaz())]][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]] += tripExpansionFactor; - } + period = getTripTablePeriod(CommonProcedures.convertMinutesToInterval(departureTime, constants), periodIntervals); + + if(!ifExternalStationsIncluded ||(!ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(trip.getDestMaz())) && !ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(hh.getHomeMaz())))) { + if ( separateCavFiles ) + cavTripTables[period][(emptyTripMode-1)*numberOfVotCategories+(emptyCarVotCat-1)][tazIndices[geogManager.getMazTazValue(trip.getDestMaz())]][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]] += tripExpansionFactor; + else + nonCavTripTables[period][(emptyTripMode-1)*numberOfVotCategories+(emptyCarVotCat-1)][tazIndices[geogManager.getMazTazValue(trip.getDestMaz())]][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]] += tripExpansionFactor; + } break; } @@ -773,13 +772,13 @@ record = hh.getId()+","+ //add them as taxi - period = getTripTablePeriod(CommonProcedures.convertMinutesToInterval(trip.getSchedDepart()+depLate-depEarly, constants), periodIntervals); - if(!ifExternalStationsIncluded ||(!ArrayUtils.contains(geogManager.getExternalStations(),origTaz) && !ArrayUtils.contains(geogManager.getExternalStations(),destTaz))) { + period = getTripTablePeriod(CommonProcedures.convertMinutesToInterval(trip.getSchedDepart()+depLate-depEarly, constants), periodIntervals); + if(!ifExternalStationsIncluded ||(!ArrayUtils.contains(geogManager.getExternalStations(),origTaz) && !ArrayUtils.contains(geogManager.getExternalStations(),destTaz))) { if( ifAvHh == 1 && separateCavFiles ) - cavTripTables[period][(4-1)*numberOfVotCategories+(votCat-1)][tazIndices[geogManager.getMazTazValue(trip.getDestMaz())]][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]] += tripExpansionFactor; + cavTripTables[period][(4-1)*numberOfVotCategories+(votCat-1)][tazIndices[geogManager.getMazTazValue(trip.getOrigMaz())]][tazIndices[geogManager.getMazTazValue(trip.getDestMaz())]] += tripExpansionFactor; else nonCavTripTables[period][(4-1)*numberOfVotCategories+(votCat-1)][tazIndices[geogManager.getMazTazValue(trip.getOrigMaz())]][tazIndices[geogManager.getMazTazValue(trip.getDestMaz())]] += tripExpansionFactor; - } + } } } diff --git a/src/main/java/appLayer/WriteCarAllocationOutputFilesOhio.java b/src/main/java/appLayer/WriteCarAllocationOutputFilesOhio.java index 97660e5..eb55c52 100644 --- a/src/main/java/appLayer/WriteCarAllocationOutputFilesOhio.java +++ b/src/main/java/appLayer/WriteCarAllocationOutputFilesOhio.java @@ -67,7 +67,7 @@ public class WriteCarAllocationOutputFilesOhio implements WriteCarAllocationOutp private float[][][][] cavTripTables; private float[][][][] nonCavTripTables; - + private boolean separateCavFiles = false; @@ -80,7 +80,7 @@ public void writeCarAllocationOutputFile( Logger logger, HashMap threhsoldRoundUp = Float.parseFloat(propertyMap.get(GlobalProperties.ROUND_UP_THRESHOLD.toString())); tripExpansionFactor = 1.0f/Float.parseFloat(propertyMap.get("global.proportion")); ifExternalStationsIncluded = Boolean.valueOf(propertyMap.get("include.external.stations")); - + String separateCavFilesString = propertyMap.get( SEPARATE_CAV_TRIP_TABLES_KEY ); if ( separateCavFilesString != null ) @@ -124,11 +124,11 @@ public void writeCarAllocationOutputFile( Logger logger, HashMap nonCavTripTableFiles[4] = insertBeforeExtension( propertyMap.get("result.path") + mpo+year +"_Auto_" + propertyMap.get( TRIP_MATRIX_EV_FILE_KEY ), "_nonCav" ); } else { - nonCavTripTableFiles[0] = insertBeforeExtension( propertyMap.get("result.path") + mpo+year +"_Auto_" + propertyMap.get( TRIP_MATRIX_EA_FILE_KEY ), "_nonCav" ); - nonCavTripTableFiles[1] = insertBeforeExtension( propertyMap.get("result.path") + mpo+year +"_Auto_" + propertyMap.get( TRIP_MATRIX_AM_FILE_KEY ), "_nonCav" ); - nonCavTripTableFiles[2] = insertBeforeExtension( propertyMap.get("result.path") + mpo+year +"_Auto_" + propertyMap.get( TRIP_MATRIX_MD_FILE_KEY ), "_nonCav" ); - nonCavTripTableFiles[3] = insertBeforeExtension( propertyMap.get("result.path") + mpo+year +"_Auto_" + propertyMap.get( TRIP_MATRIX_PM_FILE_KEY ), "_nonCav" ); - nonCavTripTableFiles[4] = insertBeforeExtension( propertyMap.get("result.path") + mpo+year +"_Auto_" + propertyMap.get( TRIP_MATRIX_EV_FILE_KEY ), "_nonCav" ); + nonCavTripTableFiles[0] = propertyMap.get("result.path") + mpo+year +"_Auto_" + propertyMap.get( TRIP_MATRIX_EA_FILE_KEY ); + nonCavTripTableFiles[1] = propertyMap.get("result.path") + mpo+year +"_Auto_" + propertyMap.get( TRIP_MATRIX_AM_FILE_KEY ); + nonCavTripTableFiles[2] = propertyMap.get("result.path") + mpo+year +"_Auto_" + propertyMap.get( TRIP_MATRIX_MD_FILE_KEY ); + nonCavTripTableFiles[3] = propertyMap.get("result.path") + mpo+year +"_Auto_" + propertyMap.get( TRIP_MATRIX_PM_FILE_KEY ); + nonCavTripTableFiles[4] = propertyMap.get("result.path") + mpo+year +"_Auto_" + propertyMap.get( TRIP_MATRIX_EV_FILE_KEY ); } // number of modes in output tables = autoTripTableNames.length (typically sov,hov2,hov3+,taxi) + empty trips = 4 + 1. @@ -151,23 +151,38 @@ public void writeCarAllocationOutputFile( Logger logger, HashMap periodIntervals[4][1] = Integer.valueOf( propertyMap.get( EV_PERIOD_END_KEY ) ); logger.info( "writing trip matrix files." ); + String formatString = propertyMap.get( OUTPUT_TRIP_TABLE_FORMAT_KEY ); MatrixType matrixType = MatrixType.lookUpMatrixType( formatString ); MatrixDataServer matrixDataServer = new MatrixDataServer(); matrixHandler = new MatrixDataLocalHandler(matrixDataServer, matrixType); - - int[] tazIndices = geogManager.getTazIndices(); - - int[] tazValues = geogManager.getTazValues(); - int[] tazValuesOrder = IndexSort.indexSort( tazValues ); - int[] extNumbers = new int[tazValues.length+1]; - - for ( int i=0; i < tazValues.length; i++ ) { - int k = tazValuesOrder[i]; - extNumbers[i+1] = tazValues[k]; - } - - String[] periodLabels = new String[]{ "early", "am", "midday", "pm", "late" }; + +// int[] tazIndices = geogManager.getTazIndices(); +// +// int[] tazValues = geogManager.getTazValues(); +// int[] tazValuesOrder = IndexSort.indexSort( tazValues ); +// int[] extNumbers = new int[tazValues.length+1]; +// +// for ( int i=0; i < tazValues.length; i++ ) { +// int k = tazValuesOrder[i]; +// extNumbers[i+1] = tazValues[k]; +// } + + int[] tazIndices = geogManager.getTazIndices(); + + int[] tazValues = geogManager.getTazValues(); + int[] tazValuesOrder = IndexSort.indexSort( tazValues ); + int[] extNumbers = new int[tazIndices.length+1]; + + for ( int i=0; i < tazIndices.length; i++ ) { + if(tazIndices[i]>=0){ + int k = tazValuesOrder[tazIndices[i]]; + extNumbers[i] = tazValues[k]; + } + } + + String[] periodLabels = new String[]{ "early", "am", "midday", "pm", "late" }; + // if separateCavFiles, add empty trips table after mode tables if ( numberOfVotCategories > 1 ) { @@ -345,8 +360,8 @@ else if(numAuto > 0 && numAuto == hh.getPersons().length ) //int votCat = getVotCategoryIndex( float vot ); //if(mode == Integer.parseInt(propertyMap.get("taxi.mode.code"))){ - // if(!ifExternalStationsIncluded ||(!ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(trip.getDestMaz())) && !ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(hh.getHomeMaz())))) - // autoTripTables[period][(4-1)*numberOfVotCategories+(votCat-1)][tazIndices[geogManager.getMazTazValue(trip.getOrigMaz())]][tazIndices[geogManager.getMazTazValue(trip.getDestMaz())]] += tripExpansionFactor; + // if(!ifExternalStationsIncluded ||(!ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(trip.getDestMaz())) && !ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(hh.getHomeMaz())))) + // autoTripTables[period][(4-1)*numberOfVotCategories+(votCat-1)][tazIndices[geogManager.getMazTazValue(trip.getOrigMaz())]][tazIndices[geogManager.getMazTazValue(trip.getDestMaz())]] += tripExpansionFactor; //} } @@ -400,8 +415,7 @@ else if(numAuto > 0 && numAuto == hh.getPersons().length ) int period = getTripTablePeriod(CommonProcedures.convertMinutesToInterval(scheduleDepart+depLate-depEarly, constants), periodIntervals); - int emptyCarVotCat = 1; - + int emptyCarVotCat = 1; int emptyTripMode= 1; if ( separateCavFiles ) emptyTripMode= EMPTY_TRIP_MODE; @@ -480,10 +494,12 @@ record = hh.getId()+","+ period = getTripTablePeriod(CommonProcedures.convertMinutesToInterval(departureTime, constants), periodIntervals); - if(!ifExternalStationsIncluded ||(!ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(hh.getHomeMaz())) && !ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(trip.getOrigMaz())))) - cavTripTables[period][(emptyTripMode-1)*numberOfVotCategories+(emptyCarVotCat-1)][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]][tazIndices[geogManager.getMazTazValue(trip.getOrigMaz())]] += tripExpansionFactor; - else - nonCavTripTables[period][(emptyTripMode-1)*numberOfVotCategories+(emptyCarVotCat-1)][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]][tazIndices[geogManager.getMazTazValue(trip.getOrigMaz())]] += tripExpansionFactor; + if(!ifExternalStationsIncluded ||(!ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(hh.getHomeMaz())) && !ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(trip.getOrigMaz())))) { + if( separateCavFiles ) + cavTripTables[period][(emptyTripMode-1)*numberOfVotCategories+(emptyCarVotCat-1)][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]][tazIndices[geogManager.getMazTazValue(trip.getOrigMaz())]] += tripExpansionFactor; + else + nonCavTripTables[period][(emptyTripMode-1)*numberOfVotCategories+(emptyCarVotCat-1)][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]][tazIndices[geogManager.getMazTazValue(trip.getOrigMaz())]] += tripExpansionFactor; + } } //Add actual person trip @@ -528,13 +544,13 @@ record = hh.getId()+","+ totalAutoNonAVTrips++; } - period = getTripTablePeriod(CommonProcedures.convertMinutesToInterval(scheduleDepart+depLate-depEarly, constants), periodIntervals); + period = getTripTablePeriod(CommonProcedures.convertMinutesToInterval(scheduleDepart+depLate-depEarly, constants), periodIntervals); //logger.info(tripMode + " " + votCat + " " + period + " " + origTaz + " " + destTaz); if(!ifExternalStationsIncluded ||(!ArrayUtils.contains(geogManager.getExternalStations(),origTaz) && !ArrayUtils.contains(geogManager.getExternalStations(),destTaz))) { if(ifAvHh == 1 && separateCavFiles) - cavTripTables[period][(tripMode-1)*numberOfVotCategories+(votCat-1)][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]][tazIndices[geogManager.getMazTazValue(trip.getOrigMaz())]] += tripExpansionFactor; + cavTripTables[period][(tripMode-1)*numberOfVotCategories+(votCat-1)][tazIndices[origTaz]][tazIndices[destTaz]] += tripExpansionFactor; else - nonCavTripTables[period][(tripMode-1)*numberOfVotCategories+(votCat-1)][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]][tazIndices[geogManager.getMazTazValue(trip.getOrigMaz())]] += tripExpansionFactor; + nonCavTripTables[period][(tripMode-1)*numberOfVotCategories+(votCat-1)][tazIndices[origTaz]][tazIndices[destTaz]] += tripExpansionFactor; } //Add empty trips @@ -651,10 +667,12 @@ record = hh.getId()+","+ period = getTripTablePeriod(CommonProcedures.convertMinutesToInterval(departureTime, constants), periodIntervals); - if(!ifExternalStationsIncluded ||(!ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(trip.getDestMaz())) && !ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(hh.getHomeMaz())))) - cavTripTables[period][(emptyTripMode-1)*numberOfVotCategories+(emptyCarVotCat-1)][tazIndices[geogManager.getMazTazValue(trip.getDestMaz())]][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]] += tripExpansionFactor; - else - nonCavTripTables[period][(emptyTripMode-1)*numberOfVotCategories+(emptyCarVotCat-1)][tazIndices[geogManager.getMazTazValue(trip.getDestMaz())]][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]] += tripExpansionFactor; + if(!ifExternalStationsIncluded ||(!ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(trip.getDestMaz())) && !ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(hh.getHomeMaz())))) { + if ( separateCavFiles ) + cavTripTables[period][(emptyTripMode-1)*numberOfVotCategories+(emptyCarVotCat-1)][tazIndices[geogManager.getMazTazValue(trip.getDestMaz())]][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]] += tripExpansionFactor; + else + nonCavTripTables[period][(emptyTripMode-1)*numberOfVotCategories+(emptyCarVotCat-1)][tazIndices[geogManager.getMazTazValue(trip.getDestMaz())]][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]] += tripExpansionFactor; + } autoRecordDistance =distanceFromHome[nextOrigTaz]; @@ -704,10 +722,12 @@ record = hh.getId()+","+ period = getTripTablePeriod(CommonProcedures.convertMinutesToInterval(departureTime, constants), periodIntervals); - if(!ifExternalStationsIncluded ||(!ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(hh.getHomeMaz())) && !ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(nextTrip.getOrigMaz())))) - cavTripTables[period][(emptyTripMode-1)*numberOfVotCategories+(emptyCarVotCat-1)][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]][tazIndices[geogManager.getMazTazValue(nextTrip.getOrigMaz())]] += tripExpansionFactor; - else - nonCavTripTables[period][(emptyTripMode-1)*numberOfVotCategories+(emptyCarVotCat-1)][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]][tazIndices[geogManager.getMazTazValue(nextTrip.getOrigMaz())]] += tripExpansionFactor; + if(!ifExternalStationsIncluded ||(!ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(hh.getHomeMaz())) && !ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(nextTrip.getOrigMaz())))) { + if ( separateCavFiles ) + cavTripTables[period][(emptyTripMode-1)*numberOfVotCategories+(emptyCarVotCat-1)][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]][tazIndices[geogManager.getMazTazValue(nextTrip.getOrigMaz())]] += tripExpansionFactor; + else + nonCavTripTables[period][(emptyTripMode-1)*numberOfVotCategories+(emptyCarVotCat-1)][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]][tazIndices[geogManager.getMazTazValue(nextTrip.getOrigMaz())]] += tripExpansionFactor; + } break; } @@ -762,12 +782,14 @@ record = hh.getId()+","+ - period = getTripTablePeriod(CommonProcedures.convertMinutesToInterval(departureTime, constants), periodIntervals); - - if(!ifExternalStationsIncluded ||(!ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(trip.getDestMaz())) && !ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(hh.getHomeMaz())))) - cavTripTables[period][(emptyTripMode-1)*numberOfVotCategories+(emptyCarVotCat-1)][tazIndices[geogManager.getMazTazValue(trip.getDestMaz())]][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]] += tripExpansionFactor; - else - nonCavTripTables[period][(emptyTripMode-1)*numberOfVotCategories+(emptyCarVotCat-1)][tazIndices[geogManager.getMazTazValue(trip.getDestMaz())]][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]] += tripExpansionFactor; + period = getTripTablePeriod(CommonProcedures.convertMinutesToInterval(departureTime, constants), periodIntervals); + + if(!ifExternalStationsIncluded ||(!ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(trip.getDestMaz())) && !ArrayUtils.contains(geogManager.getExternalStations(),geogManager.getMazTazValue(hh.getHomeMaz())))) { + if ( separateCavFiles ) + cavTripTables[period][(emptyTripMode-1)*numberOfVotCategories+(emptyCarVotCat-1)][tazIndices[geogManager.getMazTazValue(trip.getDestMaz())]][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]] += tripExpansionFactor; + else + nonCavTripTables[period][(emptyTripMode-1)*numberOfVotCategories+(emptyCarVotCat-1)][tazIndices[geogManager.getMazTazValue(trip.getDestMaz())]][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]] += tripExpansionFactor; + } break; } @@ -812,9 +834,9 @@ record = hh.getId()+","+ period = getTripTablePeriod(CommonProcedures.convertMinutesToInterval(trip.getSchedDepart()+depLate-depEarly, constants), periodIntervals); if(!ifExternalStationsIncluded ||(!ArrayUtils.contains(geogManager.getExternalStations(),origTaz) && !ArrayUtils.contains(geogManager.getExternalStations(),destTaz))) if(ifAvHh == 1 && separateCavFiles) - cavTripTables[period][(4-1)*numberOfVotCategories+(votCat-1)][tazIndices[geogManager.getMazTazValue(trip.getDestMaz())]][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]] += tripExpansionFactor; + cavTripTables[period][(4-1)*numberOfVotCategories+(votCat-1)][tazIndices[geogManager.getMazTazValue(trip.getOrigMaz())]][tazIndices[geogManager.getMazTazValue(trip.getDestMaz())]] += tripExpansionFactor; else - nonCavTripTables[period][(4-1)*numberOfVotCategories+(votCat-1)][tazIndices[geogManager.getMazTazValue(trip.getDestMaz())]][tazIndices[geogManager.getMazTazValue(hh.getHomeMaz())]] += tripExpansionFactor; + nonCavTripTables[period][(4-1)*numberOfVotCategories+(votCat-1)][tazIndices[geogManager.getMazTazValue(trip.getOrigMaz())]][tazIndices[geogManager.getMazTazValue(trip.getDestMaz())]] += tripExpansionFactor; } } int hhUnusedCar = 0; @@ -898,7 +920,7 @@ record = hh.getId()+","+ for ( int j=0; j < numModeTables-1; j++ ) { for (int v = 0; v