Towards Energy Efﬁcient Scheduling of Manufacturing Systems through Collaboration between Cyber Physical Production and Energy Systems

: Currently, enhancing sustainability, and in particular reducing energy consumption, is a huge challenge for manufacturing enterprises. The vision of the fourth industrial revolution (so-called “industry 4.0”) is not only to optimize production and minimize costs, but also to reduce energy consumption and enhance product life-cycle management. To address this challenge, a multi-agent architecture aimed at elaborating predictive and reactive energy-efﬁcient scheduling through collaboration between cyber physical production and energy systems is proposed in this paper. Smart, sustainable decision tools for cyber physical production systems (CPPS) and cyber physical energy systems (CPES) are proposed. The decision tools are data-driven, agent-based models with dynamic interaction. The main aim of agent behaviours in the cyber part of CPPS is to ﬁnd a predictive and reactive energy-efﬁcient schedule. The role of agents in CPES is to control the energy consumption of connected factories and switch between the different renewable energy sources. Dynamic mechanisms in CPPS and CPES are proposed to adjust the energy consumption of production systems based on the availability of the renewable energy. The proposed approach was validated on a physically distributed architecture using networked embedded systems and real-time data sharing from connected sensors in each cyber physical systems. A series of instances inspired from the literature were tested to assess the performance of the proposed method. The results prove the efﬁciency of the proposed approach in adapting the energy consumption of connected factories based on a real-time energy threshold.


Introduction
Over the last few years, the fourth industrial revolution has attracted more and more attention worldwide. Industry 4.0, or smart manufacturing, combines the strengths of traditional industries with new cutting edge technologies [1]. It is the combination of several technological developments that embrace both products and processes. Manufacturing systems are converted into intelligent connected factories using new technologies such as cloud manufacturing, internet of things (IoT), cyber physical systems (CPS), big data analytics (BDA), and information and communication technologies (ICT). Networking, digitalization, and computing are keys to achieving sustainable goals for such systems. Future production, energy, transport, and logistics systems should exhibit adaptive performances parameters should be adapted. A mathematical model is possible to confirm the results obtained by our approach and the Constraint Programming (CP) optimizer.
A literature review on cyber physical systemss and energy efficiency scheduling methods is presented in Section 2. Details of the proposed architecture are given in Section 3. The implementation of EasySched is detailed in Sections 4 and 5 provides the results and the interpretations of the experiments. A conclusion and future prospects are described in Section 6.

Literature Review
The scientific issue in this paper is about sustainable production and more precisely the design of "energy-efficient manufacturing scheduling systems" in the context of industry 4.0 [12]. Research on energy-efficient scheduling methods has been actively developed. Concurrently, with the rapid development of CPS technologies, research on the implementation of CPS to design energy-efficient methods has been continued [14]. The literature review is divided into two parts. The first one discusses research on cyber physical production and energy systems to achieve sustainability. The second part presents and analyses the state-of-the-art in energy efficient static and dynamic scheduling methods.

CPPS and CPES
Several researchers have reviewed articles about trends, issues, activities, and applications of industry 4.0 [5,9]. For example, Liao et al. [15] analyzed academic articles on the topic of Industry 4.0, summarized research activities, and indicated potential research directions. The detailed reviews of industry 4.0 indicate that CPS and IoT technology are receiving increasing attention from the community. In this context, many different kinds of CPS can be defined. Figure 1 illustrates some industrial domains in which the concept of CPS is used. In this paper, we consider the two following types of CPS: • Cyber Physical Production System (CPPS): defined "as a system of systems comprising autonomous and cooperative elements connecting with each other in situation dependent ways on and across all levels of production, from processes through machines up to production and logistics networks, enhancing the decision-making process in real time, in response to unforeseen conditions" [16]. • Cyber Physical Energy System (CPES): to promote building energy management, "researchers investigated the possibility of integrating energy management systems with Cyber-Physical Systems to form Energy-Cyber-Physical Systems" [17]. CPES are considered as systems of systems with dynamical behaviour through interactions between different complex components and systems. CPES combine domains from physical energy systems such as electric power grids, and distributed energy resources with information and communication infrastructures (ICT) [18]. Different methodologies and approaches have been used to address CPPS that are classified and detailed in the work of Cardin et al. [19] through an analysis framework. For example, in the context of intelligent manufacturing, the authors in [20] propose a CPS architecture for the shop floor considering various aspects such as interconnectivity between devices, multi-sourcing in data acquisition and smart decision-making and learning. Keil [21] designed an autonomous control system for decentralized CPPS manufacturing systems. The performance of the design was validated on a case study of a semiconductor production system. In a survey of CPES [22], Macana et al. identified the main research areas and challenges in energy systems. The authors in [23] proposed a dynamic battery model comprising different states representing discharge/recovery effects with scheduling algorithms. Yang [24] studied the application of IoT in a smart grid and highlights the main issues relating to large-scale IoT infrastructures in co-simulation platforms. In [25], the authors proposed a real time analysis method to manage energy in CPES for micro-grids. The proposed analysis verifies the feasibility of the scheduling. The performance and effectiveness of the method was validated through experimental results. For instance in [26], a micro-grid is considered as a CPES that is able to manage the distributed power and energy storage devices dynamically. Wu et al. [27] develop a real-time energy management system to increase the use of solar energy to avoid over-charging and over-discharging of batteries in the house; this prolongs the life of the batteries in order to meet the electricity needs of a smart building.
CPS technology can be combined with scheduling algorithms to design energy-efficient scheduling solutions. For example, in an energy-efficient job shop context, Feng et al. [14] developed a dynamic scheduling system based on a cyber physical energy monitoring system. The proposed system uses a modified genetic algorithm with multi-layer coding to ensure the energy-efficiency of the solution. A CPS was used to monitor the energy consumption of amanufacturing process. In the next section, scheduling methods dealing with energy are discussed.

