Evolutionary Algorithms in Embedded Intelligent Devices Using Satellite Navigation for Railway Transport

Nowadays, the most widely spread type of a computer is an embedded system. The embedded systems consist of the following hardware (i.e. nano-electronic components) – programmable microcontrollers or microprocessors; transmitters, including the receivers of global positioning information systems, which demonstrate the state and measuring parameters of a controlled object, and which relay that to the programmable microcontroller; actuators, which receive a signal from the programmed microcontroller and relay it to an antenna, a display or an electro-drive device; and communication devices, including wireless communication with other devices and the software with algorithms of artificial intelligence (Russel, Norvig, 2006).


Problem formulation
Railway safety is an actual and important task.Nowadays a human factor is the main reason for 74% of railway accidents and crashes.This problem is actual as in Latvia as all over the world.Various crashes like in Riga (Latvia) in February 2005, in Ventspils (Latvia) in December 2008, in Aegvidu (Estonia) in December 2010, in Brussels (Belgium) in February 2010, in Magdeburg (Germany) in January 2011 prove the necessity of finding the problem solution.
The main reason of railway accidents is a human factor, when train driver does not stop a train on the restrictive signal incorrect decisions were made by signalmen (station-on-duty) in extraordinary situations Therefore, auxiliary embedded electronic devices are needed to help a train driver and station signalmen to make the best decision faster to prevent accidents if a human does not react The primary task is to stop the train before the restrictive signal.For this task a warning point G should be detected, where regular braking still may be applied (Fig. 1.).The point G* is a marginal point and also must be defined, where only emergency braking may be applied to stop the train before the signal.Using of regular braking in G* follows the passing of the restrictive signal.
The purpose of the research is to develop a prototype of a new control command and a signalling track-side and on-board locomotive's devices to improve train movement safety.
The following functions of the on-board locomotive's embedded device are required: receiving location and other necessary data from satellite navigation system reception of the data from the server about railway infrastructure (tracks, points) and control points (signals, section points) in the location of the train; -selecting the necessary signal on the way; -establishing the wireless connection with the selected signal (Fig. 2.) Evolutionary Algorithms in Embedded Intelligent Devices Using Satellite Navigation for Railway Transport 397 -receiving the data from a track-side signal checking if the train has reached the route control point; -detecting the acceleration of the train detecting the regular braking distance; -detecting the emergency braking distance; -detecting the speed limitation; -detecting the starting point of regular braking; -starting emergency braking process a module for checking the reaching of the starting point of regular braking; -warning about the necessity to start regular braking; The following functions of the track-side embedded device are required: establishing the wireless connection with the train transmitting signal value to the locomotive's device detection of the safest state of the station points using evolutionary algorithms to avoid the collision (Fig. 3.).There are many embedded transport control systems on the market which are designed to provide safety for a vehicle, its passengers or cargo, and other traffic participants.
In the commercial railway transport segment an example of such a safety system is KLUB-U, currently used on Russian Railways.It is installed in the locomotives and by interacting with existing signaling systems and its own modules provides information about the train's and its closest neighbors' coordinates, diagnostics of the brakes, current railway segment profile and maximum allowed speed, and controls the vigilance of the locomotive driver.
Still, despite the wide array of features, it lacks automation and many decisions require manual operation.
A significant component of the whole safety system is the circuits, engines and brakes diagnostics complex.While the most complete diagnostics can be performed only in the technical service environment, most failures can be detected during its operation using circuit integrity indicators and different sensors designed to uncover electrical mechanical damage.
All kinds of damages which could lead to failures can be combined into distinctive value sets, thus recognizing them in the stream of incoming data allows early identification of problems in the engine.
Artificial immune systems (AIS) were mentioned in some papers in mid 1980s but became a subject in its own right in 1994 in the papers on negative selection (Forrest et al., 1994, Kephart, 1994).Currently the systems are actively explored for possible use cases.For example, there are studies on a real-valued negative selection algorithm for an aircraft fault detection (Dasgupta et al., 2004).

