Tutorial 4: Flowsheet Result Data

Flowsheet evaluation results are stored in a table in the FOQUS session. This data can be used for many purposes. The flowsheet evaluations may be single runs, part of an optimization problem, or part of a UQ ensemble. This tutorial provide information about sorting, filtering, and exporting data.

The FOQUS file for this tutorial is Simple_flow.foqus, and this file is located in examples/tutorial_files/Flowsheets/Tutorial_4.

Note

The examples/ directory refers to the location where the FOQUS examples were installed, as described in Install FOQUS Examples.

The Simple_flow.foqus file is similar to the one created in the tutorial Section Tutorial 2: Creating a Flowsheet with Linked Simulations, but it has been run an additional 100 times using a UQ ensemble (see Tutorial 1: Simulation Ensemble Creation and Execution).

  1. Open FOQUS.

  2. Open the examples/tutorial_files/Flowsheets/Tutorial_4/Simple_flow.foqus session from the example files.

  3. Click the Flowsheet button from the Home window.

  4. Click Flowsheet Data in the toolbar on the left side of the Home window.

Flowsheet Results Data Table, All Data

Flowsheet Results Data Table, All Data

A data table should be displayed like the one shown in the figure below. There are 102 flowsheet evaluations. The first two evaluations are single runs, as can be seen in the SetName column, and the remaining 100 evaluation are from a UQ ensemble. The Error column shows several of the evaluations resulted in an error from a negative number being passed to the square root function.

This tutorial is broken up into mini-tutorials in the remaining subsections, which can be done independently. They each use the example data file described above.

Sorting Data

  1. Open FOQUS.

  2. Open the Simple_flow.foqus session from the example files.

  3. Click Flowsheet in the main toolbar at the top of the FOQUS Home window.

  4. Click Flowsheet Data in the toolbar on the left side of the Home Window.

  5. Click Edit Filters.

  6. Click New Filter.

  7. Enter “Sort1” as the new filter name.

  8. Click New Filter.

  9. Enter “Sort2” as the new filter name.

  10. Select “Sort1” from the Filter drop-down list.

  11. Enter ["-result"] as the Sort by Column. Include the square brackets. The square brackets indicate that there is a list of sort terms, although in this case there is only one. If multiple search terms are given, the additional terms will be used to sort results having the same value for the previous terms. The “-” in front of result indicates the results should be sorted in reverse. The names of the sort terms come from the column headings, and are case sensitive.

  12. Click Done to save the filters and return to the results table.

Sort1 Data Filter

Sort1 Data Filter

  1. Select “Sort1” from the Current Filter drop-down list.

  2. The results are shown in below. The data should be sorted in reverse alphabetical order by result. Some of the columns are hidden to make the relevant results easier to see.

Sort1 Data Filter Results

Sort1 Data Filter Results

  1. Click Edit Filters.

  2. Select “Sort2” from Filter drop-down list.

  1. Enter ["err", "-result"] in the Sort Term field. This will sort the data first by Error code then by result in reverse alphabetical order.

  2. Click Done.

Sort2 Data Filter

Sort2 Data Filter

  1. Select “Sort2” in the Current Filter drop-down list.

  2. The results are shown in below. The data should be sorted so all Error code zero results are first then sorted in reverse alphabetical order by result.

Sort2 Data Filter Result

Sort2 Data Filter Result

Filtering Data

  1. Open FOQUS.

  2. Open the Simple_flow.foqus session from the example files.

  3. Click the Flowsheet button in the Home window.

  4. Click the Results Data button (Table icon in left toolbar).

  5. In the data table dialog, click Edit Filters.

  6. Click New Filter and enter “Filter1” in the Filter field as the new filter name.

The filter expression is a Python expression. The c("Comlumn Name") function returns a numpy array containing the column data. The expression should evaluate to a column of bools where rows containing True will be included in the filtered results and rows containing False will be excluded. If combining multiple logical expressions the numpy logical functions https://docs.scipy.org/doc/numpy-1.15.1/reference/routines.logic.html should be used. Numpy is imported as np

8. In this example, results without errors in the “Single_runs” should be selected. In the filer expression field enter np.logical_and(c("err") == 0, c("set") == "Single_runs")

  1. Click Done.

Filter1 Data Filter

Filter1 Data Filter

  1. In the data table dialog, select “Filter1” from the Current Filter drop-down list.

  2. The result is displayed in the Figure below.

Filter1 Data Filter Result

Filter1 Data Filter Result

Exporting Data

This tutorial uses a spreadsheet program such as Excel or Open Office. The exported data is subject to the selected filter. See the previous tutorials in this section for more information about sorting and filtering data to be exported.

Clipboard

FOQUS can export data directly to the Clipboard. The data can be pasted into a spreadsheet or as text. Copying data to the Clipboard eliminates the need for an intermediate file when creating spreadsheets.

  1. Open FOQUS.

  2. Open a spreadsheet program.

  3. Open the Simple_flow.foqus session from the example files.

  4. Click the Flowsheet button in the Home window.

  5. Click the Results Data button (Table icon in left toolbar).

  6. Click on the Menu drop-down list in the data table dialog.

  7. Select “Export” from the Menu drop-down list.

  8. Click Copy Data to Clipboard.

  9. Select Paste in the spreadsheet program. The data table in FOQUS should paste into the spreadsheet. Filters can be used to sort or reduce the exported data.

CSV File

CSV (comma separated value) files can be read by almost any spreadsheet program, and are common formats readable by many types of software. FOQUS exports CSV files using the column headings from the data table as a header.

  1. Open FOQUS.

  2. Open a spreadsheet program.

  3. Open the Simple_flow.foqus session from the example files.

  4. Click the Flowsheet button in the Home window.

  5. Click the Results Data button (Table icon in left toolbar).

  6. Click the Menu drop-down list.

  7. Select “Export” from the Menu drop-down list.

  8. Click Export to CSV File.

  9. Enter a file name in the file dialog.

  10. In the spreadsheet program, open the CSV file exported in the previous step.