Energy Efficient Scheduling Methods
Energy efficient (or green) methods are used to tackle various sustainability challenges. They must be integrated into the CPPS control systems and must interact with the CPES supplying their energy. Contributions relevant to energy efficient scheduling methods found in the literature can be classified into two main categories described hereinafter.

Static Energy Efficient Scheduling Methods
The first category groups energy efficient static scheduling methods without considering perturbations. For instance, the authors in [28] present a framework to solve a multi-objective optimization problem that minimizes total energy consumption and total tardiness. Fang et al. proposed a mathematical programming model of the flow shop scheduling problem that considers peak power load, energy consumption, and the associated carbon footprint in addition to cycle time [29]. Authors in [30] suggested a new approach to optimize energy consumption in a flexible job shop taking into account resources selection and the order of operations. They also proposed a mixed integer programming model to minimize both the makespan and the energy used. In addition to these two objectives, other studies also consider an additional objective, which is the tardiness. For instance, in the context of energy-aware scheduling, the authors in [31] developed a centralized-distributed model and a mathematical model that considers these three objectives.
A mixed integer linear programming (MILP) mathematical model is formulated in [32] for the energy-oriented hybrid flow shop scheduling to minimize both the tardiness and the non-processing energy. The authors also developed an evolutionary-based algorithm to solve the problem. A three-stage decomposition method was suggested by authors in [33] to minimize the energy used in the flow-shop scheduling problem. In the flexible job shop context, a non-dominated sorting genetic algorithm (NSGA)-based scheduling approach was suggested by Zhang et al. [34] to minimize the energy used and the makespan.
Many other studies focused on minimizing CO 2 emissions. For example, Li and Cao [35] proposed a two-stage model to minimize CO 2 emissions using two different strategies. In a similar context, the authors in [36], proposed an efficient multi-objective approach based on a genetic algorithm in order to minimize total carbon emissions and total late work. By minimizing the energy used, the carbon emission and production costs are also minimized especially at peak times when the use of energy increases or when electricity costs become very high. In this context, Moon et al. in [37] proposed a method to minimize total production costs for the the flexible job-shop scheduling problem while considering perturbations in energy sources and storage. Mikhaylidi et al. in [38] suggested an approach based on dynamic programming to generate an energy consumption schedule that indicates both the time and the amount of electrical energy used by each operation at each time period. In the context of sustainability in manufacturing systems, an evaluation and improvement approach was suggested by Liu et al. [39] to enhance the performance of the production system and the resources efficiency while considering environmental constraints.
The common point in the research cited above is that the schedule must consider another important feature, which is the energy consumed when processing jobs in addition to classical key performance indicators such as makespan, tardiness, and workload. The energy consumption (EC) can be integrated as an objective or a constraint, and can refer to machine energy consumption, CO 2 emissions, energy prices, etc.

Dynamic Energy Efficient Scheduling Methods
Taking unexpected disruptions into account increases the complexity of the scheduling problem. The authors in [40] classified the different approaches used to deal with disruptions into proactive, reactive, and hybrid methods. The predictive-reactive hybrid method is one of the most studied approaches. A predictive schedule is first generated to be executed until a disruption occurs. Then, a repair technique is launched to handle failures. Rescheduling is one of the repair procedures used in the reactive part of a hybrid approach. Rescheduling is a procedure that aims to adapt an optimal production schedule to dynamic and stochastic environments [41].
The rescheduling problem is of great importance. Researchers have focused on profitability and sustainability to construct a new class of rescheduling methods namely energy-efficient rescheduling (EER) methods [42]. Other studies have focused on the rescheduling problem in a dynamic job-shop environment in which the production resources work at various rates. For instance, Salido et al. [43] proposed a new match-up approach with a memetic algorithm to minimize the total energy used.
Many researchers have addressed the dynamic scheduling problem in flexible manufacturing systems (FMS). For example, in the context of energy consumption, the authors in [44] developed a new mathematical model based on goal programming to minimize the energy used while considering the efficiency of the schedule generated. The authors also proposed a genetic algorithm-based approach for rescheduling. Nouiri et al. [42] proposed a green rescheduling method (GRM), an extended version of the work in Nouiri et al. [45]. The GRM takes into account energy efficiency when solving the flexible job shop rescheduling problem. The above mentioned studies propose energy-efficient scheduling methods considering traditional impromptu disruptions such as due date changes, machine breakdowns, and random job arrivals. The dynamic variation of energy availability is not considered.
A few studies have focused on energy fluctuation as a source of internal perturbations in manufacturing scheduling systems. For instance, Pach et al. [46] proposed a potential field-based control model to switch resources on/off reactively depending on the situation of the FMS to reduce energy wastage. Overall, power consumption control was introduced to maintain this consumption below a dynamically determined energy threshold. Trentesaux et al. [47] presented a set of key requirements when designing multi agent or holonic architectures (MAS/HMS) for future energy aware production scheduling systems. The authors discuss the importance of design approaches that must be able to observe and control variables of energy consuming resources, and support the reconfiguration of the manufacturing system according to the cost and availability of energy as well as the availability of manufacturing resources. A predictive and reactive multi-agent architecture integrating energy consumers and energy producers is specified, however no model is proposed. Inspired from [47], Nouiri et al. [48] proposed a multi-agent-energy-aware production scheduling and rescheduling system based on decision sharing and distribution. Negotiation protocols were proposed and validated to find predictive sustainable production solutions. However, no reactive decision mechanism was provided. Table 1 summarizes the related studies in energy rescheduling, specifying the type of perturbation, the method, and the objective. As environmental impacts become a growing concern worldwide, the power-provisioning problem is a challenge for many designers. In the domain of data centre design, Li et al. 2012 [49] proposed a power management scheme called "iSwitch" that aims to balance the charge of renewable energy power load between different power supplies. They consider one type of renewable energy (wind) and the supplies represent the server clusters (i.e., VMs). To generate an optimal bidding strategy for a virtual power plant, Riveros et al. in [50] proposed an approach that considers perturbations in terms of electrical energy and energy costs in the market using stochastic optimization by evaluating various bidding strategies. Fan et al. [14] addressed the effect of disruptions on the reliability of power systems. They developed a rescheduling approach to find the most suitable scheduling solution by reducing the variances of branch power flows. The proposed method was evaluated and validated on a real-case study.
To sum up, energy-efficient scheduling research with objectives relating to environmental influences (energy consumption, CO 2 emissions, waste, etc.) is increasing. However, energy-efficient rescheduling methods taking the fluctuation of renewable energy as a source of perturbation into account are limited in the context of manufacturing. State of the art scheduling methods are based mainly on optimization tools (meta-heuristic) and they integrate simulation tools helping to maximize production efficiency and offset environmental effects. A mathematical model (MILP) considering the environmental performance as a constraint or as an objective is then formulated. Few studies have used a dynamic energy threshold to achieve sustainable production, whereas the majority of studies have applied prior-experimental data (a fixed energy threshold).
A large number of investigations on energy-aware manufacturing methods have been conducted to improve the energy-efficiency of production in the context of the fourth industrial revolution. However, the validation of the research already mentioned ignores the real-time events on the shop floor. Contributions also remain conceptual with little attention paid to practical validations. Finally, from our review, we noticed that few studies elaborate on the coordination and collaboration between CPPS and CPES to achieve production sustainability.
To address these shortcomings, this paper proposes a multi agent architecture, named EasySched, to schedule the production of goods in a predictive and reactive way. The architecture is based on collaboration between CPPS and CPES. The sustainable decision tools are based on a distributed control model based on an intelligent solving method (meta-heuristic/heuristic for scheduling and rescheduling) using a multi agent system coupled with IoT technology that enables devices (CPPS and CPES) to connect and collaborate with each other and act as an entire system.
As real-time scheduling plays an important role in CPS [25], it is primordial to propose new reactive mechanisms to handle the energy consumption. Two rescheduling methods are also proposed to take into account fluctuations in renewable energy in real time. EasySched was validated in a completely distributed way, integrating hardware and software. Reactive mechanisms are proposed to adapt the consumption of production factories according to an energy threshold communicated in real time by CPES from energy providers. The proposed architecture is detailed in the next section.

