You are on page 1of 26

Jump Start: Aspen Custom Modeler V8

A Brief Tutorial (and supplement to training and online documentation)


David Tremblay, Product Management, Aspen Technology, Inc.
Zachary Peers, Product Management, Aspen Technology, Inc

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715
Jump Start: Aspen Custom Modeler V8

Table of Contents
Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Set Up Properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Start from Aspen Properties® . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Start from Aspen Plus® . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3
Create an Aspen Custom Modeler Flash Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3
Set Up a Component List in Aspen Custom Modeler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3
Select Properties Definition File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Create a Custom Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Create Variables and Equations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5
Specify Fixed and Free Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6
Write Procedure Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7
Compile and Test the Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9
Add the Phase Equilibrium Equation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10
Add the Component Mole Balance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Add the Energy Balance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Add Forms to Improve Usability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Add Ports. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Reference Port Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Handle Properties of Port Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Add the Mass-Transfer Equations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18
Create an Icon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18
Test the Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Add the Model to the Flowsheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Create a Dynamic Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Next Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Appendix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Additional Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715
Jump Start: Aspen Custom Modeler V8

Introduction
Aspen Custom Modeler (ACM) provides a powerful way to quickly create rigorous models of processing equipment and
to apply these equipment models to simulate and optimize continuous, batch, and semi-batch processes. The product is
both a model development environment, as well as a complete flowsheet modeling environment.

In this guide, we will follow one example, the development of a mass-transfer rate-based flash model to illustrate how you
can use Aspen Custom Modeler to develop your own unit operations.

This document serves as a simple getting started guide for using Aspen Custom Modeler. We recommend that you use a
range of other resources including:

• AspenTech support website (support.aspentech.com)


• AspenTech courseware available in on-line and in-person versions
• AspenTech knowledgebase items, training, and sample models available in aspenONE Exchange®
• AspenTech business consultants
See Additional Resources (page 23) for more information.

This guide assumes that the user has Aspen Custom Modeler V8.0 or higher installed on his or her computer.

There are two example files provided with this guide: Simple Flash Models – Steady State and Simple Flash Models –
Dynamic.

Set Up Properties
Aspen Custom Modeler shares a common property database and common set of thermodynamic models with Aspen
Plus via Aspen Properties. This provides a tremendous advantage for Process Engineers by ensuring a consistent basis for
all property calculations and eliminating much of the work required to set up rigorous models.

There are two options for setting up properties in Aspen Custom Modeler: start from scratch using Aspen Properties or
export properties from an existing Aspen Plus case.

Start from Aspen Properties


From the Windows Start Menu, enter “Aspen Properties” into the search bar and select “Aspen Properties User Interface” to
get started. This will open the desktop version of Aspen Properties. To save time, select an appropriate template. In this
example, we will use the Chemical with Metric Units template (Figure 1).

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715

1
Jump Start: Aspen Custom Modeler V8

Figure 1: Select a Template in Aspen Properties

Enter the list of components to be included in your model. This list should include all of the components that may appear
in any part of your flowsheet, including process utilities. Figure 2 shows the components used in this example. From this
point, you can use the next button to confirm the binary parameters for these components. When the file is complete,
save it to your working folder as an APRBKP file (Aspen Properties Backup File).

Figure 2: Generate a Component List in Aspen Properties

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715

2
Jump Start: Aspen Custom Modeler V8

Start from Aspen Plus


You can also create an Aspen Properties backup file from any Aspen Plus simulation case. Open the Aspen Plus file, run it
once, and then select File: Export from the menu. Enter a file name in the Export dialog box, and set the file type to Aspen
Properties Backup Files (*.aprbkp).

Create an Aspen Custom Modeler Flash Model


Now that you have set up all of the necessary properties, you can open Aspen Custom Modeler and reference them. Note
that the file reference can be changed at any time in the future, so it is easy to keep your ACM Model consistent with your
Aspen Plus models.

Open Aspen Custom Modeler. It is a good habit to start by naming and saving the file to a local folder. Note that the
Aspen Custom Modeler file type is used by default.

Set Up a Component List in Aspen Custom Modeler


Aspen Custom Modeler allows you to include any number of component lists. In this example, we will start with the
default list. From the simulation explorer, click Component Lists. Then, double click the Default component list icon
displayed in the lower portion of the simulation explorer.

