How to create a sensitivity analysis using scripts in ACM?
Download as pdf :
Products:
Aspen Custom Modeler
Last Updated:
03-Nov-2020
Last Updated:
03-Nov-2020
Versions:
Article ID:
000097117
Article ID:
000097117
Primary Subject:
Problem Statement
How to create a sensitivity analysis
using scripts in ACM?
Solution
You can use a script in ACM to create a sensitivity analysis, and then report the result for different cases in the Simulation Messages window.
Attached please find an ACM example for a CSTR reactor. We want to vary the inlet stream temperature (Tin) from 100 to 110 degree C with a increment of 1 degree C, and check its effect on the concentration of component A in the product stream (cAout). To create a script, double click “Add Script” in the Flowsheet folder.
Write down the script using Microsoft Visual Basic Scripting Edition (VBScript) language:
'Define two arrays to record the inlet temperature and outlet concentration
Dim arr_tin(10)
Dim arr_cAout(10)
'Vary inlet temperature and run different cases
For i = 0 to 10
Blocks("B1").tin.value = 100 + i
arr_tin(i) = Blocks("B1").tin.value
' run simulation
application.simulation.run (true)
arr_cAout(i) = blocks("B1").cAout.value
Next
' print key results
For i = 0 to 10
application.msg arr_tin(i) & " " & arr_cAout(i)
Next
On Text Editor, Right-click to "Invoke” script. Then
you can check the cAout at different Tin in the Simulation Messages window:
Key Words
Sensitivity analysis
Aspen Custom Modeler
Script