18-649 Project Assignment #11 - Technical Notes

Please submit all project-related correspondence to


This addendum offers some hints and tools that you may find useful in the project.

Disclaimer:  These tools and suggestions are provided "AS IS".  You are not required to use them.  They are provided for your convenience, so you don't have to do everything from scratch -- but are not guaranteed to be perfect or suitable for all purposes.

Useful Excel Functions

This is a list of functions that may be useful constructing your dictionary or network analysis tables.  Consult Excel help for details on the functions.

Formula for standard hexadecimal representation:
=CONCATENATE("0x",RIGHT(CONCATENATE("00000000",DEC2HEX(A1)),8)) - produces a hexadecimal representation in the form "0x########" of the decimal number in cell A1

Find and Replace Script

Because you will be changing the CAN ID's in your code based on network priority, you will also have to change them throughout your code.  This task boils down to executing multiple find and replace operations on all your test files.  It is somewhat simplified because the 8 least significant bits (2 hex digits) are used for replication ID, and will not change.  That means that if you need to change  '0xAABEEF00' with '0xAAF00D00' and '0xAABEEF01' with '0xAAF00D01', a simple replacement of '0xAABEEF' with '0xAAF00D' will cover both cases.

You may use any tool you are comfortable with, but we have provided a script for doing multiple finds and replace operations on multiple files.  You can download it here.  This script will run correctly on the games cluster. 

Usage:  replacer.sh <replacement list> <search extension>

This script makes backups of each file each time it is run (numbered 000, 001, etc).  However, to be safe, you should always back up your code tree to a safe place before running this script!

The replacement list file should have two columns:  The first is the value to be replaced, the second is the value to replace with.  Here is an example replacement list.

The search extension is the extension type of the files to be replaced.  Do not include the '.'.  If you want to replace all .mf files, specify just 'mf' here. Each find and replace will be executed on all files in all subdirectories of the working directory that have the extension specified by the search extension parameter.

Note that the find-and-replace features of this script are case sensitive, so if you have mixed case CAN IDs, the script will not translate all IDs.  Having a partial replacement can cause some fairly strange bugs.  In that case, there are numerous other find and replace tools which can perform this task.




Back to Project 11