Contribution
This section provides a description of our contribution. Firstly, the design approach of "EasySched" is presented. Then, the reactive mechanisms and the implementation of the hardware are detailed. The validation tests concern the predictive and reactive parts.

Design Approach
Solving the scheduling problem consists in assigning and organizing the execution of a set of tasks on a set of machines and specifying the start and end time of each operation. The solution or "schedule" is characterized by a specific performance indicator (makespan, tardiness, etc.). However in the case of sustainable production, environmental performance indicators such as energy consumption, CO 2 emissions, and percentage waste reduction must be considered when constructing the schedule. In this work the makespan and the energy consumption of resources processing jobs are considered as the temporal and environmental performances respectively. The schedule must also respect several constraints. These constraints can be classified according to their deterministic (precedence constraint for example) or dynamic nature, taking into account the availability of machines over the planning horizon, for example. The predictive schedule represents the off-line solution calculated based on prior-experimental data (operating time, energy consumption, etc.), whereas the reactive one is formulated on-line using the real data and real situation of the production environment (considering unpredicted events). The constraints cited above should be considered as the design stage of the scheduling system. Several conceptual design methods have been proposed to ensure the most global view of the implications of the sustainability principles at different levels of the manufacturing system. For instance, references [51][52][53] proposed tools and conceptual models that help the developer to design and implement sustainable intelligent systems (SIMS). To ease the implementation of SIMS, multi-agent systems are suitable for distributed decision-making models enabled by a distributed agent-based architecture. In this work, the proposed multi-agent architecture was designed according to the Go-Green design methodology ANEMONA (A Multi-agent Methodology for Holonic Manufacturing Systems) [53]. The design system is completely distributed to facilitate responsiveness to a variety of unforeseen events. The Go-Green ANEMONA is based principally on the concept of Go-Green manufacturing holon proposed in [47]. In addition to the classical effectiveness-oriented mechanisms, the Go-Green holon considers efficiency-oriented mechanisms (optimizing sustainability means) to make decisions and/or execute operations. The details of the proposed architecture, including the description of its agents, are provided in the next section.

Description of the Proposed Architecture
The proposed hybrid, EasySched, combines predictive and reactive decisions and is based on cooperation between CPPS and CPES. Figure 2 represents a general view of the architecture, specifying the different types of energy suppliers and energy consumers that can be considered. The energy-consuming production systems can be a single machine, a flow shop, or a flexible manufacturing system, etc. Wind power and solar power are considered as renewable energy sources. The IoT manufacturing gateway enables the manufacturing objects to sense, interconnect, and interact with each other to automatically and adaptively carry out manufacturing logics (see Figure 2). Different possible connections can be designed: human-to-human, human-to-machine, and machine-to-machine cooperation [5]. The cyber components refer to the sensing, communication and decisional computing systems, whereas the physical components comprise the factories with renewable energy generators. The architecture is based on the coordination processes between factories producing goods and energy providers to find a sustainable decision. The intelligent decision reflects either a schedule or reschedule in SIMS and a switching/distribution order in smart energy systems. Sustainable decisions are obtained by smart sustainable decision tools in CPPS and CPES. Both tools are data-driven agent model based on optimization algorithms with dynamic internal interactions with manufacturing objects (CPPS, cyber human system (CHS), enterprise resource planning (ERP), etc.) and external interactions with other manufacturing factories or energy providers (a set of CPES). The smart sustainable tools of CPES and CPPS are controlled by the energy scheduler agent (ESA) and factory scheduler agent (FSA) respectively. Figure 3 illustrates the agent model of EasySChed based on communication between FSA and ESA. The FSA is mainly responsible for: • Runing meta-heuristics to find an energy-efficient predictive schedule. • Controlling local events.

