Event-Driven Online Machine State Decision for Energy-E ﬃ cient Manufacturing System Based on Digital Twin Using Max-Plus Algebra

: Energy-e ﬃ cient manufacturing is an important aspect of sustainable development in current society. The rapid development of sensing technologies can collect real-time production data from shop ﬂoors, which provides more opportunities for making energy saving decisions about manufacturing systems. In this paper, a digital twin-based bidirectional operation framework is proposed to realize energy-e ﬃ cient manufacturing systems. The data view, model view, and service view of a digital twin manufacturing system are formulated to describe the physical systems in virtual space, to perform simulation analysis, to make decisions, and to control the physical systems for various energy-saving purposes. For online energy-saving decisions about machines in serial manufacturing systems, an event-driven estimation method of an energy-saving window based on Max-plus Algebra is presented to put the target machine to sleep, considering real-time production data of a system segment. A practical, simpliﬁed automotive production line is used to illustrate the e ﬀ ectiveness of the proposed method by simulation experiments. Our method has no restriction on machine failure mode and predeﬁned parameters for energy-saving decision of machines. The proposed approach has potential use in synchronous and asynchronous manufacturing systems.


Introduction
Industrial activities are the most important factor that leads to carbon dioxide (CO 2 ) emissions in the world. The manufacturing industry in China accounts for 58.27% of the total CO 2 emissions, which increased by approximately 220.77% in the past twenty years [1]. With the increased sustainable consensus, many emission reduction policies were issued to undertake environmental responsibility and duty in China. More and more manufacturers take effort to reduce energy costs. Energy-efficient manufacturing has been paid more attention considering productivity, flexibility, efficiency and environmental effect in production management [2]. A discrete manufacturing system is a kind of complex, stochastic, and dynamic system with interactions among machines and buffers. It is very common that many machines stay in an idle state, resulting from starvation or blockage during a working day. Statistically, the machine at an idle state consumes about 70% energy of their processing state [3]. Many modern Computerized Numerical Control (CNC) machines and robots have multiple idle states with different energy consumptions. An important strategy for energy-saving operations is to put the idle machine to sleep and to wake it up again at an appropriate time point without sacrificing the system productivity. The machine control The current modeling and simulation approaches focused on offline evaluation, prediction, and optimization for energy-efficient manufacturing. In order to incorporate real-time production data of shop floors, a data-driven method was always adopted for alleviating the burden of modeling and simulation [16].

Energy-Aware Manufacturing System Scheduling and Control
Taking energy consumption as one objective in scheduling; a multi-objective optimization problem can be formalized, and near-optimal job sequences can be searched by heuristic algorithms or exact methods [17]. Shrouf et al. [18] presented a mathematical model to minimize energy costs for a single machine system, and genetic algorithm technology has been used to obtain optimal solutions. For a two-machine system, Fang et al. [19] proposed a mathematical programming model that considered peak power load, energy consumption, and associated carbon footprint in addition to cycle time. In a flow shop with a reference schedule, Bruzzone et al. [20] built a mixed integer programming model where the reference schedule was modified to account for energy consumption without changing the jobs' assignment and sequencing. An energy-efficient flexible job shop scheduling model considering total production energy consumption and makespan was formulated in Reference [21], and a non-dominated sorting genetic algorithm-II was adopted to solve the model. Luo et al. [22] developed an ant colony optimization meta-heuristic to optimize both makespan and electric power cost with the presence of time-of-use electricity prices in a hybrid flow shop.
Quantitative policies and fuzzy rules can describe the operation knowledge of machine/system for energy-efficient manufacturing. Mouzon et al. [23] described several switch-off dispatching policies to minimize total energy consumption in a one-buffer, one-machine system. For a single machine system with stochastic inter-arrival times, the N-policy, Upstream Policy, and Downstream Policy were defined to switch the machine off when the conditions of the policies were satisfied [24]. By formulating four ON-OFF control rules in serial production lines with Bernoulli machines, Jia et al. [25] analyzed system performance measures in order to achieve high energy efficiency while maintaining high productivity. Wang et al [26] designed a fuzzy controller considering real-time data of buffers/machines in order to switch machine states and realize energy-efficient production.
Some works used an analytical method to study energy-saving opportunities of manufacturing systems. Chang et al. [27] proposed an energy opportunity window of a machine, which was predicted based on an approximated analytical model considering random downtime events. Sun and Li [28] presented an analytical estimation of energy control opportunities considering buffer utilization. Zou et al. [29] developed a stochastic analytical model which could predict shutdown time and recovery time of machines based on discrete-time Markov Chains in a stochastic production system. Li et al. [30] developed an analytical approach to quantitatively predict the system level production loss resulting from an energy-saving control event.
The multi-objective scheduling methods of energy-aware manufacturing are usually used to optimize operation plans before actual production. The complex and stochastic events of real shop floors are simplified or ignored in scheduling algorithms. It is noted that the control policies or rules for real-time energy-saving operation of production systems have many parameters to be determined and adjusted with time-consuming work. The advantage of the analytical models is its mathematical theory. Most of the analytical models did not consider the associated events during energy-saving operation, and only a constant energy opportunity window was predicted.

