Automated system for identifying fields during grain harvesting using satellite navigation and RFID to meet the new requirements of russian legislation on the traceability of grain batches and products of its processing

. With the entry into force of the Decree of the Government of the Russian Federation on the traceability of grain, agricultural producers are obliged to promptly enter data on the grain harvested from the fields and the place of its storage into the information system. For guaranteed data entry, it is proposed to implement, in parallel with the existing procedure, a grain receipt accounting system based on tracking the geolocation of the place of grain reloading from the combine into vehicles for transportation with related data. The system includes a software and hardware complex for collecting, storing, processing information during harvesting and transferring the received data to the information system. The hardware part of the system is a device for determining the location, data exchange and an information storage unit, which are installed on vehicles (combine harvesters, harvesters, trucks), weighing stations, grain storage places. The software part includes a database of all objects in the field, fields and grain storage areas, a data processing module according to the described algorithms and an interface for interacting with the information system.


Introduction
The current legislation and accounting rules require the preparation of a number of documents when harvesting grain.For agricultural producers, this entails additional costs, as well as the organization of additional actions by employees.The accounting system is currently being changed.We will try to propose measures that will allow in the future to reduce costs, simplify the workflow during grain harvesting and increase the reliability of collecting the necessary information.

Current legal regulation
Currently, grain movement is tracked using standard forms SP-1 and SP-2, approved by the Decree of the State Statistics Committee of the Russian Federation of September 29, 1997 №68.The procedure for its use is established by the Guidelines for the accounting of inventories in agricultural organizations, approved by order of the Ministry of Agriculture of the Russian Federation of January 31, 2003 №26 (hereinafter referred to as the Recommendations of January 31, 2003), as well as the Guidelines for accounting costs and output in crop production, approved by Ministry of Agriculture of the Russian Federation on October 22, 2008 (Recommendations of October 22, 2008).
According to the Recommendations dated October 22, 2008, the register of sending grain and other products from the field (form SP-1) is used to register the dispatch of products from the field to their storage places.The register of acceptance of grain and other products (form SP-2) is used to register the receipt of products for current and other storage places.
The current system involves working with these registries in paper form.The registers are filled with the participation of a combine operator, a driver, a current manager (storekeeper) at each stage of the assembly and movement of grain.Subsequently, the registers are submitted for verification to the accounting department.
The advantage of this system is the mutual verification of sent and received grain.Manual filling of registers was convenient in conditions when there were no electronic means of tracking and information exchange.Although this made it difficult to process documents and made it difficult to control the movement of grain.
The disadvantage of this system is the low accuracy of the information obtained, due to the influence of the human factor, the difficulty in estimating the weight of the resulting grain (in the absence of a weighing system on the combine), the low speed of processing data from paper, the impossibility of monitoring the grain supply in real time.
At the same time, in addition to the difficulties associated with the preparation of documentation accompanying the grain harvest, there were also shortcomings in the legal regulation.Thus, there was no regulatory framework in the field of ensuring the safety of grain and mechanisms for traceability of grain batches from producers to end consumers (from the processing organization to the importing country), which is necessary for more objective monitoring of the situation with the quality and quantity of grain produced, and tracking the characteristics of wheat (protein, gluten, nature, etc.) sold on the market, consistent with the needs of consumers and with international practice and having sufficient accuracy.
In 2021, changes were made to the legislation on agricultural products (grain complex).The changes, in particular, provided for the creation of the Federal State Information System for the traceability of grain and products of its processing (the Grain Traceability System), which will allow tracing the life cycle of grain and products of its processing (from its production to release into circulation), as well as to create a state a quality control system for grown grain to prevent illegal circulation of grain and products of its processing and ensure the quality of grain and products of its processing.
The rules for the creation of the Grain Traceability System were approved by Decree of the Government of the Russian Federation of October 09, 2021 №1722 "On the Federal State Information System for the traceability of grain and grain processing products" (the rules).
The rules stipulate that, along with government agencies, grain producers are suppliers of information to the Grain Traceability System.
There is also a list of information that should be provided by commodity producers when harvesting grain.In particular, it is provided that, having authorized through a unified identification and authentication system, commodity producers, using an automated workplace, submit the following information and information to the Grain Traceability System: on the place of cultivation of a grain batch; the area of the land plot or its part (field) from which the grain harvest was harvested; information about the rights to the land plot; type of crop grain; the mass of grain produced on the day of harvest; storage place for grain.
Forms and formats of data and information provided by agricultural producers in the course of state monitoring of grain at the place of cultivation with a geographical indication for the formation of grain batches are also approved by the Rules.

