Вы находитесь на странице: 1из 8

Article 71254

UniSim® Design Stream Reporter Utility


Version 1.3.1, User Guide
James Martin, Honeywell Process Solutions
8th April 2018
1 Introduction
UniSim Design Stream Reporter is an Excel spreadsheet utility that allows material stream conditions,
properties and compositions to be easily reported onto a spreadsheet, it also enables streams in different
cases to be conveniently compared.
UniSim Design Stream Reporter can report properties from the following phases: Overall, Vapour, Light and
Heavy (/Aqueous) Liquid, Combined Liquid and Solid. It also allows stream user variables, property
correlations and user properties to be reported. It is also possible to create formulae in the output table.
The user can save sets of properties or use one of the pre-built property sets. Streams from different
UniSim Design cases can be reported in the same stream table. Once a stream table has been generated it
can be updated by pressing a single button. Stream tables can be moved to another Excel workbook whilst
maintaining the ability to be updated.
UniSim Design Stream Reporter takes the form of an Excel spreadsheet file with embedded Visual Basic for
Applications (VBA) code that demonstrates how UniSim Design can be accessed programmatically. The VBA
source code is freely accessible and users are encouraged to learn from it and adapt it to their own needs.
UniSim Design Stream Reporter 1.3.1 has been fully tested with UniSim Design R460, but should also work
with past and future versions.
(See also section 10 for more information about using UniSim Design Stream Reporter with different
UniSim Design versions).
UniSim Design Stream Reporter 1.3.1 was saved using Microsoft Excel 2013.
1.1 Changes for Version 1.0.1
Fixed bug so that UniSim Design Stream Reporter now correctly deals with more than 6 output sheets. Added
new Dynamic Specs and Is Boundary Stream properties. Renamed from UDSR to USD-SR for more
consistency with other USD tools.
1.2 Changes for Version 1.0.2
Minor change made to CopyExistingSheet() function to allow new sheets to be added after an HSR output
worksheet has been added to the Workbook.
1.3 Changes for Version 1.1
‘UniSim Design’ branding is used throughout. VBA code is now secured with a Verisign Code signing
certificate. There are several OLI Electrolytes property reporting improvements (keeping consistency with
improvements made in UniSim Design Browser 1.3): OLI properties are now reported against the heavy liquid
or solid phases (previously they were selected against the Overall phase); all OLI properties may now be
reported – including all component properties.
Removed check for current UniSim Design version against version for which units are stored each time a
stream table is produced, UniSim Design Stream Reporter now only warns the user to update the units if an
attempt is made to report with an invalid unit. Units may now be updated when required using a new button
on the Options window.
Added the ability to report the value of the stream 'Phase Option' setting and added an extra property 'Phase
Option - Check Consistency' which for streams where this is not the default 'Multiphase' setting, does a PH
check flash to make sure that the stream, when flashed normally, comes to the same phase result.

UniSim® Design Stream Reporter Utility version 1.3.1, User Guide 1


honeywellprocess.com/support
Fixed a problem which meant that the function to 'Copy Output Sheet, maintaining ability to refresh
information' on the Output Worksheet Advanced window didn't work. Fixed by also copying the hidden
Settings sheet which allows the in cell properties/units validations to work properly.
Fixed a problem when reporting molar flow type variables in R400. Because the internal variable type in
UniSim Design has changed from 'Flow' to 'Molar Flow' Stream Reporter needs to account for this.
Fixed a problem when reporting 'Combined Liquid' properties for a stream with only a solid phase present -
previously properties from the solid phase showed in the 'Combined Liquid'.

2 Changes for Version 1.2


Removed 256 column limitation. Updated saved units to R440. Removed digital signature. Saved in
Excel 2007 xlsm format. Added 'Reset Screen Layout' buttons to allow user to reset control sizes if Excel
changes them.

3 Changes for Version 1.2.1


Fixed a small "," decimal separator internationalisation issue when checking for the Excel version to determine
if the 256 column limit still applies.

4 Changes for Version 1.3


Fixed problems which stopped ‘Water Content In Mg/m3 (Gas)’ and ‘True VP at 37.8 C’ properties from
reporting correctly. To report these properties select 'Water Content (Gas)’ or 'True VP'. Updated saved units
to R450. Saved in Excel 2010 xlsm format.

5 Changes for Version 1.3.1


Allow all (Gas) properties to be able to be reported. Fixed missing units for 'Water Content (Gas)' property.
Updated saved units to R460. Saved in Excel 2013 xlsm format.

