RECURRENT NETWORK AS A TOOL FOR CALIBRATION IN AUTOMATED SYSTEMS AND INTERACTIVE SIMULATORS

It is common knowledge that the conditions of functioning of primary transducers of physical quantities, sensors, measuring instruments, controllers and other elements of automated production and automated work places of training simulators are unpredictably different from the ideal ones [1–10]. A wide range of levels, such as vibration, noise, humidity, temperature, as well as a change in parameters of technological process over a wide range, is characteristic of the mining, shipbuilding, machine-building, casting, rolling and other machining industries. Such changes in technological parameters and influences exerted by the external working environment significantly affect the accuracy of measuring a controlled magnitude [11–13]. Each of the factors that causes the error, typically under laboratory conditions, can be measured and separately taken into consideration in the results of measurements. However, under actual industrial conditions it appears impossible to take them all into account at the same time [11]. Given the impact of the specified factors, the results of measurement by each sensor, along with a predictable systematic error of the measured magnitude, include an additional random error, predetermined by a change in the modes of its operation [4–11]. The sensors that are built on the Hall effect, as well as other semiconductor sensors, have a pronounced temperature dependence and the non-linearity of characteristics [12]. These are only two of the factors among all that determine the accuracy of measurement by a given type of sensors. With regard to a rather high price related to an increase in the accuracy of measurements by improving the structural solutions and the overall circuitry, it is an important task to search for methods that imply less cost [13–17]. One of such methods for the adjustment of sensors’ characteristics is the recurrent artificial neural-network (RANN) method that has been gaining traction recently [1]. The main areas of application of neural networks include the approximation of functions, associative memory, data compression, recognition and classification, 31. Development of stratified approach to software defined networks simulation / Shkarupylo V., Skrupsky S., Oliinyk A., Kolpakova T. // Eastern-European Journal of Enterprise Technologies. 2017. Vol. 5, Issue 9 (89). P. 67–73. doi: 10.15587/17294061.2017.110142 32. Remote experiments for reliability studies of embedded systems / Tabunshchyk G., Van Merode D., Arras P., Henke K. // 2016 13th International Conference on Remote Engineering and Virtual Instrumentation (REV). 2016. doi: 10.1109/rev.2016.7444443 33. Using Interactive Hybrid Online Labs for Rapid Prototyping of Digital Systems / Henke K., Tabunshchyk G., Wuttke H.-D., Vietzke T., Ostendorff S. // International Journal of Online Engineering (iJOE). 2014. Vol. 10, Issue 5. P. 57. doi: 10.3991/ijoe.v10i5.3994 34. Oliinyk A., Skrupsky S., Subbotin S. A. Parallel Computer System Resource Planning for Synthesis of Neuro-Fuzzy Networks // Advances in Intelligent Systems and Computing. 2016. P. 88–96. doi: 10.1007/978-3-319-48923-0_12


Introduction
It is common knowledge that the conditions of functioning of primary transducers of physical quantities, sensors, measuring instruments, controllers and other elements of automated production and automated work places of training simulators are unpredictably different from the ideal ones [1][2][3][4][5][6][7][8][9][10]. A wide range of levels, such as vibration, noise, humidity, temperature, as well as a change in parameters of technological process over a wide range, is characteristic of the mining, shipbuilding, machine-building, casting, rolling and other machining industries. Such changes in technological parameters and influences exerted by the external working environment significantly affect the accuracy of measuring a controlled magnitude [11][12][13]. Each of the factors that causes the error, typically under laboratory conditions, can be measured and separately taken into consideration in the results of measurements. However, under actual industrial conditions it appears impossible to take them all into ac-count at the same time [11]. Given the impact of the specified factors, the results of measurement by each sensor, along with a predictable systematic error of the measured magnitude, include an additional random error, predetermined by a change in the modes of its operation [4][5][6][7][8][9][10][11]. The sensors that are built on the Hall effect, as well as other semiconductor sensors, have a pronounced temperature dependence and the non-linearity of characteristics [12]. These are only two of the factors among all that determine the accuracy of measurement by a given type of sensors. With regard to a rather high price related to an increase in the accuracy of measurements by improving the structural solutions and the overall circuitry, it is an important task to search for methods that imply less cost [13][14][15][16][17]. One of such methods for the adjustment of sensors' characteristics is the recurrent artificial neural-network (RANN) method that has been gaining traction recently [1]. The main areas of application of neural networks include the approximation of functions, associative memory, data compression, recognition and classification, 31. Development of stratified approach to software defined networks simulation / Shkarupylo V., Skrupsky S., Oliinyk A., Kolpakova T. // Eastern-European Journal of Enterprise Technologies. 2017. Vol. 5 optimization tasks, control over complex processes, and prediction [2]. From an engineering point of view, RANN is a parallelly-distributed information processing system. Its components accumulate, summarize experimental data in a convenient form for further interpretation and decision making [3]. The latter is especially important for creating automated systems and interactive simulators.

