Can an Aspen Plus block specification be deleted by a Visual Basic Application?

Download as pdf : 
Products: Aspen Plus 
Last Updated: 03-Nov-2020
Versions: 
Article ID: 000083279
Primary Subject: 
Converted from "102691_Default.txt"

Creation Date: 30-Sep-1999 02:03PM

Problem Statement:

Can an Aspen Plus block specification be deleted by a Visual Basic Application?


Solution:

Visual Basic applications or Visual Basic for Applications with Excel (Excel/VBA) can change Aspen Plus block specifications using the Happ ActiveX interface. This interface is documented in Chapter 38 of the Aspen Plus User Guide.

Normally, these applications are used to retrieve block results. Input specifications can also be changed. When changing input, Aspen Plus will enforce the same data entry rules as it does if the change is made manually. This means that it may be necessary to delete one specification before another can be made.

For example, Radfrac only permits the specification of two operating conditions. If the distillate to feed ratio and reflux ratio have been specified, one of these specifications must be deleted before another specification can be made. In Visual Basic or Excel/VBA, Aspen Plus data can be deleted by setting the value to Nothing. The following two lines will delete the reflux ratio and set the distillate rate to 150 for a Radfrac column:

'' Clear the reflux ratio specification first
go_Simulation.Tree.Data.Blocks.B1.Input.BASIS_RR.Value = Nothing

'' Add a specification for the distillate rate
go_Simulation.Tree.Data.Blocks.B1.Input.BASIS_D.Value = 150

The variable go_Simulation is a global object variable that represents the Aspen Plus simulation. It is defined by a Dim statement as an IHapp type.


KeyWords:

VBA, ActiveX