<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Siliconcreek.net: The Blog of Andrew Rohne</title>
	<atom:link href="http://www.siliconcreek.net/feed" rel="self" type="application/rss+xml" />
	<link>http://www.siliconcreek.net</link>
	<description>This is the unfiltered personal website of Andrew Rohne, expert Cube Voyager user, transportation planner, engineer, programmer, ham radio operator, and all-around geek.</description>
	<lastBuildDate>Fri, 30 Sep 2011 14:37:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Arduino Based Bluetooth Scanners</title>
		<link>http://www.siliconcreek.net/transportation/arduino-based-bluetooth-scanners</link>
		<comments>http://www.siliconcreek.net/transportation/arduino-based-bluetooth-scanners#comments</comments>
		<pubDate>Fri, 30 Sep 2011 13:22:06 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Transportation]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Bluetooth]]></category>
		<category><![CDATA[data collection]]></category>
		<category><![CDATA[O-D Studies]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=747</guid>
		<description><![CDATA[This is a post about a work in progress&#8230; If you&#8217;re in the transportation field, you&#8217;ve likely heard of the Bluetooth Scanners that cost around $4,000 each. These devices scan MAC (Media Access Control) addresses and log them (with the time of the scan) and use that for travel time studies or for origin-destination studies. [...]]]></description>
			<content:encoded><![CDATA[<p>This is a post about a work in progress&#8230;</p>
<p>If you&#8217;re in the transportation field, you&#8217;ve likely heard of the Bluetooth Scanners that cost around $4,000 each. These devices scan MAC (Media Access Control) addresses and log them (with the time of the scan) and use that for travel time studies or for origin-destination studies.</p>
<p>My question is, can we build something good-enough with an Arduino for much less money? Something like the concept below?</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2011/09/Arduino-BT-Concept.png" rel="shadowbox[sbpost-747];player=img;" title="Arduino Bluetooth Tracker Concept"><img class="alignnone size-medium wp-image-748" title="Arduino Bluetooth Tracker Concept" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2011/09/Arduino-BT-Concept-300x161.png" alt="" width="300" height="161" /></a></p>
<p>&nbsp;</p>
<p>There&#8217;s reasons for everything:</p>
<h3><strong>Arduino</strong></h3>
<p>Controls it all and brings it together.  Turns on the GPS, Bluetooth, listens to the stream of data from both, writes to the memory card.</p>
<h3><strong>GPS</strong></h3>
<p>The Arduino has no real-time clock (meaning that unless you tell it what time it is, it doesn&#8217;t know!).  The GPS signal includes time.  It also includes position, which would be pretty useful.</p>
<h3>Bluetooth</h3>
<p>If we&#8217;re going to scan for Bluetooth MAC addresses, something to receive them might come in handy&#8230;</p>
<h3>Something to Write To</h3>
<p>Scanning the addresses would be pretty pointless without storing the data.</p>
<h2>Initial Design</h2>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2011/09/2011-09-28_13-04-34_319.jpg" rel="shadowbox[sbpost-747];player=img;" title="The Bluetooth Tracker, version 1.0"><img src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2011/09/2011-09-28_13-04-34_319-300x237.jpg" alt="" title="The Bluetooth Tracker, version 1.0" width="300" height="237" class="alignnone size-medium wp-image-760" /></a></p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2011/09/Bluetooth-Reader_bb.png" rel="shadowbox[sbpost-747];player=img;" title="Bluetooth Reader"><img class="alignnone size-medium wp-image-752" title="Bluetooth Reader" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2011/09/Bluetooth-Reader_bb-300x188.png" alt="" width="300" height="188" /></a></p>
<p>&nbsp;</p>
<pre class="brush:c">
/*
Bluetooth Tracker
Written by Andrew Rohne (arohne@oki.org)
www.oki.org
*/

#include
#include 

NewSoftSerial ol(10,11);

char inByte;
boolean ext=false;

void setup(){
  String btreturn;
  Serial.begin(115200);
  delay(1500);
  Serial.print("$$$");
  delay(1000);

}

void loop(){
  byte incomingByte=-1;
  byte index=0;
  char macaddys[160];

  while(Serial.available()&gt;0){
    index=0;
    Serial.println("IN15");
    delay(16500);
    incomingByte=Serial.read();
    while(incomingByte>-1 &#038;&#038; index<160){
      macaddys[index]=(char)incomingByte;
      index++;
      incomingByte=Serial.read();
    }
    if(macaddys!=""){
      Serial.end();
      writelog((String)millis()+":"+macaddys+"\r\n");
      Serial.begin(115200);
    }
  }
  if(Serial.available()<=0){
    delay(1000);
    Serial.begin(115200);
  }

}

void writelog(String line)
{
  ol.begin(9600);
  ol.print(line);
  ol.end();
}
</pre>
<h2>The Results</h2>
<p>The program wrote about 5kb of text to the file before dying after 489986 milliseconds (8 minutes).  I had left it on a windowsill overnight (the windowsill is literally about 15 feet from Fort Washington Way in Cincinnati, which is 6 lanes (see below for the range centered on roughly where the setup was located).</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2011/09/100metermap.png" rel="shadowbox[sbpost-747];player=img;" title="100 meter map"><img src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2011/09/100metermap-300x193.png" alt="" title="100 meter map" width="300" height="193" class="alignnone size-medium wp-image-759" /></a></p>
<p>There were 9 unique Bluetooth MAC addresses scanned.  During the 8 minutes, there were 25 groups of MAC addresses written to the file.  5 MAC addresses appeared in multiple groups, with 3 of the MAC addresses appearing in 24 of the groups (and they may have appeared in the last group, it appears to have been cut off).  Those same 4 have been seen in earlier tests, too, so I don't know what's going on there.</p>
<h2>The Problems to Fix</h2>
<p>Well, first there's the problem that I had let it run all night, and it only had 8 minutes of data.  Something is causing the Arduino to stop writing or the OpenLog to stop operating.</p>
<p>In the output file, there are a few issues.  First, some processing needs to be done, and second, it appears I am reading past the end of the serial buffer (if you look in the image below, you can see a lot of characters that look like a y with an umlaut).</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2011/09/bluetoothlogsample.png" rel="shadowbox[sbpost-747];player=img;" title="Bluetooth Sample Log"><img src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2011/09/bluetoothlogsample-300x179.png" alt="" title="Bluetooth Sample Log" width="300" height="179" class="alignnone size-medium wp-image-757" /></a></p>
<p>In the code above, the IN15 command is sent to the Bluetooth Mate Gold, which tells it to inquire for 15 seconds, and then I delay for 16.5 seconds.  This is because I THINK there is a delay after the scan finishes. I don't know how long that delay is.  Vehicles traveling by at 65 MPH is 95.333 feet per second.  Assuming I can get the Bluetooth device very close to the road, that 1.5 second gap SHOULD be okay, but if I have to go longer it could be a problem (the range of a Class 1 Bluetooth device is 313 feet, so a device can be scanned anytime in 626 feet (up to 313 feet before the Bluetooth Station and up to 313 feet after the Bluetooth station).  A vehicle would be in range for about 6.6 seconds.  However, the Bluetooth signal is at 2.4 - 2.485 Ghz, and is susceptible to some interference from the vehicle, driver, passengers, etc., so speed is key.</p>
<h2>Conclusion</h2>
<p>I'm on the fence as to whether or not the Bluetooth Mate Gold is the right way to do this.  I will still be doing some research to see if I can get better speed out of it, or if I need to look into a different receiver that can receive the 2.4 GHz area and look for MAC addresses and stream them to the Arduino.</p>
<p>I also need to get the GPS up and running.  That is a different story altogether, as I have been trying on that and have not been successful (despite using code that works for my personal Arduino and GPS, although the model of GPS 'chip' is different.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/arduino-based-bluetooth-scanners/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>More Voyager PT + AWK Goodness</title>
		<link>http://www.siliconcreek.net/transportation/more-voyager-pt-awk-goodness</link>
		<comments>http://www.siliconcreek.net/transportation/more-voyager-pt-awk-goodness#comments</comments>
		<pubDate>Tue, 20 Sep 2011 13:44:09 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Transportation]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[cube]]></category>
		<category><![CDATA[gawk]]></category>
		<category><![CDATA[pt]]></category>
		<category><![CDATA[transit]]></category>
		<category><![CDATA[voyager]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=744</guid>
		<description><![CDATA[One thing I&#8217;ve missed from the old TranPlan days was the reporting group.  We&#8217;ve used that for many years to compare our transit loadings by major corridor.  Unfortunately, that functionality was lost going to PT.  I still need it, though, and enter awk. The script below looks at the transit line file and outputs ONLY [...]]]></description>
			<content:encoded><![CDATA[<p>One thing I&#8217;ve missed from the old TranPlan days was the reporting group.  We&#8217;ve used that for many years to compare our transit loadings by major corridor.  Unfortunately, that functionality was lost going to PT.  I still need it, though, and enter awk.</p>
<p>The script below looks at the transit line file and outputs ONLY the line code, comma-separated.  It uses a loop to check each field for &#8216; NAME=&#8217; and &#8216;USERN2&#8242;, which is where we now store our reporting group codes.</p>
<pre class="brush:shell">
BEGIN{
FS=","
RS="LINE"
}
{
	for (i=1;i<20;i++)
	{
		if($i~/ NAME=/)
		{
			printf "%s,",substr($i,8,length($i)-8)
		}
		if($i~/USERN2/)
		{
			printf "%s\n",substr($i,9)
		}
	}
}
</pre>
<p>The contents of the above need to be saved to a .awk file - I used trn.awk.</p>
<p>To call this, I use a Pilot script to call awk and pass the input and get the output.</p>
<pre class="brush:shell">
*awk -f {CATALOG_DIR}/INPUTS/trn.awk {CATALOG_DIR}/INPUTS/OKIROUTES.LIN >{CATALOG_DIR}/OKIROUTES.CSV
</pre>
<p>The output of this is a simple two-column comma-separated-value file of the route ID and the reporting group.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/more-voyager-pt-awk-goodness/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Gawk to get a SimpleTransit Loadings Table from Cube PT</title>
		<link>http://www.siliconcreek.net/transportation/using-gawk-to-get-transit-loadings-from-cube-pt</link>
		<comments>http://www.siliconcreek.net/transportation/using-gawk-to-get-transit-loadings-from-cube-pt#comments</comments>
		<pubDate>Mon, 19 Sep 2011 15:44:46 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Transportation]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[cube]]></category>
		<category><![CDATA[gawk]]></category>
		<category><![CDATA[gnuwin]]></category>
		<category><![CDATA[pt]]></category>
		<category><![CDATA[voyager]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=738</guid>
		<description><![CDATA[One thing that I don&#8217;t like about Cube is the transit loadings report is stuck in the big program print report.  To pull this out, the following code works pretty well: gawk /'^REPORT LINES UserClass=Total'/,/'^Total '/ 63PTR00A.PRN >outputfile.txt Where 63PTR00A.PRN is the print file. Note the spaces after ^Total. For whatever reason, using the karat [...]]]></description>
			<content:encoded><![CDATA[<p>One thing that I don&#8217;t like about Cube is the transit loadings report is stuck in the big program print report.  To pull this out, the following code works pretty well:</p>
<pre class="brush:shell">gawk /'^REPORT LINES  UserClass=Total'/,/'^Total     '/ 63PTR00A.PRN >outputfile.txt</pre>
<p>Where 63PTR00A.PRN is the print file. Note the spaces after ^Total. For whatever reason, using the karat (the &#8216;^&#8217;) isn&#8217;t working to find &#8216;Total&#8217; as the first thing on the line. So, I added the spaces so it gets everything.  Outputfile.txt is where this will go.  It will just be the table.</p>
<p>NOTE: You need GNUWin32 installed to do this.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/using-gawk-to-get-transit-loadings-from-cube-pt/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using GAWK to Get Through CTPP Data</title>
		<link>http://www.siliconcreek.net/transportation/using-gawk-to-get-through-ctpp-data</link>
		<comments>http://www.siliconcreek.net/transportation/using-gawk-to-get-through-ctpp-data#comments</comments>
		<pubDate>Thu, 18 Aug 2011 19:54:26 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Transportation]]></category>
		<category><![CDATA[ctpp]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[gawk]]></category>
		<category><![CDATA[gnuwin]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=725</guid>
		<description><![CDATA[The 3-year CTPP website lacks a little in usability (just try getting a county-county matrix out of it). One of the CTPP staff pointed me to the downloads, which are a double-edge sword. On one hand, you have a lot of data without an interface in the way. On the other hand, you have a [...]]]></description>
			<content:encoded><![CDATA[<p>The 3-year CTPP website lacks a little in usability (just try getting a county-county matrix out of it).</p>
<p>One of the CTPP staff pointed me to the downloads, which are a double-edge sword. On one hand, you have a lot of data without an interface in the way. On the other hand, you have a lot of data.</p>
<p>I found it was easiest to use GAWK to get through the data, and it was pretty easy:</p>
<pre class="brush:shell">gawk '/.*COUNTY_CODE.*/' *.csv &gt;Filename.txt</pre>
<p>Where COUNTY_CODE is the code from Pn-Labels-xx.txt where n is the part number (1,2, or 3) and xx is the state abbreviation.</p>
<p><strong>NOTE: Look up the county code EACH TIME.  It changes among parts 1, 2, and 3.</strong></p>
<p>This command will go through all .csv files and output any line with the county code to the new file.</p>
<h3>UPDATE</h3>
<p>I have multiple counties to deal with.  There&#8217;s an easy way to start on getting a matrix:</p>
<pre class="brush:shell">gawk '/C4300US.*(21037|21015|21117).*32100.*/' *.csv &gt;TotalFlowsNKY.csv</pre>
<p>This results in a CSV table of only the total flows from three Northern Kentucky counties (21037, 21015, 21117; Campbell, Boone, and Kenton county, respectfully).  For simplicity&#8217;s sake, I didn&#8217;t include all 11 that I used.</p>
<h3>Finishing Up</h3>
<p>Then, I did a little Excel magic to build a matrix for all 11 counties and externals.  The formula is shown.  I have an additional sheet which is basically a cross reference of the county FIPS codes to the name abbreviations I&#8217;m using.  See the image below (click for a larger version).<br />
<a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2011/08/ExcelCSV_gawkctpp3.png" rel="shadowbox[sbpost-725];player=img;" title="CSV file"><img class="alignnone size-medium wp-image-733" title="CSV file" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2011/08/ExcelCSV_gawkctpp3-300x97.png" alt="" width="300" height="97" /></a></p>
<p>After this, I built a matrix in Excel.  The matrix uses array summation (when you build this formula, you press CTRL+Enter to set it up right, else the returned value will be 0).</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2011/08/ExcelCSV_gawkctpp3_mtx.png" rel="shadowbox[sbpost-725];player=img;" title="Excel Matrix"><img class="alignnone size-medium wp-image-734" title="Excel Matrix" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2011/08/ExcelCSV_gawkctpp3_mtx-300x133.png" alt="" width="300" height="133" /></a></p>
<p>Using these techniques, I was able to get a journey to work matrix fairly quickly and without a lot of manual labor.</p>
<p>NOTE</p>
<p>You need to have <a title="GNUWin32 Sourceforge page" href="http://gnuwin32.sourceforge.net/" target="_blank">GNUWin32 </a>installed to use gawk.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/using-gawk-to-get-through-ctpp-data/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using gawk to Get PT Unassigned Trips Output into a Matrix</title>
		<link>http://www.siliconcreek.net/transportation/using-gawk-to-get-pt-unassigned-trips-output-into-a-matrix</link>
		<comments>http://www.siliconcreek.net/transportation/using-gawk-to-get-pt-unassigned-trips-output-into-a-matrix#comments</comments>
		<pubDate>Fri, 15 Jul 2011 15:19:29 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Transportation]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[cube]]></category>
		<category><![CDATA[gawk]]></category>
		<category><![CDATA[gnuwin]]></category>
		<category><![CDATA[pt]]></category>
		<category><![CDATA[survey]]></category>
		<category><![CDATA[tobs]]></category>
		<category><![CDATA[transit]]></category>
		<category><![CDATA[voyager]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=718</guid>
		<description><![CDATA[In the process of quality-control checking a transit on-board survey, one task that has been routinely mentioned on things like TMIP webinars is to assign your transit trip-table from your transit on-board survey.  This serves two purposes &#8211; to check the survey and to check the transit network. PT (and TranPlan&#8217;s LOAD TRANSIT NETWORK, and [...]]]></description>
			<content:encoded><![CDATA[<p>In the process of quality-control checking a transit on-board survey, one task that has been routinely mentioned on things like TMIP webinars is to assign your transit trip-table from your transit on-board survey.  This serves two purposes &#8211; to check the survey and to check the transit network.</p>
<p>PT (and TranPlan&#8217;s LOAD TRANSIT NETWORK, and probably TRNBUILD, too) will attempt to assign all trips.  Trips that are not assigned are output into the print file.  In PT (what this post will focus on), will output a line similar to this:</p>
<p><code><br />
W(742): 1 Trips for I=211 to J=277, but no path for UserClass 1.<br />
</code></p>
<p>When a transit path is not found.  With a transit on-board survey, there may be a lot of these.  Therefore, less time spent writing code to parse them, the better.</p>
<p>To get this to a file that is easier to parse, start with your transit script, and add the following line near the top:</p>
<p><code><br />
GLOBAL PAGEHEIGHT=32767<br />
</code></p>
<p>This removes the page headers. I had originally tried this with page headers in the print file, but it created problems. Really, you probably won&#8217;t print this anyway, so removing the page headers is probably a Godsend to you!</p>
<p>Then, open a command line, and type the following:</p>
<pre class="brush:shell">
gawk '/(W\(742\).*)\./ {print $2,$5,$7}' TCPTR00A.PRN >UnassignedTransitTrips.PRN
</pre>
<p>Note that TCPTR00A.PRN is the transit assignment step print file, and UnassignedTransitTrips.PRN is the destination file.  The {print $2,$5,$7} tells gawk to print the second, fifth, and seventh columns.  Gawk figures out the columns itself based on spaces in the lines.  The >UnassignedTransitTrips.PRN directs the output to that file, instead of listing it on the screen.</p>
<p>The UnassignedTransitTrips.PRN file should include something like:</p>
<p><code><br />
1 I=3 J=285,<br />
1 I=3 J=289,<br />
1 I=3 J=292,<br />
1 I=6 J=227,<br />
1 I=7 J=1275,<br />
</code></p>
<p>The first column is the number of unassigned trips, the second column is the I zone, and the last column is the J zone.</p>
<p>This file can then be brought into two Matrix steps to move it to a matrix.  The first step should include the following code:</p>
<pre class="brush:shell">
RUN PGM=MATRIX PRNFILE="S:\USER\ROHNE\PROJECTS\TRANSIT OB SURVEY\TRAVELMODEL\MODEL\TCMAT00A.PRN"
FILEO RECO[1] = "S:\User\Rohne\Projects\Transit OB Survey\TravelModel\Model\Outputs\UnassignedAM.DBF",
 FIELDS=IZ,JZ,V
FILEI RECI = "S:\User\Rohne\Projects\Transit OB Survey\TravelModel\Model\UnassignedTransitTrips.PRN"

RO.V=RECI.NFIELD[1]
RO.IZ=SUBSTR(RECI.CFIELD[2],3,STRLEN(RECI.CFIELD[2])-2)
RO.JZ=SUBSTR(RECI.CFIELD[3],3,STRLEN(RECI.CFIELD[3])-2)
WRITE RECO=1

ENDRUN
</pre>
<p>This first step parses the I=, J=, and comma out of the file and inserts the I, J, and number of trips into a DBF file.  This is naturally sorted by I then J because of the way PT works and because I am only using one user class in this case.</p>
<p>The second Matrix step is below:</p>
<pre class="brush:shell">
RUN PGM=MATRIX
FILEO MATO[1] = "S:\User\Rohne\Projects\Transit OB Survey\TravelModel\Model\Outputs\UnassignedAM.MAT" MO=1
FILEI MATI[1] = "S:\User\Rohne\Projects\Transit OB Survey\TravelModel\Model\Outputs\UnassignedAM.DBF" PATTERN=IJM:V FIELDS=IZ,JZ,0,V

PAR ZONES=2425

MW[1]=MI.1.1
ENDRUN
</pre>
<p>This step simply reads the DBF file and puts it into a matrix.</p>
<p>At this point, you can easily draw desire lines to show the unassigned survey trips.  Hopefully it looks better than mine!<br />
<a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2011/07/unmet_transit.png" rel="shadowbox[sbpost-718];player=img;" title="Unmet transit desire lines"><img src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2011/07/unmet_transit-300x187.png" alt="" title="Unmet transit desire lines" width="300" height="187" class="alignnone size-medium wp-image-719" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/using-gawk-to-get-pt-unassigned-trips-output-into-a-matrix/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting the 2nd Line through the Last Line of a File</title>
		<link>http://www.siliconcreek.net/transportation/getting-the-2nd-line-through-the-last-line-of-a-file</link>
		<comments>http://www.siliconcreek.net/transportation/getting-the-2nd-line-through-the-last-line-of-a-file#comments</comments>
		<pubDate>Fri, 24 Jun 2011 20:40:12 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Transportation]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[gnuwin]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=710</guid>
		<description><![CDATA[One recent work task involved compiling 244 CSV traffic count files and analyzing the data. I didn&#8217;t want to write any sort of program to import the data into Access or FoxPro, and I didn&#8217;t want to mess with it (since it would be big) in Excel or Notepad++. So, I took the first of [...]]]></description>
			<content:encoded><![CDATA[<p>One recent work task involved compiling 244 CSV traffic count files and analyzing the data.</p>
<p>I didn&#8217;t want to write any sort of program to import the data into Access or FoxPro, and I didn&#8217;t want to mess with it (since it would be big) in Excel or Notepad++.</p>
<p>So, I took the first of the 244 files and named it CountData.csv.  The remaining files all begin with &#8216;fifteen_min&#8217; and they are isolated in their own folder with no subfolders.</p>
<p>Enter Windows PowerShell really powered up with GNUWin.</p>
<p>One command:<br />
<code>awk 'NR==2,NR&lt;2' .\f*.csv &gt;&gt; CountData.csv</code></p>
<p>awk is a data extraction and reporting tool that uses a data-driven scripting language consisting of a set of actions to be taken against textual data (either in files or data streams) for the purpose of producing formatted reports (source: <a href="http://en.wikipedia.org/wiki/AWK">Wikipedia</a>).</p>
<p>The first argument, NR==2 means start on record #2, or the second line in the file.<br />
The second argument, NR&lt;2, means end on the record less than 2.  In this case, it always returns false, and thus the remainder of the file is output. The .\f*.csv means any file in this folder where the first letter is f and the last 4 letters are .csv (and anything goes between them). The &#8216;&gt;&gt; CountData.csv&#8217; means to append to CountData.csv</p>
<p>Once I started this process, it ran for a good 45 minutes and created a really big file (about 420 MB).</p>
<p>After all this, I saw a bunch of &#8220;NUL&#8221; characters in Notepad++, roughly one every-other-letter, and it looked like the data was there (just separated by &#8220;NUL&#8221; characters).  I had to find and replace &#8220;\x00&#8243; with blank (searching as Regular Expression).  That took a while.</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2011/06/fr_nul.png" rel="shadowbox[sbpost-710];player=img;" title="fr_nul"><img class="alignnone size-medium wp-image-716" title="fr_nul" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2011/06/fr_nul-300x210.png" alt="" width="300" height="210" /></a></p>
<p>Acknowledgements:</p>
<p><a href="http://linuxcommando.blogspot.com/2008/04/using-awk-to-extract-lines-in-text-file.html">The Linux Commando</a>.  His post ultimately helped me put two and two together to do what I needed to do.</p>
<p><a href="http://security102.blogspot.com/2010/04/findreplace-of-nul-objects-in-notepad.html">Security 102</a>.  The NUL thing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/getting-the-2nd-line-through-the-last-line-of-a-file/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Emailing an alert that a model run is complete in Cube Voyager</title>
		<link>http://www.siliconcreek.net/transportation/emailing-an-alert-that-a-model-run-is-complete-in-cube-voyager</link>
		<comments>http://www.siliconcreek.net/transportation/emailing-an-alert-that-a-model-run-is-complete-in-cube-voyager#comments</comments>
		<pubDate>Sun, 06 Mar 2011 13:00:18 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Transportation]]></category>
		<category><![CDATA[cube]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[tdm]]></category>
		<category><![CDATA[voyager]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=703</guid>
		<description><![CDATA[When you are doing many model runs, it makes life easier to know if the modelrun is complete.  The code is below. SENDMAIL, SMTPSERVER='MAILSERVER HERE', FROM='from@somwehere.com', TO='to@somewhere.com', SUBJECT='Subject Line Here', MESSAGE='Message Goes Here', USERNAME='username', PASSWORD='password' The things you replace here are pretty obvious.  If you have questions about the SMTPSERVER parameter, ask your IT person. [...]]]></description>
			<content:encoded><![CDATA[<p>When you are doing many model runs, it makes life easier to know if the modelrun is complete.  The code is below.<br />
<code><br />
SENDMAIL,<br />
SMTPSERVER='MAILSERVER HERE',<br />
FROM='from@somwehere.com',<br />
TO='to@somewhere.com',<br />
SUBJECT='Subject Line Here',<br />
MESSAGE='Message Goes Here',<br />
USERNAME='username',<br />
PASSWORD='password'<br />
</code><br />
The things you replace here are pretty obvious.  If you have questions about the SMTPSERVER parameter, ask your IT person.  Also, for Windows domains, the USERNAME parameter should be &#8216;DOMAIN\USERNAME&#8217; (you may be able to use your email address, depending on your email setup).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/emailing-an-alert-that-a-model-run-is-complete-in-cube-voyager/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding a Search Engine in Chrome to Track UPS Shipments</title>
		<link>http://www.siliconcreek.net/computers/adding-a-search-engine-in-chrome-to-track-ups-shipments</link>
		<comments>http://www.siliconcreek.net/computers/adding-a-search-engine-in-chrome-to-track-ups-shipments#comments</comments>
		<pubDate>Wed, 22 Dec 2010 13:35:16 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Search Engines]]></category>
		<category><![CDATA[Tracking]]></category>
		<category><![CDATA[UPS]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=680</guid>
		<description><![CDATA[One of the cool features of the Google Chrome Browser is the ability to add search engines and search them from the address bar. This tip builds on that capability to track UPS shipments based on their UPS Tracking Number. The first step is to go to the options menu by clicking on the wrench [...]]]></description>
			<content:encoded><![CDATA[<p>One of the cool features of the Google Chrome Browser is the ability to add search engines and search them from the address bar.  This tip builds on that capability to track UPS shipments based on their UPS Tracking Number.</p>
<p>The first step is to go to the options menu by clicking on the wrench icon and going to Options:</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/12/addUPS1.png" rel="shadowbox[sbpost-680];player=img;"><img src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/12/addUPS1-207x300.png" width="207" height="300" /></a></p>
<p>The second step is to go to the Basics tab (or on Mac, click on the Basics icon)</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/12/addUPS2.png" rel="shadowbox[sbpost-680];player=img;" title="Step 2: Manage Search Engines"><img class="alignnone size-medium wp-image-683" title="Step 2: Manage Search Engines" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/12/addUPS2-284x300.png" alt="Step 2: Manage Search Engines" width="170" height="180" /></a> <a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/12/addUPS2_OSX.png" rel="shadowbox[sbpost-680];player=img;" title="Step 2: Manage Search Engine (OS X)"><img class="alignnone size-medium wp-image-690" title="Step 2: Manage Search Engine (OS X)" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/12/addUPS2_OSX-300x290.png" alt="Step 2: Manage Search Engine (OS X)" width="180" height="174" /></a></p>
<p>The third step is to add the search engine.  On Windows, click Add, and then fill out the resulting form, on OS X, click the &#8216;+&#8217; button and do the same.</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/12/addUPS3.png" rel="shadowbox[sbpost-680];player=img;" title="Step 3: Add a Search Engine"><img class="alignnone size-medium wp-image-684" title="Step 3: Add a Search Engine" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/12/addUPS3-300x238.png" alt="Step 3: Add a Search Engine" width="180" height="143" /></a><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/12/addUPS3_OSX.png" rel="shadowbox[sbpost-680];player=img;" title="Step 3: Click on the '+' and add the search engine settings (OS X)"><img class="alignnone size-medium wp-image-691" title="Step 3: Click on the '+' and add the search engine settings (OS X)" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/12/addUPS3_OSX-300x208.png" alt="Step 3: Click on the '+' and add the search engine settings (OS X)" width="180" height="125" /></a></p>
<p>Windows Form:</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/12/addUPS4.png" rel="shadowbox[sbpost-680];player=img;" title="Windows Form"><img class="alignnone size-thumbnail wp-image-685" title="Windows Form" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/12/addUPS4-150x150.png" alt="Windows Form" width="150" height="150" /></a></p>
<p>The following are the items for the form:</p>
<p><strong>Name:</strong> UPS</p>
<p><strong>Keyword:</strong> UPS</p>
<p style="text-align: left;"><strong>URL:</strong> http://wwwapps.ups.com/WebTracking/processInputRequest?sort_by=status&amp;tracknums_displ ayed=1&amp;TypeOfInquiryNumber=T&amp;loc=en_US&amp;InquiryNumber1=%s&amp;track.x=0&amp;track.y=0</p>
<p style="text-align: left;"><em><strong>NOTE: The entire URL above should be one line with no spaces!</strong></em></p>
<p>Click OK on everything (or in some cases, the red circle on OS X).  To use this, open Chrome, type &#8216;ups&#8217; in the address bar and press Tab and enter the tracking number (copy-paste works well for this).</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/12/addUPS5.png" rel="shadowbox[sbpost-680];player=img;" title="Type 'UPS' in the address bar..."><img class="alignnone size-medium wp-image-686" title="Type 'UPS' in the address bar..." src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/12/addUPS5-300x124.png" alt="Type 'UPS' in the address bar..." width="300" height="124" /></a></p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/12/addUPS5.png" rel="shadowbox[sbpost-680];player=img;"></a><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/12/addUPS6.png" rel="shadowbox[sbpost-680];player=img;" title="...Press Tab, and paste your tracking number..."><img class="alignnone size-medium wp-image-687" title="...Press Tab, and paste your tracking number..." src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/12/addUPS6-300x95.png" alt="...Press Tab, and paste your tracking number..." width="300" height="95" /></a></p>
<p>Once you press Enter, you will immediately go to the UPS website showing your tracking information.  In this case, my shipment won&#8217;t make it by Christmas.  Oh well.</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/12/addUPS7.png" rel="shadowbox[sbpost-680];player=img;" title="...and see your tracking information"><img class="alignnone size-medium wp-image-681" title="...and see your tracking information" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/12/addUPS7-300x159.png" alt="...and see your tracking information" width="300" height="159" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/computers/adding-a-search-engine-in-chrome-to-track-ups-shipments/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python and Cube</title>
		<link>http://www.siliconcreek.net/transportation/python-and-cube</link>
		<comments>http://www.siliconcreek.net/transportation/python-and-cube#comments</comments>
		<pubDate>Sun, 19 Dec 2010 13:00:24 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Transportation]]></category>
		<category><![CDATA[cube]]></category>
		<category><![CDATA[GIS]]></category>
		<category><![CDATA[Pilot]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[voyager]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=674</guid>
		<description><![CDATA[One of the advantages of the ESRI ArcGIS Framework is that you can write Python scripts that do GIS things and run them from Cube.  Even better, Cube uses the Geodatabase format, so you can store and retrieve things from there. The first thing that is needed is a python script.  The below is an [...]]]></description>
			<content:encoded><![CDATA[<p>One of the advantages of the ESRI ArcGIS Framework is that you can write Python scripts that do GIS things and run them from Cube.  Even better, Cube uses the Geodatabase format, so you can store and retrieve things from there.</p>
<p>The first thing that is needed is a python script.  The below is an example that we&#8217;re not using at the moment, but it merges multiple transit line files together.</p>
<pre class="brush:python">import arcgisscripting, sys, os
gp=arcgisscripting.create()

gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolBox/Toolboxes/Data Management Tools.tbx")

print sys.argv

input1=sys.argv[1]
input2=sys.argv[2]
output=sys.argv[3]

in1=input1+input1[input1.rfind("\\"):]+"_PTLine"
in2=input2+input2[input2.rfind("\\"):]+"_PTLine"

input=in1+';'+in2
input=input.replace("\\","/")
output=output.replace("\\","/")

print input
print output

if gp.Exists(output):
    gp.delete_management(output)

#input=input1+"_PTLine" +';'+input2 +"_PTLine"

gp.Merge_management(input,output)

print gp.GetMessage

del gp</pre>
<p>To call this, we add the following in a Pilot script:</p>
<pre class="brush:plain">*merge.py {CATALOG_DIR}\Inputs\Transit.mdb\Routes1 {CATALOG_DIR}\Inputs\Transit.mdb\Routes2 {CATALOG_DIR}\Inputs\Transit.mdb\RoutesCombined</pre>
<p>This makes it easy to create geoprocessing steps in ArcMap, export them to Python, and call them from the model.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/python-and-cube/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Top 6 Resources for a Travel Modeler to Work From Home</title>
		<link>http://www.siliconcreek.net/transportation/top-6-resources-for-a-travel-modeler-to-work-from-home</link>
		<comments>http://www.siliconcreek.net/transportation/top-6-resources-for-a-travel-modeler-to-work-from-home#comments</comments>
		<pubDate>Thu, 16 Dec 2010 16:09:56 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Transportation]]></category>
		<category><![CDATA[googledocs]]></category>
		<category><![CDATA[Management]]></category>
		<category><![CDATA[open-source]]></category>
		<category><![CDATA[remote-working]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=667</guid>
		<description><![CDATA[It&#8217;s the most wonderful time of the year, isn&#8217;t it?  Nothing says &#8220;winter&#8221; like 6 inches of snow that keeps you from going to the office! Over the years, I&#8217;ve amassed a set of utilities, many of them free, to make my life easier.  This list can sometimes take the place of things that I [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s the most wonderful time of the year, isn&#8217;t it?  Nothing says &#8220;winter&#8221; like 6 inches of snow that keeps you from going to the office!</p>
<p>Over the years, I&#8217;ve amassed a set of utilities, many of them free, to make my life easier.  This list can sometimes take the place of things that I would normally use in the office, other times they are things that sync to the &#8220;cloud&#8221; and I use them both in the office and at home.</p>
<p>1. <a href="https://www.dropbox.com/referrals/NTczNDcyOTk5?src=global0">Dropbox</a></p>
<p>I don&#8217;t care too much for USB &#8220;thumb&#8221; drives, and I&#8217;ve had my fair share of leaving them at home or at work and needing them at the opposite location.  Dropbox clears up this mess, as there are no USB drives to lose or leave in the wrong place.  NOTE: the link that I have IS a referral link.  Clicking on that and creating an account results in both of us getting an extra 250 MB of space with the free account (starts at 2 GB, max for free is 8 GB).</p>
<p>2. <a href="http://www.evernote.com/" target="_blank">Evernote</a></p>
<p>I take a lot of notes, both on the road at conferences and at the office.  Evernote is what I use to keep them organized.</p>
<p>3. <a href="http://docs.google.com" target="_blank">Google Docs</a></p>
<p>Unless you want to spring for Microsoft Office at home, Google Docs is the way to go.  There are several others including Zoho and Office Online, but I haven&#8217;t used them.  Google Docs has great collaboration features, document versioning, and its free.  <a href="http://www.siliconcreek.net/computers/getting-googlecl-to-download-drawings">Just make sure to back it up!</a> The only problem: no DBF file support.</p>
<p>4. <a href="http://notepad-plus-plus.org/" target="_blank">Notepad++</a></p>
<p>This is perhaps the greatest text editor.  It understands and does some context highlighting (etc) for many programming languages.  Even better, Colby from Citilabs <a href="http://www.citilabs.com/usergroup/node/240" target="_blank">uploaded his language definition file for Cube Voyager to the user group</a>!</p>
<p>5. <a href="http://www.microsoft.com/express/">Microsoft Visual {whatever} Express Edition</a></p>
<p>The Express Edition tools have become our go-to tools for new development, particularly MS Visual C++ EE and MS Visual Basic EE.  Since they&#8217;re free, you can have copies both at home and work.</p>
<p>6. <a href="http://www.eclipse.org" target="_blank">Eclipse</a></p>
<p>This one&#8217;s almost optional, but for those working with Java models, this is the standard IDE, and it is open source.</p>
<p>Any tools to add?  Add them in the comments below.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/top-6-resources-for-a-travel-modeler-to-work-from-home/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using a Class Object to Help Read a Control File</title>
		<link>http://www.siliconcreek.net/transportation/using-a-class-object-to-help-read-a-control-file</link>
		<comments>http://www.siliconcreek.net/transportation/using-a-class-object-to-help-read-a-control-file#comments</comments>
		<pubDate>Sun, 05 Dec 2010 13:00:41 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Transportation]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[cube]]></category>
		<category><![CDATA[cube voyager c++]]></category>
		<category><![CDATA[mode-choice]]></category>
		<category><![CDATA[nested-logit]]></category>
		<category><![CDATA[voyager]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=661</guid>
		<description><![CDATA[One thing we&#8217;re used to in travel modeling is control files.  It seems to harken back to the days of TranPlan where everything had a control file to control the steps. In my case, I have a control file for my nested logit mode choice program, and because of the age of the mode choice [...]]]></description>
			<content:encoded><![CDATA[<p>One thing we&#8217;re used to in travel modeling is control files.  It seems to harken back to the days of TranPlan where everything had a control file to control the steps.</p>
<p>In my case, I have a control file for my nested logit mode choice program, and because of the age of the mode choice program, I want to redesign it.  The first part of this is reading the control file, and I did a little trick to help with reading each control file line.  With C++, there is no way to read variables in from a file (like there is with FORTRAN).</p>
<p>The first part of the code reads the control file, and you will see that once I open and read the control file, I section it out (the control file has sections for files ($FILES), operation parameters ($PARAMS), operation options ($OPTIONS), and mode choice parameters ($PARMS).  Each section ends with an end tag ($END).  This adds the flexibility of being able to re-use variables in different locations.</p>
<p>After the section, the next portion of the code reads the line and checks to see if FPERIN is found.  If it is, a ControlFileEntry object is created.  This object is a class that is used to return the filename held in the object.  This makes it easy to reduce code.</p>
<pre class="brush:c++">int readControlFile(char *controlFileName){
	cout &lt;&lt; "Reading " &lt;&lt; controlFileName &lt;&lt; endl;
	//Read the control file
	string line;
	bool inFiles=false, inParams=false, inOptions=false, inParms=false;
	ifstream controlFile(controlFileName);
	if(!controlFile.good()){
		cout &lt;&lt; "PROBLEMS READING CONTROL FILE" &lt;&lt; endl;
		return 1;
	}
	while(controlFile.good()){
		getline(controlFile,line);
		//check the vars sections
		if(line.find("$FILES")!=string::npos)
			inFiles=true;
		if(line.find("$PARAMS")!=string::npos)
			inParams=true;
		if(line.find("$OPTIONS")!=string::npos)
			inOptions=true;
		if(line.find("$PARMS")!=string::npos)
			inParms=true;
		if(line.find("$END")!=string::npos){
			inFiles=false;
			inParams=false;
			inOptions=false;
			inParms=false;
		}
		if(inFiles){
			cout &lt;&lt; "Checking files" &lt;&lt; endl;
			if(line.find("FPERIN")!=string::npos){
				controlFileEntry cfe(line);
				PerTrpIn=cfe.filename;
			}
//SNIP!!!
	return 0;
}</pre>
<p>The controlFileEntry is code is below.  This is used at the top of the code, just below the preprocessor directives (the #include stuff).</p>
<pre class="brush:c++">class controlFileEntry{
public:
	string filename;
	controlFileEntry(string Entry){
		beg=(int)Entry.find("=")+2;
		end=(int)Entry.rfind("\'")-beg;
		filename=Entry.substr(beg,end);
	}
	~controlFileEntry(){
		beg=0;
		end=0;
		filename="";
	}
private:
	string Entry;
	int beg;
	int end;
};</pre>
<p>The class has one public member, filename, which is what is read in the code where it is used.  There are two public functions.  The first is the constructor (controlFileEntry) which is used when creating the object.  The second is the de-constructor (~controlFileEntry), which sets the beg, end, and filename variables to zero and blank.  The beg, end (misnomer), and the line sent to it are private and cannot be used in code.</p>
<p>This can be extended, as the file entry type is fine when there are quotes around the item (it is setup for that, note the -2 in beg).  I wrote a different one for integers, floating point, and boolean values.</p>
<pre class="brush:c++">class controlParamEntry{
public:
	int ivalue;
	bool bvalue;
	double dvalue;
	controlParamEntry(string Entry){
		beg=(int)Entry.find("=")+1;
		end=(int)Entry.rfind(",")-beg;
		ivalue=0;
		dvalue=0;
		if(Entry.substr(beg,end)=="T"){
			bvalue=true;
			ivalue=1;
			dvalue=1;
		}else if(Entry.substr(beg,end)=="F"){
			bvalue=false;
			ivalue=0;
			dvalue=0;
		}
		if(ivalue==0){
			ivalue=atoi(Entry.substr(beg,end).c_str());
		}
		if(dvalue==0){
			dvalue=atof(Entry.substr(beg,end).c_str());
		}
	}
	~controlParamEntry(){
		beg=0;
		end=0;
		ivalue=0;
		dvalue=0;
		Entry="";
	}
private:
	string Entry;
	int beg;
	int end;
};</pre>
<p>As you can see above, there are return values for floating point (dvalue), integer (ivalue), and boolean (bvalue).</p>
<p>Tune in next week to see more of the code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/using-a-class-object-to-help-read-a-control-file/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reading a Matrix File in C++ and Doing Something With It</title>
		<link>http://www.siliconcreek.net/transportation/reading-a-matrix-file-in-c-and-doing-something-with-it</link>
		<comments>http://www.siliconcreek.net/transportation/reading-a-matrix-file-in-c-and-doing-something-with-it#comments</comments>
		<pubDate>Sun, 28 Nov 2010 13:00:17 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Transportation]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[cube]]></category>
		<category><![CDATA[cube voyager c++]]></category>
		<category><![CDATA[voyager]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=651</guid>
		<description><![CDATA[Last week&#8217;s post showed how to open a path file using C++. This week&#8217;s post will show how to open a Cube Voyager matrix file in C++. Setup Like last week, we need to reference VoyagerFileAccess.lib in the project.  We also need to add the external references in the header file as below: extern "C" [...]]]></description>
			<content:encoded><![CDATA[<p>Last week&#8217;s post showed how to open a path file using C++.  This week&#8217;s post will show how to open a Cube Voyager matrix file in C++.</p>
<h1>Setup</h1>
<p>Like last week, we need to reference VoyagerFileAccess.lib in the project.  We also need to add the external references in the header file as below:</p>
<pre class="brush:c++">extern "C" __declspec(dllimport)void* MatReaderOpen(const char *filename, char *errMsg, int errBufLen);
extern "C" __declspec(dllimport)int MatReaderGetNumMats(void* state);
extern "C" __declspec(dllimport)int MatReaderGetNumZones(void* state);
extern "C" __declspec(dllimport)int MatReaderGetMatrixNames(void* state, char **names);
extern "C" __declspec(dllimport)int MatReaderGetRow(void* state, const int mat, const int row, double *buffer);
extern "C" __declspec(dllimport)void MatReaderClose(void* state);</pre>
<p>Also ensure that the project is setup with the character set of &#8220;Not Set&#8221; as opposed to Unicode, which seems to be a default in MS Visual C++ Express Edition.</p>
<h1>Main Application</h1>
<p>The main application is fairly simple and just opens the matrix and outputs the number of tables and zones to the screen.</p>
<pre class="brush:c++">#include "stdafx.h"
#include &lt;stdio.h&gt;
#include &lt;iostream.h&gt;

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	char errMsg[256]="";
	// Open the matrix
	void* matrixState=MatReaderOpen(argv[1],errMsg,256);
	// Get number of tables in the matrix
	int nMats = MatReaderGetNumMats(matrixState);
	// Get number of zones in the matrix
	int nZones = MatReaderGetNumZones(matrixState);
	// Output to screen
	cout &lt;&lt; "File " &lt;&lt; argv[1] &lt;&lt; endl;
	cout &lt;&lt; "Number of Tables....." &lt;&lt; nMats &lt;&lt; endl;
	cout &lt;&lt; "Number of Zones......" &lt;&lt; nZones &lt;&lt; endl;
	// Close the matrix
	MatReaderClose(matrixState);
	cout &lt;&lt; "Matrix Closed." &lt;&lt; endl;
	cout &lt;&lt; "Press any key to close" &lt;&lt; endl; 	char tmp; 	cin &gt;&gt; tmp;
	return 0;
}</pre>
<p>The output looks like the below:</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/11/Clip-1-3.png" rel="shadowbox[sbpost-651];player=img;" title="Output of matrix file reader"><img class="alignnone size-medium wp-image-652" title="Output of matrix file reader" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/11/Clip-1-3-300x152.png" alt="" width="300" height="152" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/reading-a-matrix-file-in-c-and-doing-something-with-it/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the Path Files in the New Cube Voyager API</title>
		<link>http://www.siliconcreek.net/transportation/using-the-path-files-in-the-new-cube-voyager-api</link>
		<comments>http://www.siliconcreek.net/transportation/using-the-path-files-in-the-new-cube-voyager-api#comments</comments>
		<pubDate>Tue, 23 Nov 2010 21:21:39 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Transportation]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[cube]]></category>
		<category><![CDATA[cube voyager c++]]></category>
		<category><![CDATA[voyager]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=642</guid>
		<description><![CDATA[Matthew M., The Citilabs Director of Development, released an API to use C/C++ to read Voyager Matrixes and Highway Path Files.  I have started into using this API in C++ to read path files. The first thing with the path files is that it is (as indicated in the documentation) Highway Path Files only.  I [...]]]></description>
			<content:encoded><![CDATA[<p>Matthew M., The Citilabs Director of Development, released an API to use C/C++ to read Voyager Matrixes and Highway Path Files.  I have started into using this API in C++ to read path files.</p>
<p>The first thing with the path files is that it is (as indicated in the documentation) Highway Path Files only.  I first tried PT Route Files (which can be read in Viper in the same way one could use Highway Path files), but alas, you receive an error when trying to do that.</p>
<p>For this, I have created a console application, which could become something to run in a model run.</p>
<h1>Setup</h1>
<p>The first thing is to setup your include file with the DLL references.</p>
<p>Start by adding a reference to VoyagerFileAccess.lib.  In Visual C++ Express 2010, right-click on your solution name and add an existing item (and point it to VoyagerFileAccess.lib).  Then, in a header file (or in your source file, but normal programming conventions seem to dictate that these items belong in headers), add the following lines:</p>
<pre class="brush:c++">extern "C" __declspec(dllimport)void* PathReaderOpen(const char *filename, char *errMsg, int errBufLen);
extern "C" __declspec(dllimport)void* PathReaderClose(void* state);
extern "C" __declspec(dllimport)int PathReaderGetNumZones(void* state);
extern "C" __declspec(dllimport)int PathReaderGetNumTables(void* state);</pre>
<p>These lines tell the compiler that these four functions are imported through a DLL (and thus, it uses the lib file to know where to go).</p>
<p>The next thing, since this is a console application, is to correct the Character Set.  Right-click on the solution, go to properties, select Configuration Properties &#8211; General, and set the Character Set to &#8220;Not Set&#8221;.  If you leave it on Unicode, your command line arguments will have only one letter.  See the screen capture below.</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/11/Clip-1.png" rel="shadowbox[sbpost-642];player=img;" title="Property Page - Change Character Set"><img class="alignnone size-medium wp-image-643" title="Property Page - Change Character Set" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/11/Clip-1-300x211.png" alt="" width="300" height="211" /></a></p>
<h1>Main Application</h1>
<p>This is a small application that just shows some simple reading the zones and tables in the path file.  The application takes one command-line argument.</p>
<p>The source, fully commented, is below.</p>
<pre class="brush:c++">#include "stdafx.h"

#include &lt;Windows.h&gt;

#include &lt;stdio.h&gt;

#include &lt;iostream&gt;

using namespace std;

int _tmain(int argc, char* argv[])

{

// dim variables
char errorMessage[256]="";
int Zones,Tables;

// Opens the path file and sets the Zones and Tables variables
void* state=PathReaderOpen(argv[1],errorMessage,256);
Zones=PathReaderGetNumZones(state);
Tables=PathReaderGetNumTables(state);

// Dumps the variables to the screen
cout &lt;&lt; "State of PathReaderOpen: " &lt;&lt; state &lt;&lt; endl;
cout &lt;&lt; "PathReaderErrorMessage: " &lt;&lt; errorMessage &lt;&lt; endl;
cout &lt;&lt; "Zones: " &lt;&lt; Zones &lt;&lt; endl;
cout &lt;&lt; "Tables: " &lt;&lt; Tables &lt;&lt; endl;

// Closes the path file
PathReaderClose(state);
cout &lt;&lt; "Path Reader Closed";

// This makes the command window wait for input from the user before closing
char tmp;
cin &gt;&gt; tmp;

return 0;
}</pre>
<p>For debugging, you will want to set the command-line argument.  This is done by right-clicking on the solution and going to Configuration &#8211; Debugging.  See the screen capture below.</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/11/Clip-1-1.png" rel="shadowbox[sbpost-642];player=img;" title="Command Line Argument"><img class="alignnone size-medium wp-image-644" title="Command Line Argument" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/11/Clip-1-1-300x211.png" alt="" width="300" height="211" /></a></p>
<h1>Output</h1>
<p>The output of this is fairly simple:</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/11/Clip-1-2.png" rel="shadowbox[sbpost-642];player=img;" title="Output"><img class="alignnone size-medium wp-image-645" title="Output" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/11/Clip-1-2-300x151.png" alt="" width="300" height="151" /></a></p>
<p>In the coming weeks, I will post more about using this new API.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/using-the-path-files-in-the-new-cube-voyager-api/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Voyager + C++ With Multi-Dimensional Arrays (Part 2: Writing)</title>
		<link>http://www.siliconcreek.net/transportation/voyager-c-with-multi-dimensional-arrays-part-2-writing</link>
		<comments>http://www.siliconcreek.net/transportation/voyager-c-with-multi-dimensional-arrays-part-2-writing#comments</comments>
		<pubDate>Sun, 07 Nov 2010 13:00:25 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Transportation]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[cube]]></category>
		<category><![CDATA[cube voyager c++]]></category>
		<category><![CDATA[voyager]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=628</guid>
		<description><![CDATA[This is part 2 of using Cube Voyager Multi-Dimensional Arrays with C++. To see part 1, click here. Building on last weeks post, the below shows the modifications necessary in Cube. The first thing I added is the variable itself (else, you will get one of those inexplicable errors). In this case, I add MDARRAY2 [...]]]></description>
			<content:encoded><![CDATA[<p><em>This is part 2 of using Cube Voyager Multi-Dimensional Arrays with C++.  To see part 1, <a title="Voyager + C++ With Multi-Dimensional Arrays Part 1" href="http://www.siliconcreek.net/transportation/c-with-multi-dimensional-arrays" target="_self">click here</a>.</em></p>
<p>Building on last weeks post, the below shows the modifications necessary in Cube.  The first thing I added is the variable itself (else, you will get one of those inexplicable errors).  In this case, I add MDARRAY2 as a variable that is the same dimensions as MDARRAY.  The second part that I add (which is after the CALL statement) is just to report the values stored in MDARRAY2.</p>
<pre class="brush:c++">RUN PGM=MATRIX PRNFILE="C:\TEMP\DTMAT00B.PRN"
FILEO PRINTO[1] = "C:\TEMP\DEBUG.PRN"

PAR ZONES=1

ARRAY MDARRAY=5,5, MDARRAY2=5,5

LOOP _c=1,5
  LOOP _r=1,5
    MDARRAY[_c][_r]=RAND()
    PRINT PRINTO=1 LIST='MDARRAY[',_c(1.0),'][',_r(1.0),']=',MDARRAY[_c][_r](8.6)
  ENDLOOP
ENDLOOP

CALL DLL=DLLFILE(TableReader)

LOOP _c=1,5
  LOOP _r=1,5
    PRINT PRINTO=1 LIST='MDARRAY2[',_c(1.0),'][',_r(1.0),']=',MDARRAY2[_c][_r](8.6)
  ENDLOOP
ENDLOOP
ENDRUN</pre>
<p>In C++, I add a second variable for MDARRAY2 (called TableRecord2).  It is critical that this is a double* variable, as this needs to be a pointer so Cube can access updated values of the variable.  Similar with how I read MDARRAY into TableRecord, I do the same with MDARRAY2 and TableRecord2, which reads the pointers to MDARRAY2 into TableRecord2.  Then, as I iterate through TableRecord, I set TableRecord2 to 10 * TableRecord.  After this, the DLL is complete and Cube ultimately prints all the values to the print output.</p>
<pre class="brush:c++">int TableReader (Callstack* Stack){
	double* TableRecord;
	double* TableRecord2;
	char message[100];

	TableRecord=(double*)Stack-&gt;pfFindVar("MDARRAY",0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
                16,17,18,19,20,21,22,23,24);
	TableRecord2=(double*)Stack-&gt;pfFindVar("MDARRAY2",0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
                16,17,18,19,20,21,22,23,24);
	for(int x=0;x&lt;=24;x++){ 	if(&amp;TableRecord!=0){ 			 		sprintf(message,"TableRecord=%f",TableRecord[x]); 		Stack-&gt;pfPrnLine(1,message);
		TableRecord2[x]=TableRecord[x]*10;
		}
	}
	return 0;
}</pre>
<h1>Additional Considerations</h1>
<p>If you decide to use this, you may want to pass the sizes of each dimension if it is important.  Then, you can write a function to take the sequential value and return the column or row.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/voyager-c-with-multi-dimensional-arrays-part-2-writing/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Voyager + C++ With Multi-Dimensional Arrays (Part 1: Reading)</title>
		<link>http://www.siliconcreek.net/transportation/c-with-multi-dimensional-arrays</link>
		<comments>http://www.siliconcreek.net/transportation/c-with-multi-dimensional-arrays#comments</comments>
		<pubDate>Sun, 31 Oct 2010 16:30:43 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Transportation]]></category>
		<category><![CDATA[arrays]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[cube]]></category>
		<category><![CDATA[cube voyager c++]]></category>
		<category><![CDATA[voyager]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=616</guid>
		<description><![CDATA[This is part 1 of this subject. Part 2 will be about writing values to the arrays. One of the cool things with the latest version of Cube Voyager is multi-dimensional arrays. However, it appears behind the scenes (or at least to C++) that the multi-dimensional arrays are a wrapper over a single-dimension array. The [...]]]></description>
			<content:encoded><![CDATA[<p><em>This is part 1 of this subject.  Part 2 will be about writing values to the arrays.</em></p>
<p>One of the cool things with the latest version of Cube Voyager is multi-dimensional arrays.  However, it appears behind the scenes (or at least to C++) that the multi-dimensional arrays are a wrapper over a single-dimension array.</p>
<p>The easiest way to show this is to make a random array and send it to the print file.  Making the random array in Cube is simple:</p>
<pre class="brush:c++">RUN PGM=MATRIX PRNFILE="C:\TEMP\DTMAT00B.PRN"
FILEO PRINTO[1] = "C:\TEMP\DEBUG.PRN"

PAR ZONES=1

ARRAY MDARRAY=5,5

LOOP _c=1,5
  LOOP _r=1,5
    MDARRAY[_c][_r]=RAND()
    PRINT PRINTO=1 LIST='MDARRAY[',_c(1.0),'][',_r(1.0),']=',MDARRAY[_c][_r](8.6)
  ENDLOOP
ENDLOOP

CALL DLL=DLLFILE(TableReader)
ENDRUN
</pre>
<p>Then, in C++ we can pull 25 (!) array values from this:</p>
<pre class="brush:c++">int TableReader (Callstack* Stack){
	double* TableRecord;
	char message[100];

	TableRecord=(double*)Stack-&gt;pfFindVar("MDARRAY",0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
             16,17,18,19,20,21,22,23,24);
	for(int x=0;x&lt;=24;x++){
	if(&amp;TableRecord!=0){
		sprintf(message,"TableRecord=%f",TableRecord[x]);
		Stack-&gt;pfPrnLine(1,message);
		}
	}
	return 0;
}
</pre>
<p>For fixed size multi-dimensional arrays, this isn&#8217;t really an issue.  It would be very easy to wrap the Stack-&gt;pfFindVar line in a set of loops that fills a multi-dimensional array.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/c-with-multi-dimensional-arrays/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting GoogleCL to Download Drawings</title>
		<link>http://www.siliconcreek.net/computers/getting-googlecl-to-download-drawings</link>
		<comments>http://www.siliconcreek.net/computers/getting-googlecl-to-download-drawings#comments</comments>
		<pubDate>Wed, 20 Oct 2010 14:05:17 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[googlecl]]></category>
		<category><![CDATA[googledocs]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=609</guid>
		<description><![CDATA[While looking into backing up my Google Docs, I realized that GoogleCL is not backing up drawings. Fixing this requires a few minor modifications to the source in {download}\src\googlecl\docs\base.py (where {download} is where you downloaded the files}. The first fix is in the try block on line 51. was: from gdata.docs.data import DOCUMENT_LABEL, SPREADSHEET_LABEL, \ [...]]]></description>
			<content:encoded><![CDATA[<p>While looking into backing up my Google Docs, I realized that GoogleCL is not backing up drawings.</p>
<p>Fixing this requires a few minor modifications to the source in {download}\src\googlecl\docs\base.py (where {download} is where you downloaded the files}.</p>
<p>The first fix is in the try block on line 51.<br />
was:</p>
<pre class="brush: python">from gdata.docs.data import DOCUMENT_LABEL, SPREADSHEET_LABEL, \
                              PRESENTATION_LABEL, FOLDER_LABEL, PDF_LABEL</pre>
<p>To:</p>
<pre class="brush: python">from gdata.docs.data import DOCUMENT_LABEL, SPREADSHEET_LABEL, \
                              PRESENTATION_LABEL, FOLDER_LABEL, PDF_LABEL, DRAWING_LABEL</pre>
<p>Then, beginning on 52 (the except ImportError block), it should include DRAWING_LABEL = &#8216;drawing&#8217; as below:</p>
<pre class="brush: python">except ImportError:
  DOCUMENT_LABEL = 'document'
  SPREADSHEET_LABEL = 'spreadsheet'
  PRESENTATION_LABEL = 'presentation'
  DRAWING_LABEL = 'drawing'
  FOLDER_LABEL = 'folder'
  PDF_LABEL = 'pdf'</pre>
<p>Then, on line371, the following needs to be added before the &#8216;else&#8217;:<br />
except ImportError:</p>
<pre class="brush: python">elif doctype_label == DRAWING_LABEL:
      return googlecl.CONFIG.get(SECTION_HEADER, 'drawing_format')</pre>
<p>Finally, in your .googlecl file (mine is under my &#8220;profile drive&#8221; because of our network settings, your mileage likely will vary, so you&#8217;ll have to search for it), open config in any text editor and add the following in the [DOCS] section:</p>
<pre class="brush: python">drawing_format = png</pre>
<p><em>Note: while you&#8217;re at it, you might want to change document_format = txt to document_format = doc</em></p>
<p>That&#8217;s it.  Now if you run &#8216;google docs get .* ./backup&#8217;, you get the drawings as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/computers/getting-googlecl-to-download-drawings/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Voyager + C++ With DBI Part 1: Number Fields</title>
		<link>http://www.siliconcreek.net/transportation/c-with-dbi-part-1-number-fields</link>
		<comments>http://www.siliconcreek.net/transportation/c-with-dbi-part-1-number-fields#comments</comments>
		<pubDate>Mon, 18 Oct 2010 00:52:28 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Transportation]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[cube]]></category>
		<category><![CDATA[cube voyager c++]]></category>
		<category><![CDATA[DBI]]></category>
		<category><![CDATA[voyager]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=601</guid>
		<description><![CDATA[This is part 1 of this subject.  Part 2, using C++ with DBI String Fields, will be in a few weeks, once I figure it out! Extending the posts relating to using C++ with Cube Voyager, the next thing to look at is using C++ with the DBI input module that was added in Cube [...]]]></description>
			<content:encoded><![CDATA[<p><em>This is part 1 of this subject.  Part 2, using C++ with DBI String Fields, will be in a few weeks, once I figure it out!</em></p>
<p>Extending the posts relating to using C++ with Cube Voyager, the next thing to look at is using C++ with the DBI input module that was added in Cube 5.1.</p>
<p>The key to making this happen is the Matrix FILEI help section that discusses that certain things are held in arrays.  My last post on this subject got into arrays a little, but there are a few new tricks to use.</p>
<p>The code below (C++) is some simple source code that reads the input database (DBI.1) and reads the built-in array of field values.</p>
<pre class="brush:c++">typedef struct { int I,J,Zones,Iterations;
				double** MW;
				void* (*pfFindVar)(char*,...);
				void* (*pfPrnLine)(int,char*);
} Callstack;

int TableReader (Callstack* Stack){

	double* TableRecord;
	char message[100];

	TableRecord=(double*)Stack-&gt;pfFindVar("DBI.1.NFIELD",1,2,3,4,5,6,7,8,9,10,
		11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,
		31,32,33,34,35,36,37,38,39,40);

	for(int x=0;x&lt;=40;x++){ 		if(&amp;TableRecord[x]!=0){ 			sprintf(message,"Table %i=%f",x,TableRecord[x]); 			Stack-&gt;pfPrnLine(1,message);
		}
	}

	return 0;
}
</pre>
<p>This reads all the NUMERIC (note the emphasis!) fields and dumps them to the print file.  There is a trick in here &#8211; I have a table with 39 fields, but I pull 40 fields.  If you actually use that 40th field in the sprintf statement, it crashes.  This is why I test to ensure that &amp;TableRecord[x] (the pointer to the table record) does not equal 0.</p>
<p>Normally in Cube, one would read the database fields using DI.1.FIELDNAME.  This is certainly possible in C++.  Note the code below (where HHPERSONID is the field name):</p>
<pre class="brush:c++">int TableReader2 (Callstack* Stack){
	double HHPersonId;
	char message[100];

	HHPersonId=*(double*)Stack-&gt;pfFindVar("DI.1.HHPERSONID");
	sprintf(message,"%f",HHPersonId);
	Stack-&gt;pfPrnLine(1,message);

	return 0;
}
</pre>
<p>This is similar to the code example above.</p>
<p>Tune in next week when I get into more DBI with C++.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/c-with-dbi-part-1-number-fields/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using a C++ DLL in Cube</title>
		<link>http://www.siliconcreek.net/transportation/using-a-c-dll-in-cube</link>
		<comments>http://www.siliconcreek.net/transportation/using-a-c-dll-in-cube#comments</comments>
		<pubDate>Sun, 10 Oct 2010 13:00:20 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Transportation]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[cube voyager c++]]></category>
		<category><![CDATA[four step model]]></category>
		<category><![CDATA[tdm]]></category>
		<category><![CDATA[tour-based-modeling]]></category>
		<category><![CDATA[voyager]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=584</guid>
		<description><![CDATA[One thing that can drastically speed Cube is using a DLL to do big tasks, like Nested Logit Mode Choice. However, doing this can be fraught with hair-pulling errors.  This post shows some techniques to keep your hair on your head.  This post is written for a travel demand modeler, not a computer science person! [...]]]></description>
			<content:encoded><![CDATA[<p>One thing that can drastically speed Cube is using a DLL to do big tasks, like Nested Logit Mode Choice.  However, doing this can be fraught with hair-pulling errors.  This post shows some techniques to keep your hair on your head.  This post is written for a travel demand modeler, not a computer science person!</p>
<h3>RTFM (Read The Fine Manual)</h3>
<p>Read the help file for Matrix CALL statement.  The struct statement is pretty important, and the sprintf lines will be used throughout.</p>
<h3>Memory Pointers</h3>
<p>One of the most important things to understand is that because there are so many variables that can be passed between Cube and the C++ DLL, the memory pointers are passed instead.  Also, one of those &#8220;pull your hair out&#8221; things relates to this &#8211; if you attempt to access a memory pointer that hasn&#8217;t been initialized, you get a crash that gives no error.</p>
<p>Because of this, the variables in the struct statement have a *, which notes that it is a memory pointer.</p>
<p>To keep from getting the crash-with-no-error, the following statement works well to test and allows a default to be used if the variable &#8216;MarketSegments&#8217; is not set in Cube.</p>
<pre class="brush:c++">int MarketSegments=4;

if(Stack-&gt;pfFindVar("MarketSegments")!=0)
MarketSegments=(int)*Stack-&gt;pfFindVar("MarketSegments");</pre>
<h3>Matrix In, Matrix Out</h3>
<p>While the Help file says that you can get to defined working matrixes using</p>
<pre class="brush:c++">static double **MW;
MW=(*Stack-&gt;pfFindVar)("MW",1);</pre>
<p>I can&#8217;t get it to work using C++ (I have gotten it to work in C).  Instead, use the following:</p>
<pre class="brush:c++">static double **MW=NULL;
MW=Stack-&gt;MW;</pre>
<p>This will enable you to use MW[m][j] (where m is the MW number, and j is the j-zone).</p>
<p>You can also set the MW variables, but it does NOTHING if you don&#8217;t set the MW to something in Cube Voyager.  Ergo, if you set</p>
<pre class="brush:c++">MW[101][j]=10;</pre>
<p>Your output will be 0 unless you do the following in Cube Voyager</p>
<p><code>MW[101]=0<br />
CALL...</code></p>
<h3>Array Variables</h3>
<p>One of the tricks I use to get array variables out of Cube is this</p>
<pre class="brush:c++">float ArrayVariable[7]={0,0,0,0,0,0,0};  //Note: I'm using 1-6.  Setting this to 7 means 0-6.  Setting it to 6 would mean 0-5
if(Stack-&gt;pfFindVar("ArrayVariable")&gt;0){
double* tmpAV=NULL;
tmpAV=Stack-&gt;pfFindVar("ArrayVariable",1,2,3,4,5,6);
for(int x=1;x&lt;=6;x++)
ArrayVariable[x]=tmpAV[x];
}</pre>
<p>This code above checks that the ArrayVariable, fills them into a temporary variable, and then sets the actual variable.</p>
<h3>Compilation Linker Settings</h3>
<p>When compiling, you need to set the EXPORT flag so the name is predictable and correct.  To do this, go to your project&#8217;s property pages &#8211; Configuration Properties &#8211; Linker &#8211; Command Line.  You need to add &#8220;/EXPORT:FunctionName&#8221; under Additional Options.  See the screenshot below</p>
<p>.<img class="alignnone size-medium wp-image-590" title="Linker Settings" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/10/Clip-1-300x212.png" alt="" width="300" height="212" /></p>
<h3>Other Weird Stuff</h3>
<p>Any error in C++ that does not cause a compilation error results in one of those useless &#8220;this program has an error and will be closed&#8221; and crashes Task Monitor.  That being said, write messages to the output file frequently (if at least during debugging).  This can assist with finding typos (like, say, %10.65f in an sprintf statement, which means 65 decimal places in a 10-width line).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/using-a-c-dll-in-cube/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cube Voyager: Using Cluster with DBI</title>
		<link>http://www.siliconcreek.net/transportation/cube-voyager-using-cluster-with-dbi</link>
		<comments>http://www.siliconcreek.net/transportation/cube-voyager-using-cluster-with-dbi#comments</comments>
		<pubDate>Sun, 03 Oct 2010 13:00:12 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Transportation]]></category>
		<category><![CDATA[Cluster]]></category>
		<category><![CDATA[cube]]></category>
		<category><![CDATA[DBI]]></category>
		<category><![CDATA[four step model]]></category>
		<category><![CDATA[tdm]]></category>
		<category><![CDATA[tour-based-modeling]]></category>
		<category><![CDATA[trip-based-modeling]]></category>
		<category><![CDATA[voyager]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=580</guid>
		<description><![CDATA[Credit for this goes to Citilabs Support, although I made some adaptations. In Matrix when using DBI, PAR ZONES=1 will effectively shut off Cluster. Therefore, the following works really well. DISTRIBUTEINTRASTEP ProcessID=Cluster ProcessList={CORES} PAR ZONES={CORES} recs = ROUND(DBI.1.NUMRECORDS/{CORES}) start = (I-1)*recs+1 IF (I={CORES}) end = DBI.1.NUMRECORDS ELSE end = I*recs ENDIF LOOP _r=start,end x=DBIReadRecord(1,_r) ENDLOOP [...]]]></description>
			<content:encoded><![CDATA[<p>Credit for this goes to Citilabs Support, although I made some adaptations.</p>
<p>In Matrix when using DBI, PAR ZONES=1 will effectively shut off Cluster.  Therefore, the following works really well.</p>
<p><code><br />
DISTRIBUTEINTRASTEP ProcessID=Cluster ProcessList={CORES}</p>
<p>PAR ZONES={CORES}</p>
<p>recs = ROUND(DBI.1.NUMRECORDS/{CORES})<br />
start = (I-1)*recs+1<br />
IF (I={CORES})<br />
end = DBI.1.NUMRECORDS<br />
ELSE<br />
end = I*recs<br />
ENDIF</p>
<p>LOOP _r=start,end<br />
x=DBIReadRecord(1,_r)<br />
ENDLOOP<br />
</code></p>
<p>This script sets each core to process an equal portion of the database with any remainder (e.g if you cluster 4 records over 3 cores) to the last core.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/cube-voyager-using-cluster-with-dbi/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cube Voyager Speed Clinic</title>
		<link>http://www.siliconcreek.net/transportation/cube-voyager-speed-clinic</link>
		<comments>http://www.siliconcreek.net/transportation/cube-voyager-speed-clinic#comments</comments>
		<pubDate>Sun, 26 Sep 2010 16:33:02 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Transportation]]></category>
		<category><![CDATA[cube]]></category>
		<category><![CDATA[four step model]]></category>
		<category><![CDATA[speed]]></category>
		<category><![CDATA[tdm]]></category>
		<category><![CDATA[tour-based-modeling]]></category>
		<category><![CDATA[trip-based-modeling]]></category>
		<category><![CDATA[voyager]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=570</guid>
		<description><![CDATA[There are several issues with long travel demand model run times.  Deep down, these are supposed to be planning tools, and taking too long for results can reduce the practicality of using a travel demand model in decision making. In Cube Voyager, I&#8217;ve been finding more ways to cut runtimes down as much as possible, [...]]]></description>
			<content:encoded><![CDATA[<p>There are several issues with long travel demand model run times.  Deep down, these are supposed to be planning tools, and taking too long for results can reduce the practicality of using a travel demand model in decision making.</p>
<p>In Cube Voyager, I&#8217;ve been finding more ways to cut runtimes down as much as possible, and below is the list with some of the rationale.</p>
<h3>Keep JLoops at a Minimum</h3>
<p>The Matrix program runs in an implied ILOOP.  This being the case, anything in the script runs many times (as many as the zones you have).  Using a JLOOP in a 2,000 zone model means that there are  4,000,000 calculations to be done for each COMP statement.  What happens if you have 3 COMP statements?  You go from 4,000,000 to 12,000,000 calculations.  This is even worse if the calculations include a lookup function, which are generally slow.</p>
<h3>Keep Files Small &#8211; Only Write What You Have To</h3>
<p>This is a no-brainer.  The more that Cube (or anything, for that matter) has to write to disk, the longer the runtime.</p>
<h3>Replace RECI with DBI wherever possible</h3>
<p>DBI can be clustered (look for a post on that in the coming weeks).  While I&#8217;m not sure if there is any difference on one core, being able to use Cluster is the trump card.</p>
<h3>Use Cluster Dynamically and Wherever Possible</h3>
<p>Standardize the Cluster ID in your code, but set the process list to a catalog key as with below:</p>
<p><code>DISTRIBUTEINTRASTEP CLUSTERID=Cluster PROCESSLIST=2-{CORES}</code></p>
<p>Using Cluster to your advantage is critical to having a fast model.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/cube-voyager-speed-clinic/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blackberry + GPSed + Lightroom + Lightroom Plugin = Awesome!</title>
		<link>http://www.siliconcreek.net/photography/blackberry-gpsed-lightroom-lightroom-plugin-awesome</link>
		<comments>http://www.siliconcreek.net/photography/blackberry-gpsed-lightroom-lightroom-plugin-awesome#comments</comments>
		<pubDate>Sat, 24 Jul 2010 20:35:57 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Photography]]></category>
		<category><![CDATA[gps]]></category>
		<category><![CDATA[lightroom]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=541</guid>
		<description><![CDATA[For those of us using older digital cameras that do not have GPS capabilities (like my trusted D70), there is a way to use a Blackberry to capture the GPS coordinates and use a Lightroom plugin to put the GPS coordinates into the EXIF Metadata.  Once the metadata is written, sites like Panoramio and Flickr [...]]]></description>
			<content:encoded><![CDATA[<p>For those of us using older digital cameras that do not have GPS  capabilities (like my trusted D70), there is a way to use a Blackberry  to capture the GPS coordinates and use a Lightroom plugin to put the GPS  coordinates into the EXIF Metadata.  Once the metadata is written,  sites like Panoramio and Flickr will recognize the location.</p>
<p>The first step to this is to have a Blackberry.  I&#8217;m sure there is a way  to do this with an Android based phone or an iPhone, but I haven&#8217;t used  them, so I don&#8217;t know how to do this on those.</p>
<p>On your Blackberry, open App World and search for, download, and install GPSed.  This program  can be used to track your location.  BIG IMPORTANT NOTE: this will use  much more battery than normal.  The amount of battery is used WAY MORE  if you go into an area with no service.</p>
<h1>Before you go &#8216;Shooting&#8217;</h1>
<p>First off, set the time on your camera.  It will make your life easier down the road.</p>
<p>Then, at the start of your shoot/photowalk, open GPSed and select New Track&#8230; in the menu:</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-1.jpg" rel="shadowbox[sbpost-541];player=img;" title="GPSed Open Screen"><img class="alignnone size-medium wp-image-556" title="GPSed Open Screen" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-1-180x300.jpg" alt="" width="180" height="300" /></a> -&gt; <a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-2.jpg" rel="shadowbox[sbpost-541];player=img;" title="Select &quot;New Track&quot;"><img class="alignnone size-medium wp-image-555" title="Select &quot;New Track&quot;" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-2-172x300.jpg" alt="" width="172" height="300" /></a></p>
<p>And give it a name:</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-3.jpg" rel="shadowbox[sbpost-541];player=img;" title="Track Name"><img class="alignnone size-medium wp-image-554" title="Track Name" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-3-170x300.jpg" alt="" width="170" height="300" /></a></p>
<p>Start shooting!  While you are shooting, the GPSed free version log a GPS point roughly every 2 seconds.  This can be affected by a number of things,like tall buildings, clouds, trees, and having your Blackberry in your pocket or a case.  While those do create problems, leaving my Blackberry in its case while I walk through downtown is pretty good, but will sometimes miss points.</p>
<h1>When you are done&#8230;</h1>
<p>When you are done, open the menu ans select Finish Track.  On the following screen, it will ask you if you want to share or upload the track.  I tend to use &#8220;Do Nothing&#8221;.</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-5.jpg" rel="shadowbox[sbpost-541];player=img;" title="Finish the Track"><img class="alignnone size-medium wp-image-552" title="Finish the Track" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-5-171x300.jpg" alt="" width="171" height="300" /></a> -&gt; <a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-6.jpg" rel="shadowbox[sbpost-541];player=img;" title="GPSed Upload or Do Nothing"><img class="alignnone size-medium wp-image-551" title="GPSed Upload or Do Nothing" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-6-173x300.jpg" alt="" width="173" height="300" /></a></p>
<p>After the track is saved (and uploaded or shared if you did that), you will need to convert the track to GPX format.</p>
<p>The next steps on the Blackberry can be done now or at home.  I tend to do this part at home, since it goes hand-in-hand with the rest of the process.</p>
<h1>At Home&#8230;</h1>
<p>In GPSed, click the menu and select Pages &gt; Track List.  You will want to select your track, click the menu, and select Convert to GPX&#8230;</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-7.jpg" rel="shadowbox[sbpost-541];player=img;" title="Select Pages..."><img class="alignnone size-medium wp-image-550" title="Select Pages..." src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-7-175x300.jpg" alt="" width="175" height="300" /></a> -&gt; <a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-8.jpg" rel="shadowbox[sbpost-541];player=img;" title="Select Track List"><img class="alignnone size-medium wp-image-549" title="Select Track List" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-8-172x300.jpg" alt="" width="172" height="300" /></a> -&gt;</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-9.jpg" rel="shadowbox[sbpost-541];player=img;" title="Select Your Track"><img class="alignnone size-medium wp-image-548" title="Select Your Track" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-9-178x300.jpg" alt="" width="178" height="300" /></a> -&gt; <a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-10.jpg" rel="shadowbox[sbpost-541];player=img;" title="Select Convert to GPX Format"><img class="alignnone size-medium wp-image-547" title="Select Convert to GPX Format" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-10-175x300.jpg" alt="" width="175" height="300" /></a></p>
<p>It will take a few to process.  My ~2 hour, 3 mile photowalk around 15-30 seconds.  Make sure you remember where it tells you it put the file!</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-11.jpg" rel="shadowbox[sbpost-541];player=img;" title="Converting..."><img class="alignnone size-medium wp-image-546" title="Converting..." src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-11-169x300.jpg" alt="" width="169" height="300" /></a> -&gt; <a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-12.jpg" rel="shadowbox[sbpost-541];player=img;" title="Completed!  This is where the file is at."><img class="alignnone size-medium wp-image-545" title="Completed!  This is where the file is at." src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-12-170x300.jpg" alt="" width="170" height="300" /></a></p>
<p>After this, you can close GPSed.  You will want to locate that file and transfer it to your computer.  I used email.</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-13.jpg" rel="shadowbox[sbpost-541];player=img;" title="Find the file.  Make sure you select the GPX file and not the gpsed file!"><img class="alignnone size-medium wp-image-544" title="Find the file.  Make sure you select the GPX file and not the gpsed file!" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-13-171x300.jpg" alt="" width="171" height="300" /></a> -&gt; <a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-14.jpg" rel="shadowbox[sbpost-541];player=img;" title="Send/Share..."><img class="alignnone size-medium wp-image-543" title="Send/Share..." src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-14-175x300.jpg" alt="" width="175" height="300" /></a> -&gt; <a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-15.jpg" rel="shadowbox[sbpost-541];player=img;" title="Email!"><img class="alignnone size-medium wp-image-542" title="Email!" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/bbgpsed-15-173x300.jpg" alt="" width="173" height="300" /></a></p>
<h1>On Your Computer&#8230;</h1>
<p>At this point, all of the Blackberry steps are completed.  You should be able to open your email and get the GPX file to process in Lightroom.  Save this somewhere.  I use /Users/andrew/Pictures/Geoencoding on my Mac.</p>
<p>For this part, you will need <a href="http://regex.info/blog/lightroom-goodies/gps" target="_blank">Jeffrey Friedl&#8217;s GPS Plugin</a>.  If you have a lot of pictures, you will want to donate to him to remove the 10-pic-at-a-time block.  Also, if you do this more than once or twice in your life, you should donate to him <img src='http://www.siliconcreek.net/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>To set the GPS coordinates on the actual pictures, open Lightroom and import your pictures.  Also, use the Lightroom Plugin Manager to open the GPS plugin.</p>
<p>Select all the images you want to set GPS coordinates to (CMD-A on Mac, Cntrl-A on PC, if you have them in the same folder).  Then, go to File-Plugin Extras &#8211; Geoencode&#8230;</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/Screen-shot-2010-07-24-at-3.42.10-PM.png" rel="shadowbox[sbpost-541];player=img;" title="Open Geoencode Plugin"><img class="alignnone size-medium wp-image-562" title="Open Geoencode Plugin" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/Screen-shot-2010-07-24-at-3.42.10-PM-300x187.png" alt="" width="300" height="187" /></a></p>
<p>There are several important things on the resulting window&#8230;</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/Geoencode-Window-e1280002752638.jpg" rel="shadowbox[sbpost-541];player=img;" title="Geoencode Window"><img class="alignnone size-medium wp-image-563" title="Geoencode Window" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2010/07/Geoencode-Window-300x222.jpg" alt="" width="300" height="222" /></a></p>
<p>The important stuff here:</p>
<ul>
<li>Make sure the tracklog tab is selected.</li>
<li>Make sure you&#8217;ve selected the GPX file that you emailed to yourself.</li>
<li>Select UTC as the timezone &#8211; this is because the times from the GPS satellites are in UTC.</li>
<li>I&#8217;ve had the most luck with a 30 second fuzzyness.  Increase if you are in a downtown, decrease if you are not and you were running.</li>
<li>If your camera doesn&#8217;t have the correct time, correct it!  You really shouldn&#8217;t have to use much in the camera time correction.</li>
</ul>
<p>Once you click Geoencode, the GPS information will be added to all the pictures it can.  Congratulations, your pictures are mappable!  Now, if you use Jeffery Friedl&#8217;s Flicker plugin, Flickr will know where to place them on the map!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/photography/blackberry-gpsed-lightroom-lightroom-plugin-awesome/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Tour-Based Modeling: Why is it Important?</title>
		<link>http://www.siliconcreek.net/transportation/tour-based-modeling-why-is-it-important</link>
		<comments>http://www.siliconcreek.net/transportation/tour-based-modeling-why-is-it-important#comments</comments>
		<pubDate>Sat, 12 Jun 2010 13:47:41 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Transportation]]></category>
		<category><![CDATA[tour-based-modeling]]></category>
		<category><![CDATA[trip generation]]></category>
		<category><![CDATA[trip-based-modeling]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=461</guid>
		<description><![CDATA[One thing that is constantly bounced around is why tour-based modeling is better than trip based modeling.  We&#8217;ve been using trip based modeling for 50 years, isn&#8217;t it timeless? No. Fifty years ago, when the trip based modeling methodologies were developed, the primary reason was to evaluate highway improvements.  While tolling was in use, the [...]]]></description>
			<content:encoded><![CDATA[<p>One thing that is constantly bounced around is why tour-based modeling is better than trip based modeling.  We&#8217;ve been using trip based modeling for 50 years, isn&#8217;t it timeless?</p>
<p>No.</p>
<p>Fifty years ago, when the trip based modeling methodologies were developed, the primary reason was to evaluate highway improvements.  While tolling was in use, the bonding requirements were likely different.  Transit, while extremely important, was not in the public realm (the streetcars were normally privately owned by the area&#8217;s electric company).</p>
<p>Now, there are a lot of demands on travel models:</p>
<ul>
<li>Tolling/Toll Road analysis at a better level</li>
<li>Different tolling schemes (area tolling, cordon tolling)</li>
<li>Travel Demand Management (telecommuting, flex hours, flex time, alternative schedules)</li>
<li>Better freight modeling (which now is becoming commodity flow and commercial vehicle modeling)</li>
<li>Varying levels of transit (local bus, express bus, intercity bus, BRT, light rail, and commuter rail</li>
</ul>
<p>While many of these can be done with trip based models, most of them cannot be done well with trip based models.  There are a number of reasons, but the few that come to mind are aggregation bias, modal inconsistency, and household interrelationships.</p>
<h1>Aggregation Bias</h1>
<p>Aggregation bias occurs when averages are used to determine an outcome.  For example, using a zonal average vehicles per household, you miss the components that form the average, such as:</p>
<blockquote><p>20 households, average VPHH = 2.2<br />
2 HH VPHH = 0<br />
5 HH VPHH = 1<br />
4 HH VPHH = 2<br />
6 HH VPHH = 3<br />
3 HH VPHH = 4+</p></blockquote>
<p>The trip generation and modal choices (car, bus, bike, walk, etc.) among these households are all different, and are even more more different if you look at the number of workers per household.</p>
<h1>Modal Inconsistency</h1>
<p>In trip based modeling, &#8220;people&#8221; are not tracked throughout their day.  So, if someone rides the bus to work, there is nothing in the model to ensure that they don&#8217;t drive from work to get lunch.  While we don&#8217;t want to force people to use the same mode, since many people will use the bus to get to work and then walk to lunch or to go shopping during lunch, we want to make sure that there is some compatibility of modes.</p>
<h1>Household Interrelationships</h1>
<p>One of the features of of tour based models is determining each person&#8217;s daily activity pattern.  During this process, certain person types can determine what another person is doing.  For example, if a preschool age child is staying home, an adult (whether they are a worker or not) HAS to stay home.  Another example is if a school-non-driving-age child is going on a non-mandatory trip, an adult must accompany them.  Trip based models don&#8217;t know about the household makeup and the household interaction.</p>
<p>The above are only three of the many reasons why tour-based modeling is important.  There are many more, but I feel these are some of the most important and some of the easiest to understand.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/tour-based-modeling-why-is-it-important/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RFPs and RFQs: Legality and Ethics</title>
		<link>http://www.siliconcreek.net/management/rfps-and-rfqs-legality-and-ethics</link>
		<comments>http://www.siliconcreek.net/management/rfps-and-rfqs-legality-and-ethics#comments</comments>
		<pubDate>Sun, 28 Mar 2010 15:04:08 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Management]]></category>
		<category><![CDATA[rfp]]></category>
		<category><![CDATA[rfq]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=419</guid>
		<description><![CDATA[Recently, I attended a webinar entitled &#8220;The ABCs of RFPs and RFQs&#8221;.  This is one of those things that in my line of work (a manager of a travel model development group), I face occasionally.  I&#8217;m not an expert.  When presented the opportunity to get some guidance from some &#8220;experts&#8221; for free, I jumped on [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I attended a webinar entitled &#8220;The ABCs of RFPs and RFQs&#8221;.  This is one of those things that in my line of work (a manager of a travel model development group), I face occasionally.  I&#8217;m not an expert.  When presented the opportunity to get some guidance from some &#8220;experts&#8221; for free, I jumped on the chance.</p>
<p>I was disappointed.</p>
<p>Three things stuck out in my mind as being flat-out wrong.  The first was &#8220;The best case scenario is when you (the consultant) write the scope for the RFQ&#8221;.  The second was &#8220;The best way is sole source contracts&#8221;.  The third was constantly using RFP as a tool to limit the responses from consultants to only those that you want to respond.</p>
<p><strong>Consultants Writing Scopes for RFQs</strong></p>
<p>Looking at the AICP Code of Ethics, it seems that if a consultant writes the scope for the RFQ (or RFP), I feel it is in violation of Part A, 2a and 2c.  If a consultant is writing the scope for me, where is my professional judgement?  Does that judgement not extend to what I feel my needs (and my organizations needs) are?  Both of those are brought up in 2a.  Looking at 2c, which is avoiding a conflict of interest, it seems to me that if a consultant writes the scope for an RFQ, that is a direct conflict of interest &#8211; the consultant is going to write the scope that gives them an advantage (whether intentionally or unintentionally).</p>
<p><strong>Sole Source?</strong></p>
<p>When being audited by the State of Ohio Auditors, you are under extreme scrutiny when trying to sole-source a contract.  The reasons why are obvious.  A few years ago, my department attempted to sole-source a contract because it was a $30k contract and it seemed that there was only one firm that could do the job for that price.  While that may have been correct, there was several firms willing to try.  The job ultimately went to a firm that was NOT going to be the one that would have received the sole-source contract (there is a lot of talk that they may have taken a loss on the job, but I would venture a guess that the others would have as well).  Had the sole-source been allowed to continue, it would have been considered illegal under Ohio law and my organization would have been fined.</p>
<p>I can&#8217;t type all this without bringing up another big issue that CAN negate the above.  General Planning Consultants and General Engineering Consultants.  The GPC and GEC contracts are always put up for RFQ, and handing a scope to a GEC or GPC consultant is NOT the same as sole-source.  This method is perfectly legal (it is open to public review and open to all consultants to submit statements of qualifications) and is a great way to get smaller (less than $100k, perhaps) jobs to consultants without them spending a lot of money trying to get smaller jobs.  They have to spend their marketing money up-front, but over the 3-5 year span, they have plenty of opportunity to make it back on smaller jobs that have very small marketing requirements.</p>
<p><strong>RFPs Only to Certain Consultants?</strong></p>
<p>Again, 2c, conflict of interest &#8211; public agencies cannot perform the work of the public good using the fewest tax dollars without having an open bid process.  Also, it is pretty likely that every state requires RFPs and RFQs to be advertised.  That being said, what&#8217;s the point?  You&#8217;re going to send the RFP to 2 or 3 consultants but post it on your website (and for us, the newspaper, state DOT website, and various other locations as required by law and our policy) for all to see?  Sounds like a pretty ineffective way to only target a few consultants.</p>
<p>If you only want certain consultants to respond, find a way to do it, legally, without giving the opportunity for other consultants to not compete for it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/management/rfps-and-rfqs-legality-and-ethics/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Separating Intent and Unintended Effects</title>
		<link>http://www.siliconcreek.net/management/separating-intent-and-unintended-effects</link>
		<comments>http://www.siliconcreek.net/management/separating-intent-and-unintended-effects#comments</comments>
		<pubDate>Sun, 21 Mar 2010 15:03:59 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Management]]></category>
		<category><![CDATA[NASCAR]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=417</guid>
		<description><![CDATA[On March 7, 2010 at Atlanta Motor Speedway (AMS), an interesting crash happened in the larger context of NASCAR.  Carl Edwards intentionally got into the side of Brad Kesolowski, causing Kesolowski to spin around, become airborne, and land on his side with momentum sending Kesolowski&#8217;s car into the wall (video).  This was almost inverse of [...]]]></description>
			<content:encoded><![CDATA[<p>On March 7, 2010 at Atlanta Motor Speedway (AMS), an interesting crash happened in the larger context of NASCAR.  Carl Edwards <em>intentionally</em> got into the side of Brad Kesolowski, causing Kesolowski to spin around, become airborne, and land on his side with momentum sending Kesolowski&#8217;s car into the wall (<a href="http://www.youtube.com/watch?v=Ohe0RPA9ZfE" rel="shadowbox[sbpost-417];player=swf;width=640;height=385;">video</a>).  This was almost inverse of the Talledega spring race in 2009 where Edwards <strong><em>un</em></strong><em>intentionally</em> came down on Kesoloski, spun around, became airborne, got hit by another car in the process, and hit the safety fence that separates the track from the stands(<a title="Talledega Video via YouTube" href="http://www.youtube.com/watch?v=B2XSk4c5QrE" rel="shadowbox[sbpost-417];player=swf;width=640;height=385;" target="_blank">video</a>).</p>
<p>The big difference between these two scenarios was intention.  Earlier in the race at AMS, Kesolowski got into the side of Edwards, causing Edwards a long repair and a poor finish.</p>
<p>NASCAR handed down a three-race probation to Edwards after parking him for the remainder of the race at AMS.  The debate as to whether that was the most appropriate disciplinary action have been swirling around NASCAR for weeks (and still is at the time of writing).</p>
<p><strong>This post is not about whether NASCAR made the right or wrong decision</strong>, but rather how it relates to management.</p>
<p>You have to understand the history behind the wing.  If you&#8217;ve watched the videos above, you&#8217;ve seen two of three.  The other piece of history is at this <a title="Talladega Fall Race via YouTube" href="http://www.youtube.com/watch?v=gkhtgUsLwyA" rel="shadowbox[sbpost-417];player=swf;width=640;height=385;" target="_blank">video</a>.  The scenario at AMS is the third time that a car has become airborne after being turned around.</p>
<p>The probation that Edwards faces (and no suspension or fine, mind you) was because Edward&#8217;s intent was to mess up Kesolowski&#8217;s 6th place finish with a spin to the infield.  Edwards didn&#8217;t intend for the vehicle to flip, and the vehicle should not have flipped.  In fact, the severe crash was likely caused more by the wing on the back of the car (which has now been replaced with a spoiler), not by Edwards&#8217;s intentionally spinning Kesolowski.</p>
<p>This is quite a conundrum for NASCAR.  They control the design of the car very strictly.  They also said that the drivers could use a little less restraint after feeling a lot of criticism over the 2009 season where they made rules that limited the drivers actions.  Drivers and teams are not allowed to make decisions as to whether they use the wing or not.  They have to use it.</p>
<p>The important thing here is, as a manager, make the decision looking at all pieces of information and all parts of history.  Look at what you&#8217;ve told your employees.  Look at what has happened in the past that your employees should have been aware of.  Look at what you would have done in that situation, particularly if you weren&#8217;t a manager.  Discuss the issue with the employees involved.  Do not make rash decisions and do not let emotions be the only thing that guides your decisions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/management/separating-intent-and-unintended-effects/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why Cell Phones and Driving Aren&#8217;t Dangerous</title>
		<link>http://www.siliconcreek.net/transportation/why-cell-phones-and-driving-arent-dangerous</link>
		<comments>http://www.siliconcreek.net/transportation/why-cell-phones-and-driving-arent-dangerous#comments</comments>
		<pubDate>Mon, 15 Mar 2010 19:12:35 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Transportation]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=415</guid>
		<description><![CDATA[The short answer: they are. The long answer (and previously blogged): the study was a before and after study that claimed that cell phone laws have no effect.  Such is the case when you don&#8217;t and can&#8217;t enforce it.  Cell phone bans are difficult to enforce (as are speed limits).  Most police departments have their [...]]]></description>
			<content:encoded><![CDATA[<p>The short answer: they are.</p>
<p>The long answer (and previously blogged): the study was a before and after study that claimed that cell phone laws have no effect.  Such is the case when you don&#8217;t and can&#8217;t enforce it.  Cell phone bans are difficult to enforce (as are speed limits).  Most police departments have their hands full as it is, and their budgets are being affected (negatively) by the economy.  The original study was basically a before and after study of the same conditions on both sides.</p>
<p><a href="http://www.psychologytoday.com/blog/persuade-me/201003/why-cell-phones-and-driving-arent-dangerous">Why Cell Phones and Driving Aren&#8217;t Dangerous | Psychology Today</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/why-cell-phones-and-driving-arent-dangerous/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Romanian street sign warns drivers of &#8216;drunk pedestrians&#8217; &#8211; Telegraph</title>
		<link>http://www.siliconcreek.net/transportation/romanian-street-sign-warns-drivers-of-drunk-pedestrians-telegraph</link>
		<comments>http://www.siliconcreek.net/transportation/romanian-street-sign-warns-drivers-of-drunk-pedestrians-telegraph#comments</comments>
		<pubDate>Mon, 15 Mar 2010 17:13:52 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Transportation]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=413</guid>
		<description><![CDATA[In what is perhaps an accidental approach to reducing pedestrian crashes using the first step of &#8220;the three Es&#8221; (education, enforcement, engineering), Pecica, Romania has installed signs that warn of drunk pedestrians ahead. While a little odd, I applaud the mayor for experimenting with a low-cost, low-impact way to handle the problem.  I hope it [...]]]></description>
			<content:encoded><![CDATA[<p>In what is perhaps an accidental approach to reducing pedestrian crashes using the first step of &#8220;the three Es&#8221; (education, enforcement, engineering), Pecica, Romania has installed signs that warn of drunk pedestrians ahead.</p>
<p>While a little odd, I applaud the mayor for experimenting with a low-cost, low-impact way to handle the problem.  I hope it works.</p>
<p><a href="http://www.telegraph.co.uk/news/worldnews/europe/romania/7405695/Romanian-street-sign-warns-drivers-of-drunk-pedestrians.html">Romanian street sign warns drivers of &#8216;drunk pedestrians&#8217; &#8211; Telegraph</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/romanian-street-sign-warns-drivers-of-drunk-pedestrians-telegraph/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The American Planning Association Swings and Misses</title>
		<link>http://www.siliconcreek.net/transportation/the-american-planning-association-swings-and-misses</link>
		<comments>http://www.siliconcreek.net/transportation/the-american-planning-association-swings-and-misses#comments</comments>
		<pubDate>Tue, 02 Mar 2010 14:01:21 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Transportation]]></category>
		<category><![CDATA[AICP]]></category>
		<category><![CDATA[APA]]></category>
		<category><![CDATA[professional-associations]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=411</guid>
		<description><![CDATA[As my close friends and colleagues know, I shunned my AICP certification almost a year ago.  The reason was based on a few things: For the $400 I would have spend on APA+AICP, I can have ITE+TRB, which are more vital to any transportation planner I really don&#8217;t want to be a member of APA.  [...]]]></description>
			<content:encoded><![CDATA[<p>As my close friends and colleagues know, I shunned my AICP certification almost a year ago.  The reason was based on a few things:</p>
<ul>
<li>For the $400 I would have spend on APA+AICP, I can have ITE+TRB, which are more vital to any transportation planner</li>
<li>I really don&#8217;t want to be a member of APA.  It has done little for me, and <em>Planning </em>magazine has published questionable articles on more than one occasion.  One article even made me think that the author was high on drugs.  However, you cannot split APA and AICP.</li>
<li>While the AICP Commission tried to make AICP actually mean something by requiring CM, their one step forward took two steps back when they attempted to use it as a money-making opportunity for APA and requires approval for all hours.  This means that if you go to Ohio Model User Group meetings or attend Travel Model Improvement Program webinars, you&#8217;re not getting any certification maintenance credit for it.  If you are a Professional Engineer or a Professional Transportation Planner (the certification through TCSB), you get credit for these things.</li>
</ul>
<p>In keeping up with things going on in the field, I received an email from the Florida DOT Weekly Briefs.  In it, they had a link to &#8220;State of Transportation Planning 2010&#8243;.  They had an overview of some important topics (with suggested reading), but missed two, including:</p>
<ul>
<li>FINANCE. one of the biggest topics currently impacting transportation.</li>
<li>SAFETY.  There are almost 40,000 people killed on America&#8217;s roads and another 300,000 injured.  Distracted driving has received a lot of attention because of the crashes that it causes and has the potential to cause.  Toyota has recalled some 8 million vehicles due to problems with sticking gas pedals, brakes, or steering.</li>
</ul>
<p>Aside from the obvious blunders above, there are a few more that I think need to be pointed out.</p>
<p>First off, this is not a &#8220;state of&#8221; anything.  This is a very basic introductory document that points people to a few seemingly randomly selected works in that field.  Looking at the travel behavior section, there are several research works (and having met some of these authors, I know they are great resources).  The one thing that we already have as travel demand modelers that illustrates the &#8220;state of&#8221; is Transportation Research Board Special Report 288.  It is so vitally important to us that we know it by number (and it is the only one, in my case).  SR288 goes through in sometimes painful detail to talk about the state of travel forecasting.</p>
<p>Second off, policy is centered entirely around climate change.  They evidently haven&#8217;t been following Climategate, else they would have dropped the link to &#8220;Moving Cooler&#8221; (considering that areas near Washington DC received an uncharacteristic 5 feet of snow in some places, you&#8217;d think that might tip them off).  Obviously, the jury is still out on whether the globe is getting hotter or colder, but if you talk with real people, many feel that Global Warming isn&#8217;t occurring.  Stuff like that happens when you mess with data and hard code models for certain outputs.</p>
<p>So yeah, as Marty Brenaman (play-by-play radio host for the Cincinnati Reds) says quite often, &#8220;A swing and a miss&#8221;.</p>
<p>Here&#8217;s the link: <a href="http://www.apa-tpd.org/TPDAnnualReport_files/TPD_State_of_Transportation_%282010%29.pdf">TPD_State_of_Transportation</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/the-american-planning-association-swings-and-misses/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Entrepreneurs: Start. This. Company. Now?</title>
		<link>http://www.siliconcreek.net/transportation/entrepreneurs-start-this-company-now</link>
		<comments>http://www.siliconcreek.net/transportation/entrepreneurs-start-this-company-now#comments</comments>
		<pubDate>Mon, 23 Nov 2009 18:38:04 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Transportation]]></category>
		<category><![CDATA[freeways]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=308</guid>
		<description><![CDATA[In response to a blogger at Entrepreneurs: Start. This. Company. Now. &#8211; washingtonpost.com. I have always shied away from anything Tech Crunch, since it has been one of the most likely sites to report hoaxes and rumors.  The above link was posted to PlaNetizen and went out to thousands of readers.  I&#8217;m sure there are [...]]]></description>
			<content:encoded><![CDATA[<p>In response to a blogger at <a href="http://www.washingtonpost.com/wp-dyn/content/article/2009/11/19/AR2009111900894.html">Entrepreneurs: Start. This. Company. Now. &#8211; washingtonpost.com</a>.</p>
<p>I have always shied away from anything Tech Crunch, since it has been one of the most likely sites to report hoaxes and rumors.  The above link was posted to PlaNetizen and went out to thousands of readers.  I&#8217;m sure there are hundreds saying &#8220;Get your head out of your ass!  We have that here!&#8221;</p>
<p>Those hundreds are in Tampa.  They have an elevated freeway above the Lee Roy Selmon Cross Town Expressway.  They were finished in 2007 or so.  I&#8217;ve heard that they are really, really cool to use.  It was also really, really expensive, and it suffered a setback after one of the support piers sunk, bringing a 3 lane section down to the ground level freeway below.</p>
<p>Another thing that should be pointed out is that in this country there are dozens of bridges that are double-decker.  We have one here in Cincinnati, the Brent Spence Bridge, which carries I-71 and I-75 over the Ohio River.</p>
<p>That bridge needs to be rebuilt.  It is roughly a half of a mile (including the approaches), and the costs are measured in the billions.</p>
<p>Dear author, if you are going to tell people to start a company, make sure it hasn&#8217;t already been started first.</p>
<p>EDITS:</p>
<p>(1) I figured I needed to come back to this and bring up an important issue that I only touched on.  That is the potential for problems caused by natural disasters.  After one of the &#8220;Big Ones&#8221; in California, it was brought up that Cincinnati is somewhat earthquake-prone.  The thing that made the nightly news?  &#8221;Is the Brent Spence Bridge Going to Collapse if Cincinnati gets hit with a Big One?&#8221;  Certainly the Tampa Crosstown Expressway sink was a scary, serious issue.  It was one that was not planned for, and required a complete redesign of an area of the elevated expressway.  The reason roads tend to be on the ground is because there is a limited set of catastrophic natural disasters that can happen.</p>
<p>(2) I dogged TechCrunch above, and I figured I should mention that despite my general poor opinion, I did read another article that sourced a number of topics to TechCrunch, and the source data sounds spot-on.  I&#8217;m not a TechCrunch reader, and my opinions are still mixed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/entrepreneurs-start-this-company-now/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Former DOT Secretary weighs in on Transportation Bill</title>
		<link>http://www.siliconcreek.net/transportation/former-dot-secretary-weighs-in-on-transportation-bill</link>
		<comments>http://www.siliconcreek.net/transportation/former-dot-secretary-weighs-in-on-transportation-bill#comments</comments>
		<pubDate>Thu, 15 Oct 2009 14:34:08 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Transportation]]></category>
		<category><![CDATA[transportation-bill]]></category>
		<category><![CDATA[usdot]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=284</guid>
		<description><![CDATA[Reference: National Journal Online &#8212; Insider Interviews &#8212; Bush DOT Chief Discusses Reauthorization. I agree with the thoughts of increased tolling and more fees other than the gas tax.  I also agree with $1B per year for technology, but it has to be managed right. I&#8217;m also glad that the performance measures are measurable: Congestion [...]]]></description>
			<content:encoded><![CDATA[<p>Reference:<a href="http://insiderinterviews.nationaljournal.com/2009/10/post-1.php"> National Journal Online &#8212; Insider Interviews &#8212; Bush DOT Chief Discusses Reauthorization</a>.</p>
<p>I agree with the thoughts of increased tolling and more fees other than the gas tax.  I also agree with $1B per year for technology, but it has to be managed right.</p>
<p>I&#8217;m also glad that the performance measures are measurable:</p>
<ul>
<li> Congestion (we can measure that &#8211; it is the percent of a region&#8217;s network that is operating with a demand greater than its capacity)</li>
<li>Costs (we can measure that, although we have to watch how we do it, as we don&#8217;t want to have a system be considered bad if gas prices hit $4/gallon)</li>
<li>Safety (we DO measure this &#8211; it is the number of injuries and deaths on the road)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/former-dot-secretary-weighs-in-on-transportation-bill/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What are those little green boxes???</title>
		<link>http://www.siliconcreek.net/transportation/what-are-those-little-green-boxes</link>
		<comments>http://www.siliconcreek.net/transportation/what-are-those-little-green-boxes#comments</comments>
		<pubDate>Sat, 11 Apr 2009 15:51:30 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Transportation]]></category>
		<category><![CDATA[traffic counters]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=217</guid>
		<description><![CDATA[It is the start of traffic counting season in Ohio. Each year, we get about 7 months to count the cars on the road. With my involvement in this type of work, I hear a lot of horror stories. First off, I wanted to discuss how these things work and how the data is used [...]]]></description>
			<content:encoded><![CDATA[<p>It is the start of traffic counting season in Ohio. Each year, we get about 7 months to count the cars on the road. With my involvement in this type of work, I hear a lot of horror stories. First off, I wanted to discuss how these things work and how the data is used and cannot be used, and then show some of the war stories.</p>
<div id="attachment_261" class="wp-caption alignnone" style="width: 459px"><img class="size-full wp-image-261" title="Traffic Counter" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2009/04/asr_counter-3375.jpg" alt="Traffic Counter on side of road" width="449" height="105" /><p class="wp-caption-text">Traffic Counter on side of road</p></div>
<p><strong>First off: how these things work</strong></p>
<p>Those that have been around for 30 or more years may remember when some gas stations had a hose that rang a bell to call a station attendant to pump your fuel. Those that don&#8217;t should watch <em>Back to the Future</em>. This is the same basic concept for most traffic counters. There are hoses that go across the road, and based on what the sensors feel and the time between them, these little green (or sometimes gray) boxes calculate the number of axles, distance between them (which can be used to derive the type of vehicle), and the speed.</p>
<p>I know that speed is a big issue with a lot of people. After all, some of these counters are being used for speed studies to see if they want to put a cop on a road at a certain time. This does happen, despite my wishes that cops and others would use less-detectable methods for enforcement. There are two other ways that counts, with speed, can be taken. One is by RADAR (the same thing they use for active speed enforcement). Mind you, for speed sampling, RADAR is pretty useful when installed correctly, and the boxes can be hidden quite well. The other is using magnetic loops. There are portable models of these that sit in the lane and are difficult to see (and also susceptible to theft). There are also permanent models that can be completely hidden from view.</p>
<p>One thing I can say with ALL hose counters: WE CANNOT USE THEM FOR SPEED ENFORCEMENT! The units do not have any cameras (etc), so if you speed while going over them, we know you did, but we don&#8217;t know who you are!</p>
<p><strong>Second off: How We Use The Data We Get From These Things</strong></p>
<p>This one differs by jurisdiction, but most use it for traffic studies. Speed, count, and vehicle type are very useful for roadway improvement design. Another use is for travel model validation. We (specifically me, since it is my job) use this to ensure that the region&#8217;s travel model is accurate so when we use it to plan billions of dollars in improvements, we know we&#8217;re not just guessing, which would be a waste of money.</p>
<p>Law enforcement will use the number of speeders per unit of time to plan when to run patrols. As I indicated, I wish they wouldn&#8217;t use hose counters for this, but they do, and the data they get is accurate. However, hoses are pretty conspicuous, which is why I wish they wouldn&#8217;t use them.</p>
<p>We cannot use the data in court. You cannot be detected to be going 45 MPH in a 25 MPH zone based on a traffic counter. The counters do not have cameras in them, and none that I know of can connect to a camera. A camera would be required to prove who was speeding. Without the connection, it would be difficult to prove, since the times would have to be the same, the counter has to be operating perfectly, and the hoses have to be measured very precisely. Some states also forbid the use of cameras for passive law enforcement (a cop can actively use a RADAR+camera, but not mount one on a pole and get every car that is speeding).</p>
<p><strong>The War Stories</strong></p>
<p>I have two, both given to me by a salesperson for Jamar Tech, one of the leading traffic counter manufacturers.</p>
<p><a href="http://www.myfoxboston.com/myfox/pages/Home/Detail?contentId=2527658&amp;version=1&amp;locale=EN-US&amp;layoutCode=VSTY&amp;pageId=1.1.1">City of Boston Thinks a Counter is a Bomb</a>. This one is proof that some cops don&#8217;t use hose counters, else they would have known what this unit is.</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2009/01/burnedtrax.pdf">Counter burned</a>, likely by an accelerant. PDF from Jamar, which the salesperson sent me just after I bought 8 counters from him.</p>
<p><strong>Don&#8217;t Mess With Them!</strong></p>
<p>It amazes me that 1 month into the season, I&#8217;ve had to replace several hoses because of cut or stolen hoses. This is your tax dollars at work. The more hoses we have to replace, the less money we have to improve the roads.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/what-are-those-little-green-boxes/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Travel Demand Modeling 101 Part 1: Terminology</title>
		<link>http://www.siliconcreek.net/transportation/travel-demand-modeling-101-part-1-terminology</link>
		<comments>http://www.siliconcreek.net/transportation/travel-demand-modeling-101-part-1-terminology#comments</comments>
		<pubDate>Sat, 23 Aug 2008 02:53:14 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Transportation]]></category>
		<category><![CDATA[four step model]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=174</guid>
		<description><![CDATA[It occurred to me that many people likely do not understand all of the terminology of travel demand models.  Because of this, I felt the need to list many of them here. Assignment: A process that determines the specific route of travel from one zone to another. Binomial Logit Mode Choice: A process that compares [...]]]></description>
			<content:encoded><![CDATA[<p>It occurred to me that many people likely do not understand all of the terminology of travel demand models.  Because of this, I felt the need to list many of them here. <span id="more-174"></span><strong>Assignment: </strong>A process that determines the specific route of travel from one zone to another.</p>
<p><strong>Binomial Logit Mode Choice:</strong> A process that compares the utility of two travel mode choices and determines the probability of using each mode.</p>
<p><strong>BPR Equation:</strong> An equation used to determine the speed on a network link based on the ratio of the volume to the capacity.</p>
<p><strong>Centroid:</strong> A point that is linked to a TAZ that loads traffic onto the network</p>
<p><strong>Centroid Connector:</strong> The link that connects a centroid to the rest of the network.</p>
<p><strong>Equilibrium Assignment:</strong> An assignment method that iteratively assigns and reassigns traffic based on revised travel times on each link.</p>
<p><strong>Friction Factors:</strong> Factors that are used in distribution to refine the distance measure between zones.</p>
<p><strong>The Four Step Process:</strong> A process of modeling that began in the 1950s that performs four major steps: trip generation, trip distribution, mode choice, and assignment.</p>
<p><strong>Fratar Model:</strong> An iterative gravity model used to determine trip interchanges where total productions and attractions are known, but not necessarily balanced.</p>
<p><strong>Gravity Model Distribution:</strong> A process to determine the likelihood of traveling from one zone to another based on the attractiveness of the destination compared to the distance from the origin to the destination.</p>
<p><strong>Link:</strong> A piece of roadway in the network</p>
<p><strong>Mode Choice: </strong>A process that determines the economic utility of all available forms of travel from one zone to another and splits trips (from the trip distribution step) into a variety of modes (depending on those that exist).</p>
<p><strong>Multinomial Logit Mode Choice: </strong>A process that compares the utility of multiple travel mode choices where each is a separate and distinct choice.</p>
<p><strong>Nested Logit Mode Choice:</strong> A process that compares the utility of multiple travel mode choices as a string of choices and sub-choices.  An example would be a structure illustrated below (click on the image for a larger view).</p>
<dl id="attachment_175" class="wp-caption alignnone" style="width: 160px;">
<dt class="wp-caption-dt"><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2008/08/nestedlogit.jpg" rel="shadowbox[sbpost-174];player=img;" title="Nested Logit Diagram"><img class="size-thumbnail wp-image-175" title="Nested Logit Diagram" src="http://www.siliconcreek.net/wordpress/wp-content/uploads/2008/08/nestedlogit-150x150.jpg" alt="This is a diagram of nested logit mode choice." width="150" height="150" /></a></dt>
</dl>
<p><strong>Network:</strong> A collection of links, nodes, centroids, etc. that simulate the major travel facilities in the model area.</p>
<p><strong>Traffic Analysis Zone (AKA: zone, TAZ):</strong> A geographic division, much like a census block, that defines an area of homes and businesses used in the travel demand model.</p>
<p><strong>Trip Generation: </strong>A process of counting the homes, employees (usually by type), schools, and other activities that generate traffic to and from them.  Trips are generated as attractions and productions.</p>
<p><strong>Trip Distribution:</strong> A process of determine where generated trip productions are linked to generated trip attractions.  This determines the number of people that will go from one zone to another.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/travel-demand-modeling-101-part-1-terminology/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Random Thought: Road Nicknames</title>
		<link>http://www.siliconcreek.net/transportation/random-thought-road-nicknames</link>
		<comments>http://www.siliconcreek.net/transportation/random-thought-road-nicknames#comments</comments>
		<pubDate>Thu, 05 Jun 2008 03:09:22 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Transportation]]></category>
		<category><![CDATA[roads]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=173</guid>
		<description><![CDATA[I&#8217;ve occasionally seen some road nicknames that are particularly good.  A few that I&#8217;ve heard: Malfunction Junction (I-275 and I-4, Tampa, FL) The Riddle in the Middle (Alaska Way, Seattle, WA) Spaghetti Junction (I-85 and I-285, Atlanta, GA) I&#8217;ve also started calling a strech of Columbia Parkway (Cincinnati, OH) &#8220;The Suicide Side&#8221;, which is a [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve occasionally seen some road nicknames that are particularly good.  A few that I&#8217;ve heard:</p>
<ul>
<li>Malfunction Junction (I-275 and I-4, Tampa, FL)</li>
<li>The Riddle in the Middle (Alaska Way, Seattle, WA)</li>
<li>Spaghetti Junction (I-85 and I-285, Atlanta, GA)</li>
</ul>
<p>I&#8217;ve also started calling a strech of Columbia Parkway (Cincinnati, OH) &#8220;The Suicide Side&#8221;, which is a 45 MPH arterial that everyone goes 60 MPH.  The divider is a double-yellow line&#8230; only.</p>
<p>Got any more?  Add &#8216;em in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/random-thought-road-nicknames/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Four Step Model Explained: Trip Generation</title>
		<link>http://www.siliconcreek.net/transportation/four-step-model-explained-trip-generation</link>
		<comments>http://www.siliconcreek.net/transportation/four-step-model-explained-trip-generation#comments</comments>
		<pubDate>Wed, 04 Jun 2008 03:27:51 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Transportation]]></category>
		<category><![CDATA[trip generation]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=171</guid>
		<description><![CDATA[Trip generation is likely one of the easiest parts of the four step process.  Normally, the most difficult part of dealing with trip generation is getting the input socioeconomic (population and employment) data correct.  This post explains how trip generation is calculated in the model&#8230; The socioeconomic data for most models includes the following attributes [...]]]></description>
			<content:encoded><![CDATA[<p>Trip generation is likely one of the easiest parts of the four step process.  Normally, the most difficult part of dealing with trip generation is getting the input socioeconomic (population and employment) data correct.  This post explains how trip generation is calculated in the model&#8230;<span id="more-171"></span></p>
<p>The socioeconomic data for most models includes the following attributes for every zone in the model area:</p>
<ul>
<li>Population</li>
<li>Households or Dwelling Units</li>
<li>Dwelling Unit Occupancy</li>
<li>Auto Ownership Information</li>
<li>Hotel Information</li>
<li>School Enrollment</li>
<li>Employment Information (number, type)</li>
<li>Special Cases (airports, amusement parks, etc)</li>
</ul>
<p>Many models have several fields that describe these basic attributes.  In some, auto occupancy may be defined as a percentage of households with 0 autos, a percentage with 1 auto, and a percentage with 2 or more autos.  In others, there may be percentages based on the number of vehicles compared to the number of workers in a household.</p>
<p>The simple part of trip generation models is that once the socioeconomic data is in place and trip production factors are in place, trip generation is simply applying factors to determine the number of trips generated by and attracted to each use.  These factors are determined by a trip survey.</p>
<p>Trip generation is normally done with a cross-classification model.  This is where multiple factors are used to determine the rate of trips per unit (household, employee, etc).</p>
<p><a title="Trip Generation Spreadsheet (Excel xlsx)" href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2008/06/trip-generation-worksheet.xlsx">This spreadsheet</a> is an example of trip generation calculations. It is a cross-classification model based on household size and auto ownership.  For each purpose, the dwelling units with each criteria of auto ownership is is calculated and then applied to the trip rate in the &#8216;Production Table&#8217; tab.  For attractions, I simply applied a rate per employee to the employees by sector.  The SEData sheet indicates the inputs and outputs.</p>
<p>The final output is a set of productions by trip purpose and a set of attractions.  These are intentionally close with attractions higher than productions.  The reason why will be discussed in the Trip Distribution post.</p>
<p>A trip purpose is basically a reason for travel.  Most models include home-based work (which are any trip going to or coming from the home and work), home-based school, home-based other (trips for purposes other than school and work), and non-home-based (trips that do not go to or from the home).  Some models may include home-based shopping or home-based social-recreation separately, and some combine it into home-based other.</p>
<p><a href="http://www.siliconcreek.net/wordpress/wp-content/uploads/2008/06/trip-generation-worksheet.xlsx">trip-generation-worksheet</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/four-step-model-explained-trip-generation/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introduction to the Four Step Travel Demand Model</title>
		<link>http://www.siliconcreek.net/transportation/introduction-to-the-four-step-travel-demand-model</link>
		<comments>http://www.siliconcreek.net/transportation/introduction-to-the-four-step-travel-demand-model#comments</comments>
		<pubDate>Tue, 27 May 2008 06:00:32 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Transportation]]></category>
		<category><![CDATA[four step model]]></category>

		<guid isPermaLink="false">http://www.siliconcreek.net/?p=170</guid>
		<description><![CDATA[The center of most travel demand models is the &#8220;Four Step Model&#8221;.  This model was created in the 1950s to determine the demand on roadways.  The four steps include: Trip Generation Trip Distribution Mode Choice Trip Assignment The first step in the process, Trip Generation, uses socioeconomic data to determine the number of trips produced [...]]]></description>
			<content:encoded><![CDATA[<p>The center of most travel demand models is the &#8220;Four Step Model&#8221;.  This model was created in the 1950s to determine the demand on roadways.  The four steps include:</p>
<ol>
<li>Trip Generation</li>
<li>Trip Distribution</li>
<li>Mode Choice</li>
<li>Trip Assignment</li>
</ol>
<p><span id="more-170"></span></p>
<p>The first step in the process, Trip Generation, uses socioeconomic data to determine the number of trips produced by a traffic analysis zone (or census tract, census blockgroup, or other geographic division).  The socioeconomic data normally includes population, auto ownership, and employment information at the very least.</p>
<p>The second step is trip distribution.  Once the number of trips are known, trip distribution determines where the trips will go.  This normally uses a gravity model, which will be discussed in a future post.  This step takes in several factors, including the number of trip productions, the number of trip attractions, and an impedance value.  The impedance value is the resistance to travel, which could include distance, time, tolls, or a combination of those.  Each model is different in this regard.</p>
<p>The third step is mode choice.  This step determines what vehicle trips will utilize when going from one zone to another.  This step can be particularly complex or extremely simple, depending on the area included in the model.  Some models have very simple mode choice steps because transit isn&#8217;t available, or it doesn&#8217;t have a significant effect.  Other models can be extremely complex, such as a model for Chicago or New York, which would include autos, bus transit, subway transit, urban rail (such as Chicago&#8217;s Metra Rail), and intercity rail transit (such as the Amtrak service that connects New York to Boston, Baltimore, and Washington, DC).</p>
<p>The final step is trip assignment.  This step takes all of the trips from mode choice (which it now knows if they are trips that will drive alone, share a ride, use the bus, or use another mode of transportation) and assigns them to a transportation network.  Prior to the mid-1980s, these networks were largely text based, but with the advent of Geographic Information Systems and personal computers in the mid-1980s and moving forward, these networks became graphical.</p>
<p>These four steps represent the basic building blocks of most transportation models.  These steps are a basic way to ask:</p>
<ul>
<li> How many people are going to travel?</li>
<li>Where are they going to go?</li>
<li>What transportation mode are they going to use to get there?</li>
<li>What route will they take to get there?</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.siliconcreek.net/transportation/introduction-to-the-four-step-travel-demand-model/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