•
Rescheduling and negotiation capabilities. The ESA is mainly responsible for: • Validating predictive solutions for factories • Controlling energy consumption of connected factories.
Both FSA and ESA have predictive and reactive roles. They interact with each other and/or depend on each other. The details of the smart sustainable decision tools of CPPS and CPES are described hereinafter.

Smart Sustainable CPES Decision Tool
The cyber part of CPES is comprised of a smart sustainable decision tool integrating the embedded computing level and embedded communication skills (IoT technology) (see Figure 4). The smart tool is a data-driven agent based model with dynamic interactions and itis controlled by the energy scheduler agent (ESA). As mentioned before, the EasySched is hybrid, and thus the roles of the ESA are predictive and reactive. -Predictive role: This role validates the predictive schedules of factories. In fact, the ESA agent receives external data from CPPS representing an energy demand that reflects the energy consumption of the predictive solution calculated by the cyber part of the CPPS. The CPES approves the solution if it satisfies the energy demands, otherwise, it refuses. More details of the predictive behaviour are provided in [48]. -

Reactive role:
This on-line role controls and monitors, in real time, the availability of renewable energy and especially dynamic events. To achieve this goal, the reactive behaviours of the energy scheduler agent ESA are monitoring data, pre-processing data, analyzing data, and computing as follows:

•
Monitoring data: Data acquisition via sensors is an important aspect of industry 4.0 or smart systems in general. Sensors are the machine's gateway to sensing its surrounding physical environment. Using appropriate sensor installation in CPES, various signals such as vibration, pressure, or temperature can be extracted. This behavior is cyclic and repeated every fixed period P1. Raw data such as temperature, electric power, voltage, and energy consumption are collected and saved to be processed. The collected data is useful to find a good sustainable decision for maintenance, control, scheduling, etc. • Pre-processing data: Data pre-processing behaviour is conducted on the acquired data. This includes checkout, debugging, duplicate checking, and duplicate removal, producing useful data [20].

•
Analysing data and computing: The aim of this behaviour is to analyze the process and transform the raw data collected into smart data that can be used to make decisions. First, the ESA checks if there is a false alarm or not before making the decision. This behaviour is cyclic and repeated every period P2 (where P2 > P1). As mentioned in Algorithm 1, if there is a fluctuation in energy, a new energy threshold is calculated by the ESA and a rescheduling decision order is sent to the factory scheduler agent (FSA). The rescheduling order specifies the rescheduling time and the energy constraint to be respected. P2 = x × P2 8: else 9: ControlMessage.State = "No energy perturbation" 10: Send (ControlMessage, FSA) 11: end if Our proposed architecture takes into consideration two situations relevant to the configuration of energy providers.
-Situation 1: Each factory is connected to a specific renewable energy generator (wind, photovoltaic, etc.) controlled by a specific ESA. In other words, each ESA controls a specific source of energy (wind for example) and the factories using this source. -Situation 2: All renewable energy generators are combined and controlled by the same ESA. In this situation, two weighting parameters α, β are used to control the power supply portion of each source depending on its availability and/or the cost price of the energy type. The weighting parameters are numbers between [0, 1] that indicate the degree of importance of the energy type on the energy supply (see Equation (1)).
The data collected is used to determine α and β dynamically. If, for example, there is maintenance of a wind generator, α is set to 0 and all the factories will be supplied by the photovoltaic energy supply.
According to the energy available and the efficiency of each renewable source, it is necessary to switch the consumption between the different energy sources. Thus, an intelligent algorithm must be used to enable the optimal combination between sources according to the relation in Equation (1). α and β define the rate of power used from wind and photo-voltaic sources respectively. The configuration of the weighting parameters should take into account: (1) the threshold energy reserve that must be in the batteries, (2) the duration of consumption, α > β 4: else 5: if P Wind < P photovoltaic then 6: α < β

Smart Sustainable CPPS Decision Tool
As we can see from Figure 4, CPPS implementation for the shop floor consists in integrating components such as sensors, Radio Frequency Identification (RFID) devices, and measurement devices in the manufacturing resources and distributing them in the production environment. The smart sustainable decision tool of CPPS is a data-driven agent-based model with optimization algorithms and dynamic interactions. The factory scheduler agent possesses the following predictive and reactive roles:

•
Predictive role: This off-line role consists of calculating a predictive schedule that minimizes makespan and energy consumption. The predictive solution is determined by a particle swarm optimization (PSO) algorithm proposed in [54] where a particle represents a potential solution to the problem. Each of these particles is characterized by a position vector, a velocity that allows the particle to move and a neighbourhood, a set of particles (neighbours), that interact directly with the particle, in particular that which has the best criterion. Equation (2) represents the bi-objective function used in PSO to evaluate the solutions. It combines both the makespan (C max ) and the total energy consumption (E tot ). The two objectives are not of the same magnitude or units, therefore, a normalization phase is required. A weighting factor γ makes it possible to determine the degree of importance of each objective.
The predictive decision of CPPS aims to find an energy efficient schedule. The FSA sends an energy demand to the ESA. If the later refuses the demand, the PSO algorithm is executed again but with a new value γ found after a negotiation phase with other CPPSs of other factories. The weighting parameter is reduced by a value λ favoring the reduction of the energy consumption. The pseudo code of negotiation protocol is detailed in Figure 3. Algorithm 3 presents the pseudo code of negotiation protocol. For more details of the negotiation protocol between CPPS are given in [48]. To achieve this goal, the CPPS also has monitoring, pre-processing, and computing behaviors like the CPES. However the reactive decision concerns calculating a new reschedule while respecting a new energy threshold constraint. These behaviours are detailed as follows: -Monitoring data: The FSA acquires the raw data (e.g., temperature, electric power, speed, new job arrivals, and machine breakdowns) from internal CPPS or external data that represents a new energy threshold received in real time from the CPES.

