## 2 System Architecture
### Control Design  
The main objective of the machine is to perform automatic electric and ultrasound tomographies. In the new developed prototype, the control is performed by two Programmable Logic Controllers (PLCs) that manage the machine operations, as briefly illustrated in the workflow presented in Figure 8.  
Recalling Figure 1, the stone block is divided in \(\mathrm{n_{1}}\) sections, with 5 mm increments, along the \(X\)-axis. In each section, we perform an electric tomography, as well as \(\mathrm{n_{2}}\) ultrasonic tomographies with 10 mm increments, along the \(Z\)-axis. **SETUP**--This first procedure is meant to power-on and set up all the external devices that work with the PLC as well as to apply the appropriate compounds to the surfaces of the measuring devices, to guarantee suitable contact between the electrodes and the transducers with the sample surface. Being the only fully manual step, as it is just done once at the beginning of the measurements, it will not affect the overall system performance. Figure 8: Workflow chart. Figure 7: Y-DOF. 1-Linear Actuator SMC LES16 RJ-75S-R5 CP18 [13]; 2-Ultrasonic kHz Transducer [15]. **HOME**--This automatic process returns the entire system to its original state, in which all the actuators are at their home positions and all the peripheral equipment is inactivated. This process is called every time the machine is turned on for the first time, every time a new reading is about to start, or when the system recovers from error or emergency states. **EDGE**--This automatic process allows the machine to identify the edge of the stone block in order to establish a reference for the subsequent positioning of the measurement cycle. **ELECTRIC T.--**In this automatic procedure, an electric tomography is performed. It is initiated by a PLC analog output that triggers the current supply (EUTRON ATR700 SA 500V 1A [19]), and the subsequent voltage potential in 12 electrode pairs is read and recorded in tags. This process is made once for each stone section. **ULTRA T.--**In this automatic procedure, an ultrasonic tomography is performed. A SCADA system is used to allow the connection PLC--UPV testing equipment (Proceq Pundit Lab+ [20]) with custom VBS functions (Visual Basic Scripts). This procedure triggers the ultrasonic pulse, reads the measurements, and records the data in tags. This process is performed several times (along the \(Z\)-axis) in each stone section. **DATA SAVE**--Due to the significant amount of data produced for an entire block measurement, a limited number of PLC tags were created to only store information temporarily, referring to one stone section. At the end of the section measurement, using a SCADA system with custom VBS functions, all the data are exported to a new entry line in a CSV file, and all the tags are reset. Finally, still referring to Figure 8, all functions must be called in the order they are shown in the flowchart (Figure 8), except for the HOME function that is called whenever the RESET button is pressed. The EMERGENCY button suspends all processes, stopping the actuators and deactivating the external equipment. Table 3 shows a detailed explanation of the individual actions contained in the above-described procedures.