6 Important Note
This Automation example has been created by Honeywell as an example of what can be achieved through the
object architecture of UniSim Design. This example is provided for academic purposes only and as such is
not subject to the quality and support procedures of officially released Honeywell products.
Users are strongly encouraged to check performance and results carefully and, by downloading and using,
agree to assume all risk related to the use of this example.
We invite any feedback through the normal support channel at UniSim.Support@honeywell.com.

7 Installation
No installation is required, simply copy the Excel spreadsheet to a convenient location and double click it to
open it in Excel.
UniSim Design Stream Reporter uses VBA code to link to UniSim Design and hence requires that Macros are
enabled in Excel. If given the choice, choose to Enable Macros when opening the file.
For more details about enabling Macros see section 10.2.
UniSim Design Stream Reporter is designed to run with VBA error trapping set to Break on Unhandled Errors.
See section 10.3 for details of how to make this setting.

8 Usage – Producing Stream Tables


The UniSim Design Stream Reporter spreadsheet is initially organised into two separate worksheets. The
Setup worksheet is where the streams and properties to be reported are specified. The Comparison sheet is
where settings for the case comparison tool are specified. When output tables are produced they are added
as separate pages in the main workbook, they can then be copied or moved into other spreadsheet files. (See
section 7.1)

3 UniSim® Design Stream Reporter Utility version 1.3.1, User Guide


honeywellprocess.com/support
Using UniSim Design Stream Reporter to produce an output table is a simple four-stage process.
1. Choose streams to report
2. Choose an output location for the table
3. Choose properties to output
4. Write the table
Each step is described in detail below:
1. Choose streams to report
The three list boxes (Cases, Flowsheets, and Streams) allow any stream in a currently open case within
UniSim Design to be selected. To report properties from a stream, select it in the Streams box, then press the
Use Selected button. Streams that will be reported are shown in the rows underneath. The Use All button
adds all the streams in a flowsheet to the list.
If the list boxes are empty then press the Update Lists button to link to the currently open copy of
UniSim Design and update them. Note that changes made in UniSim Design (e.g. adding streams, opening
cases etc…) are not reflected in UniSim Design Stream Reporter until the Update Lists button is pressed. To
troubleshoot any errors that appear at this stage please see section 10.
The Sorting radio buttons change the order in which the streams are displayed in the Streams box, and hence
the order they appear in the final stream table when they are selected. By default when Ascending is
selected, streams are sorted like 1,2,3,4,5,6,7,8,9,10,11,12,a,b,c …. (and vice versa for Descending). The
Stream Sorting option available on the Options window allows this behaviour to be modified for compatibility
with older versions of HYSYS Stream Reporter. (See section 7.2) If the Workbook sorting option is chosen
then the Streams listbox is sorted in the same order as the currently active workbook page for the selected
flowsheet. If the Order Added sorting option is chosen then the Streams listbox is sorted in the order in which
the streams were added to the flowsheet.
If the Visible Streams Only checkbox is checked then the streams listbox shows only the streams currently
visible (i.e. not hidden using the right click … Hide function in UniSim Design). If the flowsheet has multiple
PFDs then the user is prompted to select the PFD from which to show the visible streams.
To remove a stream from the list of streams for output, simply delete the values from the row and move the
streams in the rows beneath up a row. To clear all the streams in the list press the Clear All button.
2. Choose an output location for the table
Select an output worksheet in the Output Worksheet list box.
Stream tables can only be reported onto worksheets specially prepared by the UniSim Design Stream
Reporter utility. To add a new output worksheet: press the Add Sheet button. To delete the selected output
worksheet, press the Delete Sheet button. If output worksheets are manually renamed or deleted, the Output
Worksheet list box will update automatically.
The Advanced … button (see section 7.1) allows output worksheets to be copied to different Excel files whilst
maintaining the ability to refresh the information, and to be converted into normal worksheets.
3. Choose properties to output
Almost all of the stream properties available within UniSim Design can be reported. Properties are added by
making selections from the in-cell drop down lists, this is a three-stage process:
• Choose a phase in the left most column. Phases available are: Overall; Vapour; Light Liquid; Heavy
Liquid (usually aqueous); Combined Liquid and Solid. There are five other options in this drop down:
Correlation, User Variable, User Property, Formula and Label. These are described below.
• Choose a property of the phase in the middle column. Properties available depend on which phase is
chosen.
• Choose a unit in which to display the property value. If Cur. UniSim Design Unit is chosen the unit
currently in use in UniSim Design will be used.
Alternatively the value of a user variable can be reported if User Variable is selected in the Phase column.
Enter the user variable Tag (not Name) in the Property column. Initially user variables can only be reported in