-
Pre-processing data: Similar to CPES behaviour; it aims to structure the raw data collected.

-
Computing: This reactive behaviour aims to make a sustainable decision based on the data collected (sensor data, internal event (internal disruptions), and external events (fluctuation of energy from CPES)). A rescheduling method is launched to find a new schedule. The pseudo code of the reactive behaviour of the FSA agent is given in Algorithm 4. This periodic behaviour is repeated every period P3 (where P3 > P2). If the message received from ESA does not refer to any perturbation, the scheduling is applied according to the original plan. Otherwise, a rescheduling technique is executed. In fact, a rescheduling optimization method is triggered to generate an updated schedule if working conditions vary significantly (internal, external) and re-scheduling adjustments are necessary. The proposed rescheduling methods are described in the next subsection. Continue scheduling based on predictive solution 4: else 5: Extract affected subparticle ( Reschedule.timeResch) 6: Apply a rescheduling method on the subparticle to find a new schedule that respects the energy threshold Reschedule.tauxEnergy 7: end if

Rescheduling Methods in the Smart Sustainable Tool of CPPS
Dynamic events in a production system significantly influence the quality and efficiency of the predictive solution. Several rescheduling methods have been proposed to address this problem. Three main groups were found: right-shift rescheduling, total rescheduling, and partial rescheduling. Examples include affected operation rescheduling (AOR) proposed by Vieira et al. [55] and modified AOR (mAOR) proposed by Subramaniam and Raheja [56]. However they do not take into account the sustainable aspect. This will also impose radical changes in the way scheduling repairing approaches are designed and implemented [42]. Before presenting the proposed rescheduling techniques, the type of perturbation considered is detailed. Figure 5 illustrates the information needed to react to a perturbation. This information concerns the affected resource, as well as the date of occurrence, the duration, and the type of disruption (e.g., repairable or un-repairable). The affected resource can be either reusable or consumable. Uncertainties in terms of machine disruptions, variations in processing time, new job arrivals, and fluctuations in renewable energy are considered in our approach. A specific technique is executed depending on the type of disruption. In this work, two rescheduling techniques are proposed to address fluctuations in renewable energy considered as sources of disruption in the system. The objective of the rescheduling method, executed by the FSA, is to find a new schedule that respects the new energy threshold communicated in real time by the CPES. In this work, the factories of the manufacturing system are job shops with machines working at different speeds. The principle of the rescheduling method is firstly to determine the operations affected in the predictive solution. The speed of the machines of affected operations is then reduced to reach a new energy consumption that respects the energy threshold. The machines are key manufacturing resources as well as the main energy sources in a workshop, therefore, energy scheduling is usually conducted to effectively manage machines from an energy consumption perspective [34]. In this work, the adjustable variable was the speed of the machines. Figure 6 summarizes the flow chart of the method. In each iteration, the speed of an affected operation is reduced and the energy consumption (EC) is calculated. If the new EC respects the threshold, the process is finished. Otherwise, the process is repeated on all affected operations. If in the final iteration the constraint is not respected, a penalty is associated to the reactive schedule. In this case the second rescheduling technique is used.

Rescheduling Method 2
The second rescheduling method is based on changing of sequence of the affected operations, which was unchanged in the previous method. However, the stability of the schedule is likely to be different compared to the predictive solution. The main idea of the method is to permute the operations while reducing the speed of the machines. In each iteration, the new energy consumption (EC) is calculated and the best solution is selected. Figure 7 presents the flow chart of the method.

Implementation of EasySched
This section details the physical distributed systems used as an example to verify the feasibility of the proposed architecture and to asses the performance of EasySched. A physical distributed validation, on different systems, integrating the physical elements (hardware with connected sensors (IoT)) and the software is proposed in this article. These elements are connected via networks and cooperate to provide sustainable decisions. The real target system is the AIP-PRIMECA cell at the Polytechnic University Hauts-de-France. In the first experiment, the Acorn RISC Machine (ARM) embedded system was considered as a factory. The photovoltaic energy system was represented by the ARM embedded system with a luminosity sensor. The wind energy system was represented by the ARM embedded system with a temperature/humidity sensor. Figure 8 illustrates the implementation steps of the EasySched architecture composed of five ARM embedded systems. The first step of the implementation was to propose agent behaviours of agents, negotiation, and coordinated mechanisms between agents and code them locally in the same main container (see Figure 8a). In a multi agent context, an agent requires the presence of a container. A container is an abstract class that contains all the services needed to host and manage agents during the execution of their behaviours (software program). These agent containers can be distributed throughout the network. The agents created are by default located in the same "Main container". Before being deployed to the physically distributed system comprising connected embedded systems, a container is created for each distant agent (see Figure 8b). "Factory Container i" and "Energy Provider Container i" are thus containers allocated to agents FSA and ESA respectively (see Figure 8b). ARM A7 embedded systems are used to embed the ESA1, ESA2, FSA1, FSA2, and MA containers (see Figure 8c).
In order to validate the proposed dynamic mechanisms of the sustainable decision tools of CPPS and CPES, a set of perturbations is simulated. Luminosity, temperature, and humidity sensors are used to simulate the fluctuation of renewable energy. In our approach, the outputs of these sensors represented the variation in the quantities of certain parameters on which the power supplied by the two energy resources depends. For example, the variation in luminosity, which systematically influences the variation in the power delivered by any photovoltaic power generator is easily simulated by masking the light sensor to varying degrees. Similarly, the power delivered by a wind power generator depends on the temperature and humidity and can modified by influencing the temperature and humidity sensors.
The pseudo code that allows the ESA to detect a fluctuation in energy provided by a wind generator is detailed in Algorithm 5. In the context of this work, the model proposed by (Marshall and Plumb., 2008) was used, where the electric power delivered by a wind turbine can be calculated as follows: where S is the area of the wind turbine, V is the wind speed, and ρ is the air density.
The air density is calculated as follows in Equation (4): where T and φ are the temperature and the humidity recovered from the sensors and the air pressure p equals 1013.25 hPa. Powers P(t) and P(0) are calculated using the previous equation. If the ratio P(t)/P(0) is lower than 1, energy production decreases. The "Alarm" variable determining the system status is then updated. From a technical point of view, to limit the effect of sensor noise on the signals and thus avoid considering ever change in signal as a disturbance, an artificial filtering algorithm was added as data pre-processing behaviour. For this, the period of this cyclic behaviour was bigger than the data acquisition behaviour period.