Technical means and algorithms
These changes in the procedure for accounting for harvested grain, as well as the introduction of the Grain Traceability System, lead to the fact that agricultural producers are faced with the need to maintain documentation in accordance with the new rules.Together with the general focus on informatization of all spheres of life, including the conversion of documentation into electronic form, this area requires new approaches.
To eliminate the above disadvantages of the existing system for tracking the movement of grain, it is proposed to introduce a system for automated maintenance of a register of grain batches received during harvesting, followed by loading into the Grain Traceability System.It is proposed to introduce a system based on RFID tags on machines involved in harvesting and transporting grain from the field to the granary.Technologies based on RFID/NFC have long been part of our daily lives.Over the past decade, it has been used in almost every industry from medicine to banking.It did not bypass agriculture [1].In the world there are many solutions for monitoring and recording the movement of vehicles using RFID: from police control of passing vehicles [2] to school buses [3], as well as in agriculture [4].
The system consists of passive static and dynamic RFID tags on each combine harvester, harvester, and other vehicle (the vehicle) working on harvesting.The choice of a passive tag with a range of up to several meters is associated with several factors [5]: 1) the limited range of the tag will not allow the vehicle to erroneously identify the neighboring tag 2) ease of installation of the tag and its low cost 3) protection of this type of tags from unauthorized reading of information from the tag.The tag is placed in the area of the unloading auger of the combine in order to minimize the level of interference between the antenna and the tag, because harvester auger is the closest harvester unit to the vehicle during unloading.The close location of the passive tag allows you to accurately set the start and end time of grain reloading from the combine bunker to the vehicle [6].
An RFID antenna, an active dynamic tag, a smart card reader, a microcontroller for processing and storing information, a GPS receiver with a low-precision module, a control panel in the driver's cab, and a GSM modem are installed on the vehicle [7].The antenna is placed in the area of the vehicle body at approximately the same distance from the front and rear walls to cover the entire area of operation of the combine auger.A dynamic RFID tag is placed for data exchange between the vehicle and the weighing station in situations where data cannot be transmitted via the GSM channel.
An antenna is installed on the weighing station for reading data from the vehicle microcontroller memory into the central database.Work algorithm (Figure 1).When filling the bunker of the combine, the combine informs about the readiness to unload the grain.When a vehicle approaches for reloading and opening the combine auger, the driver of the vehicle lights up the lamp for accepting the combine label and confirming the start of grain unloading.The information from the combine tag, the date and time of the start of unloading, the coordinates of the start of unloading, data from the driver's smart card, and similar data are entered into the memory of the microcontroller at the end of unloading, when the tag of the combine moves away from the vehicle and confirmation of the end of unloading is received.After that, the vehicle is sent to reload the grain to the next combine.As a rule, to fully load the body of the vehicle, it is necessary to reload 2-4 combine bunkers.
If there is coverage of the GSM network, the data is transmitted to the weighing station, in the absence of coverage, the data is stored in the memory of the microcontroller and transmitted via RFID\NFC directly to the weight using a dynamic label [8].The length of one record of the operation does not exceed 64 bytes, taking into account the checksum of 16 bits.Thus, the maximum required amount of EERPOM tag memory is 512 bytes.After filling the body of the vehicle, it is sent to the weighing station, where the exchange of data on the delivered grain lots takes place and, together with the actual weight of the grain, are entered into the database.(Table 1) The unit of record in the database is a batch of grain from one combine.To determine the approximate weight of grain received from each combine M fact , a formula that includes the volume of the bunker of each type of combine can be created  hpper (m3), grain weight according to data from the weighing station M  (kg), auger unloading speed r (m3/s) and unloading time t (сs): For each field, the area, address, sown culture (variety), form of property rights are known.The database stores data on the contours of the farm fields in the form of an array of coordinates of edge points (Pi(xi;yi), where i=1,2,3…nnumber of edge points) of each field.
Field edge point coordinates are recorded using GPS trackers or online sources (eg OneSoil).At the same time, the boundaries of the field expand to the boundaries of the road, where most often there is an overload of grain to prevent overconsolidation of the soil by the wheels of the vehicle [9].This also allows leveling errors in measuring the contours of the fields and the position of the vehicle during unloading.To expand the boundaries by a given value L (Figure 2), we find the normal n ̂ of each edge point P i (x i ; y i ) through the sum of normalized vectors b i−1 ̂+ b i ̂, formed by the sides of the field adjacent to the point [10].
Let's find the actual length l of the resulting vector using the formula: where αangle between side vectors.Using the cosine formula between vectors and the half angle formula, we get rid of trigonometric functions: wherein |b i−1 ̂| and |b i ̂| are equal to 1, because the vectors are normalized.We obtain: Multiplying the resulting actual length of the vector with its coordinates, we obtain the point offset   ′ (  ′ ;   ′ ) relatively to   (  ;   ) The next step is to check all the obtained points for entry into the already expanded fields in order to exclude the overlap of closely spaced areas.To do this, we use the method of ray tracing from a point [11].Using the same method, we will determine the relative position of each unloading point T (x0; y0) relative to the boundaries of each field (Figure 3) until the first match: calculate ti at For all ti<0 count the total number of intersections: If the sum is an odd number, then the point lies inside the field, if even or equal to 0, then outside it.Wherein ti=0 if the point lies on the border of one of the fields and within the framework of this algorithm, we assume that the unloading was carried out within the boundaries of this field.
The ray tracing method was chosen as the least resource intensive and accurate enough to solve the problem.Also, this method does not require preliminary calculations.Fields are, as a rule, convex non-self-intersecting polygons for which the use of an improved ray tracing algorithm is most justified.[12] However, in addition, you can use an advanced pointrelative-polygon index algorithm, which in this form is essentially a variation of the ray tracing method.[13].
The field is determined for the beginning and end of unloading, which minimizes the risk of an error in determining the field when unloading grain while the combine is moving.If one of the points does not correspond to any field in the database, then we look for the nearest field.To do this, we find the cosine of the angle between the sides of the fields and the segment (Figure 4) connecting the point with the beginning and end of the side of the field through the scalar product of vectors.If one of the cosines is negative (that is, one of the angles is obtuse), then the shortest distance to the side of the field is the smallest of the segments connecting the point to the beginning or end of the side of the field a2.(Figure 5) If the cosines of the angles are positive, then the shortest distance to the side of the field will be the perpendicular h, lowered to this side (Figure 6).We express the perpendicular from the formula for the area of a right triangle, which we find using the skew product of vectors.
Now let's compare the distances to all sides of the field and choose the smallest onethis will be the shortest distance to the field.It remains to compare the received value with all fields in the system and determine the nearest one.Also, a note is made in the database for manual verification of the place of grain unloading.
Provided that the movement of combines between fields with a full bunker is prohibited for safety reasons, the reliability of the data obtained about the field from which the batch of grain arrived is very high.
At the end of the harvesting day, the data for each field is summarized and uploaded to the Federal system through a workstation.