UniSim® Design Stream Reporter Utility version 1.3.1, User Guide 3


honeywellprocess.com/support
the current UniSim Design units, although if desired this can be changed once the output table has been
produced.
By selecting Correlation in the Phase column any property correlation in UniSim Design (including cloned
correlations) can now be reported for the overall stream. Choose Correlation, and then enter the correlation in
the form ‘[Property Correlation Type]\[Property Name]’ into the Property column. For example ‘Standard\Mass
Density’. The ‘Property Correlation Type’ is the value displayed in the Correlation Picker or Correlation
Manager windows as the heading of the branch containing the correlation. (See section 11.17 in the
UniSim Design User Guide pdf manual for more details about property correlations.) As for user variables,
correlations can initially only be reported in the current UniSim Design unit, but the unit can then be changed
once the output table has been produced.
If User Property is selected in the Phase column then type the name of the required user property in the
Property column. As with user variables and correlations, user properties can only be initially reported in the
current UniSim Design unit.
By selecting Formula in the Phase column a custom formula can be written into the output table. Enter the
formula in quotes in the Property column; any other text will be ignored. Use the Excel RC notation when
entering the formula. Here are some examples of possible entries in the Property column when Formula is
selected:
Add previous two rows "=R[-2]C+R[-1]C"
Take the square root of the row above "=sqrt(R[-1]C)"
Excel RC notation works by specifying the offset from the cell where the formula will be written. The offset
goes in the square brackets. A positive offset for rows means a row below the cell and a positive offset for
columns means a column to the right.
If Label is chosen, type the required row label into the Property Column.
To remove a property from the list, simply delete the values from the row and move the properties in the rows
beneath up a row. To clear all the properties press the Clear All button.
Once a set of properties has been selected it can be saved for later use by pressing the Save Current button
and entering a name for the property set. To use a previously saved property set, select it in the list and press
the Use button. A number of predefined property sets are supplied with the utility.
Property sets can be deleted by pressing the Delete button, and the order in which they appear in the list box
can be adjusted by pressing Sort List …
4. Write the table
Once streams, properties and an output location have been selected the output table can be generated by
pressing the Write Table button.
Stream tables can be updated by pressing the Update Stream Table button. If required the properties and
units can be adjusted by choosing from the drop down lists.
8.1 Output Worksheets – Advanced …
Pressing the Advanced … button, next to the Output Worksheet list box, brings up the Output Worksheets ...
Advanced window.
This gives access to three functions:
8.1.1 Copy Output sheet, maintaining ability to refresh information
This allows an Output worksheet to be copied within or between Excel workbooks whilst maintaining the ability
to update the data from UniSim Design by pressing the Update Stream Table button.
To use this function click its radio button, choose the worksheet to be copied, and then the target workbook
and press the Copy button.
In order that the UniSim Design Stream Reporter functionality still works when the output sheet is copied to a
new workbook it is necessary to set a reference to UniSim Design Stream Reporter. In Excel versions prior to
Excel 2002 (/Excel XP/Version 10) this reference is set automatically. However, in newer versions of Excel
the ability to set references in code has been disabled for security reasons. Hence the reference must be set

3 UniSim® Design Stream Reporter Utility version 1.3.1, User Guide


