web developer & system programmer

coder . cl

ramblings and thoughts on programming...


abstracting plant nodes in proview

published: 22-07-2012 / updated: 22-07-2012
posted in: c, c++, development, programming, projects, proview, tips
by Daniel Molina Wegener

As you know I am working on a ProView project. It has a logical and physical distinction between plant and station nodes. Physical nodes are mainly controlled by logical nodes, including user defined applications written in C, C++ or Java. On this case we are using C and C++, C for low level ProView calls and C++ to create a nice object oriented interface. A very good approach is found on ProView General Data Handler or GDH API, where you can have access to the full node hierarchy using GDH calls. This allows managing nodes in all levels, even if you want to create new nodes in run-time. This is very nice, so I have defined a C++ class device to manage each device automatically and due to the algorithm complexity we cannot use PLC programming.

system design desk

published: 21-07-2012 / updated: 21-07-2012
posted in: c++, development, programming, projects, tips
by Daniel Molina Wegener

Usually you get stuck in your computer trying to solve problems. But problems are solved thinking, and getting stuck in the computer is not the optimal way to think in complex problems. In one of my recent projects I have been working on a complex state machine, which is hierarchical and deriving states to each device on the system. On a computer is hard to have an overview of the entire system, even if you have a good modelling tool. In our team we are doing some diagrams on whiteboards, taking photos from them and then we are individually thinking on wider perspectives of the problem.

proview I/O layers

published: 09-06-2012 / updated: 09-06-2012
posted in: c, c++, development, programming, projects, proview, tips
by Daniel Molina Wegener

Understanding the I/O layers on ProView is a must. If you understand the I/O layers, you will be able to configure channels and signals grouped in classes allowing a very good usage and abstraction of the devices that are being examined and manipulated from ProView. For example a Profibus device can have 8 digital input channels for its status, but they should be grouped a custom class using an array of digital channels with Bit8 as data representation, so they are used as object attributes rather than separate channels, if you do not configure the proper class, you will be wasting your time configuring separate channels for each device, leading to some mistakes. Just imagine that you want to configure 50 devices with the same number of channels for its status, you will need to configure 50 times each channel. So, you really need to know about the I/O layering on ProView.

proview and direct binding

published: 07-06-2012 / updated: 07-06-2012
posted in: c, c++, development, programming, projects, proview, tips
by Daniel Molina Wegener

I am currently working on a ICS/DCS system using ProView. The project is cool, very interesting, where I must implement some nodes on the DCS system, as usual it has three main types of nodes where I must implement two of them: the controlling station and the processing station, there are more nodes to be implemented in the future, like reporting nodes and storage nodes. I was working with the controlling station and I was impressed with the abstraction layer, where you can bind the processing station objects into the HMI objects directly. This is really nice, and due to the nature of the used protocols, like Modbus, RP, Profibus and similar ones, we are not able to use a Web Interface.

I started using proview

published: 02-06-2012 / updated: 04-06-2012
posted in: c, c++, development, programming, projects, proview
by Daniel Molina Wegener

I started using ProView. This is a process control and automation system with a FOSS license, which makes it a good approach for building some interesting projects. It is nice, you can define from single controlled nodes to complete processing stations and HMIs controlling each node. You can use simple PLC programs for the defined hardware and devices, or you can use C, C++ or Java — but Java is not so useful due to real-time application requirements — applications if the station processing and control requires more complex algorithms, which cannot be handled using PLC programs. That is the case of my current project, I am building an application that acts as PLC program which will implement some complex algorithms.

mozilla extensions with xpcom

published: 31-07-2010 / updated: 31-07-2010
posted in: c, c++, programming, projects, tips
by Daniel Molina Wegener

The XPCOM API can allow you to create low level extensions — I mean written in C++, with support for C and assembler through C++ — and plug ins for Mozilla products. For example, you can create an extension to browse IMAP folders from Mozilla Firefox. This API is analogous to the COM+ API on Micro$oft Windows. One of my most recent projects, is a Firefox extension to handle SNMP protocol requests from JavaScript, so my extension is applied from the JavaScript within the HTML in the browser, allowing Firefox to act as an SNMP client. The extension is working fine, without memory leaks and allows you to do get and walk request. Possibly it will be expanded to more requests on the future.

c++ type casting operators

published: 25-07-2010 / updated: 25-07-2010
posted in: c++, programming, tips
by Daniel Molina Wegener

Traditionally, C programmers and Java programmers are accustomed to use the type casting form: (type)variable. C++, instead of that classical type casting form, has various type casting operators, used for different purposes. Each operator is used with different kinds of references, for example, you can not use the static_cast operator with virtual classes. Type casting operators in C++ has a syntax very similar to C++ Templates: cast_operator<type>(variable).