Select the option to “Import Aspen Properties File.” This will open a file browser. Use the browser to point to the Aspen
Properties APRBKP file created earlier (Figure 3).

Figure 3: Reference an Aspen Properties File

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715

3
Jump Start: Aspen Custom Modeler V8

The next step is to select the components to include in the component list. Initially, the list is empty. Use the “>>” button
to push all the components to the right side of the form then click “OK” (Figure 4).

Figure 4: Select Components for a Component List

Select Properties Definition File


Properties have already been defined for this example. When starting up Simple Flash Models, you will be asked if you
want to set up properties. Agree and select Use Properties definition file. Click the “Browse” button and navigate to the
directory where you saved these files. Use the property file “propsplus.” For a Simple Flash Model, you will not be asked
to configure properties.

Create a Custom Model


The next step is to create a model. Navigate to the Models folder under Custom Modeling. Click the “Add Model” icon in
the lower section of the navigation pane and enter a name for the new model (Figure 5).

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715

4
Jump Start: Aspen Custom Modeler V8

Figure 5: Define a New Model

Create Variables and Equations


For this example, we are going to start with a simple flash (vapor-liquid phase equilibrium) calculation. We will use the
phase equilibrium equation:

Xiγ i Pi L = Yi P (E1)

where:

Xi Liquid mole fraction of component “i”

γi Molar activity coefficient of component “i” in the liquid phase

PLi Vapor pressure of component “i” in the liquid phase

Yi Vapor mole fraction of component “i”

P System pressure

The vapor pressure of each component is a function of temperature. The liquid-phase activity coefficient of each
component is a function of temperature and composition. These can be calculated directly by Aspen Properties, using
property procedures in Aspen Custom Modeler.

The easiest way to get started defining variables is to use the Model Assistant. You can raise the model assistant by right-
clicking inside the Model Editor window (which automatically appeared when you created the new model) and selecting
Model Assistant from the context menu (Figure 6). Note: if you close the Model Editor, you can reopen it by pressing
Ctrl+E (Appendix, page 22).

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715

5
Jump Start: Aspen Custom Modeler V8

Figure 6: Open the Model Assistant

The assistant provides a template to define variables. Enter a name, physical type, and description. You also have the
option to set the specification (explained in the next section). Click the “Insert” button to add the text to the model
(Figure 7).

Figure 7: Use the Model Assistant to Define a Variable

Specify Fixed and Free Variables


For this example, we will set up temperature and pressure (T, P) as Fixed variables. This means they will be held constant.
Conversely, Free variables are determined by the model calculations. Note: the value and specification settings in the
model variable definitions are only default values – the person using the model will have the option of changing both.
However, it is a best practice to define models with good initial values and specifications to help resolve convergence
problems later.

The liquid and vapor mole fractions (X, Y) are defined as Arrays, indexed over the component list as shown in Figure 8.
Activity coefficients and vapor pressures are set up in a similar manner.

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715

6
Jump Start: Aspen Custom Modeler V8

Figure 8: Use the Model Assistant to Define an Array

By default, the mole fractions are initialized to a fixed initial value. A better practice is to set mole fractions to the inverse
of the number of components (this way you always end up with as many mole fractions as components). In Aspen
Custom Modeler, the Size function returns the length of any array or set, so “1/Size(Componentlist)” can be used to
initialize the mole fractions (Figure 9).

Figure 9: Variable Definitions for the Simple Flash Model

Write Procedure Calls


Next, we need to set up procedure calls to calculate the molar activity coefficients and vapor pressures. These calls will
use Aspen Properties to provide the appropriate constants. Once again, the Model Assistant can help with the syntax.
Open the Model Assistant and click the Procedure tab, then select the appropriate property models from the Type list, as
shown in Figure 10.

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715

7
Jump Start: Aspen Custom Modeler V8

Figure 10: Define a Property Call Using the Model Assistant

After inserting the procedure calls, replace the text (such as “<temperature>”) with the corresponding variables in your
model. For example:

Call (<act_coeff(*)>) = pAct_Coeff_Liq(<temperature>, <pressure>, <molefraction(*)>) ComponentList;

becomes:

Call (gamma) = pAct_Coeff_Liq(T, P, X) ComponentList;

Note that the vapor pressure procedure “pVap_Pressures” (with an “s”) must be used to return a list of component vapor
pressures; the procedure “pVap_Pressure” returns the vapor pressure of a mixture (Figure 11)

