• No results found

WaterObjects Help for Model Users

In document WaterGEMS V8i Users Guide SS5 1 (Page 61-67)

Q. What is WaterObjects?

WaterObjects is a set of application and business logic upon which WaterCAD, Water-GEMS and HAMMER are built. You may think of WaterObjects as the foundation or core workings of the WaterCAD, WaterGEMS and HAMMER applications. Given that WaterObjects is essentially invisible to any user running WaterCAD, WaterGEMS and HAMMER, you might wonder why we decided to give it a special name! The reason is that the application and business logic embodied by WaterObjects is generi-cally re-usable by external parties (and that means you too) in order to create your own custom application extensions or features. So in the most general sense WaterOb-jects is something that allows 3rd parties to extend the functionality of WaterCAD, WaterGEMS and HAMMER, without having to request the functionality from Bentley and then wait for it to be released in a future version of the software. While the feature is called "WaterObjects", a large majority of the feature is also applicable to Bentley storm and sewer products too. Time you invest in customizing WaterCAD or WaterGEMS for example, will have re-use potential for other Bentley Municipal Products applications.

Q. What can I do with WaterObjects?

As mentioned above WaterObjects provides the ability to write custom features to extend the existing WaterCAD, WaterGEMS and HAMMER functionality. For example, you may have some special calculation and report that you currently create in Excel since your supervisor/client prefers to see it in that format. With WaterOb-jects you could automate the calculation and generation of the report in Excel. In fact if you need any special additional behavior that you can't do in WaterCAD, Water-GEMS, or HAMMER with the existing functionality (make sure you looked at queries, user data extensions and the post calculation processor features) chances are that you'll able to achieve it with WaterObjects.

Q. What can't I do with WaterObjects?

As mentioned above WaterObjects represents the core workings of WaterCAD, Water-GEMS and HAMMER. As such it includes functionality to be able to read and write model data, to be able to deal with scenarios and alternatives, to be able to run compu-tations and access results. It does not, however, provide ready access to application specific logic at least in a way that can be broken down into its constituent compo-nents. This means that you can't use WaterObjects to modify existing calculations (although you could add the calculation of additional results or a completely new computation) and you can't add new menus or buttons to the existing user interface.

For example, you couldn't add a new type of graph to the graphing feature or you couldn't add a new right-click menu to the map display.

Q. How do I use WaterObjects?

The answer to this question depends on whether you are a programmer or not. If you are a programmer and are familiar with the terms API, .Net, Interface, Namespace and also with a .Net compliant language such as VB.Net, C#.Net or C++.Net you may be able to pick up WaterObjects pretty quickly, but if you are not a programmer you may need to work with one to do the programming for you.

If you need to hire a programmer (Bentley Professional Services may be able to provide you with one) then you'll need to understand some terminology to allow you to communicate with them more easily.

1. .NET: Microsoft's .NET Framework which comprises the Common Language Runtime, CLR, (provides an abstraction layer over the operating system), Base class libraries (pre-built code for low level programming tasks) and development frameworks and technologies (re-usable, customizable solutions for larger programming tasks). The CLR is an implementation of the CLI (Common Language Infrastructure). You or your programmer must write .NET compatible code.

2. Interface: A contract in software that defines the nature of the public (or external) makeup of the programming component. The analogy in hardware would be a specific kind of plug (such as DVI video) that can only connect to another plug that supports the same interface. This defines how your custom code interacts with the existing Bentley code.

An example might be INumericalEngine which defines an interface for dealing with components that support some kind of computational engine or solver.

3. Classes: In object oriented programming, a class is a bite sized piece of encapsu-lated functionality. The class name typically identifies the core function or nature of the class (e.g., PressurePipe might represent a pressure pipe that has a Material property, a Diameter property and so on). An instance of the class represents an actual PressurePipe where as the PressurePipe class is the template or prototype that defines all PressurePipes. If we like we could take out all the uniquely Pres-surePipe bits of the PresPres-surePipe class and use them to define an IPresPres-surePipe interface.

4. Namespace: In .NET this is a way of providing scope to a set of programming objects that all belong in the same collective group.

For example consider the PressurePipe class from above. Without a namespace we don't know who owns the PressurePipe, but with a namespace such as

5. API: Application Programming Interface. A set of interfaces that provide access to some logical grouping of functionality. WaterObjects is a specific example of an API. You will interact with the WaterObjects API when you write your custom code.

6. Framework: In the context of WaterObjects the framework (or the Municipal Development Framework) is itself a sub-set of WaterObjects, providing access to the most generic features such as unit conversions, database access, scenarios and alternatives, graphing, and re-usable user interface components such as tables and lists. An example of a framework component is the FlexGridControl that lives in the Haestad.Framework.Windows.Forms.Syncfusion.Components namespace.

This control (or component) is the underlying control for all the tabular based user interfaces in the Bentley Municipal Products applications.