end if
In order to avoid successive launches of rescheduling signals, the period p2 of cyclic behaviour is then modified when the ESA detects an anomaly (see line 7 in Algorithm 6).

Experimentation and Interpretation of Results
The distributed implementation consists of a PC and five ARM A7 embedded systems (FSA1, FSA2, ESA1, ESA2, and MA). The PC has an Intel Core i7 processor with 8 GB of RAM. The integrated card operates at 900 Mhz with 1 GB of RAM. The target embedded system runs the Debian version of Linux. All the machines run Java SE Embedded. A LAN is used for communication between all IoT components. The multi agent model was developed using the Java Agent Development Framework (JADE) multi agent platform in Netbeans IDE. To test the efficiency and the performance of the proposed EasySched architecture through its distributed implementation, different tests were performed on various types of job-shop benchmarks using machines with different speeds. Instances were named "machines_Vmax_Pi" where (machines) is the number of machines, (Vmax) is the maximum number of tasks per job and (Pi) is the range of processing times. For example, instance (3_5_10) refers to three machines with five operations per job and a processing time range of 10. Instance details are provided in [43]. Each instance was executed five times. For our experiments, the periods p1, p2, p3 are initially set to 3 s, 6 s, and 8 s respectively. x is set to 3. Figure 9 presents a selection of real photos of our distributed implementation in the LAMIH Laboratory. The experiment comprises two stages: The first one concerns the validation of the predictive part of EasySched and the second concerns the assessment of the reactive part. Relevant performance measurements are provided in the Section 5.1.

Rescheduling Performance Measures
In order to asses the performance of the rescheduling method, performance indicators (KPI) had be defined. In fact, in order to compare the quality of the initial schedule (predictive) and the reactive one (after rescheduling), it is necessary to define two types of performance measurements depending on the evolution of the effectiveness or the efficiency [42]. They are presented hereinafter.

•
Makespan Effectiveness: Proposed in [56], it is defined as the percentage change in makespan of the predictive schedule compared to the original schedule.
where Makespan new is the makespan of the repaired schedule using the new proposed rescheduling methods and Makespan 0 is the makespan of the original schedule. The maximum efficiency 100% is achieved if the makespan of the predictive and the reactive schedule are identical. If the increase in the makespan when a disruption occurs is minimal, the rescheduling process is efficient. • Energy Efficiency: Is as a percentage change in energy consumed by the reactive schedule compared to the predictive one and is defined as follows: where Energy new and Energy 0 represent respectively the reactive and the predictive energy consumption. Valuesgreater than 100%, mean that the energy consumption of the reactive one is lower than the predictive one. This is due to the energy constraint threshold that varies in real time depending on the fluctuation in renewable energy.

Experimentation and Results of Predictive Part
In this subsection, the results of the predictive part are presented and discussed. As explained previously, the objective of the ESA in the CPES is to validate the predictive solutions found by the FSA. To asses the efficiency of the PSO algorithm used by the FSA, it is compared with the CPLEX CP optimizer results of Salido et al. [57]. CP optimizer was used as a reference to evaluate the efficiency and performance of our approach. Table 2 contains the results of the tests. The first column represents the names of the instances, following columns present the Makespan (Mk, in seconds) and the energy consumed (E in Wh) provided by the FSA1 and FSA2. The weighting parameter γ and the control message sent by the ESA are also specified. "Yes" refers to the approval of the predictive schedules, whereas "No" triggers the FSA to find another solution after negotiating with other FSAs while reducing the weighting parameter γ. The last columns represents Mk and E found by the CP Optimizer in [57]. As it can be seen, the PSO results are efficient in terms of the quality of the solutions found. The Mk values are the same for small instances compared with the CP Optimizer. The Mk and E are very close to the CP optimizer values. The total average deviation between the results of FSA1 and the CP Optimizer is 2.8% for makespan and 0.6% for energy consumption. More details are described in Appendix A. These predictive experiments also aim to validate the negotiation protocol between agents (FSA and ESA) presented in Algorithm 3. The search for the predictive solution is repeated until the approval message "yes" is received from the ESA indicating that the CPES has sufficient energy to satisfy demands.
As one can see from Table 2, the ESA sends approval messages only if the sum of the energy demand is lower than or equals to a fixed predictive energy threshold. For instance 1, the ESA sends a "Yes" message when the energy is lower than 5000 in instance 2, etc. These results validate the effectiveness of the negotiation protocol between factory schedulers and energy schedulers. Figure 10 illustrates the predictive solution delivered by FSA 1 after executing the PSO algorithm. The makespan of this solution equals 44 s and the energy consumption is 133 Wh. The particle (the PSO algorithm output) corresponding to this solution and the Gantt chart are given in Figure 10. The machine availability vector in the particle representation is useful to extract the affected operations in case of disruption and to follow its propagation (see Figure 10). Figure 11 illustrates the profiling of machine speed used in the predictive solution. As we can see, in this solution the machines are used in high speed to favor the reduction of the completion time. Figure 12 illustrates the profiling of the energy consumption per machine with the predictive solution. The idle energy consumption, that refers to the consumption during the slack times, is not calculated in this work because the power of the machines is not specified in the instances in [43]. However, it remains a very important characteristic that affects the total energy consumption.

