# Digital Twin-Based Automated Guided Vehicle Scheduling: A Solution for Its Charging Problems
## 3 Principle of the Proposed DTDAS
### Scheduling Model  
The scheduling model built in this article is divided into two parts: the initial scheduling part and the charging scheduling part. The initial scheduling contains two decision variables: the allocation of transportation tasks and the timing management of the transportation tasks. The charging schedule also contains two decision variables: the allocation of AGV charging tasks and the allocation of charging capacity. The allocation of transportation tasks can be expressed as:  
\[O^{a}_{ij}=\left\{ \begin{array}{ll}1,&A^{a}\text{ is allocated to transportation task }O_{ij}\\ 0,&\text{else}\end{array} \right., \tag{5}\]  
The management of task execution timing can be expressed as:  
\[O^{a}_{ij-i^{\prime}j^{\prime}}=\left\{ \begin{array}{ll}1,&A^{a}\text{ is allocated to }O_{ij}\text{ then allocated to }O_{i^{\prime}j^{\prime}}\\ 0,&\text{else}\end{array} \right., \tag{6}\]  
when \(i=i^{\prime}\), \(j^{\prime}>j\); when \(i\
eq i^{\prime}\), \(j\in p_{i^{\prime}}j^{\prime}\in p_{i^{\prime}}\). The allocation of charging tasks can be expressed as:  
\[C^{a}_{ij}=\left\{ \begin{array}{ll}1,&A^{a}\text{ performs a charging task before }O_{ij}\\ 0,&\text{else}\end{array} \right., \tag{7}\]  
The decision on charging power can be expressed as:  
\[SOC^{a}_{ij}\in[0,&10,&20,&\dots,&80], \tag{8}\]  
In the initial scheduling process, reducing the makespan and the energy consumption of the AGV system is the goal. To ensure that the transportation tasks are completed as  
Figure 5: AGV Availability Prediction. early as possible during the charging schedule without affecting the production process, we hope to arrange the charging tasks for the AGV as much as possible during the idle period of the initial scheduling plan. At the same time, the charging frequency should not be too much (It is impossible to schedule AGV charging for all idle periods), which will cause a lot of unnecessary energy consumption. As a result, we consider makespan and energy consumption as the optimization goal of the charging schedule. In fact, it is also possible to insert the charging task during the initial scheduling process, however the model of this method is more complicated, and its calculation time is unacceptable for the dynamic scheduling system. Minimizing the makespan. Makespan means the maximum completion time, which can be expressed by:  
\[\min\text{MS}=\max\bigl{\{}\left(tSO_{ij}+tCO_{ij}\right)\bigr{\}}-tST, \tag{9}\]  
Subject to  
\[tSO_{ij}=\left\{ \begin{array}{ll}\mathcal{O}_{ij}^{a}(tCA^{a}+tC_{ij}^{a}+t BC_{ij}^{a}+tWO_{ij}^{a}),&C_{ij}^{a}=1\\ \mathcal{O}_{ij}^{a}(tCA^{a}+tO_{ij}^{a}+tWO_{ij}^{a}),&C_{ij}^{a}=0\end{array}  \right., \tag{10}\]  
\[tC_{ij}^{a}=tCC_{ij}^{a}+tMC_{ij}^{a}, \tag{11}\]  
\[tWO_{ij}^{a}=\left\{ \begin{array}{ll}tSPO_{ij}+tPO_{ij}-(tCA^{a}+tC_{ij}^{a }+tBC_{ij}^{a}),&\text{Case 1}\\ tSPO_{ij}+tPO_{ij}-(tCA^{a}+tO_{ij}^{a}),&\text{Case 2}\\ 0,&\text{else}\end{array} \right. \tag{12}\]  
\[\text{Case 1}:C_{ij}^{a}=1\text{ \&\&\&\&\ (tSPO_{ij}+tPO_{ij})\geq(tCA^{a}+tC_{ij}^{a}+tBC_{ij}^{a})\] \[\text{Case 2}:C_{ij}^{a}=0\text{ \&\&\ (tSPO_{ij}+tPO_{ij}\geq tCA^{a}+tO_{ij}^{a})\] \[tSO_{ij^{\prime}}\geq O_{ij^{\prime}-i^{\prime}j^{\prime}}^{a}( tSO_{ij}+tCO_{ij}+tO_{ij^{\prime}-i^{\prime}j^{\prime}}^{a}),\,\forall i,i^{ \prime}\in n,a\in m, \tag{13}\]  
\[O_{ij^{\prime}-i^{\prime}j^{\prime}}^{a}+O_{i^{\prime}j^{\prime}-ij}^{a}\leq 1, \tag{14}\]  
\[i^{\prime}\in n,i\text{ is not equal to }i^{\prime}\text{ at the same time} \tag{15}\]  
\[tSO_{ij+1}\geq tSO_{ij}+tCO_{ij}+tPO_{ij+1},\,\forall j+1\leq p_{i}, \tag{16}\]  
\[\sum_{a}^{m}O_{ij}^{a}=1,\forall i\in n,j\in p_{i}, \tag{17}\]  
\[tSPO_{ij}\geq tSO_{ij-1}+tCO_{ij-1},j=2,\ldots,p_{i}, \tag{18}\]  
where Equation (10) calculates the start time of the transportation process according to whether the charging process is included before task execution. Equation (11) calculates the time taken by the AGV to perform the charging task, including the time for the AGV to go to the charging area and the time to charge in the charging area.