#### Abstract

Automatic guided vehicles (AGVs) are unmanned transport vehicles widely used in the industry to substitute manned industrial trucks and conveyors. They are now considered to play a key role in the development of the Industry 4.0 due to their temporal and spatial flexibility. However, in order to deal with the AGV as a potential mobile robot with high capacities and certain level of intelligence, it is necessary to develop control-oriented models of these complex and nonlinear systems. In this paper, the modelling of this vehicle as a whole is addressed. It can be considered composed of several interrelated subsystems: control, safety, driving, guiding and localization, power storage, and charging systems. The kinematics equations of a tricycle vehicle are obtained, and a controller is proposed. An extended hybrid automata formalism is used to define the behaviour of the safety and the control systems, as well as their interaction. In addition, the electrical equivalent circuit of the batteries, charger, and the motors is studied. The architecture of the holistic model is presented. Simulation results of the AGV in a workspace scenario validate the model and prove the efficiency of this approach.

#### 1. Introduction

Automatic guided vehicles (AGVs) are unmanned transport vehicles widely used in the industry to substitute manned industrial trucks and conveyors [1]. They have been proved an efficient element in factory workspaces, helping to reduce logistic errors and operative costs.

Many researchers in manufacturing systems recognize the following Industry 4.0 (I4.0) design principles: interoperability, virtualization, decentralization, real-time capability, service orientation, and modularity. All these principles are connected in some way with the operative of the AGVs. For example, AGVs can easily readjust their program ensuring real-time reaction to unexpected changes in the logistic flows of the production plan. They can also operate in a decentralized way, without any central server commanding orders.

On the other hand, several I4.0 key enabling technologies have been identified in the literature to make these principles possible: autonomous robots, additive manufacturing, simulation, system integration, cloud computing, Internet of things, cybersecurity, augmented reality, and big data. AGVs are included into the category of autonomous robots as one of these technologies. In addition, this AGV can be easily interconnected and integrated with other machines and devices in the plant by its input/output subsystem. Moreover, these AGVs generate a large amount of data which are transported by IOT protocols such as MQTT, stored and processed by cloud computing systems, and can be exploited by big data technologies to obtain KPIs and optimize the production.

For all these reasons, they are now considered to play a key role in the development of the Industry 4.0. Even more, the new concept of collaborative mobile robots seeks the convergence of AGVs and collaborative robots [2].

However, this synergy demands to deal with the AGV as a potential mobile robot with high capacities and certain level of intelligence. Thus, the necessity of control-oriented models of these complex and strong nonlinear systems is clear. Even more, to take these robots to a further step, understanding their behavior and establishing safety requirements are a must. This will allow them to advance from assembly tasks to a genuine human-robot collaboration.

An AGV is a multivariable complex mechatronic system composed of several subsystems and with a strongly coupled dynamics. Each of the main elements of an AGV influences its dynamics. The power storage affects the control performance and the motion of the AGV. In turn, the control influences the power consumption and thus the power storage. An AGV usually works in a space shared with other robots, so these other vehicles or even people are perceived as obstacles by the safety subsystem that modifies the working conditions accordingly.

Even more, AGVs are normally used to automate logistics and production flows. These processes involve managing a fleet of robots traveling on the same scenario. Indeed, it is considered a multilayer problem [3], where several issues have to be addressed: the design of the layouts, the warehouse and the production plant, the storage strategies, the traffic scheduling, algorithms to share the charging stations, path planning, navigation, routes assignation, and so on. To take all of these simultaneous processes into account, a global model is necessary. This model will also allow to improve the efficiency of these vehicles and the production optimization.

In this paper, we address the modelling and simulation of an AGV as a whole. First, an architecture that relates all the subsystems that are part of the AGV is proposed. Then, each of them has been described and mathematically modelled: the control, safety, driving, guiding and localization, power storage, and charging systems. Besides, the kinematics and dynamics equations of the vehicle are developed. They have been implemented for a real industrial complex AGV, a hybrid tricycle-differential one. This holistic approach gives realistic results in the simulations of the vehicle, which allows us to validate the models.

The main contributions of this work can be summarized as follows:(i)The development of a general and high level of the abstraction model of an AGV. It has been divided into subsystems whose models can be used to implement different types of AGVs.(ii)The identification of all the interactions between the subsystems and its integration.(iii)The development of the mathematical model of the dynamics of a hybrid differential-tricycle AGV (this hybrid differential-tricycle AGV has not been previously studied in the literature).(iv)The mathematical description of the safety subsystem and the control subsystem based on the hybrid automata formalism. This approach is completely original.(v)The implementation of this general model into a specific model of a real industrial AGV, the Unibot AGV of the company ASTI Mobile Robotics [4].(vi)The integration of the kinematics, dynamics, and electrical equations in the simulation of this type of AGV.

The rest of the paper is organized as follows. Section 2 presents a brief state of the art on the AGV modelling. In Section 3, the architecture of the AGV is developed. The description and equations of the different subsystems which compose it are presented in Section 4. Simulation results on a working scenario are discussed in Section 5. The document ends with the conclusions and future works.

#### 2. Related Works

The first paper published on the design and operation of AGV systems was the work by Maxwell and Muckstadt, in 1982 [5], where a methodological framework for specifying the operational characteristics of an automatic guided vehicle system was presented. Since then, the research on this topic has not stopped growing. Nevertheless, the works found in the literature mainly tackle the system focusing on individual aspects of the AGV: kinematics, control, charging, and so on, that are not independent. Indeed, the majority focus on its kinematics and control, or the localization algorithms, or the power storage, or the charging system, but they lack a holistic approach of the guided vehicle as a whole system.

