### TREX Training Guide: Creating a TREX Executa ble File for Windows

Prepared For: Biocides Copper Task Force American Chemistry Council 700 2 nd Street NE Washington, D.C. 20002

Prepared By: HDR/HydroQual 1200 MacArthur Boulevard Mahwah, NJ 07430

January 7, 2011Prepared by HDR/HydroQual for the American Chemistry Council January 7, 2011

TREX Training Guide: Creating a TREX Executable File for Windows Page 2 of 6 

### Creating a TREX Executa ble File for Windows
Overview Any C compiler that works with the Microsoft Wi ndows Operating System (OS) can be used to create a TREX executable (.exe) file. The followi ng is a description of how users can create a TREX executable using the Microsoft Visual Studio C (C++) compiler. As of July 2010, Visual Studio C++ can be down loaded from the Micros oft web site at the following URL: http://www.microsoft.com/ express/Downloads/#2010-Visual-CPP. The instructions that follow have been used with Visual Studio .Net 2003, Visual Studio Express Edition 2008, and Visual St udio Express Edition 2010. Note: Menu items or dialog boxes described in these instructions may differ because small differences exist between versions of the Visual Studio software. Nonetheless, menus items and dialog boxes in each version of the software will be very similar even if not identical.

1. Launch the Visual Studio (.Net or Express) application.

2. Create a new project. Select the "File" Menu, click on "N ew" and choose "New Project".Prepared by HDR/HydroQual for the American Chemistry Council January 7, 2011

TREX Training Guide: Creating a TREX Executable File for Windows Page 3 of 6 3. Choose a project type and template. From the dialog box, choose Visual C++ project , select “Win32 Console Project” as the template, provide a name for the project such as TREX on the “Name” line, and specify the directory where you want the proj ect to be created. Click OK.

4. Select the project settings. From the dialog box, click on “Application Settings ” on the left hand side of the box, select “Empty project” from the list that appears on the right, and then click “Finish”. At this point, Visual Studio will create a fold er that you can use for the projec t. For your convenience, it is helpful to copy the folder containing the TREX s ource code into the folder that you just created for the project or in a folder at the sa me directory level of your project folder.Prepared by HDR/HydroQual for the American Chemistry Council January 7, 2011

TREX Training Guide: Creating a TREX Executable File for Windows Page 4 of 6 5. Add source code files to the project. Right click on the “Source Files” fo lder in the “Solution Explorer ” pane of the Visual Studio Window and choose “Add” and then “Add Existin g Item” from the context menu. When the dialog box opens up, browse/navigate your way to the folder containing the TREX source code, select each and every one of the .c files from th e list, and then click the “Open” button. Note: you will need to delete either trex-r 4.c or trex-debugger-r4.c from the source file list. See Step 8.

6. Add header files to the project. Right click on the “Header Files” folder in the “Solution Explorer” pane of the Visual Studio Window and choose “Add” and then “Add Existin g Item” from the context menu. When the dialog box opens up, browse/navigate your way to the folder containing the TREX source code, select each and every one of the .h files from the list, and then click the “Open” button.

7. Select the project configuration. Single click on the “TREX” solution name in the “S olution Explorer” pane of the Visual Studio Window to highlight it. Click on the “Build” menu and choose “Configuration Manager” from near the bottom of the list. From the “Confi guration Manager” dialog box, choose an “Active Configuration” from the drop-down menu. The c hoices are either “Rel ease” or “Debug”. A “Debug” version allows you to trace code operati on one line at a time but is slower to run. A “Release” will run faster but may not provide lin e-by-line information regarding the internal details of code operation. When developing new c ode or tracing program ope ration, it is better to use a “Debug” version. When performing full mode l simulations, it is better to use a “Release” version. Click “Close” when done.Prepared by HDR/HydroQual for the American Chemistry Council January 7, 2011

TREX Training Guide: Creating a TREX Executable File for Windows Page 5 of 6 8. Delete one of the trex-*.c file s from the list of source files The source files are located in the "Solution Explorer" pane of the Visual Studio Window. The file you need to delete will depend on whether you are creating a “Debug” or “release” version of the executable file. If you chose “Release”, si ngle click on the file “trex-debugger-r4.c” and delete it from the source file list. If you chose “Debug”, single click on th e file “trex-r4.c” and delete it from the list.

9. Build an executable. Click on the “Build” menu and select “Build Solutio n” from the top of the list. This starts the build process. It may take a c ouple of minutes for the process to complete. The TREX executable file will be located within your project folder in the “Release” or “Debug” sub-folder (depending on what you chose for an active configuration. This file can also be copied to a place where you want to run TREX. Specifica lly, TREX can be run from the Windows command prompt (Start/Program Files/Accessories/Command Prompt). Note: while code is compiling, warning message s may appear depending on which version of Visual Studio you use. These warnings repr esent differences in how C programming language standards are implemented in different versions of Visual Studio and can be safely ignored.Prepared by HDR/HydroQual for the American Chemistry Council January 7, 2011

TREX Training Guide: Creating a TREX Executable File for Windows Page 6 of 6 10. Set the working directory for progra m operation within Visual Studio Right click on the project folder in the “Solu tion Explorer” pane of the Visual Studio Window and choose “Properties” from the context me nu. Under “Configuration Properties” select “Debugging” and specify Working Directory and Command Arguments. Wo rking Directory will contain directories for input a nd output files and Command Arguments will be the specified input file (as well as any desire d simulation restart conditions).