7. Domain: A sub-set of the Municipal Development Framework that deals prima-rily with database operations and core business logic. This logic lives under the Haestad.Domain namespace. Some examples of Haestad.Domain constructs are the IDataSource interface (allowing file open/close access on model files), and the IDomainDataSet interface (allowing access to the model data set and access to managers such as the AlternativeManager (for accessing alternatives), Scenari-oManager (for accessing scenarios), the DomainElementManager (for accessing domain elements), and the SupportElementManager (for accessing support elements)).

8. Domain Element: An element used for modeling purposes. E.g., a pipe, tank, hydrant, valve etc.

9. Support Element: An element used in support of modeling and usually refer-enced as additional state or information by a domain element. E.g., a pump defini-tion (pump curve and efficiency curve), a valve headloss curve etc.

More information about the technical details of WaterObjects can be found in docu-mentation that accompanies WaterObjects.

Q. How do I get WaterObjects?

WaterObjects is available for licensed users of WaterCAD, WaterGEMS and HAMMER from the Bentley Developer Network, BDN.

http://www.bentley.com/en-US/Corporate/Bentley+Partner+Program/Tech-nology+Partners/Developers.htm

Support for WaterObjects.NET is available through the Bentley Developer Network.

See the Member Guide for support options:

http://ftp2.bentley.com/dist/collateral/Web/BPP/BDNMemberGuide.pdf For more details about getting started with WaterObjects see

http://www.bentley.com/en-US/Products/WaterGEMS/WaterObjects.NET-Bentley.htm

Q. What programming languages can I use with WaterObjects?

WaterObjects is primarily written in Microsoft.NET and therefore requires a .NET compliant language in order to be able to interoperate with WaterObjects. Your choices include:

1. VB.NET (Visual Basic for .NET) 2. C#.NET (Microsoft C#)

3. C++.NET (Microsoft C++)

In addition to these any other CLI (Common Language Infrastructure) language should be able to be used such as:

4. J# (Microsoft J#- A Java like programming language) 5. Fortran.NET

6. #Smalltalk And many others.

For more potential examples visit http://en.wikipedia.org/wiki/

List_of_CLI_languages

It should be noted that internally the Bentley Municipal Products development group predominantly use C# and C++ to develop with WaterObjects. WaterObjects itself is also predominantly written in these two languages. We do not have any direct experi-ence with many of the other possible languages that may be used.

Typically you would choose a language that you or your programmer is most familiar with in order to maximize productivity. If possible, and all other things being equal, you'll find that Bentley will be able to support you more easily if you stick to one of the languages Bentley uses and is familiar with such as VB.NET, C# or C++.Net.

Q. How do write a WaterObjects Program that works in Microsoft Office?

Those familiar with macros and programming Microsoft Office will typically be used

Office suite that can use either VB.NET or C# as the programming language. The documentation that comes with WaterObjects includes more description on VSTO and how to use it. Note that this is a step up in complexity from regular WaterObjects.NET development.

Q. How do I design a WaterObjects Program?

Whether or not you are doing the programming yourself you'll need to base your design on what you are trying to achieve with the program. First it will be necessary to document the goals of the application. In the software development industry this is typically done from the user's point of view and is called creating "user stories". To that end, put yourself into the shoes of the end-users for your program and document the workflows that the user would expect to encounter. This can be as detailed as it needs to be including how the user would start the program, and what they do when the program is running.

Options for starting a WaterObjects program will depend on the nature of the program developed, but may include:

1. Starting from the External Tools Menu from within WaterCAD/GEMS/

HAMMER,

2. Starting from a desktop shortcut to a stand alone executable,

3. Starting some 3rd party application (such as Excel) and accessing add-in menus.

In addition to starting the program you'll need to define the inputs and the expected outputs. Inputs may include human entered input or file based input (such as a Water model, or tabular data) and output may include things like raw data, reports, graphs and tables in desired formats (e.g. an Excel spreadsheet, Oracle database or a Notepad file). In arriving at the outputs the details of any specific calculations will need to be documented. Finally, you'll need to determine where you want to store the output from your calculations. Choices for storing output may include:

1. Custom results file (binary, XML, text or other format), 2. Within a 3rd party application (such as MS Access or Excel), 3. Within WaterCAD/GEMS/HAMMER using User Data Extensions.

The above process sounds like it may be tricky, particularly when some of the answers potentially require some advance knowledge of how things are going to turn out. This is precisely why in software development an iterative development approach is commonly adopted. In an iterative approach a the overall program requirements are kept initially to a minimum and then staged in bite sized pieces with the progress of the development being demonstrated by the programmer to the stakeholders at regular intervals. This process is sometime called "Agile" software development. More can be found out about Agile development by searching on-line.

2

In document WaterGEMS V8i Users Guide SS5 1 (Page 61-67)

Related documents