What are you working on?

Find a calculator, explore a formula, or learn the method.

THE ENGINEERING REFERENCE / GUIDE

DWSIM Sensitivity Analysis: Varying One Input and Exporting the Results

Short Answer

DWSIM's Sensitivity Analysis utility varies up to two flowsheet inputs across equally spaced value ranges and records selected dependent variables, recalculating the entire simulation once per point. Results appear in a table that can be copied into other analysis software or sent directly to the data regression plugin. Case definitions are saved with the simulation and cannot be exported to other simulations.

If you have built a flowsheet in DWSIM and want to know how one input, such as a stream temperature or pressure, changes an output such as an enthalpy, the Sensitivity Analysis utility is the built-in tool for the job. You select up to two independent variables, give each one a value range and a number of equally spaced points, choose the dependent variables to record, and DWSIM recalculates the entire flowsheet once for every point. The results are displayed in a table that can be copied into other software or sent straight to the data regression plugin. This article explains how the utility works, how to set up a single-variable case, what the documented enthalpy example looks like, and what the options are for exporting the numbers.

What the Sensitivity Analysis Utility Does

Sensitivity analysis is the study of how changes in chosen inputs affect outputs. In DWSIM it is implemented as a utility in which you can study the influence of up to 2 variables on other dependent flowsheet variables [2]. The changes in the input variables are defined by a value range and a number of equally spaced points within that range. For each combination of input values the flowsheet is recalculated, and the values of the dependent variables at that point are recorded.

The utility is based on case studies. Within a single simulation you can define a number of cases, each with its own variables, ranges, and results, and these cases are saved together with the simulation file [2]. Importantly, cases cannot be exported to other simulations, so it is worth deciding which file will hold your studies before you start building them.

Setting Up a Single-Variable Study

Before opening the utility, make sure the underlying flowsheet is sound. Material streams must have their conditions and composition defined so that DWSIM can calculate their properties, and the complete simulation should converge reliably at the base case [1]. A sensitivity run simply repeats that converged calculation at new input values, so a fragile base case produces fragile results.

  1. Verify the base case. Run the flowsheet as configured and confirm that the output you care about is calculated correctly.
  2. Open the Sensitivity Analysis utility. It is one of DWSIM’s analysis tools, described in the official tools documentation [2].
  3. Define the independent variable. Select one flowsheet object property to vary, for example the temperature or pressure of a stream, and specify its value range.
  4. Choose the number of equally spaced points. DWSIM divides the range into that many evenly spaced values. For a single variable, this number is also the number of times the flowsheet will be recalculated.
  5. Select the dependent variables. These are the flowsheet quantities recorded at each point, such as an enthalpy, a duty, or another stream property.
  6. Run the study and read the table. Results appear in a table with one entry per calculated point.

The official help warns about runtime: because every point triggers a full recalculation, calculation time can become prohibitive if you request many points [2]. Start with a small number of points, confirm the study behaves as expected, and refine afterward.

Worked Example: Enthalpy versus Temperature and Pressure

The official documentation illustrates the two-variable case by analyzing the influence of temperature and pressure on the enthalpy of a mixture, from 200 to 400 K and from 100 to 1000 kPa, with nine points for temperature and five points for pressure [2]. Nine temperature values times five pressure values totals 45 points, which means the flowsheet is recalculated 45 times.

This example also shows how the point counts combine. With one input variable, the number of recalculations equals its point count. With two variables, DWSIM evaluates the full grid, so the recalculation count is the product of the two point counts. A cautious first study therefore uses fewer grid points, then increases resolution in the region that matters most.

Exporting and Analyzing the Results

The built-in route is deliberately simple. The results are shown in a table, so the data can be copied and pasted into another specialized data analysis software, or sent directly to the data regression plugin inside DWSIM [2]. Copy-paste is usually enough for spreadsheets, plotting packages, and technical computing environments.

Scripted control with IronPython

For more control over how results are organized, DWSIM supports flowsheet control with Python scripts. The official scripting tutorial uses the IronPython interpreter together with the Spreadsheet and Charts features to study the effect of pressure on the temperature profile of a distillation column [3]. The script retrieves the column with a call such as Flowsheet.GetFlowsheetSimulationObject(‘Acetone Column’), defines a list of pressure levels, in that example 8, 9, 10, 11, and 12 bar, and writes the results into labeled spreadsheet cells. The same pattern works when you need more than two varied inputs, custom formatting, or charts built next to the data.