Figure 11: Model with Procedure Calls for Activity Coefficients and Vapor Pressures

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715

8
Jump Start: Aspen Custom Modeler V8

Compile and Test the Model


At this point, the model can be tested. As with any other type of modeling, testing early and often is recommended when
using Aspen Custom Modeler. To compile the model, right click on it in the simulation explorer and select Compile (or
press F8).

The next step is to build a very simple flowsheet. Drag the new model from the simulation explorer and drop it into
the flowsheet workspace. Note that at this point, there is no way to link streams to the model since we have not set up
“ports.”

Click the Run button on the tool bar to run the model (Figure 12).

Figure 12: Run the Model

The model should be complete and “square” (the number of equations matches the number of unknown variables). This
is shown by the green status box at the bottom of the application window.

The results should match those shown in Figure 13 below. Right click on the instance of the model (B1) and select
Forms>AllVariables to see the list of model results and inputs. Note that the liquid phase compositions (“X”), the
temperature, and pressure were all declared as fixed variables in the model.

Figure 13: Create and Run an Instance of the Model

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715

9
Jump Start: Aspen Custom Modeler V8

This test confirms that you are able to calculate the activity coefficients and vapor pressures correctly. You can confirm
this using the property analysis features of Aspen Properties or Aspen Plus®.

Add the Phase Equilibrium Equation


The phase equilibrium equation:

Xiγ i Pi L = Yi P (E2)

This can be defined in the model as shown in Figure 14. Note that the equation will solve for the vapor mole fractions, “Y,”
since the other variables are fixed or functions of fixed variables. With Aspen Custom Modeler, the order of the equation
is not important—these statements are indeed equations and not assignments you would see in a typical programming
language.

Figure 14: Phase Equilibrium Equation

As formulated, the equation is well structured. When writing equations for Aspen Custom Modeler some important best
practices are to:

• Avoid unnecessary division to avoid errors when the divisor goes to zero
• Try to scale both sides of the equation to a value near unity to help with convergence
• Include an equation label (“Eqn_VLE:”) to help you diagnose problems if the model fails to converge
This equation implicitly represents one equation for each component (each member of the array) since many of the terms
in the equation are indexed over all components.

When the updated model is compiled, it is square. However, this model fails to converge. This illustrates an important
pitfall: infeasible models will not converge! Figure 15 shows the simulation message you will get that explains the model is
infeasible. Note: to open the Simulation Messages window, press Alt+F12 or select Messages under View on the toolbar.

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715

10
Jump Start: Aspen Custom Modeler V8

Figure 15: Use Simulation Messages to Diagnose the Problem

A review of the unconverged results shows that the model is driving the vapor mole fraction of methane to an
impossibly high value (92.67). This occurs because the specified liquid phase composition is not feasible at the specified
temperature and pressure. Further, there is no equation constraining the sum of the vapor mole fractions to unity.

To illustrate the problem and a potential solution, you can make two changes to the model. First, free the temperature (or
pressure). Second, add an equation to set the sum of vapor mole fractions to unity to ensure the resulting composition is
feasible. We can use the “sigma” (sum) function to perform this in Aspen Custom Modeler by adding:

EQN_Ysum: Sigma(Y) = 1.0;

With these assumptions, the system will calculate the bubble point temperature at the specified liquid phase composition
and pressure. In this particular case, the model converges to a temperature of -152°C (the high liquid mole fraction of
methane means the temperature must be quite low).

Add the Component Mole Balance


Your next goal is to develop a flash model that starts from a known feed flow (Fin), composition (Zi), and state condition
(T,P) to predict the vapor and outlet liquid flow rates and compositions. This requires adding additional variables and
equations.

The component mole balance can be defined as:

Fin Zi = Fliquid Xi + FvaporYi (E3)


∑ X = 1 (E4)
i i

∑ Y = 1 (E5)
i i

where “F” represents the total mole flow of a stream.

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715

11
Jump Start: Aspen Custom Modeler V8

Figure 16 shows the code associated with these constraints. Equation E3 is captured in the model equation “Eqn_
CompBal.” The equations “Xsum” and “Ysum” enforce the constraints that the liquid and vapor mole fractions sum to
unity (E4 and E5).