There have been several attempts to model the AGV, for example, Veiga et al. compared vehicle models of a tugger-trolleys system with three linked towed. One model is a complete multibody model of the system. The second is a simplified version composed of vertical and handling models for motion in a plane, assuming no planar forces on the trolleys' front wheels and linking the vehicles with multibody joints and body, representing the coupling arms, developed in Modelica language. Results show good agreement between the models but the second one was much faster and provided more stable results [6].

A kinematical and dynamical analysis of a mobile robot belonging to the configuration classical tricycle is shown in [7]. For the kinematical analysis, authors consider a robot capable of locomotion on a surface by the action of wheels mounted on the robot. The dynamics of the nonholonomic mobile robot is obtained based on the Euler–Lagrange methodology. The paper is focused on the analysis of global asymptotic stability of a new position controller for this wheeled mobile robot.

In [8], authors state that the complexity of AGV dynamics and the difficulty of obtaining the actual vehicle dynamic parameters have led them to use two nonmodel-based control approaches. The robot is equipped with a front-centered steerable wheel and fixed parallel rear wheels. They present a comparison of control techniques for robust docking maneuvers of an AGV, specifically, fuzzy control and vector pursuit that do not require a mathematical model of the vehicle dynamics.

Recently, Montazerijouybari et al. proposed a mathematical model based on the kinematics of 2-DOF AGVs with differential driving wheels and caster wheels in order to predict the behaviour of the robot when the vehicle is carrying heavy loads not well distributed on it.

A trajectory tracking control of an AGV based on sliding mode control with an improved reaching law is proposed in [9]. The AGV in this paper has two driving wheels and two universal wheels. They consider a fully functional AGV composed of the motion mechanism, the sensing system, and the control system. Authors do not consider the rest of the systems of the vehicle. The work designs a double closed-loop control method to control the vehicle to track the given trajectory. With the same control-oriented aim, in [10], the analysis of the kinematics and dynamics of a four-wheel omnidirectional automated guided vehicle is presented.

There are other AGV-related topics that are dealt with in this paper, such as localization and navigation. In many cases, the routes implemented by these vehicles are subject to constant changes and are adapted to the currently assigned task. Thus, the sensors that allow the AGV to follow the path are an important element of the guided vehicle. Although usually the vehicle sensors are not modelled, the most common ones have been studied. Just a couple of examples are as follows. An intelligent path recognition system for vision-guided AGVs, able to tackle noise in the images captured by using a CCD camera, is presented in [11]. The paper addresses some of the most challenging problems for a vision-based AGV running in a complex workspace and improves the accuracy and reliability of vision recognition of guide paths for AGVs by means of artificial intelligence methods. Authors in [12] proposed an interesting method to measure the wheel radius. This radius is not constant, and in the case of automated guided vehicles using odometry, this is a key information to calculate the position of the vehicle. Stetter et al. designed virtual sensors that estimate forces and torques acting on an AGV [13]. However, this AGVs consists of four sprung arms that each dispose of one drive motor. For this system, they obtain a simple description of the AGV dynamics and then develop a set of virtual sensors that enables estimation of the forces and torques. Indeed, authors say that they try to avoid the use of complex tire models. The study is meant for several diagnostic purposes such as fault detection or fault prevention.

Another AGV component, the charging system, has been also the object of study by some authors. For instance, a battery management simulation is developed for evaluating battery-related costs under various AGV operation modes and for designing battery management strategies [14]. Hou et al. developed a novel energy modelling method which allows to calculate and predict the AGV energy consumption [15]. However, in this work,we do not consider energy efficiency either the design of the battery, but the simulation of the electrical performance of the AGV's battery. The charging method is out of the scope of this paper.

Finally, there are several works about the control of a fleet of AGVs. A detailed state of art on the design and control of several AGVs is presented in [16]. In this paper, author discusses the literature concerning the usage of AGVs in manufacturing and other new areas of these vehicle application, namely, distribution, transshipment, and transportation systems. As a conclusion, the author states that the most important differences between the usage of AGVs in manufacturing areas and in other environments can be noticed in the number of AGVs used. Besides, the author claims the necessity of analytical and simulation models which simultaneously address multiple design and control problems. Different vehicle platooning control strategies are presented in [17, 18].

As shown above, most of the studies found in the literature are mainly focused on individual aspects of the AGV design problem: kinematics, control, guiding, energy, and so on. However, these components are not independent; indeed, these subsystems are highly coupled. Therefore, a holistic and complete vision of these automatic vehicles is missing, where the interactions among their various elements are evident in the models used so that the simulation is realistic.

#### 3. Description of the Industrial AGV Architecture

There are different ways to split up an AGV into its different parts. We have considered the following interconnected subsystems that describe the whole behaviour of the vehicle: driving system, guiding and localization system, safety system, motors, power storage and charging, and control system. These elements interact with the working environment. Figure 1 shows the AGV architecture with all the mentioned systems and their relationships.

The control system can be considered the brain of the AGV. Depending on the localization, on the external inputs and the current state, it adjusts the charging system, generates target signals for the driving system, commands the outputs, and adjusts the safety system. The driving system collects the dynamic and kinematic of the AGV motion; it changes the position and orientation of the AGV and modifies the working environment. It also gives information about the current to the control system in order to close the control loop. The driving system is the component that demands more energy from the power system.

The safety system detects obstacles in the safety zone and warns the control system; it can even trigger an emergency stop. The charging system is responsible for recovering the energy of the power storage system. This subsystem is usually placed out of the vehicle when there is not enough space in the AGV. The power storage is in charge of providing energy to the electronic components and the motors.