Conclusions
Thus, the creation of the Grain Tracking System in Russia as a nationwide registry will require agricultural producers, especially large ones, to create similar systems within their production.Large agricultural enterprises are already using modern technologies for compliance, product traceability, service management and fraud protection [14].Taking advantage of new technologies to increase productivity allows you to manage more acreage, reduce costs and increase profits [15].
The economic and organizational effect of the introduction of such technologies for the manufacturer will be to increase transparency, ensure product quality; the ability to track grain for faster and better response to problems; and process efficiency through simplification and automation that reduce time, effort and cost [16].
For the purposes of public administration, the Grain Traceability System will allow tracing the life cycle of grain and products of its processing (from its production to release into circulation), and will also create a state system for monitoring the quality of grown grain to prevent illegal circulation of grain and products of its processing and ensure the quality of grain and products its processing.
Similar systems are already used in the world in agriculture ( [17]; [18]), as well as in other industries [15].As such systems are implemented and scaled up, their cost will decrease, which will facilitate widespread adoption and efficiency.

2 ( 15 )Fig. 4 .
Fig. 4. Determining the position of a point relative to the side of the field.

Fig. 5 .Fig. 6 .
Fig. 5. Projection of a point outside the side of the field

Table 1 .
An example of a data block transmitted from a vehicle to a weighing station.