Skip to content

Control File Converter for CE-QUAL-W2

This section describes the steps required to convert a legacy control file (w2_con.npt) and its companion graph.npt file into the Excel-based control file format (w2_con.xlsm). The converter also handles upgrading a w2_con.csv file from Version 4.1 or 4.22 to Version 4.5.

The conversion is a two-step process:

  1. Run the converter executable to produce a comma-separated values (CSV) formatted control file.
  2. Paste the CSV output into an existing Version 4.5 Excel template.

Step 1: Run the Converter Executable

  1. Copy ConverterControlFile.exe into the directory containing the legacy application files (w2_con.npt, graph.npt, and the bathymetry file). Alternatively, copy those three files into the directory containing the executable. If you are converting a Version 4.1 or 4.22 w2_con.csv file to Version 4.5, only the w2_con.csv and bathymetry file are needed.
  2. Double-click the converter executable. The program generates the following output files in the same directory:
    • w2_con45.csv: The control file in CSV format. This file will be pasted into a Version 4.5 w2_con.xlsm template in Step 2.
    • bthX.csv: A CSV-formatted bathymetry file for each waterbody, where X is the waterbody number. This format is easier to edit and analyze than the older fixed-width format. The filename reference in w2_con.csv is automatically updated to bthX.csv.

Step 2: Import into the Excel Template

Copy the contents of w2_con45.csv into an existing Version 4.5 w2_con.xlsm template file. You can obtain a template from any of the CE-QUAL-W2 example problems included with the model distribution.

Open and Copy the CSV Data

  1. Open the template file w2_con.xlsm (or a descriptively named variant such as w2_con_DeGray.xlsm) from an existing example problem.
Example of an existing w2_con.xlsm file
Figure 3. An example of an existing w2_con.xlsm file. Columns A and B are not used in the control file. The w2_con45.csv data is pasted into column C1, not A1.
  1. Open w2_con45.csv from the converter output in Excel.
Example of the w2_con45.csv file from the converter utility
Figure 4. An example of the w2_con45.csv file from the converter utility.
  1. In w2_con45.csv, select the columns and rows containing data. Do not select the entire sheet, because the data cannot be pasted into cell C1 of w2_con.xlsm if the entire sheet is selected. Select all columns required by the data, including enough columns for segment-specific parameters such as sediment oxygen demand (SOD), which requires as many columns as the number of segments (IMX).
  2. Copy the selected cells from w2_con45.csv and paste them into cell C1 of w2_con.xlsm. Use Paste Values and Number Formatting to preserve the colors and formatting of the original template.

Warning

Paste into column C1, not A1. Columns A and B in the Excel template contain descriptive labels and notes that are not part of the control file data.

Adjust Rows for Constituent Count

The template file may have been configured with a different number of water quality constituents than your application requires. Adjust the row count so that the constituent list in columns A and B aligns with the data in column C.

  1. Navigate to approximately row 384 in the Excel template, where the constituent order is defined.
  2. Compare the required number of constituents (computed by a formula in the Excel sheet) with the number of constituent rows present.
  3. To add rows, select the appropriate number of cells in columns A and B only, right-click, and choose Insert, then Shift cells down.
  4. To remove rows, select the extra cells in columns A and B only, right-click, and choose Delete, then Move cells up.

After adjustment, the labels in columns A and B should align with the corresponding data in column C.

Location in Excel template showing constituent order
Figure 5. Location in the Excel template where the constituent order is shown. The required number of constituents is computed by a formula. Verify that this number matches the count in the constituent list. Another tab in the Excel file provides guidance on the required order based on your dimensioning of algal groups, biochemical oxygen demand (BOD) groups, macrophyte groups, periphyton groups, suspended solids groups, and generic constituent groups. Column A also provides guidance on the number of columns needed.

Tip

Search for "increase # of rows" in column A to locate the sections where row adjustments may be needed.

Adjust Rows for Group Counts Exceeding Five

If your application uses more than 5 of any of the following group types, additional rows must be added in columns A and B at the designated locations in the Excel template:

  • Structures: Look at rows 136--165. Notes in columns A and B describe where to add rows if more than 5 structures are present.
Excel file location for structures row adjustment
Figure 6. Location in the Excel file where the number of rows needs to be increased if there are more than 5 structures.
  • Epiphyton/periphyton groups: Search for "epiphyton" in the Excel template to locate the relevant section.
Excel file location for epiphyton/periphyton row adjustment
Figure 7. Location in the Excel file where the number of rows needs to be increased if there are more than 5 epiphyton/periphyton groups.
  • Algae and zooplankton groups: Search for "zooplankton" in the Excel template to locate the relevant section.
Excel file location for zooplankton row adjustment
Figure 8. Location in the Excel file where the number of rows needs to be increased if there are more than 5 zooplankton groups.
  • Macrophyte groups: Search for "macrophyte" in the Excel template to locate the relevant section.
Excel file location for macrophyte row adjustment
Figure 9. Location in the Excel file where the number of rows needs to be increased if there are more than 5 macrophyte groups.

Add Double Quotes to Text Fields

The TITLE, HNAME, CNAME, and CDNAME fields require double quotes in the control file. Excel drops double quotes on import, so these must be restored manually.

To restore double quotes around a cell value, set up a formula in each affected cell:

=char(34)&[CELLREF]&char(34)

where [CELLREF] is the cell reference containing the original text. Then paste the resulting values (with the double quotes) into the corresponding locations in the control file.

Note

This workaround is necessary because Excel removes double quotes when importing CSV data. If a simpler method is available in your version of Excel, use that instead.

Verify and Export

After completing the steps above, the w2_con.xlsm file should be fully functional. As edits are made to the control file within the Excel template, use the Export to CSV file button located in column B near the top of the sheet to export the file as w2_con.csv, which is the format read by the CE-QUAL-W2 model.

The preprocessor built into the Excel template performs validation checks and will report errors if there is a problem with the setup.