Literature review and statement of the problem on measuring the characteristics of a magnetic field
The scientific literature has been focused recently on the problem of sensitivity and further improvement of magnetic sensors that are built on the principle of Hall effect [18]. Despite the progressivity of solutions, for example [19], which are implemented in the new designs of sensors by introducing micro-and macro concentrators, they still do not meet the requirements [20]. The application of integrated Hall sensors [21], planar concentrators, which greatly increase the sensitivity of magnetic trajectory transportation systems, does not resolve the problem of zero drift of temperature performance characteristics of sensors during operation [22,23].
Solving this problem is of particular relevance given the introduction of concept of the "Internet of Things" [4]. Its wide range of benefits and demonstration of practical use encourages the implementation of innovative ideas for the modernization of sensory networks, based on the integrated Hall sensors. In this regard, the defining methods on the list of proposals to improve sensors include intellectualization [14], recurrent approximation [15], analytical training of RANN [16]. No less important, as a developer's tool, is an adequate description and construction of the model based on the maximization of a single quantitative expression of five criteria of adequacy [17]. Possibilities of linearization, as one of the approaches to the development of intelligent sensors to control non-linear processes, and sensory networks, were demonstrated in [5]. This concept implies the presence of a developed sensory system as a network and increases requirements for individual sensor as an element of the system [6]. Given the remote distance of a sensor network and its autonomy (some types of sensors can operate up to 10 years on the battery of type AA) [7], there is a need for self-diagnosis [5] and calibration [4]. An effective tool for solving such practical tasks, provided there is a verified algorithm, is to employ numerical methods [8,9]. Up to now, an artificial neural network (ANN), have been used for the calibration of sensors and detection of failures [5]. ANN were also applied for the linearization of characteristics [7][8][9][10], however, the algorithms constructed are complex for practical implementation based on digital signal processors and microcontrollers. In paper [10], authors proposed a method for the implementation of an ANN on 8-bit microcontroller, and examined patterns in the realization of mathematical operations that enable the representation of numbers with a fixed point.
The papers have been already published that described the examples of devices, which helped investigate the algorithms of calibration of such an object of control as a manipulator [11]. The latter was also equipped with sensors that are built on the principle of ANN [11]. A comparative analysis of the manipulator control algorithms was performed taking into account a calibration correction, based on which an intelligent algorithm was built to control a multi-link manipulator [12]. Article [13] also demonstrates an example of joint work of two genetic algorithms: calibration and control [13]. However, the need for the simultaneous use of two algorithms slows down the implementation of control process by at least two times [15,16].
The application of RANN for correcting the error of sensors in a real time mode is examined in papers [11,12,24]. They also demonstrated an example of using a network that is based on solving the equations only for the expected states of variables [24]. The latter, owing to the use of a neural technology, eliminates the need to study the dynamics of sensor parameters, but also limits the solutions only to these existing expected states of variables [24][25][26][27]. Development of intelligent sensors is much needed when designing systems with a variable configuration [26], which are capable of working in a system of sensors with different digital inputs [27]. Automated calibration makes it possible to decrease, by the introduction of RANN [26,28], the impact of such problems as the reinstallation, variation in the coefficients of amplification, non-linearity [29]. Numerical examination of the method of automated calibration, and a comparison of results to the procedures that employ piecewise-linear and polynomial approximations, demonstrate its advantages [30]. Along with this, such factors as time and cost hinder its widespread implementation [31]. No less important are the requirements for validity and reliability, put forward by modern sensor networks that are based on the concept of the Internet of Things [32] or use the distributed computer-integrated technologies for the automation of new production processes [33,34]. Introducing neural-controller control systems into modern production processes is also accompanied by the increasing requirements to the confirmation of workability and auto-calibration [35,36].
Thus, the main unsolved task is the calibration of sensors with nonlinear hysteresis characteristics under conditions of limited computational resources. The success of the implementation of RANN [15][16][17] that employ vectors-indicators of a physical quantity and its derivatives [30], as well as recent theoretical studies into intellectualization of sensors [12][13][14][30][31][32], are very promising. The experience in analytical training of neurons [16] and peripheral data processing [17] allows us to state the following goals and objectives of present study.

