Share this

Development and Application of a Real-time Monitoring System for Gas Stations Based on KingSCADA and VB

2026-04-06 05:57:32 · · #1
1. Introduction KingSCADA, a general-purpose configuration software in the industrial control field, is a fully Chinese-interface configuration software running on the Microsoft Windows 98/NT Chinese platform. It employs new technologies such as multithreading and COM components to achieve real-time multitasking, and the software runs stably and reliably. The real-time monitoring system for gas stations uses KingSCADA as its main interface. By setting parameters for the monitored system, the interface dynamically displays the operating status of the lower-level machines and performs tests on various performance indicators of multiple fuel dispensers, such as tank level, water level, temperature, and pressure. The PLC samples data from the gas station, compares the sampled data with preset values, and controls the solenoid valves to monitor the gas station in real time. VB technology serves as the backend support, using its internal database creation tool—the Visual Data Manager—to create an Access database, retrieve KingSCADA reports and historical records, and add, modify, or delete records. After saving, the data is fed back to the KingSCADA system and presented to the user in a graphical format. The system structure diagram is shown in Figure 1. 2. Application of PLC and KingSCADA in the System 2.1 Data Sampling and Comparison A PLC can be used to sample data from a gas station. The sampled data is compared with preset values, enabling real-time monitoring of the gas station. A PLC is a new generation of industrial controller developed based on microprocessors, integrating computer technology and automation technology. The PLC I used is the OMRON CPM1A model from Omron. The PLC is connected to a host computer. Through programming, data is obtained after sampling, and then the result is obtained through comparison instructions. Figure 1 shows the system structure block diagram. When the instruction is executed, the two 4-digit hexadecimal numbers in channel C1+1 and C1 are concatenated into an 8-digit hexadecimal number, and the two 4-digit hexadecimal numbers in channel C2+1 and C2 are concatenated into an 8-digit hexadecimal number. Then, the size of these two 8-digit numbers is compared, and the comparison result is sent to the flag bit in the SR area. When (C1+1, C1) > (C2+1, C2), the greater than flag 25505 is set to ON, and the instruction following this flag is executed; when (C1+1, C1) = (C2+1, C2), the equal to flag 25506 is set to ON, and the instruction following this flag is executed; when (C1+1, C1) < (C2+1, C2), the less than flag 25507 is set to ON, and the instruction following this flag is executed. This instruction controls the switch quantity through KingSCADA. When the acquired data is compared to a certain preset value or is less than a certain preset value, the switch quantity is automatically controlled to enable real-time monitoring and control of the data. 2.2 KingSCADA Screen and Application This system uses KingSCADA version 6.5 from Beijing Yacon Technology Development Co., Ltd. In the tree view on the left side of the development system, select "Screen," then select the "New Screen" option to create a series of new screens, including: Daily Fuel Dispenser Report, Fuel Dispenser Oil Category Report, Fueling Details Inquiry, Customer Information Total Volume Inquiry, Sales Statistics, Real-time Tank Measurement System, Real-time Fuel Dispenser Operation Diagram, and Main Screen. The Real-time Tank Measurement System and Real-time Fuel Dispenser Operation Diagram allow for the control of fuel dispenser on/off states, while the reports all have query and print functions, allowing users to query or print data for the current day or historical data (as shown in Figure 2). Figure 2. Schematic diagram of KingSCADA screen 3. Application of VB6.0 in the system Using the VisData tool inside VB to create an Access database, call up the KingSCADA historical database, and use the Data control to add, modify and perform other operations on the data in it, complete functions such as refueling registration, and update the relevant information of the gas station in real time. 3.1 Creating a database table with VB6.0 Users can use the Visual Data Manager (VisData) tool provided inside VB6.0 to create an Access database. The steps are as follows: (1) Select "Add-in/Visual Data Manager"; (2) Select "File/New/Microsoft/Access/Vesion 7.0MDB"; (3) Enter "Report" under "File name", and then press "Add Field" to add the required fields; (4) Finally press "Close", and then input the data. 3.2 Connecting to the Access database table with VB6.0 VB6.0 uses the built-in Microsoft Database Jet Engine to access the database. The Jet database engine translates operations on data access objects into physical operations on the database file itself, handling all issues related to various database interfaces. In VB6.0, database programming essentially involves creating data access objects, which correspond to different parts of the accessed physical database, such as Database, Field, and Index objects. VB6.0 utilizes object properties and methods to perform database operations and displays the results and receives user input using bound and unbound controls on VB6.0 forms. Data controls are internal controls provided by VB for accessing databases; they are essentially visual tools developed using Data Access Objects (DAOs). They can open databases such as Access, FoxPro, and Paradox through the Microsoft Jet engine, and also access ODBC databases via ODBC Direct. Data controls allow database access without writing code, greatly simplifying programming and making database application prototyping much easier. Furthermore, a significant advantage of this control is that it allows for the combination of VB code and SQL to create complete applications when needed, providing advanced programming control for data processing. In practical use, the key properties of the Data control need to be set as follows: Connect = Access (database connection type); Databasename = d:qihou.mdb (database name); Recordsource = sequence table (data source of connected records); Recordsettype = 2 Snapshot (type of the Recordset object). Then, place a Textbox on the form corresponding to the field name and set its property value to: Datasource = "Data control name"; Datafield = "corresponding field name". This completes the binding of the Data control and RecordSet object to the database. Function buttons can then be placed on the form, and corresponding program code can be written to perform database operations. For example, to add a record, the relevant code is as follows: Sub Command1_Click() Data1.RecordSet.AddNew Data1.RecordSet.Fields(“Company”) = “Wuhan Doors and Windows Company” Data1.RecordSet.Fields(“Vehicle Number”) = “鄂A3652” Data1.RecordSet.Update End Sub 4 Conclusion In summary, the PLC is used to sample and compare on-site data to complete the control function; KingSCADA is used for system screen monitoring; and VB is used to implement refueling registration, completing the real-time update of relevant information of the gas station. The entire solution plays a good monitoring role for the gas station and has achieved good economic benefits in actual use, demonstrating high practical value.
Read next

CATDOLL 138CM Sasha Silicone Doll

Height: 138 Silicone Weight: 24kg Shoulder Width: 31cm Bust/Waist/Hip: 65/62/78cm Oral Depth: N/A Vaginal Depth: 3-15cm...

Articles 2026-02-22