The guiding and localization system (GLS) manages AGV position and attitude measures, which are used by the control system. Depending on the technologies used to implement the GLS, this information will have greater precision. There are technologies, such as simultaneous localization and mapping (SLAM), which provide information about the absolute coordinates (*x*, *y*, angle) of the AGV with high accuracy. Others only provide the deviation respect to a predefined trajectory, either marked on the floor or buried, such as magnetic antennas, optical sensors, and so on, and must be complemented with a localization system such as RFID tag sensors (low accuracy) or UWB devices (medium accuracy) to know the absolute position.

On the other hand, the input/output system allows to introduce information to the AGV from other external sources: machines, operators, and so on, and extract information. Finally, the workspace represents the external environment and everything that can produce any changes to the AGV behaviour.

In this paper, we are going to model a hybrid differential-tricycle AGV. This vehicle has been selected because nowadays is one of the most used AGVs in the industry. An example of this type of AGVs is the Unibot AGV of the company ASTI Mobile Robotics [4], represented in Figure 2.

The Unibot is mainly used to convey loads by pulling carts. This vehicle is robust, simple, flexible, and reliable and well-established in the market vehicles. Though with reduced dimensions, it has great load capacity. It is fully connected in real time.

This industrial tow AGV can be used in whatever industry where medium loads need to be towed. However, it achieves its full potential in enterprises where recurrent flows of pieces and/or products exist. They can be applied in any SMEs and large companies (for further information on enterprise categories see [19]) although it is commonly found in the automotive industry as it is one of the most automatized sectors. Moreover, it is easy to include them in already functioning enterprises as these automatic guided vehicles do not require to modify the infrastructure in order to implement the layout. Indeed, the layout can be usually easily removed and moved to adapt it to changes in the production plant. However, also in companies that are going to start the production, it is possible to design the plant taking into account the layouts of the AGVs to optimize the intralogistics.

In addition, it has many other functionalities such as magnetic guidance/navigation system (surface/buried), online charging system, safety laser for internal environment, safety PLC, and emergency stop button, among others.

This is a complex system because it has two wheels as a differential robot and a tricycle configuration in the front part. Most of the models found in the literature work as differential robots.

#### 4. Modelling of the AGV’s Subsystems

##### 4.1. Driving System

There are many types of AGVs regarding the kinematics, but four different models can be typically identified: tricycle, differential, quad, and omnidirectional. Figure 3 shows some standard configurations of the wheels for these AGVs. Depending on the number and type of the wheels, the kinematic constraints and the control variables of the vehicle will vary. The drive wheels provide traction but cannot change its direction. The steer wheels can change the direction but cannot provide traction. The steer and drive wheels provide both things, and they are also called motor-wheels.

All of these wheels are subjected to nonholonomic constraints to prevent wheel lateral slipping. This can disrupt the control of the vehicle and must be avoided. By contrast, the omnidirectional wheels only provide traction, but they are not affected by the nonholonomic constraints. In fact, the omni-wheels are equipped with rollers to enable the lateral slipping.

The Unibot AGV [4] is a mixture of tricycle and differential. The traction head is a differential robot; meanwhile, the body is linked with the traction unit by an axle, and it performs as a tricycle. The wheels of the body do not provide traction but support the weight of the vehicle and allow the body to follow the traction head.

As said before, the driving system includes the dynamics and the kinematics of the AGV motion. Therefore, in this section, both the kinematic and dynamic models of the hybrid tricycle-differential AGV are developed. To do it, the kinematic equations of the individual traction tricycle and differential units are combined in a novel way as the hybrid tricycle-differential AGV has not been previously studied in the literature. In addition, the dynamic model of the vehicle has been developed by the authors using the Newton–Euler fundamental equations of the translational and rotational dynamics.

Figure 4 represents the mechanical components of this AGV and the coordinate system (traction head, green square and AGV body, blue rectangle). The center of the wheels of the traction head in the inertial coordinate system is represented by , and the position of the center of the wheels of the body is , both in m. In this inertial frame, the attitude of the body is (rad) and the attitude of the head is (rad); the angle between the body and the head is (rad). is the distance between and in m, and is the distance between the wheels of the traction unit in m.

The equations of the traction head are given by the kinematic model of a differential robot [20]. That is,

On the other hand, the motion of the body follows the equations of a tricycle:where is the longitudinal velocity of the steering drive (m/s), i.e., the traction head speed. These equations (1) and (2) are linked by the following expressions:where and are the mechanical limits of the angle of the traction head (rad). These mechanical limits are set to avoid damage in the wires between the body and the traction head.

Besides, in order to prevent sliding in the wheels, the following constraints must be met, equation (4) for the rear wheels and equation (5) for the front wheels:with is the distance between the center of the traction head and the rear axle.

By the translational and rotational Newton–Euler dynamic equations, the following expressions that represent the forces and momentums are obtained:where (kg) is the total mass of the system, that is, the mass of the AGV, (kg), plus the mass of the load, (kg); the radius of the wheels in the traction unit is (m); is the rotational inertia of the traction unit (kg m^{2}); and are the angular accelerations of the right and left wheel of the traction unit (rad/s^{2}), respectively; and are the effective torques in the right and left wheel of the traction unit (Nm); is the translational friction force (N); is the friction torque (Nm); is the density of the air (Kg/m^{3}); is the front surface of the air (m^{2}); is the aerodynamic coefficient; is the rolling coefficient; is the acceleration of the gravity; and are the viscous and static friction coefficients in the traction unit (Nm and Nms/rad); and are the viscous and static friction coefficients in the wheels (Nm and Nms/rad); and are the torques produced by the motors (Nm); and is the sign function. The effect of the inertia of the wheels has been neglected. It has been supposed that the AGV is working in an indoor environment, and the wind speed is zero.