The aim and objectives of the study
The aim of present study is to develop a principle of automated calibration of signals from semiconductor sensors, such as the Hall sensors, which are typically used in automated production, at facilities of physical therapy and in simulators, including those for educational-training and analytical-consulting complexes of various purposes.
To accomplish the aim, the following tasks have been set: -to build an algorithm for correcting a vector of magnetic induction, which can be used under conditions of limited computational resources (on microcontrollers and SoC System-on-a-Chip); -to establish a structure of the recurrent network; -to establish a dependence of the magnitude of a measurement error on properties of the sensor and hardware features.

Construction of a recurrent network as a means of control over the processes of collecting and processing of peripheral data
To accomplish the set goal, we shall use RANN with a memory and structural elements that determine components of the vector-indicator. The latter, when learning, requires an effective tool for determining the roots analytically. Fig.  1 shows a fragment of RANN, which generalizes such an approach to peripheral data processing. The new decomposition into a Taylor's series [14,15] employs the magnitudes of indicators, which, by using the parallelization and recurrent approximation, allows us to successfully process and analyze signals [16]. Thus, if the output from neuron 3 defines a reference behavior of the system for an arbitrary vector of strategies , X and from neurons 4 and 17 for n X and 1 , n X + then deviation: defines the strategy of change in controlling influences. Components of the vector-indicator are obtained after processing the components of deviation vector (1) applying a comparator. The latter uses comparison predicates for one reference and representing the result by one value from a set of possible values (-1, 0, 1) [14][15][16]. In addition, after the addition of signals from neuron 7 and neurons 11 and 15, we shall obtain the approximated value at point 1 , n X + as the output from neuron 21: In turn, this standard element (Fig. 1) also makes it possible to estimate the error of approximation by comparing magnitudes 1 ( ) n L X + derived from (4) or measured at output 21 and output 17. The latter, in turn, opens up possibilities to refine the model and form control rules [15][16][17]. This is especially true for actual systems that have 1 ( ) n L X + as oscillating non-smooth functions, and the process of refinement requires many point approximations. To implement the idea of calibration, we additionally stabilize the time step of actuation ∆ of rules "condition-action". The latter ensures a stable transition from the expectation phase

Implementation of the mode of periodic automated calibration
To implement the principle of automated calibration, we shall additionally introduce to the measuring path a means of controlled calibrated influence on sensitive elements. We shall use a coil for this purpose, which is connected through the power amplifier to a digital-to-analog converter of the microcontroller. Assuming the estimated values of voltage at the axis of the coil for stabilized current to be reference values, under conditions of constancy of the relative position, we shall construct the calibration process. It should be noted that such a calibration would yield accurate relative data. In order to calibrate absolute values, one must first calibrate the coil itself. Suppose the coil has been calibrated; as a result, we know that ( ). Under such conditions, the process of calibrating the sensor is as follows. Upon forming the assigned value and stabilizing the force current in coil, we register initial values of initial signals from sensors. Ensuring an orderly change in current strength, which is equivalent to a change in the voltage of a magnetic field, and enabling the accumulation of pairs of input and output signals, the sensor is calibrated: The accuracy of such a process of calibrating is determined both by the accuracy of stabilization of the current strength and by the accuracy of calibrating the coil: Thus, in order to automate the calibrating of such a signal from the sensor and to adjust it periodically, it is necessary and sufficient, in the presence of a microcontroller with built-in DAC and АDC, to organize, by means of software, the process of changes in the current strength and to collect data on the incoming and outgoing signal of the sensor. When performing such a process within the working range, by changing the current strength for the opposite, we shall create possibilities for correcting a shift of zero and for sensor calibration in the presence of hysteresis in the characteristic.
The algorithms constructed have an advantage as they make it possible to calculate the ratio between the output digital signals and the calibrated influences automatically. The calculated difference in signals from outputs 21 and 17 is the maximum possible error. Zero deviations in the output signals from sensors for the obtained values of scale coefficients are ultimately a testament to the success of the process of automated calibration. The algorithms of auto-calibration were built with no assumption about the lin- earity of transmission characteristics of sensors, operational amplifiers, and ADC. The structural diagram of device is shown in Fig. 2.