Digital Twin of Cyber-Physical Manufacturing and Production System
Digital twin [31], a near-real-time virtual representation of a physical component, product or system enriched with sensing data, is a digital and dynamic model in the cyber-space that is Digital twin [31], a near-real-time virtual representation of a physical component, product, or system enriched with sensing data, is a digital and dynamic model in cyberspace that is completely consistent with its physical ones in real space. It is considered a key technology in realizing cyber-physical production Sustainability 2019, 11, 5036 4 of 17 systems (CPPS) for Industry 4.0 [32]. Digital twin can simulate the characteristics, behavior, and performance of its physical counterpart in a timely fashion, which shows gigantic application potential in manufacturing system analysis and control [33,34].
In the aspects of production management, optimization, and control, Zhuang et al. [35] proposed a framework of digital-twin-based smart production management and control approach for complex product-assembly shop-floors. By using Plant simulation software, Vachálek et al. [36] built a digital twin for the optimization of production plans, which was designed in a way that it triggered physical and virtual productions as well. Coronado et al. [37] described the development and implementation of a new manufacturing execution system that combines MTConnect data with production data collected from operators. The work was integral to realizing a complete digital model of the shop floor for production control and optimization.
Considering digital-twin-based energy consumption evaluation and optimization of a production plan, Karanjkar et al. [38] presented an IoT-driven digital twin for energy optimization in an automated printed circuit-board assembly line. A digital twin of the line was built, and a buffering-based solution for improving energy efficiency was evaluated using simulations. Lu et al. [39] proposed an open system architecture for energy-efficient cyber-physical production network for facilitating distributed manufacturing. A cyber twin of a physical manufacturing asset was built, and the energy consumption of feature-based machining process models were evaluated in connected virtual factories. Zhang et al. [40] proposed a framework of equipment energy consumption management for a digital-twin shop floor. The data and models were discussed for monitoring, analysis, and optimization of equipment energy consumption.
It can be concluded that the most current works on digital twin of manufacturing or production system are used to monitor, evaluate, and visualize the real system based on unidirectional mapping from physical space to digital space. There is little research on models of online real-time production control from digital space to physical space, which is the main contribution in this paper considering energy consumption and productivity.

Digital Twin Based Operation Framework of Energy-Efficient Manufacturing System
Energy-efficient operation decisions of production systems require data from shop floors, carries out evaluations in virtual space, and makes control actions on the shop floor. Digital twin is the digital representation of a physical object. The main purpose of a production system digital twin is to facilitate decision-making activities based on simulation or computation before, during, and after production. The real-time monitoring, simulation, prediction, and control of production systems are vital to improving productivity, efficiency, and flexibility. At present, the interaction between physical and digital production systems is mainly offline interactions, lacking continuous and online interaction [33]. In this section, an operation framework with a three-view representation (Figure 1), i.e., data view, model view, and service view, is proposed to digitalize a manufacturing system, which enables us to perform simulations, to make decisions, and to control the physical system for different energy-saving purposes.
In the physical space of Figure 1, the real manufacturing/production system is a complex, diverse, and dynamic system with sensible ability in the context of Industry 4.0. The multisource and heterogeneous data (e.g., behavior, event, and state) of physical objects (e.g., machines, materials, and parts) are monitored and transmitted to databases based on IoT sensors (e.g., smart meters, radio frequency identification reader, and tags), which enhance the perception ability for physical manufacturing systems. The energy-efficient decisions made in virtual space based on digital twin are implemented through actuators of machines on the shop floor. A three-view digital twin of manufacturing systems for energy-saving operations is described as follows, which enables two-way direct or indirect mapping and interaction between the physical and the virtual manufacturing systems. from the physical and cyber space before production. The energy-related key performance indicators (eKPIs), such as energy demand, energy cost, and energy efficiency, are also non-real-time data mined or acquired based on simulation after production. The energy big data can be structured or semi-structured. For example, the data of a machine, such as rated power, spindle speed, and cutting rate, is structured data. The process plan of a part is semi-structured data which has several flexible aspects (e.g., feature sequence, operation type, and machine selection).

