Research on Real ‐ time Simulation of Automobile Production Line based on Discrete Event and Multiagent

: To improve the production efficiency and quality of the automobile production line, optimize the balance rate of the production line, and realize the digital mapping of the new energy automobile production line. The critical production lines of new energy vehicles are accurately modeled and visualized in the Anylogic environment using multi-agent and discrete event modeling methods. Through the establishment of data connection with actual equipment and the simulation of the operation of the production line, a visual simulation and analysis interface of the production line is built to detect the impact of process time on the balance rate, whether the inventory strategy is reasonable and whether it meets the actual production requirements, reduce the optimization cost, and provide a new idea for the digital twin system of the automobile production line.


Introduction
With the increasing differentiation of market demand and demand for new energy vehicles [1], batch products are no longer popular with the public. Users are gradually pursuing diversified and personalized new energy vehicle products. Automobile manufacturing is a multi-dimensional operation process with multiple links and strong concurrency. There are many uncertain factors and unexpected situations in the production process, and multiple links affect each other. The improvement of traditional lean production has a slow effect, high cost, and high risk, which could be more conducive to dealing with the rapidly changing market requirements. Therefore, it is necessary to demonstrate the feasibility and rationality of the plan before the enterprise adjusts the production line.
With the development of manufacturing technology, computer simulation technology has become increasingly popular [2]. Use the achievements of computer science and technology to build the simulated model and use different conditions to conduct dynamic experiments on the model to obtain optimal results. Computer simulation has the characteristics of high efficiency, safety, fewer environmental constraints, and variable time scale. The simulation model can be used to analyze and study the problems with a high dynamic, strong dispersion, high uncertainty, and complexity in the production process. It can realize dynamic resource reorganization, improve production efficiency, and help automobile enterprises to carry out decision control and production scheduling.
A series of achievements have been made in researching automobile production line simulation at home and abroad. Yu Minghu [3] elaborated on a series of critical points in the simulation of an automobile stamping production line. Pang Zaixiang [4] used DELMIA software to simulate the beat simulation and simulation of the auto stamping line. Wang Leiding [5] used Emulate3D to simulate the PBS reservoir scheduling and sequencing of a final assembly workshop and realized PLC's control of the simulation software. Chu Yunjun [6] simulates and optimizes the assembly line of automobile rear axles through eM-Plant. Ferreira [7] proposed to evaluate complex manufacturing systems through a discrete event simulation model. Wan Jianye [8] realized the simulation and optimization of automobile assembly lines through Flexsim. Michael [9] proposed an innovative virtual factory simulation method that can quickly simulate existing plans. Guerrero [10] used the SimPython library to realize the design and simulation of harnesses in automobile production lines. Lachenmaier [11] realized the simulation application of the CPS system in the automobile production line. Feng [12] established a system dynamics model of worker training for the auto production line and optimized the production line from the level of worker management policy and team structure.
There are various kinds of objects in the automobile production line, and each object has different control strategies. In order to make the simulation process close to the actual operating environment, based on the discrete event simulation, the simulation model is established by fusing multi-agent objects, using the mixed modeling method of discrete event and multi-agent, taking the materials in the production line as agents. Using a database and OPC UA communication protocol, the digital mapping of the simulation system to the actual production line is realized, and the vehicle's real-time simulation and analysis visualization system is established. The software is compiled using Anylogic [13][14] software, currently the only commercial software that supports multi-agent and discrete event hybrid simulation.

Analysis of Research Objects
The automobile production system mainly includes material storage, material scheduling, production line operation, and other parts, and its composition is relatively complex. In the production line operation, vehicles, materials, and transport vehicles are all active entities. Changes in the status of each entity during operation may affect the decisions of other entities. Therefore, it is necessary to consider the overall operation mechanism of the model as well as the information transmission mode between entities.
The agent [15][16] is an independent application program with autonomy, interaction, interaction, and collaboration characteristics. The structure is shown in Figure 1. The agent uses the internal perceptron and interface to realize the perception and acquisition of the external environment information, makes decisions and judgments through the decision layer, and transmits the instructions to the actuator to complete the action execution. Compared with the traditional simulation model, the agent modeling method is more suitable for the operation rules of the real world.

Simulation Framework
The whole simulation model relies on the event table to push forward the time. By discretizing the continuous time, it simulates the laws of real-world operation. ∆ is the step time, starting from t0, and the model starts from t0 to tn, and executes the events at each time point in turn. The structure of the event table is as follows: <Event Table>= (<Event Type>, <Event Time>, <AgentID>, <Event Attribute>) Because the program is executed in sequence, it is executed randomly when multiple events co-occur at a certain time. Figure 2 shows the system simulation framework.  The agents interact with each other by sending messages. Each message contains the message content and execution time. The message will be put into the corresponding time node of the event table according to the execution time to wait for the call. The command will be executed when the model runs to the time node.

System Architecture
The simulation system has five layers in total, including the physical layer, transport layer, storage layer, virtual layer, and monitoring layer. As shown in Figure 3.  (2) Transport layer. The primary function is to connect the physical and storage layers using the OPC UA communication protocol. Read the field data at the beginning of the simulation and write it to the database.
(3) Storage tier. The SQL server database reads and stores the physical layer data.
(4) Virtual layer. The virtual layer includes agents, process modules, schedules, and virtual environments.
(5) Monitoring layer. Realize parameter adjustment of the simulation model, visual view of the model, and statistical analysis of simulation results.  Figure 4 shows the flow chart of the simulation system of the automobile production line.

