# A Framework for Communicating and Building a Digital Twin Model of the Electric Car
## 2 Digital Twin Components and Communication
For example, RS-232 only allows two devices to be connected for communication, whereas, thanks to the fieldbus, many devices from different manufacturers can operate simultaneously on one control platform. Thanks to this solution, the amount of cabling is reduced, costs are lower, and communication is faster and more reliable. Different protocols require specific option cards; for example, the DFP21B is needed for Profibus, the DFE32B is needed for Profinet, and the DFE24B is needed for EtherCAT. The DFE11B expansion card allows one to connect the Ethernet fieldbus, namely Modbus/TCP. The drive inverter is connected to the router via an Ethernet cable [53; 54]. Both the inverter and the PC operate on the same network. Each of them has a unique IP address. Swapping input and output words is possible using parameter P876. For the operating mode, parameter P700 is set to CFC (current flux control), where the motor current is controlled [55]. Due to the choice of this control technique, control must also be current-based (P871). The control value also appears as a setpoint value. Then, the output torque on the motor shaft can be calculated from the following formula:  
\[\text{M}=\text{c}_{\text{T}}\cdot\text{I}_{\text{Ninverter}}\cdot\text{ setpoint}, \tag{1}\]  
\(c_{\text{T}}-\text{Torque}\text{ constant}=M_{n}/I_{q_{u}}=5\text{ Nm}/2.3 \text{A}\),  
\(I_{N\_interter}-\text{Nominal}\) output current of the inverter = 2.4 A,  
\(setpoint-\%I_{N_interter}\)  
A control word (P870) is required to control the AC motor. The control word can be viewed as a software security feature. When the word has a valid value, the inverter interprets it as being ready for operation. The description of a single bit of the control word is presented in Table 5. \begin{table}
\begin{tabular}{l l l} \hline \hline
**Bit** & **Functionality** & **Assignment** \\ \hline
0 & & Controller inhibit “1”/Enable “0” \\
1 & & Enable “1”/Rapid stop “0” \\
2 & & Enable “1”/Stop “0” \\
3 & & Hold control \\
4 & & Integrator switchover \\
5 & & Parameter set switch-over \\
6 & & Reset \\
7 & & Reserved \\ \hline
8 & Direction of rotation for motor potentiometer & 0 = CW direction of rotation \\  & & 1 = CCW direction of rotation \\ \hline
9 & Motor potentiometer acceleration & 10 9 \\
10 & Motor potentiometer deceleration & 0 = no change \\  & & 0 1 = up \\  & & 1 0 = down \\  & & 1 = no change \\ \hline
11 & Selection of the internal fixed & 0 = Speed setpoint via process output data word 2 \\
12 & setpoints n11–n13 or n21–n23 & 0 1 = Internal setpoint n11 n(21) \\  & & 1 0 = Internal setpoint n12 n(22) \\  & & 1 = Internal setpoint n13 n(23) \\ \hline
13 & Fixed setpoint switchover & 0 = Fixed setpoint of the active parameter set selected by bit 11/12 \\  & & 1 = Fixed setpoint of another set of parameters selected by bit 11/12 \\ \hline
14 & & Set reserved bits to 0 \\
15 & Reserved & Set reserved bits to 0 \\ \hline \hline \end{tabular}
\end{table} 
Table 5: The control word description. The remaining parameters are the status word (P873), actual speed (P874), and actual output current (P875). The status word contains information about the inverter if the output stage is enabled or an error has occurred. The actual speed is read from the encoder. The gear ratio on the research stand is known, so that the actual speed of the DC motor and wheel can be calculated. To implement a digital twin for the presented model, the following requirements should be met:  
1. Establish communication. 2. Build a simulation program.