May 2014 SimSci® PRO/II® 9.3 COM Server Programmer’s Guide and Tutorial All rig

May 2014 SimSci® PRO/II® 9.3 COM Server Programmer’s Guide and Tutorial All rights reserved. No part of this documentation shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of Invensys Systems, Inc. No copyright or patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this documentation, the publisher and the author assume no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained herein. The information in this documentation is subject to change without notice and does not represent a commitment on the part of Invensys Systems, Inc. The software described in this documentation is furnished under a license or nondisclosure agreement. This software may be used or copied only in accordance with the terms of these agreements. © 2014 by Invensys Systems, Inc. All rights reserved. Invensys Systems, Inc. 26561 Rancho Parkway South Lake Forest, CA 92630 U.S.A. (949) 727-3200 http://www.simsci.com/ For comments or suggestions about the product documentation, send an e-mail message to ProductDocumentationComments@invensys.com. All terms mentioned in this documentation that are known to be trademarks or service marks have been appropriately capitalized. Invensys Systems, Inc. cannot attest to the accuracy of this information. Use of a term in this documentation should not be regarded as affecting the validity of any trademark or service mark. Invensys, Invensys logo, PRO/II, and SimSci are trademarks of Invensys plc, its subsidiaries and affiliates. 1 Table of Contents 1 Introduction ..............................................................4 1.1 Summary ................................................................................ 4 1.2 Component Object Model ....................................................... 4 1.3 About this Document .............................................................. 5 1.4 Additional Documentation ....................................................... 5 2 Hardware and Software Requirements ...................6 2.1 Programming Prerequisites .................................................... 6 3 COM Server Overview ..............................................8 3.1 Structure of the PRO/II COM Server ....................................... 8 3.2 PRO/II Data Organization ....................................................... 9 3.3 Data Types ........................................................................... 10 4 Basic Operations .................................................... 12 4.1 Outline of a COM Server Application .................................... 12 4.2 Start the PRO/II COM Server ................................................ 13 4.3 Open a PRO/II Database ...................................................... 14 4.4 Load Data Objects into Memory ............................................ 15 4.5 Read and Write Attributes ..................................................... 15 2 4.6 Perform Units-of-Measure Conversion .................................. 16 4.7 Commit and Free Objects ..................................................... 16 4.8 Save and Close the Database .............................................. 17 4.9 Shut down the PRO/II COM Server ...................................... 17 4.10 Modifying the Simulation Database .................................... 17 5 Writing Applications in Different Languages ....... 18 5.1 Description of Example ......................................................... 18 5.2 Visual Basic 6.0 Implementation ........................................... 18 5.3 C++ Implementation ............................................................. 19 5.4 VB Script Implementation ..................................................... 21 6 Using the Operator Interface ................................. 23 6.1 Introduction ........................................................................... 23 6.2 Initial setting of Excel application .......................................... 23 6.3 Viewing the inbuilt Example .................................................. 24 6.4 Creating a new operator interface ......................................... 24 6.5 Editing Comments ................................................................ 25 6.6 Running the Simulation ......................................................... 28 7 COM Server Examples ........................................... 30 7.1 Introduction ........................................................................... 30 7.2 Accessing Calculated Stream Conditions ............................. 30 3 7.3 Calculating Stream Properties .............................................. 30 7.4 Accessing Calculated Column Data ...................................... 33 7.5 Invoking an Excel macro from the PRO/II GUI ...................... 35 7.6 Performing a Flash Calculation ............................................. 39 7.7 Flash Drum Outlet Conditions ............................................... 42 Introduction 4 1 Introduction 1.1 Summary The PRO/II COM Server provides read/write access to information in a PRO/II simulation database from COM-aware applications and languages. You can write applications to access data (both input and calculated) in PRO/II simulation databases using Microsoft Excel, Microsoft Visual Basic, and C++ (using the MFC or ATL frameworks). Applications created using the PRO/II COM server interface can: • Create specialized reports and datasheets • Transfer data between PRO/II and other applications or databases, or • Define case management scenarios where results are analyzed based on changes to different types of inputs The PRO/II COM server also provides calculation utilities, which allow a client application to: • Perform flash calculations • Calculate stream properties, and • Solve the flowsheet Client applications can also modify information in the PRO/II simulation database and rerun the flowsheet simulation. However, the PRO/II COM Server is not intended as a complete replacement for using the PROVISION GUI or PRO/II keyword file to define a complete simulation. Additional information on the effects of modifying an existing database using the PRO/II COM Server is explained in Chapter 4 under the “Modifying information in the Database.” 1.2 Component Object Model The Component Object Model (COM) is the Microsoft-developed architecture for defining and building reusable software components. It is the foundation for many other technologies, including OLE (Object Linking and Embedding), “OLE Automation”, ActiveX, and OPC (OLE for Process Control). It is also used as implementation architecture for industry standards such as CAPE-OPEN. Introduction 5 1.3 About this Document The purpose of this document is to provide information on using the PRO/II COM Server. Visual Basic is a common language used for COM application development and is included in many Microsoft products, including Excel. The examples in this document are written primarily in Visual Basic. Chapter 2 describes the programming prerequisites necessary to develop applications for the PRO/II COM Server. Chapter 3 describes the overall structure of the PRO/II COM Server. Chapter 4 describes the basic programming steps required to create an application to access data in a PRO/II simulation database. Each step is illustrated with a simple Visual Basic code example. Chapter 5 provides a short, complete example application implemented in different programming languages. Chapter 6 contains many example applications for performing common operations with the PRO/II COM Server. 1.4 Additional Documentation For additional information on the PRO/II COM Server, refer to these documents, included with the Database Server Programming documentation: • PRO/II COM Server Reference Guide • The primary reference materials for Visual Basic, Excel, and other Microsoft Technology are the documents and reference material included with the Microsoft products. The website msdn.microsoft.com is the primary starting point for developers needing more information on specific Microsoft technologies. Hardware and Software Requirements 6 2 Hardware and Software Requirements To develop PRO/II COM applications a PC with an installed version of PRO/II is required. Refer to the PRO/II Installation Guide for specific hardware and software requirements for specific versions of PRO/II. You will also need the appropriate development environment or development tool for writing COM applications. This includes (but is not limited to): • Visual Basic • Visual C++ • Microsoft Excel The applications you create using the PRO/II COM Server can run on any platform that: • Supports the version of PRO/II being targeted and • Supports the runtime environment required by the development tool you are using Some calculation features of the PRO/II COM server also require a valid PRO/II license. 2.1 Programming Prerequisites To effectively write applications with the PRO/II COM Server you should be: • Familiar with PRO/II • Familiar with the specific development language or tool you are planning to use, such as Visual Basic or C++ • Knowing how to access and use COM objects from the chosen development language If the chosen development tool is Microsoft Excel, then it is helpful to be familiar with some of the advanced features of Microsoft Excel, including: • Accessing values in spreadsheet cells using Visual Basic, the macro language of Excel • Using the pre-defined Excel objects in Visual Basic, such as the Application, Workbook, Worksheet, and Range objects Hardware and Software Requirements 7 • Creating and using named spreadsheet cell ranges • Creating and using spreadsheet templates and add-ins • Record, write, and edit macros in Visual Basic for Applications Refer to the on-line help for your Microsoft product. You can also visit http://office.microsoft.com and http://msdn.microsoft.com search for "Excel Object Model Overview") for more information. COM Server Overview 8 3 COM Server Overview 3.1 Structure of the PRO/II COM Server Figure 1 shows the basic structure of the PRO/II COM Server and the applications that use it. Figure 1. PRO/II COM Server Architecture The PRO/II COM Server consists of the following parts: • The PRO/II COM Server provides the support for the COM interface into PRO/II. COM applications written in Excel, Visual Basic, C++, and other COM-aware languages interact with this interface. The COM Server is called p2oledbs.exe and is located in the BIN directory under the PRO/II installation path • The PRO/II Server consists of the various DLLs used by PRO/II with PROVISION for GUI and keyword support. This support includes the functions that access and manage the PRO/II data objects. It also includes many calculation features of PRO/II such as solving a flowsheet, calculating stream properties, and performing flash calculations • The PRO/II Database (with extension "prz") contains the simulation data The various client applications, which can access the PRO/II COM server, include the following: • VB Script COM Server Overview 9 • Visual Basic (Standalone) • Visual Basic for Application: VBA is the macro language of Microsoft Office and certain other applications. Microsoft Office components Excel and Access would be typical applications to use the uploads/s1/ dbs-guide.pdf

  • 21
  • 0
  • 0
Afficher les détails des licences
Licence et utilisation
Gratuit pour un usage personnel Attribution requise
Partager
  • Détails
  • Publié le Oct 07, 2021
  • Catégorie Administration
  • Langue French
  • Taille du fichier 0.2024MB