Structure of proposed system for railway safety tasks
The chapter will demonstrate some issues of design and modelling of a part of a modern embedded system for a rail transport (Fig. 4.).This embedded system is intended for managing the rail transport's electrical drive and the traffic lights, and it consists of the microcontrollers, the developed software and the information system, the wireless communication possibilities and the global positioning system.
Fig. 4 illustrates a complete scheme of a structure of the rail transport's embedded system.
In the figure, the brown colour shows the train's embedded devices; the green colour stands for the devices of the traffic lights' embedded system; the purple colour -the devices of the crossing's embedded system; the yellow colour -coordination embedded system devices; the light blue colour -software which provides operation of the network of the wireless embedded system, operation of the communication network of the wireless devices and which is responsible for making operational decisions.
The device receives the signal from the defined traffic light and defines its position using a wireless communication network and has data storage with route control points as well.
Artificial immune systems use evolutionary data processing paradigm based on biological immune systems.It differs from computational immunology which models biological immune systems.Immune algorithms are mainly used to solve anomaly recognition, data collection and analysis tasks.From the computational point of view the most interesting features of the immune systems are self-learning, diversity maintenance and memory.
The problem is represented as an antigen and a solution candidates as antibodies which are randomly generated from the library of available solutions or genes.The evaluation of affinity  In the rolling stock safety system (Fig. 5) (Mor-Yaroslavtsev, Levchenkov, 2011), the invading object I is picked up by sensors S and the data is transmitted to the nearest cell tower CT, which relays it to the control center CC and the nearest locomotives wireless modems M. Through the same modem the locomotive L receives data about the closest neighbors' rolling stock position and status, railway segment profile and maximum allowed speed.
Fig. 5.The intelligent rolling stock safety system functional design L also hosts: a positioning receiver G which receives data from a positioning satellite ST; data analysis module AIS which communicates to the immune detector database DBD and control cell database DBC.Depending on the results of control cell maturation the module makes a decision and executes it by sending a control signal or displaying an alert to the driver.
Analogous to the hybrid IDS (Powers, He, 2009) the most feasible way to implement such a system would be through the two phases of anomaly detection and determination of their type to draw a conclusion.In this case the incoming data from the sensors is the set of antigens.The data includes but is not limited to speed, acceleration, voltage, rotation, temperature, and presence of smoke.

Model of differential positioning system
Differential satellite navigation systems are used to increase precision of the positioning systems that is very significant for safety-critical systems, such as transport.
Differential satellite navigation systems (Fig. 6.) contain the following object types: Each satellite S is described by the following parameters: α -slope of the satellite's orbit to the equator plane; -Ω -slope of up-going node of the satellite's orbit to the Greenwich meridian; ω -perigee angle from up-going node t -time of crossing perigee or up-going node of the satellite's orbit; where a and b are half-axes of the ellipsoid orbit; where r  -receiver's result segment error, mr t  -combined clock deviation, x r , y r , z r -coordinates of the receiver.

Model of railway station
The model of the station may be described with the following sets of objects:

Model of braking of rolling stock
The braking way consists of preparation and real segments: where S T is the braking distance, S p -distance of moving during the preparation of braking system, S D -real braking distance The braking power of the train should be defined taking into account a real force of the braking chock influencing the train wheels.A real friction factor depends on the braking chock material.
The following factor characterises the braking chock made of cast iron: 16 100 100 0,6 80 100 5v 100 The cast iron braking chocks containing phosphorus of 1,0-1,4% are characterised with the factor The mentioned above factor for braking chocks of composite materials can be defined with the following expression : 20 100 0,44 4K 100 2v 100 The calculations of braking force of the chocks also depend on a type of chocks.
For the standard cast iron braking chocks: The total braking factor: The main force resistive to the motion in idle running where N -quantity of the carriages.
Locomotive without the train: 2 0l 24 0,11 0,0035 Cargo carriages: Passenger trains: As within the time interval Δt the braking force and the opposite self-resistive force Ox ω to the motion of the train are assumed as constant values then the increasing of the speed can be calculated according to : The speed of the braking force distribution is a braking wave: Railway signal G is an object with fixed coordinates x 0 , y 0 connected to the fixed position on the track.
Each signal gG  has the following states of signals { , , , , , } , where "R"red, and rolling stock must stop before the signal; "Y" -yellow, can move and be ready to stop, the next signal is red; "YG" -yellow and green, next two sections are free; "G" -green, "V" -violet, "W" -moonlight white.