Process Analysis
During operation, the simulation system can simulate the inventory status, order demand, and production line operation of materials. During production, the order will be processed according to the set operation sequence and the time required for each operation. During processing, the arrival of the required materials will be monitored at any time, and the corresponding status will be changed according to the arrival of the materials. The material system will conduct real-time analysis and dynamic adjustment of the inventory status according to the existing demand strategy and distribute materials according to the scheduling strategy. The order processing process is shown in Figure 5, where Coating N is the coating workshop process and Install N is the assembly workshop process.

Agent Model
The agent package contains 3D models, internal attributes, running rules, and messages. The mathematical description of a single agent is as follows: Agent=<Mod, Attribute, Rule, Instruction, Msg> Table 1 shows the meaning of each subset.

Message System
A message is an instruction that an individual needs to process or request feedback from others. Its mathematical description is: Msg=<MsgID, Dest, Source, MsgType, Content, Send Time, Elapsetime, Validtime> Table 2 shows the meaning of each subset.

Model Establishment
Take a production line with four workshops and three warehouses, as shown in Figure 6.
Take a production line with four workshops and three warehouses, as shown in Figure 6.2 Model establishment.
Take a production line with four workshops and three warehouses, as shown in Figure 6. In order to verify the feasibility of the model, the following assumptions are made: (1) There are 57 processes in total, including ten processes in the stamping workshop, eight in the body workshop, 17 in the painting workshop, and 22 in the assembly workshop.
(2) To simplify the model, there are three customizable options: battery, wheel hub, and interior trim, two for each, and eight types of customizable vehicles.
(3) The painting workshop and the assembly workshop are streamlined workshops. The back-office vehicles can only be processed after the front office vehicles are processed. Each process can accommodate at most one vehicle for processing.  (4) The material will arrive immediately after the order is placed.

Agent Design
The model design includes 38 kinds of agents, including body skeleton agents, material agents, and vehicle agents. Figure 7 shows the body skeleton agent model.  The agent includes a model, interface, variable, and state flow chart. The specific meaning is as follows: (1) Model and interface Select the car model inside Anylogic to generate 2D and 3D data. The message-receiving port is responsible for receiving external messages, the decision algorithm is responsible for data analysis and processing, and the command-sending port sends the generated execution instructions.
(2) Variable It mainly includes state variables, time variables, and configuration variables. State variables: After simplifying the model, four nodes are selected for variable marking, from coating to final assembly. The operation state diagram will modify the corresponding variables when the model runs to the corresponding node. At the same time, the variables are associated with the 3D model of the automobile agent to realize the real-time change of the model's appearance during the operation. Time variable: record the start processing and completion time. Configuration variables: different record configurations in user orders.
(3) State flow chart Send information to the car agent through the external environment, trigger the car agent status to change accordingly, and execute different instructions.  The process construction includes the processing process of each workshop, the material warehousing and delivery process, and the distribution process of the transport vehicle and conveyor belt. Select the corresponding module from the Anylogic process library, and build the process model of the whole system according to the production and transportation processes. The intelligent experience is generated in the Source module, and the subsequent modules are run according to the rules of each module until the Sink module eliminates the intelligent agent. The modules used and their corresponding names are shown in Table 3. Figure 8 shows the module process model. Take a material in the warehouse of the assembly workshop as an example. The material is generated by the Source5 module and stored on the shelf. When a new order is generated, it will be delivered to the specified location, as shown in Figure 9.

Timeliness of Simulation Model
The connection between the model and the on-site industrial control PLC can ensure that the on-site parameters can be read with minimal refresh time when the simulation model is running and the timely update of the model parameters is realized.

Repeatability of the Simulation Model
The model includes the complete simulation of all processes, from sheet metal stamping to final assembly, involving three parts: process, inventory, and transportation. In the early stage, the construction was completed according to the actual production line. Each region's operation process and judgment rules remain unchanged during the simulation process. The simulation results only relate to order, warehousing details, and inventory information. Therefore, it is only necessary to read the latest values of the relevant data at the beginning of the simulation, and the simulation can be repeated.

Adjustability of the Simulation Model
In addition to external data, the input of the simulation model can also modify the operation time, order, and material information during the simulation process to study the impact of different conditions on the simulation results. In addition to running with existing parameters, the simulation platform can adjust the operation time twice at the beginning and during the operation to observe the effect of different operation times on the efficiency of the production line. The production line can be simulated by reading the database at a specific time. The operator can also implement the warehousing operation of various materials. At the same time, the platform can display the current material inventory. The simulation platform can realize the transformation of the 3D or 2D model perspective through the mobile interface in the way of a 3D window or 2D plane, as shown in Figure 10

Data Statistical Analysis
According to the purpose of the simulation model, the data statistics and analysis page is designed. The page is divided into three areas: inventory status, production line status, and completed status. It can reflect the details of each area under the current simulation time in real-time. Inventory, including the inventory balance of main accessories and the proportion of different models of similar materials; Production line status, showing the production status of the day and the real-time operation time of each critical process; Completed status, including details of the last ten, completed orders. The page layout is shown in Figure 13.

Conclusion
Through the investigation and research on the production line of new energy vehicles, this paper has formed a feasible real-time simulation and visualization platform for the production line of new energy vehicles using the Anylogic software based on multi-agent and discrete event modeling. The platform can be used to understand the production line's future operation status and the inventory change under the current parameters. The platform can help with the existing production line's virtual debugging and layout optimization. In the later stage, the feedback connection with the field control can be established in the system, which can provide a feasible idea for the digital twin platform of the automobile production line.