=Paper= {{Paper |id=Vol-3742/paper22 |storemode=property |title=Development of Software for the Implementation of Automated Reserve Input Modes Operation |pdfUrl=https://ceur-ws.org/Vol-3742/paper22.pdf |volume=Vol-3742 |authors=Bohdan Orobchuk,Oleh Buniak,Ivan Sysak,Serhii Babiuk,Ihor Bodnarchuk,Vadym Koval |dblpUrl=https://dblp.org/rec/conf/citi2/OrobchukBSBBK24 }} ==Development of Software for the Implementation of Automated Reserve Input Modes Operation== https://ceur-ws.org/Vol-3742/paper22.pdf
                                Development of Software for the Implementation of
                                Automated Reserve Input Modes Operation
                                Bohdan Orobchuk†, Oleh Buniak†, Ivan Sysak*,†, Serhii Babiuk*,†, Ihor
                                Bodnarchuk†, Vadym Koval†

                                Ternopil Ivan Puluj National Technical University, Ruska str. 56, Ternopil, 46001, Ukraine


                                                Abstract
                                                The problem of the development of automated reserve input system and software for
                                                communication with OMD switch controller produced by ABB company based on the laboratory
                                                stand, used for laboratory works aimed at the research and control of power system operation
                                                modes of electric power systems at the Department of Electrical Engineering of Ternopil Ivan
                                                Puluj National Technical University is considered in this paper. Software based on Modbus RTU
                                                protocol has been developed for data exchange between the laboratory stand and OMD device.
                                                The development and implementation of the software is carried out in the Microsoft Visual
                                                Studio environment. The creation of diagrams is performed in the Borland Together design
                                                environment. The project schedule is implemented by means of Microsoft Project, and the
                                                operation of communication and Modbus registers is implemented due to the Modbus Poll
                                                program. The program makes it possible to evaluate the state of OMD device and to analyze the
                                                operating modes of the reserve input system elements: selection of the source for transferring
                                                electricity to the load between the main and secondary sources, the status of the connected
                                                electrical network and switching devices. The animation mode has also been developed to
                                                present the functions of the OMD device without physical connection to the device.

                                                Keywords
                                                automated reserve input, automatic control, laboratory stand, load switch,
                                                microprocessor control system, software1


                                1. Introduction
                                   Modern technological systems operate using electricity, which is taken for granted.
                                Electricity is essential in industry, transportation, and everyday life. The common
                                requirement of all consumers is the continuity of power supply or its rapid restoration in



                                CITI’2024: 2nd International Workshop on Computer Information Technologies in Industry 4.0, June 12–14, 2024,
                                Ternopil, Ukraine
                                ∗Corresponding author.
                                †These authors contributed equally.

                                  orobchuk_b@tntu.edu.ua (B. Orobchuk); buniak0203@gmail.com (O.Buniak); sisak.tntu@gmail.com (I.
                                Sysak); sermuk@gmail.com (S.Babiuk); bodnarchuk.io@gmail.com (I. Bodnarchuk); koval_vadym@tntu.edu.ua
                                (V. Koval)
                                   0000-0002-6375-2440 (B. Orobchuk); 0000-0001-9304-8254 (O.Buniak); 0000-0002-2315-7911 (I. Sysak);
                                0000-0001-5318-8586 (S.Babiuk); 0000-0003-1443-8102 (I. Bodnarchuk); 0000-0002-7427-6507 (V. Koval)
                                         © 2024 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0).




CEUR
                  ceur-ws.org
Workshop      ISSN 1613-0073
Proceedings
case of interruptions. Although interruptions in electricity supply to household consumers
are of emergency nature, they do not cause significant damage. Instead, the peculiarities of
the operation of most technological and technical systems in industry and transportat
require uninterrupted power supply or, in case of the problem, its restoration as soon as
possible [1].
   The generation of electrical energy is carried out by various methods, but in the
systems of distribution by electrical networks, the equipment that can recognize faults in
the system and replace the electrical network connected to the load with another one is
installed in order to ensure uninterrupted supply of electrical energy. In industry, the
backup power plant or own generator which should be put into operation in the event of
power outage are used as the second source of electricity at electricity distribution units.
In some cases, the selection of backup power supply link is carried out in manual mode
due to electrical switches for direct and reverse action significantly slowing down the
restoration of power supply to consumers in case of failure [2].
   Taking into account these problems, ABB company produced a series of OMD products
that can be connected to electrical network switches and provide automatic switching
function. OMD device constantly checks the operating conditions of two power sources;
and if failure occurs in the power network that has the priority of the main power source,
the backup power source is connected to the load. With the specified automated switching
of power supply links, OMD device ensures significantly shorter interruption time in
power supply of technological and technical equipment, and the switching procedure itself
does not require manual mode. Some of OMD series devices have generator control
functions and can automatically start or stop the generator. The proposed technical
system uses OMD800 device, which is more universal in terms of extended package of
functions, it can provide status information about the current state of the switch and
connected power network links via Modbus protocol, for example, to the dispatcher of the
controlled power network link [3].
   The automated system based on the laboratory stand and software, which was
implemented in the educational process of the Department of Electrical Engineering at
Ternopil Ivan Puluj National Technical University for acquaintance and application of
OMD800 device functions is considered in this paper.
   The device can be demonstrated without being connected to the computer. Instead,
when the device is connected to the computer, the software analyzes the status of the
OMD800 device using the Modbus protocol. The objective of the developed automatic
system based on the laboratory stand and software is to visualize the functioning of
devices of OMD product series during laboratory work in the laboratory of “Automated
Dispatch Control Systems” in “Power Supply Management Systems” educational course.
The students will have the opportunity to study the operation of the switch controlled by
OMD device, get acquainted with the processes of data exchange during switching
between the main and backup power supply links, and carry out the process of generator
control [4].
2. Development of the laboratory stand and connection to the
   simulator
    The main task in the construction of the automated system was to ensure simplicity in
conducting the laboratory experiment by students [5]. Graphical representation of
equipment operation using diagrams made it possible to perform the software
implementation of data exchange as clear and informative as possible. By default, the
working language for constructing the software package is English. For more flexible
application in the educational process, there is an option for language selection (English,
Ukrainian) in the program texts displaying.
    Figure 1 shows the main devices of the laboratory stand (without computer): 1 -
OMD800 automatic control unit; 2 - load reversing switch controlled by OMD device; 3 -
load reversing switch drive; 4 - converter of ADAM 4520 RS-232 into RS-485; 5 - ADAM
converter power supply (Siemens); 6 - power electrical panel (Figure 2).
    In order to increase visualization and practical application, the developed system was
integrated into the training SCADA-system “Energy” of the hardware - software complex
“Arrow” [6], which is designed as a simulator of the automated dispatch control system for
research and control of the operating modes of electric power systems [7-9].
   To exchange data between hardware - software complex “Arrow” and OMD800 device,
the program based on the Modbus RTU protocol was developed [10]. Only a part of the
available commands of OMD800 device register, which in case of need can be added to the
laboratory stand software are used in the program block presented below.
   The communication channel RS232-RS485 is used to exchange data with the devices of
the laboratory stand. The data are transferred into the equipment model, where the
messages are processed. Next, the data are transferred to the real model, where the final
processing is carried out: fixing the message in the database, analysis of emergency
situations, , and saving information about the current status of the model. During the
work, the student uses the graphical model that provides a request for input of the real
model and outputs it in a form familiar to the user - mnemonic schemes (рис. 3).
   Figure1: Laboratory stand equipment




Figure2: Power electrical panel for the laboratory stand power supply:
1 – automatic switc for personal computer powering; 2 – automatic switc for power
supply of the load reversing switch drive power supply; 3 – automatic switc of three-
phase 380V power line supplied to the load reversing switch; 4 – automatic switc of three-
phase 380V generator supplied to the load reversing switch.

                                Modbus RTU device card file
   [GENERAL]
   AddressDecrement=0
   [REQWEST]
   ; Start address, number of registers, Modbus command, group 101, whether included in
the general protocol
   reqwest01=58,14,3,1,1
   reqwest02=150,15,3,1,1
   reqwest03=166,11,3,1,1
   reqwest04=250,3,3,1,1
   [TVLIST]
   ; Start address, offset (for a bit), data type, scale (coefficient), start of scale
   ; Data types 0: ui161: i16 2: ui32          3: i32       4: float32
   ; 5: float48 6: Int647: float64 8: float80
   ; Start address, offset (for bit), data type, scale
   1_U1 - phase A voltage of the first line (with an accuracy of 0.1 V)
   tv001=150,0,1,0.1
   ;1_U2 – phase B voltage of the first line (with an accuracy of 0.1 V)
   tv002=152,0,1,0.1
   ;1_U3 –phase C voltage of the first line (with an accuracy of 0.1 V)
   tv003=154,0,1,0.1
   ;1_U12 – voltage between phases AB of the first line (with an accuracy of 0.1 V)
   tv004=158,0,1,0.1
   ;1_U23 – voltage between phases BC of the first line (with an accuracy of 0.1 V)
   tv005=160,0,1,0.1
   ;1_U31 – voltage between phases CA of the first line (with an accuracy of 0.1 V)
   tv006=162,0,1,0.1
   ;2_U1 – phase A voltage of the second line (with an accuracy of 0.1 V)
   tv007=164,0,1,0.1
   ;2_U2 – phase B voltage of the second line (with an accuracy of 0.1 V)
   tv008=166,0,1,0.1
   ;2_U3 – phase C voltage of the second line (with an accuracy of 0.1 V)
   tv009=168,0,1,0.1
   ;2_U12 - voltage between phases AB of the second line (with an accuracy of 0.1 V)
   tv010=172,0,1,0.1
   ;2_U23 - voltage between phases BC of the second line (with an accuracy of 0.1 V)
   tv011=174,0,1,0.1
   ;2_U31 - voltage between phases CA of the first line (with an accuracy of 0.1 V)
   tv012=176,0,1,0.1
   ;1_F – frequency of the first power line (with an accuracy of 0.1 V)
   tv013=250,0,1,0.1
   ;2_F – frequency of the second power line (with an accuracy of 0.1 V)
   tv014=252,0,1,0.1
   ;Start address, offset (for a bit)
   ;Reg_SL_Status – Register of additional load status
  tv015=60,0,0,1
  ;Reg_Generator_alarm – Generator failure signal register
  tv016=61,0,0,1
  ;Reg_Force_manual – Register for forced switching to manual control mode
  tv017=62,0,0,1
  ;Reg_Force_Comutation – Register of forced comutation
  tv018=63,0,0,1
  ;Reg_Generator_start – Generator start register
  tv019=64,0,0,1
  ;Reg_Inhibit_switching – Switching inhibit register
  tv020=65,0,0,1
  ;Reg_Inhibit_remote – Remote control inhibit register
  tv021=66,0,0,1
  ;Reg_Remote_O – Register for remote switching to position I
  tv022=67,0,0,1
  ;Reg_Remote_1 – Register for remote switching to position I
  tv023=68,15
  ;Reg_Remote_2 – Register for remote switching to position II
  tv024=69,15
  ;Reg_Man_Back_Switching – Reverse switching register in manual mode
  tv025=70,15
  ;Reg_Emergency_Stop – Emergency stop register
  tv026=71,15
  ;Reg1_status – No-voltage register
  tv027=58,0,0,1
  ;Reg2_status – Under-voltage register
  tv028=59,0,0,1
  [OK]
  ok=ok

       The developed program file of the Modbus RTU device map and OMD800
automatic control unit itself are the real model of the training SCADA system “Energy”. To
integrate this model into the SCADA system environment, the graphical model (Figure 3)
and configuration file containing the following data were created.

                                       Configuration file
    [GENERAL]
    ObjectCount=1 – number of substations
    ChannelsCount=1 – number of communication channels
    DisableCrashLog=1 — disable the automatic creation of logs (by default, log data is
  written to the Logs directory or the application startup directory)
    CheckInterval=1000 – control checkup period in msec.
    CommonRequestInterval=30000 — common request interval in msec.
   ; Modbus
   [Channel1] - 1 communication channel is used
   Type=1 - channel type (2 – TCP-IP, 1 – RS232)
   Thread=1 – thread number
   Port=7 – port number
   Prm=19200-8-N-1 –RS232 connection parameters (19200 – frequency, 8 – 8 bits, N
– parity, 1 – stop bit)
   ByteTimeOut=200 – waiting time for the next byte
   DataReadTimeOut=3500
   DeffaultTimeout=2000
   Description=Modbus
   [Object1]
   Type=7
   ModbusTCP=0 – The protocol used is not the classic Modbus TCP, but a specialised
                   Modbus RTU protocol is used
   Address=42 – model address
   Channel=1 – 1st communication channel
   Paused=0 – survey delay time
   // Modbus RTU map file name of the device
   Map=ABB_OD800 – object model
   Description=AVR(ABB) – model description
   [MainForm] - parameters of the main window for viewing data exchange logs (filled
in automatically).
   Top=179
   Left=738
   Width=890
   Height=627
   LVHeight=150
   [ModelState] - parameters of the window for graphic diagram placement of the
model
   Top=17
   Left=247
   Width=887
   Height=974
   [LogForm0]
   Top=182
   Left=182
   Width=698
   Height=316
   [LogForm1]
   Top=500
   Left=32
   Width=698
   Height=316
   Figure 3: Window of the graphical model of communication between the laboratory
simulator and OMD800



3. Software development for the laboratory stand
     The development and implementation of the software was carried out in Microsoft
VisualStudio environment, where comprehensive programming language tools such as
VisualBasic, Visual J#, Visual C++ and Visual C# were available [11].
     The diagrams were created in the BorlandTogether design environment, the project
schedule was implemented due to Microsoft Project, and the work of communication and
Modbus registers was performed using ModbusPoll program [12].
     The basic SwitchEnergy program consists of several modules, each of which performs
its own task.
     The communication module contains ModbusConnector class with subprograms for
Modbus communication, in particular, searching for free COM ports, opening and closing
the connection, creating a message, sending, receiving and checking errors.
     Forms module contains all the forms that are used in the program, the main one being
MainForm. When the program starts, it also creates. While launching the program,
ModbusDataForm, which contains verbal explanation of the values of OMD device
registers is created. Depending on the method the program is used, DelayForm that sets
the delay modes at different points of the electrical connection (animation mode) or
ModbusStatusForm (real device operating mode) containing verbal explanation of the
device - the current status are created.
     Graphics module contains classes that process program graphics.
     Languages module contains classes for the program languages. The division of the
program into categories and modules is shown in Figure 4.
  Figure4: Program division into classes and modules

3.1. Implementation of communication with Modbus
   Modbus request is created in ModbusConnector class, which contains subprograms
related to establishing and maintaining connection. When the user selects the correct
device mode to be used in the program, the process where COM communication ports
found on the computer are determined by the operating system is started. One Modbus
message is sent to each of the available waiting for response ports. If the response is
received, the operating port is found, and from this moment this port is used for Modbus
communication. Modbus message itself, which requests certain registers from a certain
Modbus device, is created using the following GenerateModbusQuery subprogram:

private void GenerateModbusQuery
(ushortregisters,ref byte[] message)
{
            // Address of the device is 1
            byte address = 1;
            // Starting register is always 2000
            ushort start = 2000;
            // Array to receive CRC bytes
            byte[] CRC = new byte[2];
            // Modbus query is created here. message[1] is funct. code
            message[0] = address;
               message[1] = 3;
               message[2] = (byte)(start >> 8);
               message[3] = (byte)start;
               message[4] = (byte)(registers >> 8);
               message[5] = (byte)registers;
               // After query created, calculate it’s CRC value
               CalculateCRCvalues(message, ref CRC);
               message[message.Length - 2] = CRC[0];
               message[message.Length - 1] = CRC[1];
      }.

   Since SwitchEnergy program is supposed to connect only to one Modbus device and the
data are read from predefined registers, these initial conditions are already determined as
fixed in the code. Modbus request is addressed to the slave device with identifier equal to1
and uses the function code number 3, which indicates the number of registers [13]. Eight
registers are read from the device, starting with register 2000 [14]. Modbus message is
created from this information,. The request is sent to the functional communication port
determined from the list of COM ports previously received from the operating system due
to SendQuery subprogram:

try
           {
                    // Keep track of sent messages
                    Sent Query++;
                    // Write message to serial port
                    30
                    Modbus SerialPort. Write(message, 0, message.Length);
                    // Get the response
                    Get Response(ref response);
       }
catch (Exception)
      {
                // If error received, set communication error to true
                Communication Error = true;
                Return false;
       }.

   The number of both sent and received messages is stored. If these numbers differ from
each other, the connection has failed and the user receives notification. In case of
connection failure, wait for 10 seconds until the connection is restored. If the connection is
restored within this time, Modbus requests will continue normal operation.
   The response to the sent Modbus request is stored by the subprogram: GetResponse:

      private void GetResponse(ref byte[] response)
        {
            // Get data from serial port
               for (int i = 0; i