Eqn_CompBal: z*F_in=x*F_liq+y*F_vap;
Eqn_VLE: X*Gamma*Pvap=Y*P;
Eqn_Xsum: sigma(X)=1.0;
Eqn_Ysum: sigma(Y)=1.0;
Figure 16: Develop Equations for the Mole Balance

The feed mole fractions (Zi) are not checked into this simple sample model. Usually, these compositions would come
from a feed stream/port. Typically, a normalization equation is used to ensure valid feed conditions, for example the
equation “Z * sigma(Z_user) = Z_user” could be used to normalize user-specified mole fractions “Z_user.”

Figure 17 shows the code for the simple flash model so far.

Figure 17: Simple VLE Flash Model – Mass Balance Only at Fixed State Conditions

Add the Energy Balance


In most models, you cannot assume fixed state conditions. Instead, you may need to calculate temperature based on
the energy balance. For example, consider an adiabatic flash from high pressure to low pressure. In this situation, the
downstream temperature will drop under adiabatic conditions.

To calculate the energy balance, you need the molar enthalpy (h) of each inlet and outlet stream. You can also include a
heat duty term (Q). Additional terms, such as heat loss to the environment, can easily be added to the model as needed
(not shown below). E6 shows the enthalpy balance equation:

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715

12
Jump Start: Aspen Custom Modeler V8

Fin hin + Q = Fliquid hliquid + Fvapor hvapor (E6)

Since Aspen Custom Modeler uses Aspen Properties, you can easily get the stream enthalpies by making a property
procedure call. Since the feed stream could be at a different state than the product streams, additional variables T_in and
P_in have been included in the model . These are set to fixed state. Enthalpy calls are added for the feed and each product
phase. Note that Aspen Custom Modeler includes different physical types for mixed phase, liquid, and vapor enthalpy.
The only difference between these types is the initial value of the enthalpy.

The resulting model is shown in Figure 18. As you might expect from a flash model, you can set any two state conditions
(T, P, or Q) and calculate the others.

Figure 18: Write a Simple VLE Flash Model with Mass and Energy Balance

Add Forms to Improve Usability


As more variables are added, the AllVariables table can become unwieldy. You can add additional forms to your ACM
Model to make it easier to find the variables of interest. From within the simulation explorer, select the model in the top
pane and click ‘Add Form’ in the bottom pane. Enter a name for the table and click the “OK” button to create the object
(Figure 19).

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715

13
Jump Start: Aspen Custom Modeler V8

Figure 19: Add a New Form to a Model Type

The new table will be empty by default. Right-click on the table and select Properties. This opens a dialog with two tabs,
Properties and Variables. Use the Properties tab sheet to select which attributes to display by default (for example to add a
column for the variable Units). Use the Variables tab to set the list of variables to include in the table.

After the new table is defined, you can view it for any instance of the model by right-clicking the model icon on the
flowsheet, selecting Forms, and then selecting the form by name (Figure 20).

Figure 20: Navigate to the New Form from the Flowsheet

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715

14
Jump Start: Aspen Custom Modeler V8

Add Ports
In order to generate a model that works within a flow sheet, you must add ports. Ports allow you to connect streams
and other units. This model is being built for use within Aspen Plus and Aspen HYSYS, so you need to select the
MoleFractionPort for compatibility. You will need one inlet port (Feed) and two outlet ports (Liquid, Vapor). Figure 21
shows the code for the outlet ports.

Figure 21: Define the Outlet Ports

In order to allow multiple streams to enter the inlet, you need to define it as a multiport. This will mix the streams coming
in and use the resulting contents to solve for the outlets. The syntax for a multiport is similar to that for a port, except
“Multiport of” is added prior to the port type. You must also add a minimum number of required connections (Figure 22).

Figure 22: Add the Ports

Now, you must add mixing rules for the streams entering the flash in terms of the total flow, component flow, and
enthalpy. To reference all of the connections to the multiport, write them out as:

<name>.connection.<variable>

Thus, in the case of the flow, the syntax is:

Feed.connection.F

Use the “sigma” command to sum all of the values over the connection (Figure 23). This method is helpful because it
does not require you to specify the number of streams beforehand (since this number may vary for each instance of the
model).

Figure 23: Add the Mixing Rules

Reference Port Variables


Port variables can be defined by using the syntax:

<portid>.<variable>

For example, the enthalpy in the feed port is referenced by:

Feed.h

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715