Moreover, in the simulations, the slippage has been considered. The slippage happens when the traction force exceeds the surface friction force. The traction forces in the front wheels are given by and . Therefore, to avoid the slippage, the following constraints must be fulfilled:where is the friction coefficient. The number 4 that appears in the denominator means that the weight of the AGV is equally distributed into the four wheels.

##### 4.2. Safety System

In this section, we develop the mathematical model of a general safety subsystem applying a new approach to do this, the hybrid automata formalism. The safety system is in charge of preventing collisions with humans and objects. The safety norms establish that the AGV must stop in the near presence of obstacles. This normally leads to introduce a processor in the safety system to take the control and trigger an emergency stop command when the control system is not operative.

Figure 5 shows the interactions between the driving, the safety, and the control systems. The safety system monitors the velocities of the wheels by encoders. If the current longitudinal velocity is higher than the predefined current safety velocity, , during a configurable period of time, then the safety system fires an emergency stop procedure. This is represented in Figure 5 as the signal. Normally, this is carried out by acting directly on the brake of the vehicle or on the motors. The control system is also informed about this anomaly situation by the signal.

On the other hand, the control system notifies the safety system about what type of safety zones must be activated at each moment. These safety zones are polygonal areas where there cannot be obstacles. Each zone has a and a maximum velocity, (m/s), which is calculated considering the deceleration rate of the AGV to ensure that it is able to stop before a collision. The control system knows the location of the AGV and, for instance, if the AGV is towing a trolley, the safety zones must be big enough to cover it. Moreover, if the AGV is going to turn left, the safety zones must be defined on this side of the AGV. If the safety system detects an obstacle inside the safety perimeter, it automatically sends the code of the zone to the control system, with the signal , and updates the safety velocity.

The AGV safety system is equipped with different types of sensors: mechanical, ultrasounds, infrared, or LIDAR, to detect the obstacles. In the Unibot AGV, the safety system has a PLC and a LIDAR sensor installed in the front of the vehicle. The safety zones can be mathematically defined as a set of pairs of points relative to the center of the LIDAR (, ). In addition, each safety zone can be classified as warning zone or error zone. Therefore, by the union of all zones, it is possible to conform the set .

The LIDAR returns a set of distance measures, , that are defined in polar coordinates as follows:

The size of this set is , where is the angular resolution, and and are minimum and maximum angles detected by the LIDAR. This set may be transformed to Cartesian coordinates by the following function:(1)The subset of allowed zones, , is obtained according to the type of zone, , selected by the control system. The safety PLC checks if any of the points in belongs to the set of allowed zones by the function: (9). where the function gives the list of points within the perimeter of the safety zone. If there is not any obstacle in an allowed safety zone, the zone given by (10) is , being (m/s) the AGV maximum velocity. This is usually defined in the datasheet of the vehicle, and it normally goes from 0.8 m/s to 2 m/s. If more than one zone is obtained by (10), the safety velocity, , is set as the minimum safe velocity. This can be expressed as follows: The model of the safety controller can be described by the hybrid automata formalism. A hybrid automata is a formal model that combines discrete control graphs, usually called finite state automata, with continuously evolving variables. An extension to the hybrid automata H defined in [21] is a tuple , where(i) is a set of discrete variables, and is countable. Also it is also known as the set of discrete states of the automata.(ii) is a set of continuous variables, that is, the set of continuous state variables of the automata.(iii) is a set of input variables.(iv) is a set of output variables.(v) is a set of initial states.(vi) is a vector field of the differential equations.(vii)(X) assigns a domain to each .(viii) is a collection of discrete transitions.(ix) assigns a guard condition to each .(x) assigns a reset relation to each and . Let be the set of discrete variables; is the set of continuous variables; is the set of input variables; is the set of output variables, and is the initial. When the variable , the emergency stop is triggered. As expected, the safety controller receives as inputs the velocity of the wheels, the type of allowed zones, and the points measured by the LIDAR; its output is the stop signal, the current safe velocity, and the code of the active safety zone. The differential equations are given by The domains are , , and . In addition, the discrete transitions are given by The guard conditions are the following: where is calculated as a function of and by equations (9)–(11) and and are parameters of the safety controller which can be adjusted by the user. The reset relations can be expressed as follows: The outputs: and , are calculated in the same way for all discrete states, by equations (10) and (11); thus, they have not been included in (15)–(17). To summarize, if an obstacle is detected in a warning zone, the maximum allowed speed is reduced. If the obstacle is in an error zone, the maximum speed is automatically set to zero. In both cases, the control system receives a warning, and it must follow the commands of the safety system. If the safety system detects that the AGV velocity is higher than the allowed speed for a period of time, the safety chain is broken and the vehicle is stopped.

##### 4.3. Guiding and Localization System

The guiding and localization functionalities of the AGV can be implemented by only one device, such as a navigation system based on laser reflectors or the SLAM navigation systems. Both technologies are commonly complemented with the use of an accurate odometry of the vehicle [22]. To combine this information that come from different sensors, a Kalman filter or another similar mathematical tool can be used. However, there are situations, such as slippage produced by an inadequate load distribution or a slippery surface, where the estimation of the speed using only the encoders of the wheels is not possible. In these cases, an inertial measurement unit (IMU) embedded in the vehicle can help to estimate the AGV velocity. However, this solution increases the cost of the AGV, and thus many mobile robots are not equipped with the IMU neither implement a Kalman filter. This is the case of the AGV studied here. As it will be explained below, in this AGV, guiding and localization are decoupled. Guiding (understood as deviation from the expected trajectory without localization) is provided by the magnetic sensor, and the localization is provided by a RFID reader. The guiding system allows us to know the deviation between the AGV and the path defined in the working environment. There are different types of guiding sensors: optical ones (to follow a painted line), magnetic ones (to follow a magnetic tape), inductive ones (to follow a buried wire), and so on. In the AGV used in the study, the guiding is based on a magnetic sensor. The localization system detects points of reference placed in the working environment, with a known specific location on the plane. These reference points may be sensed by an optical device (QR codes), a magnetic device (magnetic spots), an electromagnetic device (RFID tags), and so on. This way the AGV can know its own location through references. The accuracy of the localization system is half the distance between two points. In the standard Unibot robot, the localization is RFID-based.

