Does your company or institution have unique stream property correlations? Would you like to implement these in Petro-SIM™ so they can be calculated instantly alongside other stream properties?
Petro-SIM™ has a wealth of stream properties relevant to the Upstream and Downstream industries which are natively available to you. Many industry standard index properties are also included in this list, such as smoke point index, viscosity index, RVP index, and cold flow property indices. However, there are times when you may have different indices, proprietary stream property correlations, or want to derive a new stream property, and wish to model these in Petro-SIM™.
This can be done with a user-defined script property in Petro-SIM™. Script properties can be used in other parts of your simulation just like any other stream property.
In the following section, brief steps show how to create a user-defined script property and implement it in a stream. If you have further questions on how to create and use a script property, please feel free to contact the KBC software helpdesk (firstname.lastname@example.org).
Open the Property Manager and scroll to Script Properties in the list.
- Click the Add new script property button to create a blank script property.
- Notice that an example template provides syntax, layout, and sequencing for you to follow when writing your script property.
Begin writing out the script property using the following steps:
- Define variables
- Test for empty values
- Calculate property
- Report results
The script below is used to sum up the total amount of 2-butenes in a stream.
- The first step is to define variables and call them into the script. Define new variables “cis” and “trans” in the script, as seen below.
- Assign values to these new variables by clicking Stream Values... and choosing values from the list.
- Select cis2-Butene By Wt and trans2-Butene By Wt, ensure that the units dropdown is set to the correct units for the variables to match with the calculations that will be performed, and choose Paste To Script so they are assigned to “cis” and “trans”.
- The next step is to test whether the variables have values. The command “<> PSEmpty” allows you to test whether a variable has a value, as seen below. All variables are tested to ensure the calculation can proceed.
- If they do, then the calculation will be performed. Otherwise, <empty> will be returned for the script property.
- The result and its units are then defined based on the calculation just performed.
- Select a Test Stream with which to validate the new script property. Then click Run and verify the Result and Units in the window. In this case, a mixed C4 stream called “BB” is selected.
- Notice it returns a value of 29.3448 wt%. Upon checking the 2-butene values in the actual “BB” stream, the same value is obtained for the sum of tr2-Butene and cis2-Butene.
- Once the script property result has been validated, it can be attached to a stream by clicking on the Append New Property button available on the Properties page on the stream itself.
- Scroll to the section called Script Properties, and expand this entry to show the new script property, 2 Butenes By Wt. Click on this property, then click Apply and Close. Scrolling to the bottom of the list of Properties in the “BB” stream list, you can see 2 Butenes By Wt [wt%] has been added.
- This property can then be used in other parts of the simulation just like any other stream property, including the LP Utility.
The use of script properties can easily be extended to more complex property correlations and include various logic statements.
Note: The default scripting language used in Petro-SIM™ is VBScript. However, if you prefer a different scripting language, such as Java, you may define this at the beginning of the script.