honeywellprocess.com/support
manually (this is a similar process to setting the UniSim Design type library reference as in section 10.1). The
procedure to do this is as follows:
• Go to the VBA editor. (Tools … Macro … Visual Basic Editor menu option, or press Alt + F11)
• In the VBA editor go to the Tools … References menu option. (If the menu options are greyed out, press
the Reset button on the button bar [its icon is a blue square – “Stop” button].)
• Press the Browse button, set the file filter to xls and navigate to the location of the UniSim Design Stream
Reporter xls file. This will add a new item to the list of references (‘vbprojUSDSR’), ensure this is checked
and OK the references window.
Note that when you copy an output worksheet to a new Excel workbook, each time this workbook is loaded,
UniSim Design Stream Reporter will also be loaded automatically to allow the update stream table
functionality to work. To stop this from happening, the output worksheet must be converted to a normal Excel
worksheet…
8.1.2 Convert worksheet to a normal Excel worksheet
By doing this the Output worksheet will lose the ability to choose new properties, change units and update
from UniSim Design.
To use this function click its radio button, choose the worksheet to be converted, and then press the Convert
button. If the worksheet being converted is the only Output sheet in the workbook then for Excel versions
prior to 2002 the reference to UniSim Design Stream Reporter will be removed automatically. For later Excel
versions this must be done manually, a reminder message is displayed. Follow the instructions as above and
uncheck the ‘vbprojUSDSR’ reference.
8.1.3 Copy Output sheet and convert it to a normal sheet
This allows an Output worksheet to be copied within or between Excel workbooks. The copy is a normal
Excel worksheet (i.e. user can no longer choose new properties, change units, and update from UniSim
Design). This function is equivalent to performing the previous two actions one after another. No references
to UniSim Design Stream Reporter need be set.
8.1.4 Using Output Worksheets – Advanced … function to copy Output sheets produced by HSR
This function can be used to copy an output worksheet produced using HSR (HYSYS Stream Reporter). The
only restriction is that these stream tables cannot be automatically recalculated from within UniSim Design
Stream Reporter. Additionally if a reference is made to vbprojHSR (following the steps in 7.1.1 above) HSR
also cannot be used to recalculate these stream tables. Attempting to recalculate the sheet will give a VBA
error in UniSim Design Stream Reporter.
8.2 Options
UniSim Design Stream Reporter options can be seen by pressing the Options button on the Setup worksheet.
There are four sets of options that can be set here:
8.2.1 Units
In order to create the in-cell drop downs (using Excel cell Validation criteria) that allow the required units to be
selected, UniSim Design Stream Reporter needs to store a list of all the available units for each variable type.
On occasion the available units change between UniSim Design versions. The Units section shows the
UniSim Design version from which the stored units in UniSim Design Stream Reporter were obtained. The
button Update to open version allows the units to be updated from the currently open version.
8.2.2 Combined Liquid Phase Options
Here the combined liquid phase behaviour when only a single liquid phase is present in the stream can be set.
The two options are as follows.
If a stream has only one liquid phase present ... Display the properties of this phase for the 'combined' liquid
This is the behaviour shown by UniSim Design when combined liquid phase properties are added to the
workbook. This is the default behaviour.
If a stream has only one liquid phase present ... Don’t show any combined liquid properties

UniSim® Design Stream Reporter Utility version 1.3.1, User Guide 5


honeywellprocess.com/support
8.2.3 Stream Sorting
This controls how streams are sorted in the Streams listbox on the Setup sheet. The two options are as
follows.
Text Only (1,10,11,12,2,3,4,5,6,7,8,9,a.b.c)
Numbers are treated purely alphabetically.
Intelligent (1,2,3,4,5,6,7,8,9,10,11,12,a.b.c)
‘Excel like’ sorting. This is the default behaviour.
These options apply when the Ascending or Descending sorts are selected on the Setup worksheet.
8.2.4 Stream Notes
This controls whether the Stream Note is reported as plain text (default), or raw Rich Text format. Additionally
there is an option to strip off the Modified date/time text which is appended by UniSim Design.

9 Usage – Case Comparison Tool


The case comparison tool is configured from the Comparison worksheet. Using the case comparison tool is a
three-stage process.
1. Match reference and comparison streams
2. Choose an output location for the table
3. Write the comparison table
Each step is described in detail below:
1. Match reference and comparison streams
The first step is to generate two stream tables on different output worksheets for the cases (or groups of
cases) that are to be compared. (For example these may be the same case before and after some
modification has been made.)
Select one of these worksheets to be the Reference sheet and one the Comparison sheet.
Streams on the Comparison sheet are compared to those on the Reference sheet.
Press the Analyse streams on these worksheets button. This will generate a list of all the streams on the
reference sheet and the comparison sheet. UniSim Design Stream Reporter automatically tries to match up
like named streams.
If required the comparison stream that is compared to each reference stream can be changed by choosing
from the in-cell drop down lists.
The reference and comparison sheets must list the same properties otherwise the results produced
will not make sense.
2. Choose an output location for the table
Select an output worksheet in the Comparison Output Worksheet list box.
Similarly to stream tables, comparison tables can only be reported onto worksheets specially prepared by the
UniSim Design Stream Reporter utility. To add a new output worksheet, press the Add Sheet button. To
delete the selected output worksheet: press the Delete Sheet button.
3. Write the comparison table
Finally press the Write Comparison Table button to generate a comparison table. UniSim Design Stream
Reporter generates a table with Excel formulae to link to the reference and comparison sheet values, so when
these are updated the comparison table will be automatically updated.
9.1 Using UniSim Design Stream Reporter to compare UniSim Design results with
HYSYS results
The case comparison tool can be used to compare output produced by UniSim Design Stream Reporter with
an output worksheet produced in HSR and copied in (as per 7.1.4). The steps below describe the process:

3 UniSim® Design Stream Reporter Utility version 1.3.1, User Guide