The traction unit of the AGV equipped with the guiding sensor and the magnetic tape on the floor is shown in Figure 6. The guiding sensor gives the error signal , that is, the deviation respect to the planned trajectory. If the sensing point is at the right of the magnetic tape, the error is considered positive; otherwise, it is negative.

##### 4.4. Control System

The main contribution of this section is the formal description of a general control subsystem of the AGV, as well as the identification of the interactions with the other subsystems. Figure 7 shows the interaction between the subsystems driving and safety, the guiding and location systems, as well as the internal structure of the control system (orange dashed rectangle). The control system has three internal blocks: the control unit, the velocity control, and a block called MIN that calculates the minimum of its inputs.

The control unit has as inputs the variable from the GLS and the signal from the safety system. Its outputs are the reference of the cruise velocity, , and the type of safety zone, , associated to the section of the route where the AGV is currently located.

The inputs of the MIN block are and (from the safety system). It selects the minimum of them and calculates the effective velocity that the AGV should have, .

Finally, the velocity control module is in charge of generating the control signals for the motors in order to track the reference longitudinal velocity and to minimize the error signal, . To do it, it receives the velocity of the wheels from the driving system and the error signal from the GLS. Even more, it is notified if the stop signal is triggered, and it also receives the references for the wheel speeds directly from the user if the manual controller is on. It interacts with the workspace through a set of input/output signals ().

The velocity control is carried out by the function , which receives as inputs (m/s) from the MIN block, (m) from the GLS, (m/s) from the driving system, (m/s) from an external control device, and the digital signals . The signal, as it was explained, comes from the safety system. The signal is generated in an external control device. It is 1 when the manual external controller device is on and 0 otherwise. The output of the function is the pair of control signals for the motors . Thus, this function can be defined as follows:

As it may be observed in (19), when signal is active, the motor targets are set to 0. However, when the manual mode is active, the external velocity control signals are changed to . On the other hand, if the automatic mode is on (last statement in (20)), the control output is generated by a couple of PID controllers, in particular a PI controller per wheel. The targets for the left and right wheels are and , respectively. These targets are calculated by equation (19) using as inputs the longitudinal velocity reference, , and the angular velocity reference, . The angular reference is computed by a PID to compensate the guiding error, .

As explained before, the control unit is in charge of assigning the type of safety zone, , and a cruise velocity reference, . A lookup table is generated by the user with as input and this information.

Likewise with the safety controller, the control unit can be modelled as a hybrid automata. It has three macrostates: automatic, manual, and safety stop. Therefore, the set of discrete states is ; the set of continuous variables is , that is, defined by the user according to the actions to be carried out by the AGV. is the set of input variables and , where the inputs and outputs are configured by the user in the lookup table. The initial state is .

The set of discrete transitions is given by

The set of guard conditions are given by

The hybrid automata is defined for each macrostate: , , and by a tuple , as defined before. In this work, we are going to focus on because it has more interactions with the rest of subsystems. When in the automatic macrostate, the set of discrete states is , where is the number of known localizations. In other words, the number of microstates is . The parameter is configured by the user for each application. The discrete variables mean “waiting for conditions,” and the variables mean “the AGV is in motion.” Therefore, for each localization defined in the lookup table, the AGV will be either waiting for conditions or in motion once the conditions are fulfilled.

The set of continuous variables in this macrostate, , and its corresponding vector field of differential equations, , are defined by the user according to the actions to be carried out by the AGV. The user can associate to each in the lookup table a set of inputs , a set of outputs , a set of conditions , a cruise velocity reference , and a type of safety zone . Thus, the set of inputs in this macrostate is , and the set of outputs is .

The set of discrete transitions in the automatic mode is as follows:

where is a user-defined relationship. This relationship defines the sequence of localization values of an action and so it is necessary to specify a pair of microstates . As shown in (23), the jump between two microstates can only be done if its sequence appears in .

From the relationship , the set of guards is automatically generated as follows:

where is a set of conditions. It is possible to observe in (23) and (24) how the AGV in the microstate waits for the meeting of condition . When they are fulfilled, it switches to the microstate . And vice versa, when it is at state and it reaches a defined in , it changes to .

Finally the set of reset relations is given by

As expressed in (26), when the AGV reaches the microstate , it sets to the value stored in the lookup table associated to .

##### 4.5. Electrical System: Charging, Power Storage, and Motors

The novelty of this section is the integration of the electrical models of the battery, the charger, the motors, and the drives. The most frequently power storage technologies used in AGVs are the lead-based and lithium batteries. More recently, supercaps, electric capacitors with an unusually high power density, are being used for very high charging currents demand. However, still lead batteries are the most widely used because they are much cheaper than the other options. There are several mathematical models of these batteries, each one considering different aspects. The electrical model is adapted from [23, 24] to include the charger and the motors, as shown in Figure 8.

The electrical model of the motors (Figure 8) is adapted from [25–27]:

Regarding motor , (V) and (A) are the voltage and the current; is the motor winding resistor (Ω); is the motor inductance (H); is the electromotive constant (kgm^{2}s^{−2}A^{−1}); is the rotor angular velocity (rad/s); is the moment of inertia of the rotor (kgm^{2}); is the coefficient of rotation resistance; is the load moment (kg m^{2}/s^{2}); is the performance coefficient; is the input current (A); and is the absolute value function; the control signals of the motors and are calculated by equation (33), and they are the inputs of the motor drivers.