Fig. 2. Functional block diagram of the device
Note that the process of automated calibration does not require to measure the temperature of the primary converter and the power voltage. The impact of these factors is automatically accounted for in the form of the "obtained instantenous values of zeros" and "obtained instantenous scale coefficients" from sensors. They typically change slowly and can be accepted as valid over a period of time. During this period, measurement accuracy will be estimated by the maximum possible error (4). Upon completion of the period of time, the procedure of auto-calibration is repeated. The magnitude of time period is assigned by the calibration algorithm. The algorithm implies an interactive setting of the magnitude of a time period. Functional block diagram of software for the instrument for measuring a three-component vector of magnetic induction is shown in Fig. 3.
To check a given algorithm, we fabricated the prototype of an instrument for measuring a three-component vector of magnetic induction. Measuring element of this instrument is built based on the sensors SS495. The algorithm for the automated periodic calibration was implemented on the hardware of microcontroller Atmega 328. In turn, simplicity of the functional block diagram shows unpretentiousness to the selection of hardware resources.
The microcontroller software is based on a module principle, using three paradigms of object-oriented programming. Such an approach opens up the possibility to scale. A complete cycle of software features is executed using nine modules. Modularity increases the percentage of reuse of software parts by the organization of requests, enables the creation of new functions without making significant changes to the existing code. To ensure the independence of software from the hardware platform of sensor realization and systems of data processing and transmission, it is equipped with a module that adapts the level of hardware abstraction (HAL). The result of introducing HAL is the simplified procedure for transferring the software through ports, selected for other hardware. All platform-dependent system functions are implemented at this level. In addition, this adapted level ensures independence from the influence of hardware features of different platforms, which is implemented by engaging computational tools, techniques, and means, and in turn increases efficiency of software. The next level in this software is represented by modules of SPI, UART interfaces, which are employed to configure and exchange data with peripherals connected to these interfaces. To implement the channel level of exchange with peripheral modules of the device for measuring a three-component vector of magnetic induction, we use protocol modules. These modules implement: -Exchange protocol with SPI ADC to measure the value of a three-component vector of magnetic induction, based on the results of signal processing from a primary transformer based on Hall sensors; -Exchange protocol Modbus-RTU for transferring measurement results to a personal computer where it will be further processed.
The next software module is a module of preliminary processing. Its functions are checking the correctness of the obtained values, and converting the data obtained to the format suitable for further processing.
A module of periodic calibration is intended to control a calibrating influence. This module also performs the function of calculating the correction coefficients and correction of values of "instantaneous zeros". Based on the obtained values for the correction coefficients, the module of error correction corrects the measured value of a three-component vector of magnetic induction, which is initial for the developed sensor.

The task of experimental research into intelligent sensor
To experimentally test the feasibility of the sensor in general, we fabricated an additional board, which holds six pairwise connected primary Hall sensors; the photograph is shown in Fig. 4.

Fig. 4. Physical appearance of the tested module of transducers
In addition, to verify correctness of work of the algorithm, we designed and fabricated a microprocessor module for testing, the prototype of which is the most simplified variant of the popular microcontroller board Arduino [37]. In line with the project, the board meets the following requirements: -the printed board is designed according to the third class of accuracy, minimizing the cost through the use of less accurate equipment;  -it allows adding the Arduino libraries for various sensors, engines, interfaces of PC and other devices connection [11][12][13], exchange protocols with various information carriers and information environments: Ethernet, Bluetooth, Zig-Bee, and others; -the core of the board is the popular microcontroller Atmega 328.
Module of stabilization of creation and amplification of the calibrated signal.
In order to ensure automated verification and testing of operational correctness of measuring elements, design of the device includes a module of automated periodic calibration. Structurally, it comprises three functional units: current stabilizer, unit of switching, and unit of generating elements.