Process level models
Real time data The methods for cleaning, reduction, integration, and storage of energy-efficient manufacturing data can be referenced in Reference [41] and is not the focus of the paper. The high real-time processing ability of the storm real-time computing framework [42] can be adopted to process the time-series energy data. The Hadoop computing framework [43] can be used to process the non-real-time data. In order to efficiently store the big data of energy-efficient manufacturing, the Not only Structured Query Language [44] can be chosen for these large-scale structured and semi-structured datasets.

Model View
In digital space, the parameter correlations of the objects/systems are represented in simulation or computation models, which are core components of digital twin and the base of the application services. The models describe the working principle of machines with power supply, the energy consumption resources of the machining process, and the state space evolution of production

Data View
The data of energy-efficient manufacturing collected from different sources has the "4V" characteristics (i.e., volume, velocity, variety, and value) of big data considering the spatial and time dimensions. The big data for energy-efficient operation of manufacturing system includes real-time and non-real-time data. The real-time data, such as electrical power of device, location of parts, buffer level, and machine throughput, is monitored and collected during production, which is the most important data source for online energy-saving decisions. The layout data, process plan, maintenance plan, and job schedule are the non-real-time data of the system collected or generated from the physical and cyber space before production. The energy-related key performance indicators (eKPIs), such as energy demand, energy cost, and energy efficiency, are also non-real-time data mined or acquired based on simulation after production. The energy big data can be structured or semi-structured. For example, the data of a machine, such as rated power, spindle speed, and cutting rate, is structured data. The process plan of a part is semi-structured data which has several flexible aspects (e.g., feature sequence, operation type, and machine selection).
The methods for cleaning, reduction, integration, and storage of energy-efficient manufacturing data can be referenced in Reference [41] and is not the focus of the paper. The high real-time processing ability of the storm real-time computing framework [42] can be adopted to process the time-series energy data. The Hadoop computing framework [43] can be used to process the non-real-time data. In order to efficiently store the big data of energy-efficient manufacturing, the Not only Structured Query Language [44] can be chosen for these large-scale structured and semi-structured datasets.

Model View
In digital space, the parameter correlations of the objects/systems are represented in simulation or computation models, which are core components of digital twin and the base of the application services. The models describe the working principle of machines with power supply, the energy consumption resources of the machining process, and the state space evolution of production systems. The models at three different levels are built for energy-efficient decisions in this framework.
At the device level, the physics-based energy model is required to formulate power consumption and dynamic behavior of industrial robot and CNC machine [40,45], and thus the energy-efficient trajectory planning, operating parameters, and power state of machine components can be completed. At the process level, the machining parameters, e.g., spindle speed, feed rate, and depth of cut, have a notable influence of energy consumption for the same job features [9]. The mathematical cutting equations or learning algorithms should be constructed for energy-consumption calculation and prediction of machining process. The models at the system level depict the interaction among the objects in production systems. Various models such as knowledge-based models, mathematical models, and discrete event simulation models are established for different decisions of energy-efficient manufacturing. The policies/rules [23][24][25] and fuzzy logic [26] are expert knowledge for the energy-saving operation of production systems. The big data analysis models [46], e.g., neural networks, rough set theory, and deep learning, can mine implicit relationships of production parameters considering energy cost and productivity. The stochastic process [28] and algebra mathematical models [47] usually are used to evaluate the system eKPIs. The heuristic models (e.g., simulated annealing, genetic algorithm, and particle swarm optimization algorithm) for multi-objective optimization [17] are important for production scheduling. The discrete event simulation models are very popular for system evaluation and optimization as stated in the review section. The complex relations among entities, events, and activities of a production system are scheduled based on queuing theory in simulation models.