Experimentation and Results of the Reactive Part
The objective of the experimentation is to validate the reactive part of the proposed architecture. For this purpose, many perturbations were simulated to affect the predictive solutions. As mentioned before, the fluctuation of the renewable energy is simulated by varying the output of the luminosity, temperature and humidity sensors. Figure 13 illustrates the sensing data results acquired by the ESA after executing the monitoring behaviour. The analysis of the data enables any fluctuations in renewable energy to be detected. As in the predictive part the makespan (Mk) and the energy consumption (EC), which reflect production and energy efficiency respectively are estimated.  Table 3 summarizes the results of the reactive experiments when faced with energy perturbations. The makespan and the energy consumption of predictive and reactive solutions are compared. Table 3 contains the Mk and EC of the predictive and reactive solutions respectively while specifying the energy threshold communicated by the ESA that controls this factory. It compares the performance of the reactive solutions found by the rescheduling methods with the predictive solutions. As one can see, in most cases, the FSA was able to find a new solution respecting the energy constraint. Figure 14 contains the Gantt diagram of a reactive schedule found by the factory scheduler agent FSA1 after executing the rescheduling method. As we can see from this figure, a new energy threshold was detected and communicated by the CPES. This trigger launches the rescheduling procedure at time 22 s (trigger time). The energy consumption of the reactive schedule found was reduced to 94 Wh after the disruption while the makespan is degraded to 53 s (see Figure 14). As we can see, the energy consumption and the makespan of the predictive and the reactive schedules are not the same. However, there is a small deviation in Mk value from 44 s to 53 s and in EC value from 133 Wh to 94 Wh. The new energy consumption of the reactive schedule respected the energy threshold 26%. Figure 15 illustrates the variation of the speed of machines of the affected operations to reduce the energy consumption. The high machine speeds were reduced to low and medium speed. In this scenario, the adaptation of the energy consumption of the factory to respect the 26% energy threshold led to a deterioration in the makespan performance (an increase in the production completion time). However, the quantification of this degradation depends on the production and energy consumption models used. This solution was found using the first rescheduling method proposed that seeks to preserve stability and change the speeds of machines to meet the energy constraint. The speeds of the machines M1, M2, and M3 are thus changed starting from the rescheduling time (see Figure 15).      Table 4 presents the makespan efficiency and the energy efficiency for the different instances. For instance 1, Makespan Efficiency (ME) equals 79%, which means that the makespan has not degraded much compared to the predictive makespan. However, Energy Efficiency (EE) equals 129%, which means a decrease in EC with regards to the energy threshold. Thus, the reactive energy value is lower than the predictive one. Even though the results seem to be in favour of the proposed EasySched, the simulation results obtained for all the cases were examined using an analysis of variance (one way ANOVA) to conclude if there was a statistically significant difference to support our conclusions. A statistical sensitivity test has been performed on the results.
In order to validate the obtained results, an ANOVA analysis is performed. The results obtained with the one-way ANOVA are presented in Table 5. The F-ratio and the p-value show the impact of the perturbation on the quality of the predictive solution.
The impact is considered significant for p-values < 0.05. However, according to the p-values in Table 5, the perturbation does not have a significant impact. The results presented above represent the first implementation case where each CPPS was connected to a different CPES (factory 1 to wind generator, factory 2 to photovoltaic generator). In the next subsection, the results of the second situation are analysed.

Self Configuration of CPES
Contrary to the configuration in the previous section, the results presented in this section were obtained from the second implementation case of EasySched where all CPPSs were connected to the same CPES. Tables 6 and 7 summarize the results of the experiments related to the dynamic configuration of the weighting parameter to switch between energy sources. Some assumptions are taken into consideration. Firstly, all renewable energy generators (represented by CPES) were combined and controlled by a global ESA delegated to make decisions to control the distribution of energy portion from each generator autonomously. As the luminosity sensor used in our experiments was digital and not analogue, the output was binary (0 or 1) and therefore, we could not quantify the power delivered by the photovoltaic generator. However, in this case, the weighting parameter β was set to 0.5 when the output (sensor data) was 1 or 0.2 otherwise. If there is a decrease in wind energy, α is decreased. If there is a power degradation by 10% for example α is reduced by 0.1, for 20% α is reduced by 0.2, etc. Table 6. Self-configuration of weighting parameter according to the luminosity sensor output.  As we can see from this experiment, the ESA was able to provide internal intelligent decisions to self-configure the weighting parameter responsible for switching the energy supply depending on the fluctuation in the power of each renewable energy generator.

Output of Luminosity
Other scenarios can be imagined in the context of switching between energy sources, for example, the dynamical real-time variation in the price could also be treated as a source of perturbation.

Discussion
The results obtained by EasySched architecture seem to be promising in terms of makespan and energy efficiency of the obtained solutions. The architecture enables the connected factories to adjust especially their consumption in terms of an energy threshold communicated in real-time by CPES. A statistical sensitivity test has been performed on the results. However, formal studies have to be conducted to prove the effectiveness and efficiency in predictive and reactive parts. Other self configuration mechanisms have to be designed for the CPES to switch between different renewable sources.

