Why "do" - because it is actually not there.
Why “your own” - in case someone in the comments rolls out a certain “entity”, passing it off as an alarm log / archive.
This is not a finished instruction, but rather a direction of action, therefore there is no tutorial tag.
The alarm log will be based on the apache web server, php interpreter, SQLite database.
The magazine itself consists of:
1) file alarmlog.db - contains an archive of alarms;
2) apache web server - processes our http requests from the web-muzzle from the SCADA page of the system;
3) files ( .html, .php, etc.) in a folder, for example, " C: \ alarmlog_ostrov ";
4) ODBC SQLite driver.
In the folder C: \ alarmlog_ostrov we have:
1) folder img - there is a picture of a calendar;
2) folder css - we direct beauty with styles;
3) js folder - javascript calendar, taken ready on the Internet;
4) alarmlog.db - the database itself, where Citect puts its alarms;
5) front_end.html - the front end of our magazine;
6) index.php - the most important file is the “engine” of our magazine;
7) my_lib.inc - a file with own functions on php;
8) sqlite3_connect.php is the mechanism for connecting to the database, always in index.php always stick out with a unified interface, regardless of the type of database used (there are several such files for each type of database).
INSTALLING APACHE WEB SERVER
Installation will not describe - everything is simple. I used httpd-2.2.25-win32-x86-openssl-0.9.8y.msi.
The main thing that appeared in the tray familiar icon
and in the settings file C: \ Program Files (x86) \ Apache Software Foundation \ Apache2.2 \ conf \ httpd.conf there were the following values:
1) ServerRoot "C: / Program Files (x86) / Apache Software Foundation / Apache2.2"
2) Listen 80
3) LoadModule php5_module "c: /PHP/php5apache2_2.dll" (taking into account that PHP is in the root of the C drive :)
4) AddType application / x-httpd-php .php
5) DocumentRoot "C: \ alarmlog_ostrov" taking into account that our log is located in this folder.
INSTALLING ODBC SQLITE DRIVER
Installation is simple. I used the sqliteodbc_0.996.exe file. The driver must be used 32 bit (even if you are using a 64-bit OS).
In the window "Choose Components" you must select the item "SQLite 2 Drivers".
.
The installed ODBC driver can be viewed in the ODBC Data Source Administrator.
.
INSTALLING LANGUAGE PHP INTERPRETER
I used the option c file archive PHP_5.4.26.zip, unpacked in the folder C: / PHP .
The php.ini settings file must be stored in the C: / Windows folder .
ODBC SETTING CONNECTIONS
The SCADA system is connected with the alarm log database file using ODBC. You must configure the data source in the ODBC data source manager.
Configure the ODBC data source in the ODBC Data Source Administrator (file C: \ Windows \ SysWOW64 \ odbcad32.exe ).
In the ODBC Data Source Administrator window, go to the "SYSTEM DSN" tab.
.
To add an ODBC data source, click the Add button, select the SQLite 3 ODBC Driver from the list, click the Finish button.
For ODBC connection, you must specify the following parameters:
1) Source Name - ALM_LOG_OSTROV;
2) Database Name - C: \ alarmlog_ostrov \ alarmlog.db;
3) Lock Timeout (ms) - 5000;
4) Sync Mode - OFF;
5) NoWCHAR - check the box / checkbox;
.
In order for the SCADA system to have write access to the file C: \ alarmlog_ostrov \ alarmlog.db, it must be granted the rights of the type "User: All - full access".
In SCADA itself, we need to create a device in Devices, for example, alm_log_db of type SQL_DEV.
.
In the alarm categories, you must specify our device alm_log_db .
.
Previously used Citect 7.0 under Windows XP and the magazine was opened in a third-party Firefox application. Then we switched to Windows 7 and Citect 7.3 (now 7.5) and on the graphic page of the magazine we use the ActiveX element Microsoft Web Browser .
.
In the page events on "On page shown" we set a samopisnaya wrapper function, which in ActiveX element prescribes the desired web-address.
.
In runtime, it looks like this.
.
The contents of the database itself looks like this:
.
.
An attempt was made to combine alarms with acknowledgment facts through two tables and the presentation mechanism, but on the target machine this was very slow (there are no brakes on the developer's virtual machine).
.
We left the situation by setting the parameter in citect.ini , which not only On , Off , but also Ask, enter an alarm into the alarm state change event in the alarms.
The same calendar for JavaScript.
.
The alarm log calendar window provides the following user interface:
1) dropdown list of month selection;
2) drop-down list of year selection;
3) indicator of the selected year and month;
4) the current day of the month;
5) the selected day of the month (after clicking on the day, the window closes automatically);
6) button to close the alarm log calendar window.
The alarm log has the ability to print the result of the sample. To do this, use the "Print ..." item of the context menu, which is invoked by right-clicking on the magazine canvas.
.
With PDFCreator installed, we get an excellent export mechanism in pdf.
The preview allows you to adjust the appearance of the printed document.
Source: https://habr.com/ru/post/323036/
All Articles