Assessment functions
Multi-criteria target function for braking: -ΔS -distance between the closed section and rolling stock -danger level criteria (DL) -ε(t) -deceleration of rolling stock ε * -optimal deceleration for passengers -comfort level criteria (CL) -dε /dt -changes of deceleration and braking torque -optimal energy consumption criteria (EL) t i -the i-th time moment of switching points x ij -state of the j-th point in the i-th time moment

Fitness function for genetic algorithm
Step 0. Initialization T i sum = 0 -for each i-th train summary time G i = 0, for each i-th train goal achievement i = 1 -selected train number Step 1. Moving the time calculation of the i-th train on the j-th railway section, / i jji tSv  where S j -length of the j-th section, v i -current i-th train speed Step 2. Check if the j-th section ends with signal.
Step 2.1.Check the occupancy of all tracks to the next signal.
Step 2.2.If any of sections in Step 2.1 is busy and the train is moving, then recalculate time with braking conditions and Goto 4. Step 2.4.j = j + 1, select next section of the route else if the j-th section is not a signal then j = j + 1, select the next section of the route Step 3. Check if the train reached the goal, then Gi = 1 Step Step 6. Check occupancy of tracks in switching moment Step 6.1.Recalculate position of the train () Step 6.2.Find "tail" of the train i end beg i

SSL  
Step 6.3.Check the occupancy of all tracks.
If switching points are busy, then T Σ = ∞, algorithm ENDS; else Goto 1

Genetic algorithm
A genetic algorithm for the task solution may be described with the following steps.If stop criteria is false then repeat the algorithm from step 4. If true then the result of the algorithm is solution s .

Shape-space concept
AIS are modeled after biological IS and carry the terms of antigens and antibodies.They can be modeled using the shape-space concept (see Fig. 8.) (Musilek et al., 2009).The shapespace S allows defining antigens, receptors and their interactions in a quantitative way.The affinity of an antigen-antibody pair is related to their  distance in the shape-space S and can be estimated using any distance measure between the two attribute strings.The distance between an antigen, Ag, and an antibody, Ab, can be defined, for example, using a general class of Minkowski distance measures: By varying the value of the parameter p a suitable measure of distance can be obtained.

The negative selection algorithm
Negative selection is the paradigm describing the evolution of the T-lymphocytes where they are randomly generated and learn to recognize all except the self structures, specific to the host.Negative selection algorithms need training samples only from one class (self, normal), thus, they are especially suited for the tasks such as novelty, anomaly or change detection including those in engines and other devices.
The key advantage of anomaly detection systems is their ability to detect novel attack patterns for which no signature exists, while their most notable disadvantage is a larger false positive rate.
The algorithm: Step 1. Define a set S which needs to be monitored and the set P of the know self 12 , ,..., elements in a feature space U.The set U corresponds to all the possible system states, P -normal states and S -the current state which changes in time.
Step 3. Compare each candidate c i to the set of known good elements P.
Step 4. If a match occurs, discard the individual c i , otherwise store it in the mature detector set D. Or, to maximize the nonself space coverage with a minimum number of detectors, move the matched candidate away from the closest element p j , then store it in D.
Step 5. Monitor S for changes by continually matching it against the detectors in D. If any detector matches, the change which has occurred most likely is dangerous, as D is designed not to match any normal system state.
This algorithm produces a set of the detectors capable to recognize non-self patterns.The action following the recognition varies according to the problem under consideration.In the case of transport safety control system it could be an alarm or issue of an immediate stop signal depending on the detected fault.
The detectors and the caught fault conditions are stored in an immune memory for further processing and to provide further information about the consequences of the attack and possible future actions instead of simply reporting the incidents.