Conclusions
This work deals with sustainable manufacturing systems to improve resource efficiency, environmental friendliness, and energy-aware production performance. A multi-agent architecture named "EasySched" was proposed to find predictive and reactive productionscheduling based on renewable energy that is difficult to predict. The agents proposed in "EasySched" are responsible for the smart sustainable decision tools of the cyber part of cyber physical production systems and cyber physical energy systems. The smart sustainable tool of CPPS and CPES is an agent based model coupled with intelligent techniques (PSO) and dynamic interactions. The proposed architecture contains intelligent mechanisms for enhancing adaptability to events. The objective of the proposed mechanisms was to coordinate the communication between CPPS and CPES in order to adjust the consumption of factories in terms of an energy threshold communicated in real time by CPES. To assess the performance of the predictive and reactive parts, several instances resulting from the literature were tested on an original physical distributed implementation of the architecture. The results illustrate only the efficiency and the effectiveness of the proposed approach in specific case studies for both the predictive and reactive parts. This means that formal studies have to be conducted to prove the contribution of our work. Other experiments on the capabilities of CPES to self configure and switch between different sources of renewable energy will be the object of future research. A second aspect is to provide a multi-layer holonic architecture to generalize EasySched. In this case, the scheduler representing the connected factory would be a holon recursively composed of a set of holons each representing a machine or intelligent product in the industry. A third perspective is to add a prediction module to the sustainable decision tool of CPS, based on artificial intelligence techniques such as recurrent neural networks (RNN), to solve one of the other main challenges in this area which is the computational prediction of system uncertainty. Job shop scheduling problem with machine at different speeds (JSMS) is an extension from classical job shop problem (JSP). JSP can be formulated by a set of jobs (j = 1 . . . J) with a set of machines (m = 1 . . . M). In JSP, each job has a set of operation (i = 1 . . . I). Each operation O ij requires a duration p ij . Each operation O ij has a machine to be executed on. The problem consists of sequencing the operations on machines in order to optimize a given objective while respecting a set of given constraints.
These constraints define the limits that should be considered when solving the problem. In JSP each machine can process only one operation at time. Once the execution of an operation starts, the pre-emption is not allowed. Precedence constraints between operations of the same job should be respected. There are no precedence relationships between operations of different jobs. The objective to reach is time-based. It is often expressed in terms of total production time (leadtime) or sometimes, in terms of just-in-time production.
In JSMS, each machine can work with different speeds or modes. An operation of one job can be executed on a machine at a given speed to be chosen. The speed of machine affects the processing time and the energy consumed during the execution of the operation. The processing time decreases when the machine works with higher speed while the energy consumption increases. Each mode or speed of machine has its corresponding processing and energy consumption. Solving the JSMS problem refers to determining the sequencing of operations on machines and their speeds that minimize a criterion based on the makespan and the total energy consumption. The speed of a machine cannot be changed during the execution of an operation.
Appendix A.2. Constraint Programming Model of JSMS Constraint programming (CP) is a modeling language. It is a powerful domain filtering algorithm for global constraints and very effective on complex scheduling problems and other hard combinatorial optimization problems [58].
The JSP problem is modelled as a constraint satisfaction problem (CSP) with a triple (X, D, C) where X is a set of variables, D is a mapping of variables to finite sets of integer values, where D(x) representing the domain of x. In constraint programming model, each CP variable is associated to an interval. The CP Optimizer model uses many constraints such as "Logic constraint", etc. The process of removing inconsistent values from the variables domain is called propagation. In JSP, each task O ij has a single machine assignement M ijr and a start time St ijr to be determined. In JSMS, each machine can work with different speeds, the duration and energy combination is presented by a tuple p ij , e ij . The objective function is to find a schedule that reduces in an aggregated and normalized way the makespan and the energy consumption. The Algorithm A1 shows the pseudo code of the CP Model proposed in [59] to solve the JSMS problem.
Algorithm A1 Pseudo code of CP-Optimizer Model 1: Data: tasks: set of tasks; modes: Set of 3 modes for each task; 2: Result: A solution minimizing the objective function depending of γ 3: interval itvs := Define interval, one for each task; 4: interval modes := Define mode, three for each task; 5: Sequence mchs := Each itvs with the same machine is linked up; 6: Minimize γ × NormMakespan + (1 − γ) × NormEnergy 7: Subject to 8 NormEnergy and NormMakespan refer to the normalization of both measures, where NormMakespan = makespan maxMakespan and NormEnergy = Energy maxEnergy . MaxMakespan is the sum of operation durations when all machines are working with the lowest speed. MaxEnergy is the sum of energy consumed in the execution of operations when all machines are working with the highest speed. For more details about CP optimizer of JSMS, one can see [59,60]. For JSMS mathematical model, one can see [61], but this is not our concern in this paper since the authors did not consider the same benchmark, objectives, etc.

Appendix A.3. Instances
The proposed model was tested on different instances that varies according to the number of jobs operations, machines, etc. Instances are named "machines_Vmax_Pi" where (machines) is the number of machines, (Vmax) is the maximum number of operations per job and (P i ) is the range of processing times.
The tables below present the details of a small instance (3_5_10) with three machines, five operations per job, and a range of processing time set to 10 time units. All machines of all instances have three modes or speeds. Table A1 presents the machine assignment of operations of each job. For each operation of each job, the (<id,m ijr >)is given. <1,2> means the first operation of job 1 is assigned to machine 2. For each operation, three triplets are represented: the id of the task, the energy used e ij and the processing time p ij (<id,e ij ,p ij >). Table A2 presents the processing time of each operation depending on the speed of the machine. Table A3 presents the energy consumption of each operation depending on the speed of the machine. The data of all tested instances are in [57,62].  Table A3. Energy consumption of operations of the small instance. 3   14  16  19  6  4  5  14  13  15  3  4  5  1  2  3  17  16  18  12  5  10  2  3  4  2  1  1  1  1  2  17  12  8  4  7  13  2  1  1  3  5  9  5  6  3