15
Jump Start: Aspen Custom Modeler V8

If you do not know the syntax for your desired variable, or what variables are associated with a particular port, open the
simulation explorer and go to Libraries>Modeler>Port Types (Figure 24).

Figure 24: Open Port Types

Find the port you are interested in, right-click, and select edit. This will display the port and its variables (Figure 25).
A port can inherit another port type. In this case, the MoleFractionPort references the MainPort, so you must check
MainPort to find its variables.

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715

16
Jump Start: Aspen Custom Modeler V8

Figure 25: Look Up the Variables for a Port

Now that you have added ports to take in variables from a flowsheet, you do not need to fix all of your initial variables. The
code in Figure 26 tells the model to automatically use the stream values from the flowsheet to specify these variables.

Figure 26 : Use Stream Values Collected by a Port to Specify Variables

In order for this to work properly, you need to change the variables definitions to “Free” (Figure 27).

Figure 27: Make Sure Variables that are Determined by Ports are Free

Handle Properties of Port Variables


When you compile this model, you will see that it is not square. This is because the model does not know how to
calculate the molar volume in the outlet ports (if you open the port type MoleFractionPort, you will see molar volume,
V, is a required variable). To fix this problem, you can call on the molecular weight and density from Aspen Properties
using the procedure described in Write Procedure Calls (page 7). Figure 28 shows the code to call the correct properties
and calculate the required molar volumes. Note that you do not need to calculate the inlet molar volumes, because that
information is provided by the streams.

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715

17
Jump Start: Aspen Custom Modeler V8

Figure 28: Calculate Outlet Molar Volumes

Add the Mass-Transfer Equations


You can now add the rate-limiting equation (E7) for the mass transfer:

y*P
Fvap * y *Vliquid x − * kLa * Vliq − Tank (E7)
y * Pvap
This requires the addition of new variables that you have not yet defined. Add the mass transfer coefficient, kLA, and the
volume of liquid in the tank, vol_liq, as variables (Figure 29).

Figure 29: Add the Mass Transfer Coefficient and Liquid Volume in the Tank

Now, add the mass transfer equation as seen in Figure 30.

Figure 30: Add the Mixing Rules with Mass Transfer

Create an Icon
Creating an icon for the model allows you to connect the ports rather than using a universal inlet and outlet port. To enter
the icon-creating environment, select the model on the simulation explorer and select Add Icon (Figure 31). This will ask
you to name the icon and then open up a new window to draw it.

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715

18
Jump Start: Aspen Custom Modeler V8

Figure 31: Add Icon

After you add a shape, you can right-click on it to add a fill (Figure 32).

Figure 32: Draw an Icon and Add Fill

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715

19
Jump Start: Aspen Custom Modeler V8

When you are finished, exit the window and save the model. Next, right click on the icon for your model on the explorer
and select “Make Default” (Figure 33). For this example model, we have recreated a flash icon and added the vapor and
liquid ports from the port list on the left panel.

Figure 33: Set New Default Icon

Test the Model


Add the Model to the Flowsheet
The last step is to test the model. Compile and then add it to the flowsheet. Open View on the toolbar and select
Model Libraries (or press Alt+F10). Use Connection to add inlet and outlet streams to the block. Next, put the model into
Initialization mode and run it (Figure 34).

Figure 34: Run in Initialization Mode

After this completes, try running the model in Steady State mode. You should now have a model that converges and
calculates the rate-based results.

Create a Dynamic Model


To add dynamics to a model, you have to add a differential to the mass and energy conservation equations:

d ( Molx )
= Z * Fin – ( x * Fin + y * Fvap ) (E8)
d (t )

d (U )
= ( Fin * H in + Q ) − ( Fliq * H liq + Fvap * H vap ) (E9)
d (t )

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715

20
Jump Start: Aspen Custom Modeler V8

This is done by using the “$” symbol to represent the differential over time:

d0
$= (E10)
d (t )

You can break down the mass conservation equation to define the component holdup and total holdups. For the energy
conservation equation, you can define the holdup energy in the tank as Q. Figure 35 shows how to code the mass
conservation equation.

Figure 35: Write Equations for Molar Holdup in the Tank

Figure 36 shows how to code the energy conservation.

Figure 36: Write Equations for Energy Holdup in the Tank

