Report generation for Masterscada

I will tell you about the reporting system we developed and implemented on one of the dispatch objects. At the end of all the work, the Customer had a need for reports, which were previously discussed, but rather as something secondary. In fact, this is quite a responsible link in the system, since it carries the economic component - numbers. All data in the tables is requested by sampling by dates from the SQLite database, processed by FBScript and displayed in forms developed in Visual Studio.

The implementation of the reports began with the fact that the Customer, at the end of the general NDP, gave us seven interconnected tables, which were to be interactively recalculated and memorized.

Obviously, this is the task of the application (script) when dealing with a sample of any database. Mastercade has its own database, but there was no paid tool for accessing it and we had to create an application, create our own database and DBMS on SQLite. Masterskada, of course, has its own master of creating reports, but, having examined it, it was decided to develop its own subroutine, allowing it to respond flexibly to any requests of our Customer. This decision was dictated by the need to inherit this reporting system to any other SCADA systems.

A master script was written in Masterskad that runs once a second, polls the variables and stores them in SQLite. Visualization (report forms) were developed in Visual Studio 2017. Report forms select the necessary data from the database (for a specific month) and form a table for display. The DB at Masterskada is not closed, but we have a difficulty in pre-purchasing the tool for working with this DB itself. The fact is that the Customer and the integrator did not know that it was necessary to purchase the application for Masterskada, which would allow working with the database (recording data for further processing). By that time, the money was already coordinated and no one was going to buy anything - I had to develop my application.

With the choice of the DBMS (the DBMS is a program for working with the database), I also had to tinker. There were difficulties associated with the features of the operating system Windows 7 and not very advanced computer configuration. Everything had to be fairly optimized to ensure the stable operation of the system.

Why choose SQLIte? The entire database consists of a single data file, which ensures the highest level of portability, i.e. nothing needs to be installed on the computer. I created a database, threw it into the project - and everything works perfectly, no need to put any server + we have a small load, there are no huge amounts of data.

It turned out that the possibility of ActiveX output is present in Masterskad, this allowed to place reports directly in the format of mnemonic diagrams, without going beyond the limits of the application using operator rights. Mastercade allows you to connect custom components / interfaces written in Visual Studio. The principle of operation is quite simple: visualization is written in Visual Studio - our reports, the library is assembled - dll, and then this dll is simply connected in Masterskad via ActiveX. Then the written user interface is dragged with the mouse in Masterskad to the right place. Thus, using Visual Studio tools, you can finish the Masterscade functionality well.

For comparison, SimpleScada and Teslascada do not have the possibility of adding OLE-objects to the project, which makes these software products not applicable for the implementation of this approach.

As a result, two databases were used on the computer. One for graphs and events (internal Masterskady functions), the second for the reporting system. DBMS act independently from each other, in different threads.

There were difficulties in the fact that Masterskad occasionally fell off and had to pretty much dig in the settings, before we achieved steady work and application of reports, and Masterskada itself. Quite difficult was the data processing at the beginning of the day, month, year. The fact is that in the calculations it was necessary to take into account the discharges of the integral indicators of metering devices, the shutdown of a computer or a SCADA system, as well as various factors, including human, like short-term starts of pumps.

It was also created the ability to display reports on a connected laser printer, saving a report (sample) for a specified period of time on disk.

The technical task was agreed upon in appearance, it is about seven tables in MS Word.


Report structure. How software components interact with each other, how things work

Appearance of report windows, including a general report navigation window, monthly reports and final annual reports.











I would be glad if you express criticism, suggestions, questions in the "comment"

#Reports, #Masterscada, #Insat, #SQLite, #VisualStudio, #ActiveX, #DBMS, #monthly, #Excel, #SCADA

Ваш комментарий добавлен

Возврат к списку