honeywellprocess.com/support
1. Use UniSim Design Stream Reporter to report the results from a HYSYS case that has been loaded
into UniSim Design and allowed to recalculate.
2. Use HSR to report the results from the same HYSYS case solved using HYSYS. (Ensure the
streams/properties are reported in the same order as in UniSim Design Stream Reporter.)
Streams/Properties can be copied from the Setup tab of UniSim Design Stream Reporter to the Setup
tab in HSR
3. Copy the output sheet from the HSR workbook to the UniSim Design Stream Reporter workbook:
either by dragging and dropping the sheet, or by using the Output sheet, maintaining ability to refresh
information function available by pressing the Advanced … button on the Setup tab as described in
7.1.1 above.
Note that it is important that the HSR Output sheet is not converted to a normal worksheet (as in
7.1.2) as then the case comparison tool will not recognise it. Additionally once the HSR Output sheet
has been copied into UniSim Design Stream Reporter it cannot be updated automatically, even if a
reference is made to vbprojHSR. If the data from HYSYS needs to be updated, update the sheet in
HSR then copy it into the UniSim Design Stream Reporter workbook again.
4. From this point the case comparison tool can be used as though the HSR output sheet was produced
using UniSim Design Stream Reporter. Follow the three steps: Match reference and comparison
streams; Choose an output location for the table; Write the comparison table, as above

10 Authors Note
All the VBA source code is freely accessible [Tools … Macro … Visual Basic Editor] and not password
protected. It is fully documented and can be used as a basis on which to build your own VBA programs that
link to UniSim Design via OLE Automation. If you find any bugs in the code, or think of any improvements
please report them to Support so the utility can be improved for the benefit of all users.

11 Troubleshooting / Using different UniSim Design versions


11.1 “Method or Data Member not found,” “Type Mismatch,” “Compile Error ...
Object Library Feature not supported,” or RPC errors.
The Stream Reporter uses COM/OLE to integrate programmatically with UniSim Design. When multiple
versions of UniSim Design are installed on a computer only one version is COM registered. This is important
because the Stream Reporter can only work fully with the COM registered version. This will typically be the
last version installed when Microsoft Windows User Access Control (UAC) is
enabled. If a UniSim Design version other than the COM registered version is
used the Stream Reporter will perform unpredictably, displaying errors like those
listed above.
Normally users running without administrator privileges cannot change which
UniSim Design version is registered. However UniSim Design R440 onwards
includes a tool which allows any user (even when running without administrator
privileges) to change the COM registered UniSim Design version. This is the
UniSim Apps tool which may be found from the gearwheel icon at the top right
hand side.
For more details please view Knowledge Base Article 80511 (this requires a log
in).
11.2 Nothing seems to work, pressing buttons does nothing [This is accompanied by
a warning message about the macro security level setting]
This occurs either because macros are not enabled. In Excel 2003 either the macro security level in is set to
High, or you chose to disable the macros in the Excel file when you opened it. In Excel 2007 the problem is
similar.
To change the macro security setting in Excel 2003 go to Tools ... Macro ... Security and make the setting
Medium. Whenever an Excel file with macros is opened you will then get the choice whether you want the
macros to be able to run.

UniSim® Design Stream Reporter Utility version 1.3.1, User Guide 7


honeywellprocess.com/support
In Excel 2007 go to the Office button then the Excel Options button and then the Trust Center page. Press
the Trust Center Settings button and then make sure the option Show the Message Bar in all applications
when content has been blocked is set. In this way when the file is opened a prompt appears allowing the
macros to be enabled.
In Excel 2010 onwards go to the File ... Options menu item and then the Trust Center page and then follow
the instructions as above for Excel 2007.
11.3 Setting the VBA Error Trapping setting to Break on Unhandled Errors
UniSim Design Stream Reporter is designed to run with VBA error trapping set to Break on Unhandled Errors.
To make this setting use the following procedure:
• Go to the VBA editor. (In Excel 2003 - Tools … Macro … Visual Basic Editor, In Excel 2007 – Developer
ribbon Visual Basic option or in both versions press Alt + F11)
• In the VBA editor go to the Tools … Options menu option
• On the General tab ensure that Break on Unhandled Errors is selected in the Error Trapping group
11.4 On screen controls are jumbled or the wrong size
The UniSim Design Support Team is aware of a problem where Microsoft Excel can change the size/position
of the controls (buttons and lists) used to configure the Stream Reporter. Press the Reset Screen Layout
button on either the Setup or Comparison tabs to fix this.

3 UniSim® Design Stream Reporter Utility version 1.3.1, User Guide


honeywellprocess.com/support

Вам также может понравиться