Computer experiments 6.1 Computer experiment of genetic algorithm
The task of the experiment is to minimize idle time of trains on the station and to minimize the risk of their collision.
The station (Fig. 9.) with 4 points p 1 , p 2 , p 3 , p 4 is given and two trains V1 and V2 are approaching.Railway tracks of the station are split into the sections, where start and end of each section is a point or a signal.The length of the trains L v1 = 500 m and L v2 = 300 m is given.One data set for the experiment was taken from the two PLCs in the field attached to a vehicle and a level crossing.The data collection scheme is presented in Fig. 11.The communication between the PLCs is facilitated by GPRS modules and a server running on a PC.Through the chain of software tools the data is piped from the PLCs to DB tables.
The data was collected into two tables for records related to a vehicle and a level crossing.The report (Fig. 4) contains this data cross-matched using the date and time -as all the data was simultaneously recorded with discrete steps of 1 s, the matches are 1:1.
This provides a set of data for test runs of the algorithms.

The real-value negative selection algorithm
The RNS detector generation starts with a population of candidate detectors, which are then matured through an iterative process.In particular, the center of each detector is chosen at random and the radius is a variable parameter which determines the size of the detector in m-dimensional space.The basic algorithmic steps of the generation algorithm are given in 5.3.2.
The whole detector generation process terminates when a set of mature (minimum overlapping) detectors are evolved which can provide significant coverage of the non-self space.
A detector is defined as    The testing of the algorithms on a 2-dimentional space proves that the detectors show good coverage of the non-self space and a stable detection of non-self antigens.Fig. 13.shows the coordinates, radii, overlap and detection score of the first detector generation.The population should stay the same but after 3 generations the detector population decreased (Fig. 14.) but still detected the pathogens (Fig. 15).The chosen actions did not differ much probably because of the implementation which needs further research and improvement.

Computer simulation of the railway station
For the experiments the program for programmable controller was implemented.The controller performs all the calculations and controls the electric drive and traffic lights on the functional prototype.
The computer model is created to show the results of controller's operations to perform an emergency stop before the red signal of the traffic lights.
The specific environment is developed by the authors for the modelling of railway system for safety improving algorithms (Fig. 16).
The data from the specific memory addresses of the controller is read by the server (Fig.    Each rolling stock and signal is equipped with receiving and transmitting devices that give a possibility in a multi-agent system. Electrical part of the model (Fig. 19.) consists of a DC drive with characteristics of 8 DC motors, 1 switch to connect or disconnect the electric drive from the electric contact network, and 2 pairs of switches for acceleration and for braking that changes direction of field current I f flow.A braking branch contains braking resistance.An output of a DC drive is an electrical torque which handles the mechanical part of a rolling stock.

Experiments of prototype in real conditions
The result of this work is a train emergency braking device.The invented device is proposed to increase safety on railway transport.It gives possibility to stop rolling stock automatically before a closed signal timely.
In contrast to the known devices that actuate brake only after the passing of a closed signal, the invented device provides a train emergency braking and stopping before a closed section, even if it is not equipped with automatic locomotive signalling.The device also provides a distance control and an emergency braking way calculation.
The detector of the regular braking distance determines an emergency braking distance, but the detector of the starting point of regular braking defines the point on the route when braking should be started.The module for checking the reaching the starting point of regular braking evaluates location of the train, defines starting point of regular braking and operates braking signalling device in the cabin, the module for controlling starting of

Conclusions
Advantages of the proposed device are the following: The device is not using rail circuits and works independently of automatic locomotive signalization system.The proposed device is an alternative or auxiliary to existing safety systems.As opposed to existing systems the new device uses wireless communication network and may work in railway sections without an automatic interlocking system.The possibility to prevent a dangerous situation and a crash corresponding to the condition of the braking system of rolling stock allows stopping the train before dangerous failure time point; possibility of using of already existing measurement devices and sensors together with the new sensors.
The results of the experiment show the possibility to use the proposed system as an auxiliary safety device to prevent breaches of red signal and crashes on the railway.
The most relevant features of immune algorithms are self-learning, diversity maintenance, memory about the past decisions, and detection of previously unknown but related elements, noise rejection and classifying ability.
An intelligent rolling stock safety control system could benefit from using a combination of both an immune negative selection algorithm and a clonal selection algorithm.A fault detection system for railway electric transport could benefit from using an immune negative selection algorithm.
The most feasible way to implement a railway electric transport safety control system would be through the two phases of anomaly detection and determination of their type to draw a conclusion about further action.
Single string data encoding is better suited for use on PLC.The PLC program needs a data buffer to eliminate the risk of data loss due to unstable radio signal.

Fig. 2 .
Fig. 2. Selection of the necessary signal on the way.

Fig. 3 .
Fig. 3. Detection of the safest state of the station points to avoid the collision.a) Initial state, b) Collision is possible, c) Collision is avoided.

