Академический Документы
Профессиональный Документы
Культура Документы
This appendix is dedicated to the Component Object Model (COM) feature available in
SuperPro and EnviroPro Designer. The COM feature has been available since version 6.0
and is constantly updated to include additional options of the above software packages. The
main essence of COM is to enable inter-process communication and dynamic object
creation through a variety programming languages. Code has been added in SuperPro &
EnviroPro so that the applications behave as an Object Linking and Embedding (OLE)
Automation Server. For the rest of this document we use Pro-Designer to refer to either the
SuperPro Designer or the EnviroPro Designer applications and similarly we use Pro-
Designer COM Server to refer either to the EnviroPro or SuperPro automation server.
Functionality-Applications
Using the Pro-Designer COM Server you can now explore windows interoperability
combining several other applications (such as Microsoft Excel, Microsoft Word, Microsoft
Visual Basic, and Visual C#) with Pro-Designer. The Pro-Designer COM Server can thus
be used by client applications to perform various tasks including:
Data exchange between the Pro-Designer simulation variables and other applications.
Exporting of Pro-Designer reports, charts, tables and pictures to specified files or to the
clipboard.
Prerequisites
The object exposed by the Pro-Designer server is the The Designer Library. The Designer
Type Library is common to SuperPro and EnviroPro Designer Servers. The methods and
members of the Designer Type Library, are explained in Pro-Designer COM server
Methods and the variables that can be accessed with these methods are listed in Accessing
Pro-Designer Variables with COM. Use of these methods to inter-operate with other
windows applications (such as MS Excel, MS Word, etc.) requires the use of a common
scripting language, for this purpose Visual Basic for Applications (VBA) was chosen to
illustrate this, see VBA Sample Scripts for more information. These methods can also be
used to inter-operate with other windows programming environments (such as Visual C#).
For more information on the latter please, see Visual C# COM Application.
In order to get started using the Pro-Designer OLE Automation Server follow the
instructions in Setting Up The Project.
The Pro-Designer COM Server is not intended as a tool for creating a simulation case, but
rather as a tool for manipulating the variables of existing process files in order to further
analyze and evaluate the process. It can be an indispensable tool for engineering parametric
studies of process design or/and economic analysis. An example of such study is illustrated
in Sensitivity Analysis Example. Furthermore it allows integration of Pro-Designer with
other windows applications such as stochastic risk-analysis tools for performing uncertainty
and risk-assessment studies on ambiguous process files as described in Risk Analysis
Example.
Getting Started
Useful information for getting started to use the COM technology, and setting up your
project using Excel and the Visual Basic Editor (VB Editor) is provided in this section.
Visual Basic for Applications (VBA) is Microsofts common scripting language that
facilitates the interoperability of various applications. Familiarity with VBA is important
for taking full advantage of the Pro-Designer COM Server, however this manual provides
the basic examples one can follow to carry out simple tasks.
For the following procedure we will be using the Excel spreadsheet example ComEx1.xls
along with the ProDesigner simulation case ComEx1.spf. This excel spreadsheet contains
many useful scripts for using the COM functions. It can be also used for a parametric study
as described in the Sensitivity Analysis Example. Before you start using this example you
must perform the following tasks:
2. Choose Enable Macros when opening excel file or visit the Macro Security settings
and enable all macros (MS Excel 2007-2013).
3. Specify the path and name of the Pro-Designer file in designated cells
(C:\Designer\ComEx1.spf).
4. From the Excel main menu choose Tools/Macros/Visual Basic Editor or click on the
Visual Basic Editor button located on the Visual Basic toolbar. MS Excel 2007-2013
users may select the Developer tab and click on the Visual Basic icon button. (note: if
the Developer tab is not showing in the Ribbon, click on the Office Button on the top
left corner of Excel, select Excel Options, and check Display the Developer Tab in the
Ribbon checkbox.) This brings up the Visual Basic Editor interface which looks like
the picture bellow:
5. From the VB Editor main menu select Tools / References, which brings up the
following dialog:
6. Scroll down in the list until you find the SuperPro Designer reference library (This is
the Designer Type Library exposed by the Pro-Designer OLE Server). Check the library
to be included in your references. The location of the library is shown in the lower part
of the window as shown in the following dialog. You may click on browse to find the
library (Designer.tlb) in case the location shown below is not pointing to the exact
path were SuperPro Designer is installed.:
Make that the location of the library corresponds to the latest version of the
software installed. If this is not the case you should close MS Excel or any
other MS Office application, run the latest version of Pro-Designer software
first, and then open MS Excel to select and include the correct Designer Type
Library. When running the latest version of Pro-Designer, WIndows registry
will get updated with the correct location of the library. It is highly
recommended to first uninstall any older versions of Pro-Designer that may
exist on your system.
7. By now the Designer library should be included in your project. You can view the
libraries in the project by displaying the VBA Object Browser (press F2 or click on the
icon on the standard toolbar, or select View / Object Browser from the VBE main
menu).
8. You can now save your Excel wotksheet.Next time you open the file, you do not have
to repeat these steps. Just verify that the Designer library is added to your Excel
references by checking the object browser.
The Designer Library
General Info
The library exposed by Pro-Designer COM server is the Designer Type Library. The file that
captures the definitions for this library is called Designer.tlb and it is located in the
installation folder of your application. As mentioned in the introduction we use the term
Pro-Designer Server or Designer Server to represent either the SuperPro-
Designer server or the EnviroPro-Designer automation server. The Designer Type Library is
common to both servers and it can be utilized to perform several actions including:
Enumerate over several items lists included in process file (unit procedures, equipment,
streams, components, etc.)
The class Application which includes methods (functions and subroutines) that can be
used for communicating between the main Pro-Designer application and other
applications. information on using these methods can be found in Pro-Designer COM
server Methods
The class Document which includes methods (functions and subroutines) that can be
used for communicating information between a Pro-Designer case file and other
applications. Information on using these methods can be found in Pro-Designer COM
server Methods.
The enum varID whose members are predefined constants, used as arguments in the
methods of the Document class in order to access a Pro-Designer variable. Information
on accessing the Pro-Designer variables using these constants can be found in Accessing
Pro-Designer Variables with COM.
Then enum ExportDestination which is used as an argument in the functions used to
export objects as described in Specifying Export Destination. It is part of the argument
list of some Object Export Related Methods.
The enum COMPQUnits which is used for specifying the units in the exported Stream
Summary, Equipment Contents and Procedure Activity Overview tables Specifying
Physical Quantity Units in Tables.
The enums StreamInitMode and SolveAutoInitMode which are used to specify Auto
Initialization options of Streams and Equipment. Please, see Auto Initialization
Variables.
The object browser in Visual Basic Editor (VB Editor) can be used to view the classes of
the Pro-Designer library and their member methods and properties as explained in Viewing
Pro-Designer Methods and Properties.
The object browser in Visual Basic Editor (VB editor) can be used to view the objects of
the Designer Type Library and their member methods (and properties). From the VB Editor
press F2 (or click on the icon from the standard toolbar, or select View/Object
Browser from the VBE main menu) to display the object browser. From the drop down list
box on the upper-left corner select the Designer library. this will display the classes,
methods and enums belonging the Designer Type Library in the left pane (Document,
EexportDestination, ExportFormat, ExportObjectType, IngredientConsumptionType,
VarID and globals). The right pane displays the members of the selected class/enum. For
example if you select the Document object (left-click) its members are displayed in the
right pane as shown in the following figure.
The bottom pane displays details for the selected item, in this case the class Document. You
can see on the right pane the members of Document. If you select one of them, for example
left click on GetFlowsheetVarVal, and information regarding the specific member is displayed in the
bottom pane, as can be seen in the following figure.
In this case we can see that the function GetFlowsheetVarVal returns a Boolean value and that it takes
2 arguments, the first argument (VarID) is of VarID type and the second argument (val) is of
VARIANT type.
The members of the Enums (ExportDestination, ExprortFormat, ExportObjectType, IngredientConsumptionType, and VarID) are
predefined constants used as arguments in the Designer library methods. The members of
VarID are used as variable identifiers in order to access or specify a Pro-Designer variable.
Their value is insignificant, however in order to use the Pro-Designer OLE Automation
Server you need to know the correspondence between the Pro-Designer variables and their
identifiers.
See Pro-Designer COM server Methods for information on the Pro-Designer COM
Server methods that can be utilized.
See Accessing Pro-Designer Variables with COM for information on the Pro-Designer
variables than can be accesses with the COM Methods.
The object browser can be a valuable tool to be used as a quick reference when using the
VB Editor since the method and the argument names are self-explanatory. For additional
information on the action and the arguments of each method you can refer to this manual.
Declaring and Initializing Pro-Designer Server Objects
There are two main Pro-Designer server objects that must be created first to automate
SuperPro or EnviroPro Designer. The first one is the Application object, which is
responsible for the top level tasks of the Pro-Designer application, as well as getting a
reference to the second main object which is the Document object. You always have to first
get a reference to the Application object followed by a reference to a Document object in
order to manipulate the process file.
You may see the objects and their methods provided by Pro-Designer by selecting View /
Object Browser from the Visual Basic Editor main menu.
The following code can demonstrate the steps that are taken to declare and initialize these
two server objects:
Sub StartApp( )
Set superProApp = New Designer.Application
superProApp.ShowApp
End Sub
Sub OpenDoc( )
Set superProDoc = superProApp.OpenDoc(spdFileName)
End Sub
In the above scripts both superProApp and SuperProDoc are declared globally, usually
done at the class or module level of the VBA project, so they can be available to all of the
procedures of the VBA project (sheets, modules, classes, ThisWorkbook). The
initializations of the Application and Document objects are done in the two subroutines
StartApp( ) and OpenApp( ) respectively, which can be defined anywhere in the VBA
project but are usually placed in the ThisWorkbook project object.
For information on the methods of the two objects, see Pro-Designer COM server
Methods.
For more detailed VBA examples that demonstrate the initialization of the two objects
and the use of their methods, see Application Related Scripts.
Export Methods
Enumerators
These methods are used for performing general application tasks such as activating the
designer, application, opening and closing files, etc.
ShowApp( ) This subroutine is used to activate the Pro-Designer application and display
it in its current size position.
CloseApp( ) This subroutine is used to close the Pro-Designer application. If there are
Pro-Designer case files still open it will close all the documents without saving them.
OpenDoc(fileName As String) This function is used to open the Pro-Designer file with
name fileName, makes this file the active Document object, and returns a reference to
the caller.
a) For help on how to initiate the Application and Document objects, in order to access the
above methods, please see Declaring and Initializing Pro-Designer Server Objects.
b) For VBA examples that use these methods see Application Related Scripts.
Document Related Methods
These methods are used for performing generic document tasks on specific Pro-Designer
case files.
SaveDoc() This subroutine is used to save the the active Document object.
a) For help on how to initiate the Application and Document objects, in order to access the
above methods, please see Declaring and Initializing Pro-Designer Server Objects.
b) For VBA examples that use these methods, see Application Related Scripts.
These methods are used for simulation tasks. They are all functions that return a Boolean
value, which is True if the task was successful and False if the task failed. They include:
ScaleUpThroughput(VarID As VarID, val) This function is used for scaling the process
throughput (It is equivalent to selecting Tasks / Adjust Process Throughput from the
Pro-Designer application main menu and selecting the Based on Scale Up / Down
Factor option). Use VarID = scaleUpFactor_VID and the value of the scale up factor for
val (val is a Variant, its type should be double and its value should be greater than
zero).
For VBA examples that implement these methods, see Simulation Related Scripts.
These methods are used for data exchange between a Pro-Designer processs file and
external applications. They can be used to set/change input variables in a processs file, or
simply to get the value of an input/output variable.
Please note that the COM functions used for variable data exchange were designed to
mimic the Pro-Designer application interface dialogs, therefore experience with the
SuprePro interface is important for using the COM functions. For example in many dialogs
you have a choice for setting one variable or another, and the respective variables are
enabled only if you select the corresponding option. The same applies in the COM
functions. If you are setting an operation/equipment/ stream etc. variable through a COM
function, make sure you have selected the option for this variable first. If for example you
can set either the mass flow or the volume flow, before calling the COM function on setting
the volume flow, make sure that the option for setting the volume flow is selected (you can
check/set this with the COM function as well). In many cases when setting a value the
corresponding option is also set/enabled.
All variable data exchange methods are Boolean type functions. All functions return True if
the data access was successful and return False if an error occurred during data transfer. In
order to find out how to retrieve error messages in the latter case look at Error Related
Methods. The typical COM function for accessing an input/output variable has 2
arguments, the first one being of VarID type (the variable identifier that specifies the
variable) and the other one being of Variant type (the actual value of the variable). Some
functions require extra arguments in order to specify the variable being accessed. The
variable data exchange methods are grouped in the following categories:
One difference with the Pro-Designer application interface is that in the Designer library
methods all variables (with some exceptions) are communicated in SI Units. To find more
on the units of the COM Server Variables, see Units of Variables accessed by COM.
These methods are used for data exchange between a Pro-Designer processs file and
external applications. They can be used to set/change input variables in a processs file, or
simply to get the value of an input/output variable.
Please note that the COM functions used for variable data exchange were designed to
mimic the Pro-Designer application interface dialogs, therefore experience with the
SuprePro interface is important for using the COM functions. For example in many dialogs
you have a choice for setting one variable or another, and the respective variables are
enabled only if you select the corresponding option. The same applies in the COM
functions. If you are setting an operation/equipment/ stream etc. variable through a COM
function, make sure you have selected the option for this variable first. If for example you
can set either the mass flow or the volume flow, before calling the COM function on setting
the volume flow, make sure that the option for setting the volume flow is selected (you can
check/set this with the COM function as well). In many cases when setting a value the
corresponding option is also set/enabled.
All variable data exchange methods are Boolean type functions. All functions return True if
the data access was successful and return False if an error occurred during data transfer. In
order to find out how to retrieve error messages in the latter case look at Error Related
Methods. The typical COM function for accessing an input/output variable has 2
arguments, the first one being of VarID type (the variable identifier that specifies the
variable) and the other one being of Variant type (the actual value of the variable). Some
functions require extra arguments in order to specify the variable being accessed. The
variable data exchange methods are grouped in the following categories:
One difference with the Pro-Designer application interface is that in the Designer library
methods all variables (with some exceptions) are communicated in SI Units. To find more
on the units of the COM Server Variables, see Units of Variables accessed by COM.
These methods are used for error reporting. They are all functions that return a Boolean
value.
IsCOMSimDataComplete() This function returns True if the data exchange using the
COM functions was consistent. If the function returns False it means that some data that
you have set using the COM functions is inconsistent and that you cannot proceed with
the simulation. In this case you can use the GetCOMErrorMsg(val) to find out what
went wrong.
For VBA examples that apply these methods, see Error Handling Scripts.
These methods are used for error reporting. They are all functions that return a Boolean
value.
IsCOMSimDataComplete() This function returns True if the data exchange using the
COM functions was consistent. If the function returns False it means that some data that
you have set using the COM functions is inconsistent and that you cannot proceed with
the simulation. In this case you can use the GetCOMErrorMsg(val) to find out what
went wrong.
For VBA examples that apply these methods, see Error Handling Scripts.
Enumerators
The ProDesigner COM server includes methods which can facilitate in retrieving lists of
various items that are part of a ProDesigner processs file file. Such item lists may be:
etc.
Enumerator Description
About
The following tables display variable related information, for accessing (either as input or
output) the Pro-Designer variables using the COM methods of the Designer server. Mainly
the correspondence between the varID Enum and the Pro-Designer variable is given. You
can retrieve the value of all variables using the Get. functions but you can set the value
(using the Set functions) only for those marked as I/O in the table. The tables list the
Variable ID that needs to be used for each variable (val) and their type. Some variables
require extra specification, which is provided through the extra arguments (val2, val3, val4)
when that is necessary.
The variables used in the Pro-Designer Server are grouped in the following categories:
Flowsheet Variables
Section Variables
Equipment Variables
Procedure Variables
Operation Variables
Stream Variables
Ingredient Variables
All val, val2, val3 arguments of the COM functions are defined as Variants in
the Pro-Designer Server and they must be defined as susch in VBA scripts.
This means they can take different data types (Long, Boolean, Double, String,
etc.). Each Pro-Designer server variable corresponds to a specific type and the
data type for each variable ID is given for each variable category listed below.
Please, see How to Use Variant Data Types in VBA Scripts for useful tips on
how to treat these arguments in your VBA Scripts.
All variables of the Designer type library are communicated in SI Units. To find more on
the units of the COM Variables, see Units of Variables accessed by COM.
The data exchange in the Pro-Designer COM functions is done in SI units. The following
table lists the most common units used in these functions:
Variable Units
Mass kg
Time s
Volume m3
Mass Flow kg / s
Volumetric Flow m3 / s
Temperature Kelvin
Pressure Pa
Power W
Specific Power W / kg or W / m3 or W /
m2 (depending on the
operation)
Mass Flux kg / m2 s
Volume Flux m3 / m2 s
Mass Concentration kg / m3
Currency $
Fraction / Percentage [0, 1]
Heat Capacity J/kg-K
basis as shown in the following table. Furthermore some quantity specific variables are
reported on per entity basis if the main product is discrete.
Category Type
Scheduling Recipe Batch batchTime_VID O Double
Time
Recipe Cycle cycleTime_VID O Double
Time
Minimum Recipe minCycleTime_VID O Double
Cycle Time
Maximum maxNumberOfBatchesPerYear_VID O Long
Number Of
Batches Per Year
Number of numberOfBatchesPerYear_VID I/O Long
Batches per Year
Annual annualThroughput_VID I/O Double
Throughput
Batch batchThroughput_VID I/O Double
Throughput
Ref. Flow Stream refFlowStream_VID I/O String
Name
Ref. Flow refFlowComponent_VID I/O String
Component
Name
Throughput Ref. throughputRefFlowDscr_VID O String
Flow Description
Available Annual AOTAvailable_VID I/O Double
Operating Time
Annual Operating AOTUtilized_VID I/O Double
Time
Number of numberOfCampaigns_VID I/O Long
Campaigns
Is the Number of is NumberOfBatchesSBU_VID I/O Boolean
Batches Set By
User
Is Cycle TIme isCycleTimeSBU_VID I/O Boolean
Set-by-User
Longest longestUPName_VID O String
Procedure
Bottleneck bottleneckEquipName_VID O String
Equipment
Is Batch Mode isBatchMode_VID O Boolean
Cost Equipment purchaseCost_VID O Double
Purchase Cost
Unlisted unlistedEquipPurchaseCost_VID O Double
Equipment
Purchase Cost
Direct Fixed Cost DFC_VID O Double
Raw Material materialsCost_VID O Double
Cost
Total Installation installationCost_VID O Double
Cost
Working Capital workingCapital_VID O Double
Startup Capital startupCapital_VID O Double
Up-front R&D upFrontRD_VID O Double
Expenses
Up-front upFrontRoyalties_VID O Double
Royalties
Equipment Cost equipmentCost_VID O Double
Labor Cost laborCost_VID O Double
Consumables consumablesCost_VID O Double
Cost
Laboratory labQcQaCost_VID O Double
Quality Control
and Assurance
Cost
Waste Treatment wasteTrtDspCost_VID O Double
/ Disposal Cost
Utilities Cost utilitiesCost_VID O Double
Transportation transportationCost_VID O Double
Cost
Miscellaneous miscellaneousCost_VID O Double
Cost
Annual Operating annualOperCost_VID O Double
Cost
Annual Operating annualOperCostNDP_VID O Double
Cost (without
depreciation)
Other Annual otherAnnualCost_VID O Double
Operating Cost
Extended Annual extendedAnnualOperCost_VID O Double
Operating Cost
Depreciation Cost depreciationCost_VID O Double
Annual Variable annualVariableOperCost_VID O Double
Operating Cost
Annual Fixed annualFixedOperCost_VID O Double
Operating Cost
Annual annualElectricityCost_VID O Double
Electricity Cost
Product Units unitProductionCost_VID O Double
Cost
Product Units unitProductionCostNDP_VID O Double
Cost (without
depreciation)
Product Units unitProductionCostDscr_VID O String
Cost Units
(Description)
Is the whole isMainRevenueWholeStream_VID O Boolean
stream the main
revenue
Net annual netAnnualOperCost_VID O Double
operating Cost
Economic Revenue revenue_VID O Double
Indices
Net Cash Flow netCashFlow_VID O Double
Gross Margin grossMargin_VID O Double
ROI ROI_VID O Double
IRR Before IRR_BeforeTaxes_VID O Double
Taxes
IRR After Taxes IRR_AfterTaxes_VID O Double
Main Rvenue mainRevenueCost_VID O Double
Cost
Gross Profit grossProfit_VID O Double
Net Profit netProfit_VID O Double
Payback Time paybackTime_VID O Double
Total Investment totalInvestment_VID O Double
Total Investment projectTotalInvestment_VID O Double
charged to this
project
Annual Amount annualElectricityAmount_VID O Double
of Electricity
Low Interest Rate NPVInterestLow_VID O Double
for NPV
Medium Interest NPVInterestMedium_VID O Double
Rate for NPV
High Interest NPVInterestHigh_VID O Double
Rate for NPV
NPV at Low NPVLow_VID O Double
Interest Rate
NPV at Medium NPVMedium_VID O Double
Interest Rate
NPV at High NPVHigh_VID O Double
Interest Rate
Year of Analysis yearOfAnalysis_VIDq I/O Long
Year yearConstructionStarts_VIDq I/O Long
Construction
Starts
Construction constructionPeriod_VID I/O Long
Period
Startup Period startupPeriod_VID I/O Long
Project Lifetime projectLifetime_VID I/O Long
Inflation Rate (0- inflation_VID I/O Double
1)
Depreciation deprecMethod_VID I/O Long
Method
Depreciation deprecPeriod_VID I/O Long
Period
Salvage Fraction salvageF_VID I/O Double
(0-1)
Is Depreciation isDeprecSubFromNetProfit_VID I/O Boolean
Subtracted from
Net Profit
Product Failure prodFailureRate_VID I/O Double
Rate
Failed Product failedProdDisposalCost_VID I/O Double
Disposal Cost
Income Tax Rate incomeTaxRate_VID I/O Double
Sales & adSalesExpFixed_VID I/O Double
Advertising Cost
(Fixed
Component)
Sales & adSalesExpVariable_VID I/O Double
Advertising Cost
(Variable
Component)
General Number of numberOfComps_VID O Long
Components
Registered
Year of Analysis yearOFAnalysis_VID I/O Long
Draftsmans draftsman_VID I/O String
Name
Designers Name designer_VID I/O String
Supervisors superviso_VID I/O String
Name
Companys Name companyName_VID I/O String
Plants Name plantName_VID I/O String
Revision revision_VID I/O String
Approval Date approvalDate_VID I/O Date
Comments comments_VID I/O String
File name fileName_VID O String
including path
Initialize auto bInitIStreamsUponOpen_VID I/O Boolean
intialized streams
upon opening
type
Total amount of totalComponentInput_VID Double Component O
component input to Name
the process (String)
Total amount of totalComponentOutput_VID Double Component O
component output Name
of the process (String)
Labor Cost Rate laborCostRate_VID Double Labor Name I/O
(String)
Adjusted Basic adjBasicCostRate_VID Double Labor Name O
Labor Cost Rate (String)
Annual Amount of annualAgentAmount_VID Double Agent O
Heat Transfer Name
Agent use (String)
Annual Cost of hxAgentCost_VID Double Agent
Heat Transfer Name O
Agent use (String)
Annual Amount of annualElectricityAmount_VID Double Power O
Electricity Name
(String)
Annual Electricity annualElectricityCost_VID double Power O
Cost Name
(String)
Annual Amount of laborAmount_VID Double Labor Type O
Labor hours used Name
(String)
Annual Cost of laborCost_VID Double Labor Type O
Labor use Name
(String)
type type
Consumable description_VID String Consumable Consumable I/O
Unit Cost
Name Type
(String) (String)
Consumable consumableBasis_VID Double Consumable Consumable O
Basis Type
Name (String)
(String)
Electricity secOCElecUnitCost_VID Double Section Branch O
Unit Cost Name Name
(String ) (String)
Note: Electricity Unit Cost can only be retreived, if there is only one type of Power utilized
in the section (default power), otherwise, if there are different types you must use
GetPowerVarVal function indicating the power type, see Functions for Power Variables.
1 = Using PC-to-
DFC Factor
2 = Detailed
Estimation
PC-to-DFC secCCPCtoDFCFactor_VID I/O Double
Factor
Piping Factor secCCPipingF_VID I/O Double
Instrumentation secCCInstrumentationF_VID I/O Double
Factor
Insulation Factor secCCInsulationF_VID I/O Double
Electrical secCCElecFacilitiesF_VID I/O Double
Facilities Factor
Buildings Factor secCCBuildingsF_VID I/O Double
Yard secCCYardImprovementF_VID I/O Double
Improvement
Engineering secCCEngineeringF_VID I/O Double
Factor
Auxiliary secCCAuxFacilitiesF_VID I/O Double
Facilities Factor
Yard secCCYardImprovementF_VID I/O Double
Improvement
Factor
Construction secCCConstructionF_VID I/O Double
Factor
Contractors Fee secCCContractorFeeF_VID I/O Double
Factor
Contigency secCCContigencyF_VID I/O Double
Factor
Unlisted secCCUnlistedEquipF_VID I/O Double
Equipment Factor
Unlisted secCCUnlistedEquipInstallF_VID I/O Double
Equipment
Installation
Factor
Capital Is Working secCCWkngCapSetByUSer_VID I/O Boolean
Capital
Cost/Misc
Set By User
Working Capital secCCWkngCap_VID I/O Double
Days of Labor secCCWkngCapLanorDays_VID I/O Double
Incl. Cost In
Working Capital
Days of Raw secCCWkngCapRawMatDays_VID I/O Double
Materials
CostIncl. In
Working Capital
Days of Utilities secCCWkngCapUtilities_VID I/O Double
Cost Incl. In
Working Capital
Days of Waste secCCWkngCapWasteTrmtDays_VID I/O Double
Treatment incl. In
Working Capital
Working Capital secCCWkngCapMisc_VID I/O Double
for Miscellaneous
Activities
Is Startup Cost secCCStartupCostSetByUser_VID IO Boolean
Set By User
Startup Cost secCCStratupCostF_VID I/O Double
Factor
Up Front R&D secCCUpFrontRD_VID I/O Double
Factor
Up Front secCCUpFrontRoyalties_VID I/O Double
Royalties Factor
User Comments comments_VID I/O String
Oper. Cost Inc. Component secOCInclOpParamsBased_VID I/O Boolean
Based on
/ Facility Operating
Parameters
Incl. Component secOCInclCapInvstmBased_VID I/O Boolean
Based on Capital
investment
Incl. Component secOCInclEquipUseBased_VID I/O Boolean
Based on Equip.
Usage/Avail.
Inc. Component secOCInclFacilityUseBased_VID I/O Boolean
Based on Facility
Usage/Avail.
Is Equipment secOCEquipHrsBasedOnUsage_VID I/O Boolean
Charge (Hours)
Based on Use?
Facility Charge secOCFacilityUseRate_VID I/O Double
Rate
Is Maintenance secOCInclMaintnc_VID I/O Boolean
Component
Included?
Is Depreciation secOCInclDeprec_VID I/O Boolean
Component
Included?
Is Miscellaneous secOCInclMiscCosts_VID I/O Boolean
Cost Component
Included?
Is Miscellaneous secOCMaintcBasedOnDFC_VID I/O Boolean
Cost Calculated
from DFC?
DFc to secOCDFCtoMaintcF_VID I/O Double
Maintenance
Factor
Insurance Factor secOCInsuranceF_VID I/O Double
Local Taxes secOCLocalTaxF_VID I/O Double
Factor
Factory Expenses secOCFactoryExpF_VID I/O Double
Factor
Oper. Cost Electricity Unit secOCElecUnitCost_VID O Double
Cost
/ Util.
Extra Electricity secOCExtraElec_VID I/O Double
(as % total)
Electrical Poqer secOCUnlistedEquipLoadF_VID I/O Boolean
for Unlisted
Equip. (as %
Total)
Oper. Is Misc. Oper. secOCIsOCMiscPerYear_VID I/O Boolean
Cost Items Set on
Cost/Misc. a Per Year Basis?
R&D Cost secOCResAndDevFixed_VID I/O Double
(Fixed)
R&D Cost secOCResAndDevVariable_VID I/O Double
(Variable)
Process secOCProcessValidation_VID I/O Double
Validation
Other Cost secOCMiscOtherFixed_VID I/O Double
(Fixed)
Other Cost secOCMiscOtherVariable_VID I/O Double
(Variable)
General Number of numberOfComps_VID O Long
Components
Registered
Gross Mass Yield grossMassYield_VID O Double
Refined Mass refinedMassYield_VID O Double
Yield
Molar Yield molarYield_VID O Double
type
Annual Material materialAmount_VID Double Material O
Amount Name
(String)
Annual Heat annualAgentAmount_VID Double Agent O
Transfer Agent Name
Amount (String)
Annual Labor laborAmount_VID Double Labor O
Amount Type
Name
(String)
Annual Electricity annualElectricityAmount_VID Double Power O
Amount Type
Name
(String)
Equipment Variables
Type
Number of Units noUnits_VID I/O Long
Number of Procedures noHostedProcedures_VID O Long
hosted by this
equipment
Is Equipment In isDesignMode_VID I/O Boolean
Design Mode?
Number of Staggered noStaggeredEquip_VID I/O Long
Equipment Sets. Will
enable staggering
mode if number of
staggered sets >=1 or
disable it if set to zero.
Purchase Cost equipPC_VID I/O Double
Purchase Cost equipPCEstimationOption_VID I/O Long
Estimation Option
0 = Default Model
1= User Defined
Model
2 = Set by User
Number of Standby equipStandByNoUnits_VID I/O Long
Units
PC Portion Already equipPCDeprePortion_VID I/O Double
Depreciated
Construction Material equipConstrMaterial_VID I/O String
Construction Material equipConstrMaterialF_VID I/O Double
Factor
Installation Factor equipInstallCostF_VID I/O Double
Maintenance Factor equipMaintcCostF_VID I/O Double
Usage Rate equipUsageRate_VID I/O Double
Availability Rate equipAvailabilityRate_VID I/O Double
Busy Time (total time busyTime_VID O Double
equipment is engaged,
possibly by multiple
procedures, not
including in-between
dead-time)
Occupancy Time occupancyTime_VID O Double
(total time equipment
is occupied, including
in-between dead-time)
Equipment Name equipmentName_VID O String
Description description_VID I/O String
User Comments comments_VID I/O String
Equipment Size size_VID O Double
Equipment Size Units sizeUnits_VID O String
Sizing Description sizeName_VID O String
Equipment Type typeName_VID O String
Equipment Type ID typeID_VID O Long
/ GetEquipVarValEx
type type
Consumable consumableReplFreq_VID Double Consumable Consumable I/O
Basis
Size sizeUtilization_VID Double Procedure - O
Utilization Name
(String)
Time timeUtilization_VID Double Procedure - O
Utilization Name
(String)
3. Equipment Specific Variables for variables used in certain equipment (i.e. volume in
vessels)
Type
Contents Temperature temperature_VID I/O Double
Contents Pressure pressure_VID I/O Double
Activity activity_VID O Double
Mass Flow massFlow_VID I/O Double
Volumetric Flow volFlow_VID I/O Double
Ingredient Mass Flow componentMassFlow_VID I/O Double
Ingredient Mole Flow componentMoleFlow_VID I/O Double
Ingredient Mass compMassConc_VID O Double
Concentration
Ingredient Mole compMoleConc_VID O Double
Concentration
Ingredient Mass Fraction compMassFrac_VID I/O Double
Ingredient Mole Fraction compMoleFrac_VID O Double
Ingredient Vapor Fraction compVaporFrac_VID O Double
Ingredient Extra Cell compExtraCellFrac_VID I/O Double
Fraction
Ingredient Molecular mw_VID O Double
Weight
Edit the ingredient bEditIngredientFracs_VID I/O Boolean
fractions as opposed to
the flows
Edit the contents mass as bVolFlowSetByUser_VID I/O Boolean
opposed to the volume
Type
TOC_VID O Double
COD_VID O Double
ThOD_VID O Double
BODu_VID O Double
BOD5_VID O Double
TKN_VID O Double
NH3_VID O Double
NO3_VID O Double
TP_VID O Double
TS_VID O Double
TSS_VID O Double
VSS_VID O Double
DVSS_VID O Double
TDS_VID O Double
VDS_VID O Double
DVDS_VID O Double
CaCO3_VID O Double
Procedure Variables
Type
Number of Operations in numberOfOperations_VID O Long
the Procedure
Number of Cycles in the numberOfCycles_VID I/O Long
Procedure
Start Time startTime_VID O Double
End Time endTime_VID O Double
Cycle Time cycleTime_VID O Double
Holdup Time holdupTime_VID I/O Double
Total Time per Batch (all totalTimePerBatch_VID O Double
cycles)
Is Batch Mode? isBatchMode_VID O Boolean
Equipment Name equipmentName_VID O String
Size Utilization sizeUitlization_VID O Double
Time Utilization timeUtilization_VID O Double
Comments comments_VID I/O String
type
Annual Material materialAmount_VID Double Material O
Amount Name
(String)
Annaul Heat annualAgentAmount_VID Double Agent O
Transfer Agent Name
Amount (String)
Annual Labor laborAmount_VID Double Labor O
Amount Type
Name
(String)
Annual Electricity annualElectricityAmount_VID Double Power O
Amount Type
Name
(String)
Type
Operation Start Time startTime_VID O Double
Operation End Time endTime_VID O Double
Operation Set Up setUpTime_VID I/O Double
Time
Operation Process processTime_VID I/O Double
Time
Operation Holdup holdupTime_VID I/O Double
Time
Operation Turnaround turnaroundTime_VID I/O Double
Time
Process Time Calculation processTimeCalcMode_VID O Long
Mode
Thermal Mode thermalMode_VID I/O Long
Exit Temperature exitTemperature_VID I/O Double
Heating Duty heatingDuty_VID I/O Double
Cooling Duty coolingDuty_VID I/O Double
Primary Heat Transfer primaryHxAgentName_VID O String
Agent Name
Primary Heat Transfer primaryHxAgentRate_VID O Double
Agent Rate
Primary Heat Transfer primaryHxAgentRate_VID O Double
Agent Duty
Is Primary Heat isPrimaryHxAgentHeating_VID O Boolean
Transfer Agent
Heating or Cooling?
Power Calculation Mode powerCalcMode_VID O Long
Power power_VID I/O Double
Specific Power specPower_VID I/O Double
Power per Unit powerPerUnit_VID I/O Double
Power Dissipation to powerDissipationFrac_VID I/O Double
Heat
Operation Type opType_VID O String
Operation Description opDescr_VID I/O String
Is Operation isOpDescrSetByUser_VID I/O Boolean
Description
Set By User
User Comments comments_VID I/O String
Note: When setting the operation process time the process time calculation mode is forced
to Set by the User.
type
Labor Need laborNeed_VID Labor Name I/O Double
(String)
Labor Units laborUnits_VID Labor Name O String
(String)
Thermal Mode
Thermal Calculation Mode Values that can be set or retrieved with thermalMode_VID:
Stream Variables
Ingredient Variables
Stock Mixtures:
Note that for the value of the units variable a new Enum is now exported: the
COMPQUnits Enum. For more information look at Specifying Physical Quantity Units in
Tables.
When using the AutoInitMode_VID the functions can only take as a VARIANT val
aurgument the following options:
(Equipment only)
and when using solveAutoInitMode_VID they can only take the following options:
This Enum is used for specifying the type of conatiner that holds (or owns) the list of items
that we are enumerating. It is used by the enumeration functions StartEnumeration() and
GetNextItemName().
This Enum is used for specifying the type of items that we wish to start or contunue
enumerating over. It is used by the Enumerators StartEnumeration() and
GetNextItemName().
Exporting of objects such as charts, pictures and reports require certain options to be
specified. These are the Export Destination, Export Format, Export Object Type and Export
Ingredient Type.
Examples are given for VBA functions/subroutines that can either be called directly from
an Excel cell (or another Windows application) or they can be used in another VBA
function / subroutine. These scripts make use of the Pro-Designer COM
functions/subroutines that are members of the Designer Type Library. These VBA script
examples include:
A Variant data type variable is the data type for all variables that are not explicitly declared.
You can use the Variant data type in place of any data type to work with data in a more
flexible way. More information can be found in the VBA Documentation of Excel.
In VBA the Variant data type is automatically specified if you don't specify a data type for
a variable. However it is advised to declare it as such for more efficient memory use. You
can use the Dim, Public, or Private statement for this as shown:
When variable var1 is set to a value VBA automatically converts the data type to the proper
type, i.e. String, Double, Long, Boolean, etc. However in many cases errors in the way the
data was entered leads to misinterpretation of the data-type, which may result in delirious
results. Therefore it is highly recommended that when you assign values to Pro-Designer
variables you use the correct type.
If you are assigning a value of a variant variable from a VBA script the make sure you get
it from a type variable or you cast it to the right type. This is demonstrated in the following
script, which is a subroutine that can be used for demonstration purposes.
Sub Demonstrate()
nVal = CLng(74)
bVal = True
dblVal = CDbl(5467.77)
var1 = dblVal
var1 = nVal
var1 = dateVal
MsgBox (dblVal)
MsgBox (nVal)
MsgBox (bVal)
SuperProDoc.GetFlowsheetVarVal VarID.longestUPName_VID, var1
MsgBox (str)
MsgBox (dateVal)
End Sub
In the script above the following VBA functions were used for casting an expression to a
specific data type and returning a value of that data type:
If you are setting the value of a variable through an Excel cell you can generally expect that
any string you enter will be taken as a String, any False/True as a Boolean, and any number
as a Double unless otherwise specified. But you can still cast the variant types variables as
shown in the above script . When you pass arguments using VBA functions you can specify
the type of the argument in the function statement. If you dont specify the type of the
argument in the function statement then its type is a Variant. (Look at the second example
of Scripts For Procedure Variables)
Application Related Scripts
superProApp.ShowApp
superProApp.OpenDoc (spfFile)
End Sub
or
superProApp.ShowApp
superProApp.OpenDoc (spfFile)
End Sub
or
Sub OpenSPDFile(spfFile As String)
superProApp.ShowApp
superProApp.OpenDoc (spfFile)
End Sub
In this VBA example the VBA subroutine OpenSPDFile() is used for opening an existing
Pro-Designer processs file file. The VBA function CreateObject("SPDFlowsheet") is used
for creating and returning a reference to the Application server object. In this case
SPDFlowsheet is the application type class string of the SuperPro Designer Server (use
EPDFlowsheet for the EnviroPro Designer Server), and superProApp is the server object
that represents an instance of the Pro-Designer application. The ShowApp() Pro-Designer
COM subroutine is used to activate the Pro-Designer application and display it in its
current size and position. The OpenDoc (spfFile) COM function is used for opening the
Pro-Designer file and making it the active object. This function will also return a reference
to a Document server object. The file name spfFile is a string and specifies the full path and
name of the object to be retrieved. Alternatively one could create a new instance of Pro-
Designer application and assign it to the superProApp server object (Set superProApp =
New Designer.Application) or you may use the New keyword to declare and create an
instance of the object (Dim superProApp As New Designer.Document) at the same time.
superProApp.ShowApp
Set superProDoc = superProApp.OpenDoc (spfFile)
End Sub
or
superProApp.ShowApp
End Sub
Similar to Example1 you could create a new instance of Pro-Designer and assign it to the
superProApp server object (Set superProApp = New Designer.Document) or you may use
the New keyword to declare and create an instance of the object (Dim superProApp As
New Designer.Application), and also initialize the document object superProDoc by
assigning it the reference of the document object from the OpenDoc COM function (Set
superProDoc = superProApp.OpenDoc (spfFile). Note that the superProDoc and
superProApp have been declared as global variables in all the above scripts except the last
one where the application object variable superProApp is local. By using the keyword
Public the objects can be used in all the procedures and modules of the VBA project.
The file name spfFile specifies the full path and name of the object to be retrieved.
In the following VBA example the VBA function GetObject() is used to return a reference
to an object provided by an ActiveX component in this case the Pro-Designer case files.
End Function
Example 3: Closing the Pro-Designer file
superProDoc.CloseDoc false
End Sub
In this VBA example the GetObject function is used to get a reference to the desired Pro-
Designer case file, and the CloseDoc function to close this file without saving it. The file
name spfFileOne specifies the full path and name of the object to be retrieved.
superProDoc.CloseDoc true
superProApp.CloseApp
End Sub
Here the Pro-Designer file is saved first and then closed by using the COM document
subroutine CloseDoc and passing true as an argument. To close the Pro-Designer app, the
application subroutine CloseApp is called with the application object superProApp. Both
superProApp and superProDoc have been previously declared and defined as global
variables and initialized elsewhere. See Examples 1 & 2.
superProApp.CloseAllDocs false
superProApp.CloseApp
End Sub
This script demonstrates how you may close all the open Pro-Designer files without saving
them with the use of the application function CloseAllDocs. It also calls CloseApp to close
the application. Note that both CloseAllDocs and CloseApp functions are called with the
application object superProApp.
var1 = throughput
superProDoc.DoMEBalances var1
superProDoc.DoEconomicCalculations
SetAndGetThroughput = CDbl(var1)
End Function
The above script is an example of a function that performs several tasks. The
SetAndGetThroughput function takes as an argument the desired value of the throughput. It
can be called from an Excel cell or another VBA function. First the
SetFlowsheetVarVal COM function is used to set the value of the throughput. Then the
DoMEBalances and DoEconomicCalculations COM subroutines are called to solve the
simulation case and perform economic calculations. Finally in order to check that the
throughput was correctly set GetFlowsheetVarVal COM function is used to retrieve the
value of the throughput from the Designer file and its value is returned with the
SetAndGetThroughput function. Note that in the function statement of
SetAndGetThroughput it is specified that the throughput is a Double data type and
therefore you do not need to cast var1 to a Double.
For information on how to properly use the variant data type to access the Pro-Designer
COM variables look at How to Use Variant Data Types in VBA Scripts.
SuperProDoc.GetCOMErrorMsg var1
errorMsg = var1
Worksheets("Sheet1").Range("B80") = errorMsg
End Sub
The above script is an example of a subroutine used to retrieve the latest error message that
was generated during an unsuccessful (previous) use of another Pro-Designer
GetCOMErrorMsg COM method. In this case the string with the error message is then
displayed in worksheet "Sheet1" and cell B83. If for example you try to set / get a
flowsheet variable and the function returns False you can use this VBA subroutine to find
out why the data exchange failed.
Example 2: Retrieving the COM error Message after failing to retrieve a flowsheet
variable.
Sub GetFlowsheetVar()
If bReturn Then
Worksheets("Sheet1").Range("B81") = CDbl(var1)
Else
SuperProDoc.GetCOMErrorMsg var1
Worksheets("Sheet1").Range("B82") = CStr(var1)
End If
End Sub
The above script is an example of a subroutine used to retrieve a Flowsheet variable with an
incorrect VarID. This results in the bReturn which is a Boolean data type to be false and in
this case the script calls the GetCOMErrorMsg to retrieve the error message and display it
in Worksheet "Sheet1" and cell B82. Note that var1 could be a double data type if the
VarID was correct, but in this case it is a String and cast accordingly.
Sub IsCOMSimDataComplete()
SimDataOK = SuperProDoc.IsCOMSimDataComplete
Range("B77") = SimDataOK
The above script is an example of a subroutine used to check whether the data exchange
using the COM functions was consistent. The Pro-Designer COM method
IsCOMSimDataComplete is used. Most Data Exchange methods (Variable Data Exchange
Methods) check and therefore forbid these inconsistencies but there are some cases that all
data exchange has to be completed before checking. For example you can independently set
the mass fractions of components in a stream. When the IsCOMSimDataComplete is called
it will verify that the sum of all mass fractions in the streams is equal to 1.0.
Report Creation Related Scripts
Examples of general-purpose application related scripts that use the Pro-Design report
creation related COM methods:
Example 1:
Sub CreateReports()
SpecifyReportOptions
CreateIDReport
CreateStreamReport
CreateCashFlowReport
End Sub
Sub SpecifyReportOptions()
superProDoc.SetReportFormat rtF_EF
End Sub
Sub CreateIDReport()
superProDoc.GenerateReport inputDataReport_VID
End Sub
Sub CreateStreamReport()
superProDoc.GenerateReport streamReport_VID
End Sub
Sub CreateCashFlowReport()
superProDoc.GenerateReport cashFlowReport_VID
End Sub
In this VBA example the VBA Subroutine CreateReports() is used for calling 4 other
subroutines to specify the reports options and then create certain reports, the Input Data,
Stream and Cash Flow reports (with default file name & location) .
Example 2:
Sub CreateReportToFile()
superProDoc.SetReportFormat htm_EF
End
In this VBA example the VBA Subroutine CreateReportToFile() is used for creating the
economic evaluation report, and saving it to the specified file name and location.
Examples of general-purpose application related scripts that use the Pro-Design report
creation related COM methods:
Example 1:
Sub SetProcedureTableOptions()
rangeName = CStr("RangeProc")
procName = "P-20"
varBool = CBool(True)
spfFileOne = Worksheets("Charts Examples").range("B10")
superProDoc.SetXLSLinkDataForProcedureOperSeqTable procName,
bEraseExtraCellArea_VID, varBool
superProDoc.SetXLSLinkDataForProcedureOperSeqTable procName,
bExpandExtraCellArea_VID, varBool
superProDoc.SetXLSLinkDataForProcedureOperSeqTable procName,
bIncludeColumnHeaders_VID, varBool
superProDoc.SetXLSLinkDataForProcedureOperSeqTable procName,
bIncludeRowHeaders_VID, varBool
End Sub
In this VBA example the VBA Subroutine SetProcedureTableOptions() is used for setting
the data link variables for the Activity Overview table of a procedure with the name P-20.
Some examples of VBA scripts used for exporting objects such as Charts, Pictures, etc.
Sub ExportIngrConsumptionClipboard()
Set SuperProDoc = DocumentObject("filename")
ingrName = CStr("Water")
noBatches = CLng(3)
consumptionType = cleaningAgent_ICT
End Sub
The above script will export the consumption tracking chart of the ingredient "water" to the
clipboard (no filename has been given, note the empty string of the third argument). The
number of batches have been set to 3 and the consumption type is as a cleaning agent.
Also we do not want to take in account the consumption of water in entities (False), but we
do want to include the consumption of water in mixtures (True).
About
To find more about the structure of the sample workbook and the available examples
please, see The Excel Workbook for the Sensitivity Analysis Example.
To find more about the specific process file and the sensitivity analysis example
please, see The Process File for the Sensitivity Analysis.
The process file chosen for the sensitivity analysis is variation scenario of the Synthetic
Pharmaceutical process file, inspired from the Synthetic Pharmaceutical example(SPhr6_0f
as described in the tutorial). This is a typical example of a pharmaceutical industrial
process. A synthetic pharmaceutical intermediate is formed by condensation of quinaldine
and hydroquinone. The process plant shown in the next figure was designed to include
three stirred tank reactors, two nutsche filters and a tray dryer. The process is described in
more detail in the tutorial.
Sensitivity Analysis Motive:
The plant was originally designed for an annual throughput of 34,000 kg /year, which was
the original objective. The operation of the plant was optimized by rearranging and reusing
several equipment as shown in the above flowsheet. However during the design phase a
market study performed by the management concluded that the pharmaceuticals industry
market could easily absorb up to 100,000 Kg/ year of this product. Given that it was
possible for the company to invest up to a maximum of $50,000,000 for this activity they
questioned the design engineers about the feasibility of a higher capacity plant, as well as
its profitability. Since no equipment were yet bought, the engineers decided that with out
changing their recipe (except for times required for certain operations) they would perform
a parametric study to access the impact of the annual throughput change on the economics
indices that are used to measure the profitability of the project as described in Impact of
Throughput Variation.
If you select Tools / Macro / Visual Basic Editor from the Excel main menu (or the
Developer Tab and click on Visual Basic icon button in Excel 2007), the Visual Basic
Editor Interface comes up as described in Setting Up The Project and you can navigate this
interface to browse through the VBA scripts or change / add to the scripts used in this
example. Initially you may get a blank view with the project contents displayed on the left
pane. Double click on This Workbook, or expand the Modules folder and double click on
any of the modules to view the code in the right pane, as shown in the next picture.
For more on VBA scripts please, see VBA Sample Scripts.
As the process was still in design phase, it was possible to use the Pro-Designer OLE
Server to evaluate the profitability of plants with different maximum capacity. This allows
the engineers to compare the profitability of a range of investments (up to the $50,000,000
company limit for the investment) in order to determine what is the optimum size / capacity
the plant should be designed for (up to the 100,000 kg/ year market-requirement limit). In
the SuperPro simulation of ComEx1.spf all equipment are in design mode. For each run the
equipment were resized to have 100 % Capacity Utilization. The recipe was kept constant
in terms of the use of equipment, the order of procedures and operations, but the plant batch
time varied with the batch sized, as the time required for several operations is size
dependent (i.e. Charging and Transfers at constant rate).
The Throughput Analysis worksheet in the ComEx1.xls Excel workbook demonstrates this
sensitivity analysis. In order to vary the annual throughput the batch size was increased.
The SetAndGetBatchThroughput(throughput) function involves setting the batch size,
performing material balances and economic calculations and retrieving the value of the new
batch size (to check whether for some reason this was not achievable). The VBA script for
this function can be found in Module 1. Once a batch size was set the SPD solved the
material balances, sized the equipment accordingly and calculated the maximum number of
batches per year. Since the plant is in Design Mode, and the plant batch time changed, so
did the number of batches, so every time there was an increase in the plant batch size, the
new value of the annual throughput, was obtained with the GetThroughput(double)
function. So for each value of annual throughput the values of the important economic
evaluation factors such as Profit, Revenue, ROI, IRR, Unit Costs etc. are obtained. The
simulations were performed for a range of batch throughput of 200 - 2600 kg/batch which
corresponded to annual throughput range 30400 80600 kg /year and a range of
$15,746,650 - $48,908,817 for the total investment.
Examining how the revenues / net profits change with the annual throughput one can see
that they increase linearly with the plant capacity as shown in the following figure:
From the above figure it appears that the plant should be run at the highest capacity.
However, taking a closer look to the indices used to evaluate the profitability of investment,
mainly the Return on Investment (ROI) and the Internal Rate of Return (IRR) before and
after tax we notice that the value of these indices does not vary linearly with throughput.
Looking the variation of economic indices, the engineers have concluded that the
investment is more profitable if the annual throughput is in the range of 58800 64800 kg
/yr since the ROI / IRR are higher for this capacity. This is due to the fact that for an annual
throughput of up to about 62000 kg they experience the economy of scale benefits. These
occur when the revenues rise faster than the expenses because production is increased by
utilizing larger vessels, but not more vessels and the cost of a vessel with respect to its size
is not linear [1]. Beyond the point of 62,000 kg/yr, they need to install multiple equipment
(which is similar to building another plant) and they no longer have those benefits. The
company can of-course decide to design the plant at the highest capacity possible, as long
as the ROI value is acceptable.
:
References
1. Harrison R.G., Podd P., Rudge A.R., Petrides D.P. (2003), Bioseparations Science and
Engineering (Chapter 11), Oxford University Press.
Data Transfer and Parametric Study Example
The purpose of this example is first to illustrate how you can use the COM functions to
vary a process parameter and assess its impact on the economic decision variables (similar
to the Sensitivity Analysis Example) and second to provide more examples of data-
exchange between the Pro-Designer and Excel. A sample Excel workbook (ComEx2.xls) is
provided along with a sample Pro-Designer simulation case (ComEx2.epf).
Look at The Excel Workbook for the Data Transfer Example for more information on this
example. Please follow the instructions in Setting Up The Project the first time you open
the excel file.
Readme: Provides useful information that enables you to use this workbook in order to
Parametric study: This spreadsheet contains an example on how you can vary a process
variable, in this case the annual operating time, to examine the effects on the economic
indicators.
Data Exchange: This spreadsheet contains data exchange examples, where you can access the
If you select Tools / Macro / Visual Basic Editor from the Excel main menu (or the
Developer tab and click on the Visual Basic icon button in Excel 2007), the Visual Basic
Editor Interface appears as described in Setting Up The Project and you can navigate this to
browse through the VBA scripts or change / add to the scripts used in this example. Expand
the Microsof Excel Objects or the Modules folders and click on any of the sheets/ modules
to view the code in the right pane. For more information on VBA scripts please, see VBA
Sample Scripts
Process simulation tools can be used for robust modeling and evaluation of the average
situation (base case or most likely scenario). Assessment of the impact of uncertainty and
estimation of the range of possible outcomes is an additional challenge. The integration of
the process simulation tool (Pro-Designer) with risk analysis tools, which allow for
stochastic modeling of the uncertain variables, provides probabilistic forecasts of the output
variables enabling us to evaluate the impact of uncertainty/variability on these process
decision variables. The quantification of risks and the overall process variability is
important to engineers involved at the process development stage when targeting risk
minimization, process optimization and process validation, as well as managers at the
decision-making level when assessing the feasibility of batch processes under uncertainty
and strategic planning.
An example is presented in which the The Designer Type Library is used for integrating
SuperPro Designer with a risk analysis tool such as Crystal Ball (created by
Decissioneering, Inc. and acquried by Oracle corporation) in order to evaluate a
pharmaceutical process. A sample Excel workbook (ComEx4.xls) is provided along with a
sample Pro-Designer simulation case (ComEx4.spf). Please note that to run the example
you must have Crystal Ball installed on your PC. For versions of Excel prior to 2007 and
Crystal Ball version 7 or older versions please follow the instructions in Setting Up the
Project with Add-Ins the first time you open the excel file. For Excel 2007 and Crystal Ball
version 7 or newer please follow the intsructions in Setting Up the Project without Add-Ins.
To find more about the specific process file and the sensitivity analysis example
please, see The Process File for the Risk Analysis Example.
To find more about the structure of the sample workbook and the available examples
please, see The Excel Workbook for the Risk Analysis Example.
The steps described here are similar to the ones in Setting Up The Projectdescription. In
this case we consider an example that uses an Excel add-In Crystal Ball, which you must
have installed on your computer in order to run this example.
A sample Excel spreadsheet (ComEx4.xls) is provided along with a sample Pro-Designer
simulation case (ComEx4.spf). This Excel spreadsheet contains many useful scripts for
using the COM functions. It can be used for risk analysis as described in Risk Analysis
Example
Before you start using this example you must perform the following tasks:
3. Specify the path and name of the Pro-Designer file in designed cell (i.e.
C:\Designer\ComEx4.spf)
4. From the Excel menu select Tools / Add Ins and select (check) the Crystal Ball add-in
5. From the Excel main menu chose Tools /Macro /Visual Basic Editor.
7. Scroll down in the list until you find the CB.xls. Check that library to be included in
your references.
8. Continue scrolling until you find the SuperPro Designer (This is the Designer Type
Library exposed by the Pro-Designer OLE Server). Check that library to be included in
your references.
By now the Designer library should be included in your project. You can view the libraries
included in the project if you display the VBA object browser (click F2 or click on the icon
from the standard toolbar, or select View/Object Browser from the VBE main menu).
If you look at the list of libraries the Designer library should now be included.
You can now save your Excel worksheet. Next time you open the file, you do not have to
repeat these steps. Just verify that the Designer library is added to your Excel references by
checking the object browser.
Before running the Risk Analysis example first follow the steps described in Setting Up
The Project.
Setting up the project to work with Excel 2007 and newer versions of Crystal Ball
(versions >= 7.x) is as simple as running Crystal Ball. This will run MS Excel 2007 and
will present you with a welcoming screen were you may select to Open your Excel
Workbook in this case the example ComEx4.xls.
Excel has a new Crystal Ball tab in the Ribbon bar, which can be used to define the
assumptions, decisions and forecasts fields in the excel workbook. Also by clicking on the
Run Preferences button one can set the number of trials to run, precision, and other running
preferences. More information can be found in the Crystal Ball help documentation.
After running preferences have been set, you may run the risk analysis simulation by
clicking on the Start button or end the simulation by clicking the Stop button.
In the sensitivity analysis example the process file chosen is a variation scenario of the
Synthetic Pharmaceutical process file, inspired from the Synthetic Pharmaceutical
example(SPhr6_0f as described in the tutorial). This is a typical example of a
pharmaceutical industrial process. A synthetic pharmaceutical intermediate is formed by
condensation of quinaldine and hydroquinone. The process plant shown in the next figure
was designed to include three stirred tank reactors, two nutsche filters and a tray dryer. The
process is described in more detail in the tutorial.
Information on general methodology used for this example is given in the Methodology
in Uncertainty Study section.
Information on the base case simulation with the SuperPro Designer is given in the
Base Case Scenarion description.
The information provided in this manual for this example is extracted from our publication:
Analysis and Evaluation of Batch Pharmaceutical Processes: Integration of Process
Simulation and Risk Analysis Tools which can be found on our website:
http://www.intelligen.com/literature.shtml
Readme: Provides useful information, that enables you to use this workbook in order to
: This spreadsheet is used to perform a risk analysis study for assessing the
Study Case
Visit the Visual Basic Editor interface to navigate through the VBA scripts to add or
modify them according to your needs. Please, see Setting Up The Project for more
information on the Visual Basic Editor interface.
To perform the work presented in this paper, we combined the deterministic simulation
capabilities of SuperPro Designer application with the stochastic (Monte Carlo) simulation
capabilities of Crystal Ball in order to study how the variance in selected process
parameters affects the final process decision variables.
Crystal Ball from Oracle, is an Excel add-in application that facilitates Monte Carlo
simulation which enables the user to designate the uncertain input variables and specify
their probability distributions and to select the output (decision) variables whose values are
recorded during the simulation. For each simulation trial (scenario) Crystal Ball generates
random values for the uncertain input variables based on their probability distributions
using the Monte Carlo method. The random value generation attempts to imitate
randomness in the real world. Based on the recorded output (decision) variables, Crystal
Ball determines the variance of the decision variables by generating probabilistic
distributions and performs dynamic sensitivity analysis. All input variables are perturbed
simultaneously and their interactions are captured in the fluctuations of the output. Crystal
Ball also calculates the uncertainty involved in the outputs in terms of their expected value
(mean, median, mode), variance, standard deviation, and their complete frequency
distribution. In addition it generates various reports and charts such as the tornado and the
sensitivity analysis charts.
The methodology used for integrating the two tools, takes advantage of the Component Object Module
(COM) technology of SuperPro Designer (General Info on the Designer Type Library)
and is illustrated in the following figure:
The probability distributions of the parameters of the uncertain parameters were defined in
Crystal Ball. Running the Crystal Ball application, the Monte Carlo method is used to
create random values for these parameters according to their distribution. In typical Crystal
Ball runs the decision variables (output) are linked to the input variable in Excel using a
model through an equation or an Excel macro. In our case Excel macros employing VBA
scripts were used to link the input (uncertain) parameters as well as the output decision
variables to the SuperPro Designer application as inputs and outputs (respectively) to the
processs file. For each scenario the values the input-uncertain parameters are passed to the
process simulator, which is employed to perform material and energy balances, scheduling
and capacity utilization calculations, cost estimation and economic evaluation. The values
of the objective decision variables (the forecasts in the Crystal Ball simulation) are outputs
of the process simulator. These are passed back to Excel spreadsheet, again using macros
employing VBA scripts and are recorded by Crystal Ball as forcasts.
For more information on the scripts used in this example, see VBA Scripts Used for Risk
Analysis.
var2 = SetHydroquinoneCost(Cost1)
var2 = SetQuinaldineCost(Cost2)
var2 = SetFinalProductPrice(Price)
'Set Cloth Filtration Flux (P-4)-from L/m2 hr to m3/m2 s
procName = "P-4"
more code
procName = "P-1"
opName = "Chlorination"
more code
'Perform ME Balances
superProDoc.DoMEBalances var1
superProDoc.DoEconomicCalculations
superProDoc.GetFlowsheetVarVal VarID.paybackTime_VID, var1
SetVariablesAndSolve = var1
End Function
The function, whose code is shown above, calls several other VBA functions for setting the
SuperPro Designer case variables. These are included in Module2. A sample script for the
function used to set the filtrate flux is shown here:
str1 = CStr(procName)
str2 = CStr(opName)
var1 = CDbl(InDouble)
SetFiltrateFlux = var1
End Function
Finally in Module4 you can find all functions for obtaining the output values, used in cells
B33 to B43 in the Study Case spreadsheet. In this simulation only the first two outputs
(Number of Batches and Main Product Cost) were defined as forecast variables in Crystal
Ball and their output values are recorded.
var1 = InDouble
GetMPC = var1
End Function
var1 = InDouble
End Function
If you are interested to see the variation caused in the other output variables you can set
them as forecast variables the next time you run the Crystal Ball Simulation.
: The object superProDoc is declared globally and defined in the ThisWorkbook object
Note
of the COMEx4.xls file. For more information on object initializations see Declaring and
Initializing Pro-Designer Server Objects.
The base case scenario involves using an average (or most probable) value for the uncertain
input variables. A brief summary of the results relevant to the case study objectives (i.e.
36,000 kg of final product per year at a cost of no more than $250/kg) is presented.
The process simulator calculates that each batch generates 246 kg of final product. The
recipe scheduling information dialog of SuperPro Designer provides a summary of the
process scheduling: the batch time (time from start to finish of a batch) is 99.2 h. and the
processs min cycle time (time between consecutive batches) is 52.3 h. This is determined
by the cycle time of R-102, which is the scheduling bottleneck equipment. Hence if the
plant can operate under its min cycle time, it can process 150 batches per year. To meat the
target production of 36,000 kg/year, a minimum of 147 successful batches is required per
year.
The equipment utilization and scheduling is displayed in the following figure for three
consecutive batches.
Multiple rectangles for the same equipment (e.g. for R-101, R-102, NFD-101, and R-103)
within a batch represent reuse (sharing) of the same equipment by multiple unit procedures.
The flow of material through the equipment is shown with the red arrows for the first batch.
Equipment R-102 has the longest cycle time and is the current time bottleneck that
determines the maximum number of batches per year. Any process changes that increase
the cycle time of R-102 will result in fewer batches per year and lower annual throughput.
Please note that such changes are not limited to the operations of P-9. Delays in the
operations of the preceding procedures (P-1, P-3, P-4, P-5, P-6, P-7, and P-8) are
propagated to P-9.
In addition to the M&E balances and scheduling calculations the process simulator
performs thorough cost analysis and overall project economics, estimating the capital as
well as the operating cost. The economic evaluation report generated by the process
simulator reveals that the estimated unit production cost is $237/kg, which is below the
upper limit target of $250/kg. The pie chart (Figure 3) shows the distribution of the
manufacturing cost. The facility overhead costs account for 39%, followed by raw material
costs at 26% and labor for 21 %. The cost distribution of the raw material can be seen in the
following table.
Quinaldine is the most expensive raw material accounting for around 44% of the raw
materials cost which translates to about 11.4% of the overall cost as shown in the next
figure:
The results from the base case scenario meet the production and unit cost targets, but with
small margins. Consideration of variability in input parameters can help us quantify the
risks for this project. Therefore an Uncertainty Analysis study is performed.
Uncertainty Analysis
As mentioned in Base Case Scenarion the major contributors to the unit production cost are
facility-dependent cost, raw material cost, and labor-dependent cost. Since this process is
carried out on an existing facility we do not expect a great variation in the facility
dependent cost. We do however expect to have significant uncertainty in the purchasing
price of the key ingredient (quinaldine) and since this is the most expensive raw material,
we anticipate it will have significant impact on the unit production cost. The probability
distribution of quinaldine, was estimated by fitting and extrapolating historical market data.
The other objective variable, the annual throughput /number of batches, is determined by
the plant cycle time. Therefore we consider variability in the operational parameters that
may have an impact on the cycle time of the process and consequently on its annual
throughput. Variation in operational parameters results in process time variation and hence
variation in the annual number of batches and throughput of a plant. In this study we
consider time variability that is inherent to the process (it is the result of natural variability
and not control / mechanical failure limitations) and can cause delays on the time
bottleneck, in this case reactor R102 in procedure P-9, and consequently affect the cycle
time. Any delays in procedures upstream P-9 can increase the cycle time. We therefore
focus on the duration of the reaction operations that are upstream of P-9 and may exhibit
inherent variability. These include the reaction times for chlorination in P-1 and
condensation in P-3, which depend on catalyst activity/performance. In addition the
filtration fluxes can vary significantly due to fouling. Here we consider only filtration
procedures that relate to P-9 (upstream procedures). We also consider the filtration flux in
P-10 (even though it is downstream P-9) because the filtration flux in NFD-101 determines
the transfer out of vessel R-102 in P-9 and therefore has a direct effect on the cycle time of
that (bottleneck) procedure. More over the variation in these operational parameters can
have a direct impact on the unit production cost. The variability in the durations of reaction
operations and filtration times is best estimated based on laboratory and pilot plant data
with a triangular distribution (as shown in the table above).
The two forecast variables considered in this study include the number of batches that can
be processed per campaign and the unit production cost. These are key performance
variables important for production planning and process economic evaluation. The output
variables, of the combined SuperPro Designer - Crystal Ball simulation, are quantified in
terms of their expected value, variance, standard deviation, median, mode, and probability
distribution.
The results for the Number of Batches is shown in the next figure:
The results for the Unit Production Cost in the next figure:
Based on our assumptions for the variation of the input variables we note that average
values (mean / median /mode) calculated for the decision variables satisfy the objective. A
certainty analysis reveals that we can meet the unit production cost goal with a certainty of
93%. However, the certainty of meeting our production volume goal (of 36,000 kg or 147
batches) is only 83%.
The dynamic sensitivity charts can provide useful insight for understanding the variation of
the process. They illustrate the impact of the input parameters on the variance (with respect
to the base case) of the final process output, when these parameters are perturbed
simultaneously. This allows us to identify which process parameters have the greatest
contribution to the variance of the process so as to focus the effort for process
improvement.
The sensitivity analysis for Annual Number of Batches is shown in the next figure:
The sensitivity analysis for Unit Production Cost is shown in the next figure:
The duration of the condensation reaction has the greatest impact on the number of batches
and consequently the annual throughput. If the management of the company is seriously
committed to the annual production target, it would be wise to allocate R&D resources to
the optimization of the condensation reaction. In addition we can see that the purchasing
price of quinaldine has the greatest impact on the manufacturing cost of the final product.
Focusing the market research on lower cost suppliers for quinaldine would be advisable.
The variation in the two performance parameters is also affected by the filtration fluxes in
NFD-101. The increase in the filtration fluxes corresponds to a decrease in operation times,
and therefore to an increase of the number of batches and the annual throughput. Decrease
of operation times and also results in a small decrease of the unit production cost.
This simple example from the pharmaceutical industry demonstrates how the combination
of process simulation and risk analysis could facilitate the decision-making process. A
probabilistic estimate is more representative of the real world than a deterministic
approach, thus including variance/uncertainty in the modeling of industrial processes leads
to reliable forecasts or the important production / economic indices and enables
management to consider all possible scenarios (and their probability). The framework
presented combines a deterministic process simulator that provides reliable correlations
between input and output variables through detailed process modeling and a risk analysis
tool which employs Monte-Carlo simulation a practical approach for considering
uncertainty and generating the possible scenarios that need to be accounted for. It is
applicable to complex situations, in terms of process design and parameter interaction,
where simple spreadsheet models are insufficient for analysis. It is an indispensable tool for
recognizing and mitigating the risk factors that determine the project outcome by guiding
the management to the aspects of the process they need to address their focus.
Environmental Example
To find more about the structure of the sample workbook and the available examples
please, see The Excel Workbook for the Environmental Example.
To find more about the specific process file and the sensitivity analysis example
please, see The Process File for the Environmental Example.
The process file chosen is a variation scenario of the Industrial Water treatment example
(described in the tutorial). This is a typical example that analyzes an industrial wastewater
treatment plant and demonstrates how to track the fate of multiple chemical components
(constituents) in an integrated facility. The influent stream, which is a waste stream from an
industrial process is combined with the sludge return stream (Sludge Recycle) and is sent to
a sequence of two aeration basins (AB-101 and AB-102) for biological oxidation of the
organic material, a clarifier (CL-101) for removing the biomass and thickening, a granular
media filter (GMF-101) for removing remaining particulate components and a belt filter
press (BF-101) for concentrating the waste. The removed water, which contains small
amounts of biomass and dissolved solids, is recycled back to the aeration basin.
In water waste treatment processes (whether industrial / municipal) there is very often
variability in the composition of the influent waste stream. In this case the influent
represents the combined waste products of upstream industrial processes that may
themselves have variability, or may not run simultaneously resulting in a variation of the
composition of the total waste stream. Our incentive is to study the impact of this
variability on the economic aspects of the process such as treatment cost as well as on the
environmental properties of the liquid effluent stream as described in Impact of Influent
Variation section.
The ComEx3.xls Excel Workbook for the Environmental Example contains the following
spreadsheets:
Readme: Provides useful information, that enables you to use this workbook in
order to visualize the parametric study, the data exchange examples, and the report
exporting examples.
Parametric Study: This spreadsheet is used to show how variability in certain input
parameters may change the results of the simulation. Follow the instructions for opening
the file and changing the input parameters. See how the plots of the environmental and
economic variables.
Visit the Visual Basic Editor interface to navigate through the VBA scripts to add or
modify them according to your needs. Please, see Setting Up The Project for more
information on the Visual Basic Editor interface.
The plant was designed for an average inflow of 157,500 kg/hr with a benzene
concentration of 0.636 g/L (100 kg/hr in the influent) and glucose concentration 4.98 g/L
(783 kg/hr in the influent). Benzene is treated with aerobic bio-oxidation but it is also
emitted. Glucose is also treated with aerobic bio-oxidation. Small fluctuations in the
upstream plant operating conditions result in variation of the pollutants concentrations. The
Parametric Study worksheet in the ComEx3.xls Excel workbook demonstrates this analysis. The
scripts for this sheet are included in the VBA module: ParamStudy.
The inflow of benzene was varied from 20 kg/hr (which corresponds to a concentration of
0.1278 g/L in an influent stream of 157,418 kg/hr) to 1620 kg/hr (which corresponds to a
concentration of 10.19 g/L in an influent stream of 158,970 kg/hr) while glucose inflow
was constant at 783 kg/h. As a result the waste treatment cost increases almost linearly with
Benzene concentration.
In addition to the economic effects we can see that the variation of benzene in the inflow
causes variation to the environmental properties of the liquid effluent stream and we can
see here for example that Chemical Oxygen Demand in the effluent stream increases with
increasing benzene concentration.
Variation of Glucose in the Influent
The inflow of glucose was varied from 400 kg/hr (which corresponds to a concentration of
2.54 g/L in an influent stream of 156,115 kg/hr) to 1150 kg/hr (which corresponds to a
concentration of 7.3 g/L in an influent stream of 157,465 kg/hr) while benzene inflow was
constant at 100 kg/h.
Furthermore the Total Organic Carbon in the effluent stream increases linearly with
glugose concentration in influent after a certain a concentration. The TOC starts increasing
significantly with glucose concentration after a concentration of 0.22 g/L which
corresponds to a glucose inflow of 800 kg/hr. Glucose is treated with aerobic bioxidation in
the two reactors which where designed for the average inflow of glucose (783 kg/h ). For
higher glucose concentrations glucose is not completely degraded therefore contributing to
the final TOC.
Custom Report Creation Example
The purpose of this example is first to illustrate how you can use the COM functions to
create a custom report. You can see how you can make use of the COM functions (and
particularly the export methods and the variable data access methods) to create a report that
contains the information /charts /figures of your selection. A sample Excel workbook
(ComEx5.xls) is provided along with a sample Pro-Designer simulation case
(ComEx5.spf). Please follow the instructions in Setting Up The Project the first time you
open the excel file.
Readme: Provides useful information that enables you to use this workbook in order
to create and export reports and charts. You should read this before proceeding.
Custom Report P1: This spreadsheet is the 1st page of the Custom Report. First
make sure that the information for the directories and file names (highlighted in yellow)
is correct corresponds to your settings. Then click on the Update Custom Report button
to create a custom report. The VBA scripts for this can be found in module
CustomReport.
Economics: This spreadsheet is the 2nd page of the custom report where several
economic parameters are displayed. The relevant VBA scripts can be found in module
Economics.
Material Balance: This spreadsheet is the 3rd page of the custom report where
material balance information is displayed. What is actually displayed here is the stream
summary table, which is linked to the spreadsheet with a data link.
Gantt Charts: This spreadsheet is the 4th page of the custom report. The operations
and equipment Gantt charts are displayed here.
Throughput: This spreadsheet is the 5th page of the custom report. The Throughput
analysis charts (potential / utilization) are displayed here.
Equipment: This spreadsheet is the 6th page of the custom report. The equipment
occupancy chart (potential / utilization) is displayed here.
Visit the Visual Basic Editor interface to navigate through the VBA scripts to add or
modify them according to your needs. Please, see Setting Up The Project for more
information on the Visual Basic Editor interface. For more information on VBA scripts
please, see VBA Sample Scripts.
The purpose of this example is first to illustrate how you can use the COM functions to
create and export reports, that can be generated with the Pro-Designer application. You can
see how you can make user of the COM functions and particularly the report related
methods. A sample Excel workbook (ComEx6.xls) is provided along with a sample Pro-
Designer simulation case (ComEx6.spf). Please follow the instructions in Setting Up The
Project the first time you open the excel file.
Readme: Provides useful information that enables you to use this workbook in order to
Reports Examples: This spreadsheet contains examples of using the COM functionality to
export reports by setting certain options, like the export format type. The code for these
examples can be found in the code for this Sheet and in modules GeneralFunctions and
ExportReports.
Visit the Visual Basic Editor interface to navigate through the VBA scripts to add or
modify them according to your needs. Please, see Setting Up The Project for more
information on the Visual Basic Editor interface. For more information on VBA scripts
please, see VBA Sample Scripts.
Object Linking Example
The purpose of this example is first to illustrate how you can use the COM functions to
export various objects (pictures, charts) to picture files or the clipboard, that can be
generated with the Pro-Designer application. You can see how you can make use of the
COM functions and particularly object export related methods. A sample Excel workbook
(ComEx7.xls) is provided along with a sample Pro-Designer simulation case
(ComEx7.spf). Please follow the instructions in Setting Up The Project the first time you
open the excel file.
Readme: Provides useful information that enables you to use this workbook in order
to create and export reports and charts.
Visit the Visual Basic Editor interface to navigate through the VBA scripts to add or
modify them according to your needs. Please, see Setting Up The Project for more
information on the Visual Basic Editor interface. For more information on VBA scripts
please, see VBA Sample Scripts.
Enumerating Example
The purpose of this example is to illustrate how you can make use of the enumerating COM
functions in order to enumerate and retrieve lists of items that are part of a ProDesigner
case file. You will also see how to display the generated lists in the Excel worksheet. A
sample Excel workbook (ComEx8.xls) is provided along with a sample Pro-Designer
simulation case (ComEx8.spf). Please follow the instructions in Setting Up The Project the
first time you open the excel file.
Pick File: In this worksheet you pick the ProDesigner Case file by pressing on the
button Pick a File.
Visit the Visual Basic Editor interface to navigate through the VBA scripts to add or
modify them according to your needs. Please, see Setting Up The Project for more
information on the Visual Basic Editor interface. For more information on VBA scripts
please, see VBA Sample Scripts.
When you start the Visual Studio application you create a new project by selecting File /
New / Project on the main menu and from the dialog that appears you select Visual C# as
your language from the left pane and the Windows Application template from the right.
This will do the necessary work to create the foundation on which your application can be
built on. In order to make C# code to work with the Pro-Designer COM interface, one
should load as in the Visual Basic Editor, the Designer Type Library. This is done by right
clicking on the References properties, and selecting Add Reference as shown in the
following image:
On the dialog that appears you switch to the COM tab and you scroll down and click on the
SuperPro Designer Component Name. Make sure the path of the reference library
(Designer.tlb) is correct, and click on OK. You can now view the Object Browser by
right clicking on the Designer object and selecting View in Object Browser as shown in the
following image:
Once you have completed the above procedure, you may start writing your code and/or
designing your interface. Your code with all your declarations, initializations of objects and
data exchanging with Pro-Designer can be written in the Form1.cs file. The Form1.cs file
can be viewed/edited by right clicking on the Form1.cs file and selecting View Code as
shown in the following image:
A Visual C# example that utilizes the Pro-Designer COM server is included with this
manual. The example can be found in the Pro-Designer installation directory under the
folder /Examples/COM/C#/COMEx1/. The solution file that must be loaded in Visual
Studio is COMEx1.sln.
Description of Specific COM Variables
There are certain variables which are Operation or Equipment Specific. This will give a
detailed description of all those specific variables which can be accessed through the COM
server.
In addition to the variables that are general to all operations and can be accessed as
described in Functions for Equipment Variables and Equipment Variables, you can access
variables that are equipment specific. You will use the same functions
(GetEuipVarVal/Val3 or SetEquipOperVarVal/Val3 or GetEquipVarValEx) depending on
the number of arguments required as described in the general case. The list of specific
variables include:
Absorber Variables
Assembler Variables
Centrifuge Variables
Clarifier Variables
Condenser Variables
Cyclone Variables
Degasifier Variables
Diafilter Variables
Equalizer Variables
Evaporator Variables
Extruder Variables
Fermentor Variables
Filler Variables
Fryer Variables
Gasifier Variables
Granulator Variables
Grinder Variables
Homogenizer Variables
Hopper Variables
HydroCyclone Variables
Incinerator Variables
IP Clarifier Variables
Labeler Variables
Microfilter Variables
Mixer Variables
Neutralizer Variables
Packer Variables
Pasteurizer Variables
Printer Variables
Pump Variables
Shredder Variables
Silo Variables
Stripper Variables
Tableter Variables
Thickener Variables
Trimmer Variables
Turbine Variables
Ultrafilter Variables
UV Radiator Variables
Valve Variables
Vessel Variables
In addition to the variables that are general to all operations and can be accessed as
described in Functions for Operation Variables and Operation Variables, you can access
variables that are operation specific. You will use the same functions
(GetOperVarVal/Val2/Val3 or SetOperVarVal/Val2/Val3) depending on the number of
arguments required as described in the general case. A list of operation specific variables is
available for:
Degasification Variables
MA Elute Variables
MA Regeneration Variables
MA Wash Variables
Transfer In Variables