Service View
At the top of Figure 1, many kinds of application services are provided for online and offline scheduling, evaluating, forecasting, visualizing, monitoring, and controlling of energy-efficient manufacturing based on simulation or computation models.
The offline services are usually initiated on-demand by managers to determine the appropriate energy-efficient process parameters or job sequences in advance before production. The simulation services allow managers to perform what-if analyses on various production plans and to optimize schedules for minimizing total energy cost while maintaining higher productivity. After production, the future energy management [48,49], such as energy policy, energy benchmark, energy recycle, and manufacturing process/production schedule, can also be analyzed based on the collected data. The data-mining application services [46] can be formulated to discover hidden valuable information and knowledge from the enormous production datasets with energy indicators.
From the online services view, a near-real-time dynamic visualization application of productionand energy-related information can be generated based on discrete event simulation models with collected data, which provide more direct perceptions of the physical shop floor status. By creating the latest snapshot of the physical manufacturing system status based on the data-driven simulation method [16], the forecasting application is adaptive and flexible to any change in terms of actual production settings and can provide prediction services of system performances and eKPIs using online forward simulation experiments. Feedback control based on decisions in virtual space is the distinct characteristic of digital twin. The energy-saving opportunities during production come from the transient states of manufacturing system [27]. An online, event-driven energy-saving decision service for machine state control is proposed in this paper to execute short-term analysis by mapping the exact state of a physical system into the digital world at run time. The decision results will be sent to physical machines for realizing energy-efficient production.

Physical Manufacturing System and Modeling Assumptions
In this paper, a typical serial production system ( Figure 2) is used to illustrate energy efficient operation at the system level based on the above described digital twin framework. In order to build the mathematical model of the physical system for energy saving decision and control, the following assumptions are made.

1.
A physical serial production system is composed of m machines and m−1 buffers. There is one buffer between each adjacent machine.

2.
Each buffer B i (i = 1, 2, . . . , m−1) has a finite capacity C i and its real-time level is I i .
The reliability model of machines can be any probability distribution. 5.
The bottleneck machine (BN) of the system is denoted as The first machine M 1 is never starved, and the last machine M m is never blocked. 7.
The transportation time between machines and buffers is not considered. In this paper, a typical serial production system ( Figure 2) is used to illustrate energy efficient operation at the system level based on the above described digital twin framework. In order to build the mathematical model of the physical system for energy saving decision and control, the following assumptions are made.
1. A physical serial production system is composed of m machines and m-1 buffers. There is one buffer between each adjacent machine. 2. Each buffer Bi (i = 1, 2, …, m-1) has a finite capacity Ci and its real-time level is Ii. 3. Each machine Mi (i = 1, 2, …, m) has a constant cycle time Pi. 4. The reliability model of machines can be any probability distribution. 5. The bottleneck machine (BN) of the system is denoted as Mb (1 ≤ b ≤ m). 6. The first machine M1 is never starved, and the last machine Mm is never blocked. 7. The transportation time between machines and buffers is not considered.