Fig. 4 .
Fig. 4. Wireless network structure's scheme of embedded devices for a rail transport

Fig. 7 .
Fig. 7. Graphical interpretation of station model www.intechopen.comEvolutionary Algorithms in Embedded Intelligent Devices Using Satellite Navigation for Railway Transport 403

Fig. 8 .
Fig. 8.A shape-space model of an antigen and an antibody.chromosomes in the in the evolutionary algorithms, depending on a problem being solved it also could be a set of integers or binary numbers -m Z L or {0,1} L m  .

Fig. 9 .
Fig. 9. Structure of the station for the computer experiment
d = (c, r d ), where c = (c 1 , c 2 , …, c m ) is an m-dimensional point that corresponds to the center of a hypersphere with r d as its radius.The following parameters are used (Fig. 12):  r s : threshold variation of a self point;  α: variable movement of a detector away from a self sample or existing detectors;  ξ: maximum allowable overlap among the detectors, allowing some overlap can reduce holes in the non-self coverage.

Fig. 12 .
Fig. 12.A screenshot from the computer program running a real-valued negative selection algorithm showing the initial settings for training the detector set.During the straightforward detection process the matured detectors are continually compared to new test data samples.The distance D between a sample pattern p = (c p , r s ) and a detector d = (c d , r d ) is computed in the same way as in the detector generation phase.If D < (r s + r d ) then the detector d gets activated indicating possible fault.

Fig. 14 .
Fig. 14.The fourth generation of detectors after running several suppressions.

Fig. 15 .
Fig. 15.Test runs with a sample of antigens on each detector generation with detection results. 17 .) and transferred to the model.

Fig. 19 .
Fig. 19.Fragment of the electrical part of the computer model of the rolling stock The current experiment is proposed for modelling of crash prevention of two trains moving towards each other.The model consists of 3 series block-sections; 2 rolling stocks; 4 railway signals (Fig. 18.).

Model of railway infrastructure and command and control system
t t -time from the moment when the driver turns the handle of the hoist till the pressure appears (?) in the braking cylinders; air wave : 20 Algorithm stops by time, generation, convergence or by another predefined criteria.

Table 1 .
shows the dynamics of genetic algorithm.The algorithm is performed in 2 seconds and the algorithm converges completely in the 12th generation, where an average value of the population is equal with the best value.

Table 1 .
Average and best values of fitness function on each generation