Headless automation with the .NET API

When runs become numerous or repetitive, DWSIM can also be driven from outside the graphical interface. A small open-source GitHub project automates DWSIM headlessly through its .NET API and runs parametric sweeps: one set simulates n-pentane isomerization in a plug flow reactor across different reactor volumes and feed temperatures, and another sweeps a pentane-separation distillation column across different reflux ratios and stage counts [4]. The script runs every combination of inputs, handles solver failures gracefully, and writes the data into a CSV file along with plots. Its stated requirements are Windows, a local DWSIM installation, and Python 3.9 or 3.10. This route suits large sweeps and produces machine-readable output from the start.

Limitations and Common Pitfalls

  • Two-variable cap. The sensitivity utility accepts up to 2 independent variables per case [2]. Studies needing three or more inputs should use scripting or API automation instead.
  • Runtime growth. Recalculation counts multiply with two variables. The documented 9 × 5 example already means 45 full flowsheet recalculations, and the official help explicitly cautions that calculation time can be prohibitive [2].
  • Case portability. Cases are saved with their simulation and cannot be exported to other simulations [2]. If you expect to reuse a study, save a copy of the simulation file as your starting point rather than planning to move cases later.
  • Convergence failures. A point at which the flowsheet fails to converge yields no useful result. Automated sweeps typically build in failure handling for exactly this reason [4].
  • Sensitivity is not optimization. Mapping how an output responds across a range is different from searching for the best value. DWSIM’s toolset also includes a separate Optimization tool for that purpose [2].

Practical Takeaways

  • Verify a converged base case first; sensitivity points are only as reliable as the flowsheet they rerun.
  • Keep point counts modest at first, remembering that two variables multiply: 9 × 5 equals 45 recalculations in the documented example.
  • Use the built-in table for copy-paste export, or send results directly to the data regression plugin.
  • Turn to IronPython scripting inside DWSIM, or headless .NET API automation from Python, when you need more than two variables, custom formats, or CSV output.

FAQ

How many input variables can one DWSIM sensitivity case vary at once?

Up to two. The official documentation describes the utility as studying the influence of up to 2 variables on other dependent flowsheet variables. For studies requiring three or more inputs, the practical alternative is Python scripting or automation through the .NET API.

How many times will my flowsheet be recalculated during a sensitivity run?

Once per evaluated point. With a single variable, the recalculation count equals that variable's number of equally spaced points. With two variables, DWSIM evaluates the full grid, so the count is the product of both point counts; the documented example of nine temperature points and five pressure points produces 45 recalculations.

Can I copy my sensitivity cases from one DWSIM simulation to another?

No. According to the official help, cases are saved together with the simulation in which they were defined and cannot be exported to other simulations. If you plan to reuse a study, save a copy of the simulation file first and build the cases there.

How do I get the result numbers out of DWSIM?

The utility shows results in a table, from which the data can be copied and pasted into another specialized data analysis software, or sent directly to the data regression plugin inside DWSIM. Scripted and headless approaches can additionally write machine-readable files such as CSVs.

What is the difference between sensitivity analysis and optimization in DWSIM?

Sensitivity analysis maps how dependent variables respond as inputs sweep through defined ranges. Optimization searches for the best values of variables against a target. DWSIM provides these as separate tools, both covered in its official tools documentation.

References

  1. DWSIM Simulator Help (Cross-Platform UI): Sensitivity Analysis and Optimization. https://dwsim.org/docs/crossplatform/help/tools.htm
  2. DWSIM User Guide: Process Modeling (Flowsheeting). https://dwsim.org/help/main/13-process-modeling-flowsheeting.html
  3. DWSIM User Guide: Flowsheet Control with Python Scripts. https://dwsim.org/help/main/51-flowsheet-control-with-python-scripts.html
  4. ekagrazi/dwsim-python-gui: DWSIM Python Automation (GitHub). https://github.com/ekagrazi/dwsim-python-gui

Related Terms

Leave a Reply

Your email address will not be published. Required fields are marked *