Methodology of Event-Driven Online Energy Saving Decision and Control of Machine States
Usually, time-based scheme is adopted at shop floor to collected production data with predefined sampling intervals and data-driven method is used to make operation decisions [41]. Generally speaking, the idle activities during production bring energy-saving opportunities. The idle activities generate from the events of blockage or starvation. Thus, event-based scheme can be more effective and economical considering the big data processing burden of time-based scheme [50]. Event-driven decision has shown many potential applications in manufacturing, such as manufacturing information system architecture [51], make-to-order production [52], and manufacturing execution system [53]. The most related research of event-based energy efficient production control is conducted by Li et al. [30,54], where a sequence of disruption events was defined to estimate the production loss for energy saving operation. In this paper, four traditional events of a machine, i.e., blockage event (BE), starvation event (SE), failure event (FE) and recover event from failure (RE), are monitored at the physical shop floor, which trigger energy-saving decision in digital space and control machines in physical system.
Based on previous works [27,[55][56][57], an energy-saving window (ESWi) of a target machine Mi is defined as a time length of Mi being purposely put to sleep without bringing production loss to the system in this study. A system segment (SGi) of a target machine Mi is defined as the partial system including all machines and buffers between the target machine and bottleneck machine. The estimation of ESW in the next section will consider the bottleneck machine of the system, of which the production interruption will most likely result in system production loss [57]. The main flow of event-driven online energy-saving decision and control is shown in Figure 3 and explained as follows.

Methodology of Event-Driven Online Energy Saving Decision and Control of Machine States
Usually, time-based scheme is adopted at shop floor to collected production data with predefined sampling intervals and data-driven method is used to make operation decisions [41]. Generally speaking, the idle activities during production bring energy-saving opportunities. The idle activities generate from the events of blockage or starvation. Thus, event-based scheme can be more effective and economical considering the big data processing burden of time-based scheme [50]. Event-driven decision has shown many potential applications in manufacturing, such as manufacturing information system architecture [51], make-to-order production [52], and manufacturing execution system [53]. The most related research of event-based energy efficient production control is conducted by Li et al. [30,54], where a sequence of disruption events was defined to estimate the production loss for energy saving operation. In this paper, four traditional events of a machine, i.e., blockage event (BE), starvation event (SE), failure event (FE) and recover event from failure (RE), are monitored at the physical shop floor, which trigger energy-saving decision in digital space and control machines in physical system.
Based on previous works [27,[55][56][57], an energy-saving window (ESW i ) of a target machine M i is defined as a time length of M i being purposely put to sleep without bringing production loss to the system in this study. A system segment (SG i ) of a target machine M i is defined as the partial system including all machines and buffers between the target machine and bottleneck machine. The estimation of ESW in the next section will consider the bottleneck machine of the system, of which the production interruption will most likely result in system production loss [57]. The main flow of event-driven online energy-saving decision and control is shown in Figure 3 and explained as follows.  As shown in Figure 3, the main decision flow (rectangle 1) will be triggered if there is a BE or SE of a target machine Mi during production. The ESW of this target machine is estimated based on the current states of SGi. Then, the physical machine is switched into sleep mode. During the sleep duration of a target machine, different events of machines will be monitored and machine states will be controlled for energy-saving operation. In the flow of rectangle 2, the FE and then the RE of a machine in SGi are monitored. If an RE occurs on a machine, the main decision flow is retriggered to estimate a new ESW of the target machine. The underlying principle is that the failure of a machine in SGi can provide more energy-saving time for the target machine. In the flow of rectangle 3, different machines of the system are monitored according to the place of SGi, considering the bottleneck Mb. If the target machine Mi is before Mb, a new system segment before SGi is named as BSGi. The BE of machines in BSGi and the SE of machines in SGi are monitored. For each machine, from near to distant, related to the target machine, the machine in BSGi or SGi will be put to sleep if it is blocked or starved. If the target machine Mi is after Mb, a new system segment after SGi is named ASGi and similar decisions are made on each machine before the target machine ends its sleep. All the machines that were put to sleep will be woken when the ESW of the target machine is exhausted and a decision round ends.
Compared with time-based data sampling in the fuzzy logic method [26], our event-driven method greatly eases the burden of data collection and conforms to the stochastic of the system. The dynamic updating of the ESW of the target machine during one round decision is more reasonable compared with the constant opportunity windows [27,29,[55][56][57] and will be illustrated in Section 5.
From the flow in Figure 3, our event-driven energy-saving decision method is also different from the event-based energy-efficient production control in References [30,54], which used predefined energy-saving control events to analyze the system performances.

Estimation of Energy Saving Window Based on System Segment using Max-Plus Algebra
Discrete event simulation is usually time consuming and cannot be used as the online tool for real-time decisions. Max-plus Algebra is a mathematical tool that can model discrete event systems in linear equations analogous to traditional state space dynamic equations [58] and has higher computation efficiency. Some works used Max-plus Algebra to model and analyse manufacturing systems, such as parametric analysis of mixed-model assembly lines [59], makespan calculation of a job-shop [60], and flow shop scheduling problems [61]. In this section, Max-plus Algebra is used to estimate the ESW of a target machine for energy saving operation based on previous work [62].
As aforementioned, ESW represents the sleep time of the target machine without affecting the production of Mb. If the target machine Mi is located before the bottleneck Mb (1 ≤ i < b), the sleep of As shown in Figure 3, the main decision flow (rectangle 1) will be triggered if there is a BE or SE of a target machine M i during production. The ESW of this target machine is estimated based on the current states of SG i . Then, the physical machine is switched into sleep mode. During the sleep duration of a target machine, different events of machines will be monitored and machine states will be controlled for energy-saving operation. In the flow of rectangle 2, the FE and then the RE of a machine in SG i are monitored. If an RE occurs on a machine, the main decision flow is retriggered to estimate a new ESW of the target machine. The underlying principle is that the failure of a machine in SG i can provide more energy-saving time for the target machine. In the flow of rectangle 3, different machines of the system are monitored according to the place of SG i , considering the bottleneck M b . If the target machine M i is before M b , a new system segment before SG i is named as BSG i. The BE of machines in BSG i and the SE of machines in SG i are monitored. For each machine, from near to distant, related to the target machine, the machine in BSG i or SG i will be put to sleep if it is blocked or starved. If the target machine M i is after M b , a new system segment after SG i is named ASG i and similar decisions are made on each machine before the target machine ends its sleep. All the machines that were put to sleep will be woken when the ESW of the target machine is exhausted and a decision round ends.
Compared with time-based data sampling in the fuzzy logic method [26], our event-driven method greatly eases the burden of data collection and conforms to the stochastic of the system. The dynamic updating of the ESW of the target machine during one round decision is more reasonable compared with the constant opportunity windows [27,29,[55][56][57] and will be illustrated in Section 5.
From the flow in Figure 3, our event-driven energy-saving decision method is also different from the event-based energy-efficient production control in References [30,54], which used predefined energy-saving control events to analyze the system performances.

Estimation of Energy Saving Window Based on System Segment using Max-Plus Algebra
Discrete event simulation is usually time consuming and cannot be used as the online tool for real-time decisions. Max-plus Algebra is a mathematical tool that can model discrete event systems in linear equations analogous to traditional state space dynamic equations [58] and has higher computation efficiency. Some works used Max-plus Algebra to model and analyse manufacturing systems, such as parametric analysis of mixed-model assembly lines [59], makespan calculation of a job-shop [60], and flow shop scheduling problems [61]. In this section, Max-plus Algebra is used to estimate the ESW of a target machine for energy saving operation based on previous work [62].
As aforementioned, ESW represents the sleep time of the target machine without affecting the production of M b . If the target machine M i is located before the bottleneck M b (1 ≤ i < b), the sleep of the target machine will result in the starvation of the M b . We define TE i as the time length that all work-in-processes (WIP) in buffers of SG i are cleared out. In order to recover the production of M b immediately after waking the target machine, the time length from entering the target machine to arriving at buffer B b−1 must be eliminated and donated as TR i . If the target machine M i is located after the bottleneck M b (b < i ≤ m), putting the target machine to sleep will cause a blockage of the M b if all buffers in SG i are full. We define TF i as the time duration that all buffers in SG i are filled from their current levels. The ESW of the target machine M i is estimated as follows: The time length TE i , TR i , and TF i can be estimated using the Max-plus Algebra method, which can calculate the time instant of a system state. Here, the estimation of TE i is illustrated as an example. The following variables are defined to describe the system states for target machine M i (1 ≤ i < b).

•
The total number of WIP in all buffers of SG i is denoted as n.
u j is an column vector of u j (k). • x j (k) is the time instant when M j starts processing the kth part.
Apparently, we can get the following formula if the current time clock is zero.
where x b (n) means the time instant that bottleneck machine M b starts processing the last part in SG i . At a decision time point, there are I j−1 parts in buffer B j−1 that are available to machine M j . After the processing activity of M j , a new part will be sent to B j and will be available to machine M j+1 . The vector u j is formulated as follows: For each part in buffers of SG i , the time instant that M j starts processing the part is as follows: In state space form, it can be described as follows: The coefficient matrices A, D and F are formulated as follows: where e is the null element and ε is the identity element in Max-plus Algebra. Based on the above method, the state equations of the system segment will be quickly initialized using real time production data collected from shop floor and the ESW of a machine can be estimated for online energy saving decision and control.

Simulation Case of a Serial Manufacturing System
The event-driven energy saving decision model in our digital twin of an energy efficient manufacturing system can be used to control the physical system online under Industry 4.0 environment in the future, which realizes the communication from virtual space to physical space. In order to imitate the operation procedure of the physical production system, the model of the real production line is built in MATLAB-Simulink [63]. The running process of the modeled system generates real-time production data and events, which are monitored, collected and sent to digital twin. The energy-saving decision based on Max-plus Algebra is built in digital space as a service. The decision is driven based on defined events and the decision results are sent to the mimetic physical production system in MATLAB-Simulink, where the machines are controlled for energy-saving operation. The whole process simulates the bidirectional communication between physical space and virtual space.
A typical serial manufacturing system including six machines and five buffers (6M5B) in References [26,29] is taken to illustrate the effectiveness of our method. This system is a simplified version of a real automotive production line. The parameters are presented in Tables 1 and 2, where mean time between failure (MTBF) and mean time to repair (MTTR) are assumed as exponential distribution for this case. The simulation duration is three weeks, i.e., 30,240 min. The electricity rate is assumed to be $0.2/kWh. It is assumed that no power is consumed in machine sleep mode for comparing performances with the methods in References [26,29]. Three scenarios are simulated as follows: baseline scenario with no energy saving decision and control (S1), only one machine being controlled for energy saving (S2), and multi-machine except the bottleneck machine being controlled for energy saving (S3). These three scenarios are simulated for 20 trials-each. After simulation of baseline scenario S1, machine M 4 is recognized as the system bottleneck.

Experiment Results and Analysis
The simulation results of system performances, i.e., System throughput (STP), System throughput Loss (STPL), Total system energy cost (TSEE), Energy cost per part (ECPP), and Energy cost saving per part (ECSPP), are shown in Table 3 with 95% confidential interval (CI). It can be seen that the energy cost saving per part is remarkable based on an event-driven digital twin model of the machine control method. When multiple-machines are controlled in S3, there is almost 57.24% energy-cost saving and only 2.20% system throughput is lost compared with baseline scenario S1.   Table 3.
We recorded the data of an event-driven energy-saving decision process during simulation experiments. Table 4 shows some data from S3, and the meanings are explained as follows.
An SE of M 3 is monitored at 19,772.1 min, and M 3 is taken as the target machine. An energy-saving decision is triggered based on the system segment SG 3  M3 before the BN (M4), the blockage time gradually decreases and the sleep time (energy-saving time) gradually increases in S2 and S3 compared with S1. The processing time of the machines almost remain unchanged, which means the energy-saving control does not affect processing work and converts the blockage time to sleep time. For machines M5 and M6 after the BN (M4), the energy-saving decision and control method can effectively change the starvation time into sleep time. For example, the total starvation time of M5 in S1 is 86.37% of simulation time. In S3, the starvation time of M5 is entirely converted to sleep time. The total processing time of M5 in S1 (3438.2 minutes) and S3 (3376.6 minutes) almost remain the same, while the sleep time of M5 is 86.57% of simulation time in S3. The control of machine states results in the energy-cost reduction as shown in Table 3. We recorded the data of an event-driven energy-saving decision process during simulation experiments. Table 4 shows some data from S3, and the meanings are explained as follows.   Figure 5 shows the changing process of machine states (M 5 ) in S1 and S3, which is randomly selected from the experiments between 20,000 to 24,000 min. In baseline S1 with no energy-saving decision and control, there are many interval starvations and processing times of M 5 due to the empty state of buffer B 4 . For example, there is one part in B 4 at time 20,158.6 (S1) and in M 5 that begins to process the part for 1.1 min. After time 20,159.7, the frequent starvation and processing state occurs alternately. Therefore, many normal starvation states of M 5 with short duration consume a lot of non-value-added energy. In controlled scenario S3, the M 5 is put to sleep until time 20,619.2. At time 20,619.2, M 5 is woken up and processes parts continuously for 61.6 min until time 20,680.7. Then, M 5 is put to sleep again in a new event-driven decision round. Comparing the states of M 5 in S1 and S3, it can be concluded that control of machine energy-saving states brings energy-cost reduction of manufacturing systems. The eKPIs of the system under multi-machine control scenario in this paper are compared with fuzzy logic method [26] and mathematical model [29] in Table 5. The three methods of energy-saving control all result in reduction of system throughput less than 3%, which is acceptable in practical manufacturing systems. Our method achieves the most energy-cost reduction per part (57.23%) compared with the other two methods, and the effectiveness of this paper is proved. Except for the better performances, our method has some advantages for practical use in shop floors. The first advantage is that there is no restriction on the failure mode of machines in our method. The mathematical models [24,25,29] for energy-saving decision are all based on specific failure modes of machines. When the machine recovers from failure, the event-driven method will re-estimate the ESW of the machine. Non-predefined control parameter is the second advantage of our method. In fuzzy logic method [26], the threshold values and decision intervals of the machines should be defined in advance for energy-saving control. The method in Reference [29] should assume the subjective value of discount ratio and collaboration ratio. The third advantage is that our method can be used in synchronous manufacturing systems and asynchronous manufacturing systems. The method in Reference [29] can only be used in an asynchronous line.

Conclusions
With the development of IoTs, energy-efficient manufacturing is provided more opportunities in an Industry 4.0 environment, where the digital twin plays an important role for real-time production monitoring, simulation analysis, and feedback control of physical systems. Considering most current works focus on the uniderection mapping from physical space to virtual space, a The eKPIs of the system under multi-machine control scenario in this paper are compared with fuzzy logic method [26] and mathematical model [29] in Table 5. The three methods of energy-saving control all result in reduction of system throughput less than 3%, which is acceptable in practical manufacturing systems. Our method achieves the most energy-cost reduction per part (57.23%) compared with the other two methods, and the effectiveness of this paper is proved. Table 5. Comparision of the system eKPIs in different methods.

Method
Reduction of System Throughput (%)

Reduction of Energy Cost per Part (%)
This paper 2.20% 58.17% 57.23% [26] 0.23% 51.76% 51.66% [29] 2.70% 27.00% 24.98% Except for the better performances, our method has some advantages for practical use in shop floors. The first advantage is that there is no restriction on the failure mode of machines in our method. The mathematical models [24,25,29] for energy-saving decision are all based on specific failure modes of machines. When the machine recovers from failure, the event-driven method will re-estimate the ESW of the machine. Non-predefined control parameter is the second advantage of our method. In fuzzy logic method [26], the threshold values and decision intervals of the machines should be defined in advance for energy-saving control. The method in Reference [29] should assume the subjective value of discount ratio and collaboration ratio. The third advantage is that our method can be used in synchronous manufacturing systems and asynchronous manufacturing systems. The method in Reference [29] can only be used in an asynchronous line.

Conclusions
With the development of IoTs, energy-efficient manufacturing is provided more opportunities in an Industry 4.0 environment, where the digital twin plays an important role for real-time production monitoring, simulation analysis, and feedback control of physical systems. Considering most current works focus on the uniderection mapping from physical space to virtual space, a digital-twin-based bidirectional operation framework of energy-efficient manufacturing system is proposed to digitalize the physical manufacturing systems, to perform simulations and decisions for different energy-saving purposes in virtual space, and to control the power states of physical machines. The three views, i.e., data view, model view, and service view, are described to map the physical system to digital system. An online event-driven energy-saving decision method based on Max-plus Algebra is presented to switch machines to sleep mode with consideration of maximum energy saving and minimum effect on system throughput. The Max-plus Algebra model is used to snapshot the states of system segment and to estimate the ESW of the machines. A simplified real automotive production line is taken as an example to carry out simulation experiments, and the results illustrate the effectiveness of the proposed method compared with other methods in literatures. Not relying on machine failure mode and non-predefined parameters in our method makes it simple to be used in synchronous and asynchronous systems. The potential application of our method in more complex line, e.g., parallel line, assembly line, or disassembly line, will be experimented in the future.