Now that you have added the holdups, you have defined a dynamic equation. Dynamic models can still be run in steady
state in Aspen Custom Modeler. In this case, the differential is set to zero as seen below:

d ()
→0
d (t )
d (U )
= ( Fin * H in + Q ) − ( Fliq * H liq + Fvap * H vap ) (E11)
d (t )
0 = ( Fin * H in + Q ) − ( Fliq * H liq + Fvap * H vap )
( Fin * H in + Q ) = ( Fliq * H liq + Fvap * H vap )

This model ignores vapor holdup to make the dynamic model more robust (as it is negligible when no reactions are
present). You can also simplify the energy calculations for molar holdup HU:

U = hliq * HU liq (E12)

This lets you set an equation that relates the internal energy (U) to the enthalpy, allowing you to fix internal energy and
free the temperature. This is valuable because it is much simpler to measure temperature than it is to measure internal
energy.

Your dynamic model is now ready to be run. First, converge the Initialization state and then converge the Steady State.
Once you have these converged, you should save a snapshot. On the tool bar, click on the Snapshot button (Figure 37).

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715

21
Jump Start: Aspen Custom Modeler V8

Figure 37: Take a Snapshot

Give the snapshot a name such as “SavedSS.” You can now return to the converged steady state model if the dynamic
model has convergence issues later.

After saving the steady state model, go to the tool bar, change the mode to Dynamic, and run. If the model does not
converge, look at the message panel and see what errors the model is encountering to help troubleshoot.

Next, add controllers in the same way as you would in other simulators such as Aspen Plus Dynamics (see Additional
Resources, page 23). This step is not required to build this model, but helps to keep the model converged by minimizing
variable fluctuation. You can now change different fixed variables and see how the model reacts.

Next Steps
To learn how to run your ACM Model in an Aspen Plus or Aspen HYSYS flowsheet, check out the Computer Based
Training (CBT) course, “Getting Started with Aspen Custom Modeler in Aspen Plus V8,” available online (see Additional
Resources, page 23).

Appendix
Shortcuts

Compile F8
Model Assistant Ctrl+M
Model Editor Ctrl+E
Model Libraries Alt+F10
Simulation Messages Alt+F12
Variable Find Ctrl+Alt+F

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715

22
Jump Start: Aspen Custom Modeler V8

Additional Resources
Public Website
www.aspentech.com/products/aspen-plus
www.aspentech.com/products/solids

Support Website
aspentech.com/support

Online Training
www.aspentech.com/products/aspen-online-training

Computer Based Training


Aspen Custom Modeler
http://support.aspentech.com/webteamasp/KB.asp?ID=137498

Aspen Plus
http://support.aspentech.com/webteamasp/KB.asp?ID=132142

Aspen Plus Dynamics


http://support.aspentech.com/webteamasp/KB.asp?ID=135831

On-demand Webinars
Introduction to Aspen Custom Modeler
http://www.aspentech.com/July_2013-ACM/

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks of Aspen Technology, Inc. All rights reserved.11-7691-0715

23
About AspenTech
AspenTech is a leading supplier of software that optimizes process manufacturing—for energy,
chemicals, engineering and construction, and other industries that manufacture and produce products
from a chemical process. With integrated aspenONE® solutions, process manufacturers can implement
best practices for optimizing their engineering, manufacturing, and supply chain operations. As a result,
AspenTech customers are better able to increase capacity, improve margins, reduce costs, and become
more energy efficient. To see how the world’s leading process manufacturers rely on AspenTech to
achieve their operational excellence goals, visit www.aspentech.com.
Worldwide Headquarters
Aspen Technology, Inc.
20 Crosby Drive
Bedford, MA 01730
United States
phone: +1–781–221–6400
fax: +1–781–221–6410
info@aspentech.com

Regional Headquarters
Houston, TX | USA
phone: +1–281–584–1000
São Paulo | Brazil
phone: +55–11–3443–6261
Reading | United Kingdom
phone: +44–(0)–1189–226400
Singapore | Republic of Singapore
phone: +65–6395–3900
Manama | Bahrain
phone: +973–17–50–3000

© 2015 Aspen Technology, Inc. AspenTech®, aspenONE®, the Aspen leaf logo, the aspenONE logo, and OPTIMIZE are trademarks For a complete list of offices, please visit
of Aspen Technology, Inc. All rights reserved. 11-7691-0715 www.aspentech.com/locations

You might also like