The main equations of the equivalent electrical circuit of the AGV and the charger are as follows:

where (A) and (V) are the current and the voltage in the terminals of the battery; (A) is the current consumed by the AGV when it is stopped; (A) is the current given by the charging station; (Ω) is the equivalent resistance of the charger; (A) is the parasitic current in the battery when is charging; (V) is the voltage in the open circuit of the battery; (Ω), (Ω), and (F) are internal parameters of the battery; and (Ah) is the capacity of the battery. The control signal is active, = 1, when the AGV is in a charging station. For more details of these variables and parameters, see [23].

##### 4.6. Workspace

The workspace, although is not embedded in the AGV as the rest of the subsystems, plays an important role in the performance of the automatic vehicle. It represents the environment where the AGV moves. It collects information about the ground, the obstacles, and other possible AGVs and provides information to the safety system, the guiding and localization system, the driving system, and the control system.

Figure 9 shows the interaction among these subsystems. The workspace gives the landmarks and references to the GLS to calculate the guiding error and . It also detects obstacles that will be handled by the safety system. In addition, it interacts with the driving systems by the friction coefficients and the ramps of the ground. In turn, the driving system moves the AGV, changing its position coordinates . Finally, the workspace sends IO signals to the control system that may come from other machines [28], AGVs, and human operators, and it also receives commands from the control system.

The workspace can be simulated as a lookup table, where the inputs of the table are the AGV position coordinates , and the output is a set that provides information about the obstacles, the landmarks and references, the friction coefficients, the ramps, and the IO signals in that spatial location.

#### 5. Simulation Results and Discussion

Several simulations have been carried out to validate the analytical modelling approach [29] and analyze the AGV model. The model has been implemented with Matlab/Simulink software package. In order to reduce the discretization error, a variable simulation step size has been used, with maximum step size set to 25 ms. The control sample time Tc has been also fixed to 25 ms. The AGV parameters used in the simulations are listed in Table 1. The load mass is set to 500 kg.

The simulation scenario is represented in Figure 10. It is a magnetic tape loop (green line) with a charging station and a traffic light. The charging station supplies the energy to the vehicle, so the AGV does not need to leave the circuit to reload. This component, part of the workspace, has been included in the electrical equations of Section 4.5 due to its electrical nature.

A typical element that interacts with the AGV through the IO System is a traffic controller (shown in Figure 10 as a traffic light). When the AGV arrives at an intersection, it stops; then, it requests crossing priority to the traffic controller, and when the intersection is free, the traffic controller informs the AGV and the vehicle continues moving.

The trajectory proposed in Figure 10 is Bernoulli’s lemniscate. This trajectory is interesting because the curvature radius is variable and even more, it has an intersection point as it happens in many real layouts. It can be described as the set of points where the product of the distance to two focus, and , located at a distance between them, is .

The intersection between the straight line projected by the guiding sensor and the lemniscate is used to calculate the guiding error. To calculate the crossing points, we substitute the well-known straight-line equation in (32) and obtain a fourth-degree polynomial (33), with the constants to defined in the following:

The solution of this polynomial gives the coordinate of the intersection points. As it is fourth-degree polynomial, the analytical solution is not evident so it is solved by numerical methods.

During the simulation, it has been supposed that there are not ramps in the environment, all the localizations have the same friction coefficient, and friction coefficients are considered constant due to the large system time constants.

For the sake of clarity, the inputs and outputs of the simulation blocks used during the experiments are shown in Table 2.

##### 5.1. Kinematic Behaviour Simulation

Figure 11 shows the trajectory followed by the traction unit (Figure 11(a)) and the body of the AGV (Figure 11(b)) when reference is a lemniscate curve with a sinusoidal velocity profile, with = 0.4 m/s of amplitude and 0.4 m/s of mean value. In this experiment, the parameter of the lemniscate is set to 5, and the initial position of the AGV is (3.144, 2.5) with an angle of 0° in the traction unit and the body.

**(a)**

**(b)**

This figure represents 200 steps of the AGV motion on the XY plane, between the initial and the final position. It is possible to observe how the positions described by the traction unit follow a lemniscate-shaped trajectory. This type of representation is very useful to design the layout where the AGV is going to travel in a factory or workhouse. It allows to foresee, among other cases, whether the AGV will be blocked by an obstacle, get stuck in a narrow corridor, or if it will reach correctly a station.

The trajectories followed by the traction unit (red line) and the body (orange line) of the AGV are represented in Figure 12, with the reference (blue line). The trajectory on the plane is shown on the left, and the evolution of each coordinate is represented on the right. The coordinates () represent the center of the traction unit, and () are the coordinates of the middle of the rear axle.

**(a)**

**(b)**

The traction unit follows reasonably well the lemniscate-shaped magnetic tape; thus, the reference and the traction unit lines are overlapped in Figure 12(a). Nevertheless, the body of the AGV follows a lemniscate curve closer than the reference. This difference decreases with the width of the lemniscate, parameter in (30). This effect is more visible in the edges of the lemniscate, and it is not shown at the intersection.

Looking closely at Figure 12(b), local maximums and minimums appear at m, m, m, and m, the extremes of the lemniscate, as expected. It is also interesting to note how when the AGV is in the first and third quadrant, from *t* = 0 to *t* s and from *t* around 60 s to 100 s, seems to be delayed respect to . However, when it is in the second and fourth quadrants, the opposite happens.

