Frontiers in Computing and Intelligent Systems ISSN: 2832-6024 | Vol. 4, No. 1, 2023 83 Research on Real‐time Simulation of Automobile Production Line based on Discrete Event and Multiagent Yujie Zhang 1, *, Jiawei Li 2 1 Xi'an Technological University, China 2 CCTEG Xi’an Research Institute, China Abstract: 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. Keywords: Discrete Events; Multi Agent; Visualization Platform; New Energy Vehicles; Anylogic. 1. 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. 2. System Description 2.1. 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 84 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. Control/decision- making level Perceptron Actuator Process/function Executive level Communication layer: interactive interface Data 1 Data k Object i Object j Agent Figure 1. Structure of Agent 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. 2.2. 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: = (, , , ) 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. Agent 1 Agent 2 Agent n Virtual physical environment t0 t1 t2 tn Agent n-1 ... Event table Event flow Feedback flow Interactive flow data stream Figure 2. 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. 2.3. 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. Virtual layer PLC Sensor transmitter Monitoring layer SQl server database OPC UA communication protocol physical layer Steel plate magnetization Door welding magnetization electrophoresis ED sanding Wax injection LASD robot spraying Flame Plating Finishing paint drying room and buffer area spot repair Degreasing and phosphating Final assembly line Agent 1 Three-dimensional model State diagram Communication interface Variable Module 1 Rule Variable Rule Virtual external environment Event Table ... ... Adjusting parameters Visualization page Statistical analysis of data Agent n Three-dimensional model State diagram Communication interface Variable Rule Variable Module n Rule Storage layer Transport layer Figure 3. Simulation system architecture (1) Physical layer. Including field equipment sensors, controllers, and other equipment. (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 85 simulation model, visual view of the model, and statistical analysis of simulation results. 2.4. Process Analysis Start Program initialization Read external data External data writing model Operation model Finish Figure 4. Flow chart of simulation system Figure 4 shows the flow chart of the simulation system of the automobile production line. 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. New orders Materials arrive at Install N assembly area N>=17 Waiting Coating N process Initial materials are complete General assembly workshop material X N=1 N=N+1 Install Nprocess N=1 N>=22 N=N+1 Finished goods warehousing Material X receipt X corresponding Out of stock in assembly area Transfer to X corresponding assembly area Inventory is lower than Lower storage limit Material X orders Inventory is higher than Upper storage limit Item X stops placing orders Y Y Y Y N N N Y Y N N Y N Send a message to the warehouse N Figure 5. Production Flow Chart 2.5. Mathematical Description of the Production Line System 2.5.1. 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= Table 1 shows the meaning of each subset. Table 1. Meaning of agent subset Subset name Meaning Agent Agent Mod 3D model Attribute Internal attribute Rule Internal operation rules Instruction Execute command Msg various messages 2.5.2. Message System A message is an instruction that an individual needs to process or request feedback from others. Its mathematical description is: Msg= Table 2 shows the meaning of each subset. Table 2. Message subset meaning Subset name Meaning MsgID Unique ID of the message Dest Agents receiving messages Source Agent sending message MsgType Message type Content Message content SendTime Sending time Elapsetime Delay time Validtime Effective time 3. 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 86 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. Stamping workshop Stamping workshop warehouse Body workshop Painting workshop General assembly workshop Material warehouse Spraying production line General assembly line Figure 6. Layout Plan of a Workshop (4) The material will arrive immediately after the order is placed. 3.1. 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. Receptor Actuator Decision code Internal clockMsg Msg Type variable (int) Time variable (date) State variable (double) Three-dimensional model Figure 7. Body Framework 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. 3.2. Process Construction Table 3. Statistics of Module Usage 87 Module 1 Agent 2 Module 2 Module 3 Module n-2 ...Module 4 Module 5 Module 6 Agent 1 Module 13 Module 14 Module 15 Module 8 Module 7 Module 9 Module 12 Module 11 Module n-3 Module n-1 Module n Module 10 Agent 3 Agent 4 Figure 8. Module Process Model Figure 9. Stock in and Stock out Flow Chart of a Material 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. 3.3. Model Evaluation 3.3.1. 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. 3.3.2. 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. 3.3.3. 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. 3.4. Visualization Interface Figure 10. Simulation Page Figure 11. Simulation Page 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 88 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- 12. Figure 12. Simulation Page 3.5. 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. Figure 13. Data statistics and analysis interface 4. 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. References [1] Zheng Jianfei. Research on the new model of intelligent manufacturing for mass customization of automobiles [J]. China Collective Economy, 2018 (16): 152-154. [2] XIONG Guan-leng, WANG Xin. Application and Development of Simulation Technology in Manufacturing[J]. Journal of System Simulation, 1999(03): 3-9. [3] Yu Minghu. Analysis of the key points of the whole line simulation of the automobile stamping production line [J]. 89 Forging Equipment and Manufacturing Technology, 2019, 54 (04): 7-10. [4] PANG Zaixiang, WANG Qinglai, FAN Zhiyun, et al. Auto stamping line simulation under DELMIA environment[J]. Journal of Changchun University of Technology, 2018, 39(05): 446-451. [5] WANG Leiding, GAO Changshui, CHENG Xiaoxin. Simulation of Automotive Assembly Line Based on Emulate3D [J]. Machine Building & Automation, 2017, 46(02): 91-93. [6] Chu Yunjun, Kan Shulin, Xu Jie, Dong Qiaoying, Ren Yizhou, Wei Yufeng. Simulation and optimization of automobile rear axle assembly line based on eM-Plant [J] Machinery Manufacturing, 2008 (10): 26-29. [7] L.P. Ferreira, E. Ares, G. Peláez, et al. A Methodology to Evaluate Complex Manufacturing Systems through Discrete- Event Simulation Models[J]. Key Engineering Materials, 2012, 1647 (502-502). [8] Jian Ye Wan, Li Yuan Gao, Zhen Fu Xu. Research on MP-X Assembly Line Planning Simulation Based on Flexsim[J]. Applied Mechanics and Materials, 2012, 2025(220-223). [9] Debevec Michael, Simic Marko, Jovanovic Vukica, et al. Virtual factory as a useful tool for improving production processes[J]. Journal of Manufacturing Systems, 2020, 57. [10] Guerrero Ruddy, Serrano Hernandez Adrian, Pascual Jose, et al. Simulation Model for Wire Harness Design in the Car Production Line Optimization Using the SimPy Library[J]. Sustainability, 2022, 14(12). [11] Jens F. Lachenmaier, Heiner Lasi, Hans-Georg Kemper. Simulation of Production Processes Involving Cyber-physical Systems[J]. Procedia CIRP, 2017, 62. [12] Yuan Feng, Wenhui Fan. A system dynamics-based simulation model of a production line with cross-trained workers[J]. Journal of Statistical Computation and Simulation, 2014, 84(6). [13] CHEN Yue-feng, DONG Yuan-sheng, DENG Li-qun. Comparison of Agent-based Simulation Platforms[J]. Journal of System Simulation, 2011, 23(S1): 110-116. [14] Wei Xing, Liu Ying, Liu Xiaoming, Jiang Jun AnyLogic System Simulation Environment [C]//. Proceedings of the 8th National Academic Conference on Signal and Information Processing of the Chinese Academy of Aeronautics, 2004:175- 178. [15] LIU Jin-kun, ER Lian-jie. Overview of Application of Multiagent Technology[J]. Control and Decision, 2001(02): 133-140+180. [16] Deng Hongzhong, Tan Yuejin, Chi Yan. A research method for complex systems -- multi-agent based integrated modeling and simulation method [J]. Systems Engineering, 2000 (04): 73-7.