Discussion of results: simulation, interaction between an experimental module of transducers and programming environments of simulation
To test the operation of the proposed algorithm, we used the mathematical modelling environment Matlab. To ensure the interaction between the examined module and the Simulink environment, we employed the package matlab Serial IO. This package makes it possible to organize exchange between devices and the environment of mathematical modeling using UART interface. To create the user interface, we applied Matlab GUI. By using this application, we implemented a mode of data collection from sensors, and recorded the values to a database, and changes the settings of the examined prototype, it also enabled the visualization of values obtained in real time, as shown in Fig. 5. Connection to the laboratory bench is enabled in the application through a connect button in UART interface. Data transfer and support were implemented using Matlab Serial IO; the database connection is based on the DBMS Firebird.
The results of the pilot study confirmed effectiveness of the application of communication protocol Modbus RTU, which allowed us to establish a link between the examined prototype and PC; its support was executed by the data collection software Instrument Control Toolbox. Such capabilities make it possible to connect MATLAB directly to such instruments as oscilloscopes, function generators, signal analyzers, power source, and analytical instruments. To remotely communicate with other computers and devices with MATLAB, a given Toolbox ensures a built-in support for successive protocols TCP/IP, UDP, I2C, SPI, MODBUS, and Bluetooth®. The generator generates a signal, due to which current flows in a calibrated coil and a magnetic field is created. Based on the value of magnitude at the input to the system, the magnitude of magnetic induction at the axis of the coil is given from a knowledge base on request. Upon request, the Hall sensors readouts are synchronously measured. Thus, we obtained two magnitudes that make it possible to calculate the calibration multiplier in line with procedure [26] and to record and store its magnitude in a knowledge base. As confirmed by the available data of graphic representation (Fig. 5), such algorithms are capable of performing simultaneous measurements of oppositely pairwise connected sensors, which in turn allows correction of zero of the components of vector of magnetic induction when implemented under conditions of limited computational resources. Implementation of oppositely-pairwise connection of sensors makes it possible to level off the drift of zero and different temperature dependences of the chip, which is achieved by using RANN and algorithms for determining and remembering the calibration coefficients. The latter predetermines the advantages of the proposed approach in comparison with [18][19][20][21][22][23]. However, despite these advantages, it is unknown how these crystals would behave over time and how they would be affected by the processes of aging and radiation. One should expect that under certain circumstances jumplike changes in the properties of one of the chips would give rise to the situations of uncertainty until the next process of auto-calibration. Such problems are theoretically possible, however, up to now, they have not been experimentally registered. It is obvious that only the integrated use of auto-calibration, which is built on the principles of traditional metrology and the theory of fuzzy sets, opens up broader possibilities for its application in the engineering practice, for the implementation of various projects and for the construction of methods for decision-making [38].
The theoretical and experimental research that we conducted, have confirmed the capability of RANN algorithms to correct a vector of magnetic induction when implemented under conditions of limited computational resources. New possibilities for the estimation of dependence of the magnitude of measurement error on properties of the sensor and its hardware features open new technologies for the automatic correction and calibration. The application of principle of automated calibration of signals from semiconductor sensors that are commonly used in automated production, is not limited to Hall sensors. One should expect that they will spread along with the introduction of intelligent methods for prediction, identification, and control [35,36]. At the same time, comprehensive application of the tested algorithms and protocols in combination with neural-network regulators will find its implementation in the designs of instruments for physical therapy and simulators. Especially appealing is their application in the educational-training and analytical-consulting complexes of dual application. 1. The implementation of principle of automated calibration of output signals of Hall semiconductor sensors is ensured by the application of a recurrent network that uses the tools of vector-indicators and a recurrent approximation, with their error determined by the error in the calibration curve of the coil, stabilization of the magnitude of current strength, and an error in digitizing.
2. Implementation of the correction algorithm of the vector of magnetic induction, carried out under conditions of limited computational resources, experimentally confirms the feasibility of auto-calibration on microcontrollers and SoC System-on-a-Chip.
3. Application of the recurrent neural network makes it possible to determine experimentally the magnitude of maximally possible error and to establish the dependence of magnitude of the measurement error on the properties of the sensor and hardware implementation.