Figure 13(a) represents the same trajectory as in Figure 12 in order to help to understand the angles shown in Figure 13(b). On the right side of this Figure 13, the angle of the traction unit (blue line) and of the body (red line) of the AGV is shown.

**(a)**

**(b)**

The angle of the body of the AGV decreases up to 225° around *t* = 28 s when the straight part of the lemniscate starts, and it keeps constant until that straight part of the lemniscate end about to *t* = 40 s. After this point, the AGV turns counterclockwise, which increases the angle up to approximately *t* = 70 s when the straight part of the lemniscate starts again. On the other hand, the angle of the traction unit is related to the radius of curvature. At the top and bottom edges of the lemniscate, this radius slightly varies and the angle of the traction unit keeps practically constant at −25° from *t* = 10 s up to *t* = 25 s and at 25° from *t* = 50 s up to *t* = 65 s. This angle is positive when the AGV turns clockwise and negative otherwise. In the straight part of the lemniscate, as expected, the angle of the traction unit is 0°.

So, these results validate the model as the AGV moves as expected.

##### 5.2. Dynamic Behaviour Simulation

The model of the dynamics of the AGV has been also implemented. Figure 14(a) shows the angular velocity of the traction unit (red line) and its reference (blue line). Figure 14(b) represents the reference of (blue line) and the longitudinal velocity (red line). When the AGV starts moving, the angular speed reference, that is, generated by the controller, oscillates due to error of the velocity. Once the reference speed is reached, at *t* = 8 s, the oscillations are much smaller and the mean value is around 0. In any case, the angular velocity reference is well tracked, with a slight oscillation (smaller than 0.5 rad/s). The sinusoidal profile of (Figure 14(b) is well followed by the controller. The biggest error appears at the beginning of the simulation as the AGV is stopped, and it starts accelerating to reach the reference speed.

**(a)**

**(b)**

In order to reach these angular and longitudinal velocities, the corresponding wheel speeds are calculated. Figure 15(a) shows these references, and Figure 15(b) shows the effective wheel velocities. The blue lines represent the right wheel and the red lines the left one. As it is possible to see, the controller is able to track the wheel speed references. The largest error appears at the beginning of the simulation as it is necessary to overcome system inertia. Once the reference value is achieved, the biggest difference between the velocities of the wheels appears at the inflection points of the angle of the traction unit. This happens approximately at *t* = 25 s, 45 s, 65 s, and 85 s. At these points, if the angular velocity of the traction unit is positive, the speed of the right wheel is bigger than the left one, and it is smaller in the opposite case.

**(a)**

**(b)**

In order to follow the wheel speed references (Figure 15(a)), the control has to generate the right power values. Figure 16(a) shows the control signals which are the inputs of the electrical model equation (27); in Figure 16(b), the torque of the wheels is represented. As explained before, this torque is the result of subtracting the friction forces from the torque provided by the motors. The blue lines represent the right wheel and the red lines the left one. The range of the control signals is [−1, 1]. These control signals are inputs in equation (29), and they are dimensionless; they represent the percentage of battery voltage that is applied in the motors.

**(a)**

**(b)**

At the beginning of the simulation, both control signals are saturated to 1, as the initial state of the AGV is stopped. These values are maintained until the wheel speed reference is reached; from this point, the control signals show a sinusoidal behaviour similar to the reference but slightly noisier. Negative peaks appear at t30 s, 50 s, 70 s, and 90 s. These values match with the peaks of Figure 14(a). They correct the angular velocity of the traction unit to maintain the angle when the AGV gets close to the top and bottom edges of the lemniscate trajectory. Due to this, the curvature radius is practically constant (Figure 13).

As expected, the shape of the effective torque in the wheels is similar to the control signals but with different amplitude. At the beginning, when the control signals are saturated to 1, the value of the torque is maximum. Then, the effective torque decreases although the control signals are constant due to the effect of the viscous friction forces which increase with the velocity.

##### 5.3. Electrical Behaviour Simulation

In this section, the same experiment is carried out but the analysis is focused on the electrical model. At the initial state, the voltage in the capacitor is = −4V, and is set to 24 V, that are the common values after the charging. The initial current in the motors is 0 A.

Figure 17 shows the current in the motors on the left and the effective torque on the right. The blue lines represent the right motor and the red lines the left one. As expected from equation (26), the absolute value of the effective torque is practically proportional to the current. The difference comes from the friction forces. In the simulations, the current of the motor is considered always positive no matter the sign of the control signal. The sign of the torque in each motor is equal to the sign of its control signal.

**(a)**

**(b)**

In addition to the current of the motors, it is also interesting to study the current and the voltage in the battery terminals. This helps us to scale up the layout and the production cycles, as well as to foresee the battery life. Figure 18 shows the current and voltage in the battery terminals (blue and red lines), the voltage in open circuit of the battery (yellow line), and the voltage in the equivalent capacitor (purple line). As expected, the battery current follows a sinusoidal signal. Although sometimes the current in the motors is 0 A, the current in the battery is bigger due to the consumption of the other electronic devices of the AGV. This consumption is considered constant and modelled by . The negative peaks of the torque can be seen in the battery current as positive peaks at the bottom part of the signal.

The battery voltage measured in terminals varies with the current; when the battery current increases, the voltage decreases due to the effect of the internal resistance, producing an observable sinusoidal curve. When the system is working, the absolute value of the voltage in the capacitor decreases. This also produces a decreasing trend in the battery voltage. On the other hand, the slightly decreases as well but this is not noticeable due to the high capacity of the battery, i.e., the bigger the capacity, the slower the decreasing trend.

Another interesting effect is that when the battery voltage decreases, the voltage applied to the motor for the same control value also decreases. And if the motor voltage decreases, its speed also decreases. This forces to increase the control signal to get the same motor velocity. In turn, the increment of the control makes the consumed current to increase, as it is possible to see in Figure 18. This effect is less significant when the capacitor is discharged since the decreasing trend of the battery voltage is much smaller.

Figure 19 shows the total accumulated current in Ah (Figure 19(a)) and the percentage (%) of the battery (Figure 19(b)). As expected, the sinusoidal current in the battery terminal produces a sinusoidal total current. It is a usual practice to calculate the percentage of the battery using the total consumed current. In this case, the capacity of the battery is 150 Ah; thus, a total current of 0.3 Ah is equivalent to 0.2% battery, as shown in Figure 19(b). This provides an autonomy of approximately 13.8 h. This is an approximation since it has been seen, the battery voltage also affects the current.

**(a)**

**(b)**

##### 5.4. Influence of the Mass of the Load

The effect of the load on the AGV has also to be analyzed. To do it, different experiments varying the load mass have been carried out with two different speed profiles: a sinusoidal one, as before, and a constant speed of 0.8 m/s. All these experiments are configured as in the previous sections but the mass. In the previous experiments, the load mass was set to 500 kg.

Figure 20 represents the variation of the average battery power with the mass (Figure 20(a)) and the variation of the average current (Figure 20(b)). The blue lines represent the values for a sinusoidal speed profile and the red lines for a constant velocity. As expected, the bigger the load mass, the larger the power and current. This effect is more marked when the speed is constant. As the AGV travels more time at a bigger speed, it needs more energy.

**(a)**

**(b)**

Figure 21 shows the variation of the MSE guiding error (Figure 21(a)) and the variation of the standard deviation of the total torque in the wheels (Figure 21(b)). The color code is the same as in Figure 20. These indicators have been calculated using the following equations:where is the sampling time at and is the total simulation time. This period is necessary since a variable simulation step has been used. This way the MSE gives the mean squared value of the guiding error in cm. The standard deviation of the total torque can give us an idea of the degradation of the electromechanical pieces, as larger total torque means bigger degradation.

**(a)**

**(b)**

In Figure 21, it is possible to observe how the MSE is not affected by the mass until certain mass threshold is surpassed. This value is around 300 kg for the sinusoidal speed profile and 150 kg for the constant speed. This may be explained as the average velocity with the sinusoidal profile is approximately half than the obtained with the constant speed. However, the effect of the mass on the standard deviation of the torque is worse. The sinusoidal speed profile produces bigger deviations, and moreover, the influence of the mass is bigger.

##### 5.5. Influence of the AGV Velocity

Finally, the effect of using two AGV velocity profiles, sinusoidal and constant, is studied. The mean amplitude of the sinusoidal signal is half the value fixed for the constant one. The load mass is 500 kg. The rest of parameters of the experiment have been configured as in previous sections.

Figure 22 represents the variation of the average battery power with the velocity (Figure 22(a)) and the variation of the average current (Figure 22(b)). The color code is the same as in the previous experiments. Again, as expected, bigger velocity produces larger power and bigger current. However, in this case, the sensitivity, defined as the derivative of the measured variable respect to the parameter that is modified by the sweep, is smaller.

**(a)**

**(b)**

The sensitivity is denoted by , where is the measured variable and is the parameter that is modified in the experiment. In particular, is 0.4 W/kg, is 0.18 Ws/cm, is around 0.016 W/kg, and is 0.007 Ws/cm, approximately.

Figure 23 shows the variation of the MSE (Figure 23(a)) and of the standard deviation of the total torque in the wheels (Figure 23(b)). The color code is the same as in Figure 22. It is remarkable how the error is related to the cruise velocity; lower speeds produce smaller errors. This is so in general, but there exist an inferior limit related to the accuracy of the encoders that measure the velocity. The velocity is also related to the torque, as shown in Figure 23(b), where larger velocities demand bigger effective torque. This is not a general rule since the torque is directly related to the acceleration; in order to increase the acceleration of the AGV, it is necessary to increase the effective torque of the wheels. However, a bigger velocity does not necessarily entail a bigger torque since a higher velocity can be reached with the same acceleration and torque but spending more time. However, in this case, the AGV cannot leave the magnetic circuit; thus, bigger accelerations are necessary to maintain the cruise velocity and that increases the effective torque.

**(a)**

**(b)**

#### 6. Conclusions and Future Works

Automatic guided vehicles are complex systems with highly coupled internal variables. Their use has lately grown exponentially due to the Industry 4.0 paradigm, as these are industrial devices and play a key role in process flow and in the logistic sector. However, some of their safety requirements depend on the dynamics and control of these vehicles. Therefore, a holistic modelling approach of the AGV is necessary in order to better understand its performance and to design efficient controllers.

In this paper, a complete model of a hybrid AGV has been developed. The vehicle is a general one, widely used, that is a mixture of tricycle and differential robots. The different subsystems of the AGV have been described and mathematically modelled, particularly, the control system, the safety system, the driving system, the guiding and location system, the charging, the power storage, and the motors. Even more, the interactions among them have been identified and represented in the proposed architecture of the AGV.

Simulations results, varying some of the vehicle parameters, have allowed it to validate the models as the global performance of the AGV is as expected.

Among other possible future works, we may highlight the study of the influence of the deformation of the wheels and the design of neural-controllers to improve the performance provided by the current PIDs. Besides, rollover conditions depending on the load could be estimated to ensure the safety of these systems.

#### Data Availability

The equations and parameters used in this study are included within the article.

#### Conflicts of Interest

The authors declare that they have no conflicts of interest regarding the publication of this paper.

#### Acknowledgments

This work was partially supported by the European Commission, under European Project CoLLaboratE, grant no. 820767 [2].