ELEKTROTEHNI ˇ SKI VESTNIK 92(4): 181–190, 2025 ORIGINAL SCIENTIFIC PAPER A Control Framework for the Machining Center with Multiple Spindles Karlo Gripari´ c 1,† , Diego Suˇ sanj 1 , Vilijan Matoˇ sevi´ c 1 1 Juraj Dobrila University of Pula, Faculty of Engineering, Alda Negrija 6, 52100 Pula † E-mail: karlo.griparic@unipu.hr Abstract. The paper addresses the problem of minimizing the tool exchange time in computer numerically controlled (CNC) machining centres. The increasing variety of products and the demand for smaller quantities have placed a significant pressure on the CNC systems to enhance the adaptability, improve her flexibility, and shorten the preparation and operating times. In milling machines, a certain amount of the operating time is consumed during the tool exchange process. To reduce the exchange time, the paper proposes a solution that introduces a second spindle positioned physically close to the main spindle, controlled by a pneumatic system. For this purpose a novel control framework is developed that reduces the operation time, facilitates the operator handling, and improves the efficiency. A combinatorial optimization approach is then used to solve the tool scheduling problem, in order to minimize the total exchange time of the used tools. The presented novel approach to the machine is based on the initial and final positions of each tool and on the magazine holders positions. The experimental results show that by implementing a control framework to manipulate the multiple spindles, the reduction in the exchange time is significant and dependent on the number of tools needed for a certain machining process. Moreover, the tool scheduling algorithm optimizes the tools assignment at magazine locations and efficiently reduces the total execution time. This can be important for items with a short operational time and a large number of the used tools. Keywords: Computer Numeric Control (CNC), Automatic Tool Exchanger (ATC), Multiple Spindles, Combinatorial optimization, Automata Okvir za vodenje obdelovalnega centra z veˇ c vreteni ˇ Clanek obravnava problem zmanjˇ sanja ˇ casa menjave orodij v raˇ cunalniˇ sko krmiljenih (CNC) obdelovalnih centrih. Zaradi vse veˇ cje raznolikosti izdelkov in manjˇ sih serij se na CNC- sisteme vrˇ si pritisk po veˇ cji prilagodljivosti, krajˇ sem ˇ casu priprave in uˇ cinkovitejˇ sem delovanju. Pri rezkalnih strojih del obratovalnega ˇ casa odpade na menjavo orodij, zato ˇ clanek predlaga reˇ sitev z uvedbo drugega vretena, nameˇ sˇ cenega v bliˇ zini glavnega in krmiljenega s pnevmatskim sistemom. Za ta namen je bil razvit nov okvir za vodenje, ki zmanjˇ suje ˇ cas delovanja, olajˇ sa upravljanje in poveˇ ca uˇ cinkovitost. Za raz- porejanje orodij je uporabljena kombinatoriˇ cna optimizacija, ki minimizira skupni ˇ cas menjav glede na zaˇ cetne in konˇ cne poloˇ zaje orodij ter poloˇ zaje drˇ zal v magazinu. Eksperimen- talni rezultati kaˇ zejo, da uporaba veˇ c vreten in predlaganega krmilnega okvira znatno skrajˇ sa ˇ cas menjave, pri ˇ cemer je prihranek odvisen od ˇ stevila uporabljenih orodij. Algoritem za razporejanje orodij dodatno optimizira njihovo razporeditev v magazinu in uˇ cinkovito zmanjˇ suje skupni ˇ cas obdelave, kar je posebej pomembno pri izdelkih s kratkim obratovalnim ˇ casom in velikim ˇ stevilom uporabljenih orodij. Received 17 April 2025 Accepted 31 July 2025 Copyright: © 2025 by the authors. Creative Commons Attribution 4.0 International License 1 INTRODUCTION In the last decades, the increasing demands for flexibil- ity, product diversity, and speed of production in industry have drawn a tremendous interest in developing high- performance CNC machine tools. Modern manufactur- ing processes should be fully digitalized to provide an efficient production of complex mechanical parts. This is one of the main goals of the manufacturing systems developed under the fourth industrial revolution known as Industry 4.0, comprised of cyber-physical systems [1], Internet of Things (IoT) [2], and digital twins [3]. The important requirements in the production industry that uses machine tools are also the repeatability and accuracy. Therefore, the development of such machine faces many challenges in the multidisciplinary field of mechanical, control, and computer engineering [4], [5]. In the process of designing a CNC machine tool, achieving an optimal balance between automation and profitability is crucial for success. On the other hand, complex parts require several different operations, such as roughing, drilling, tapping, milling, etc., where for each operation a different tool is used. To increase the productivity of a machining 182 GRIPARI ´ C, SU ˇ SANJ, MATO ˇ SEVI ´ C process, manufactures have designed an Automatic Tool Exchange (ATC) system. Its most widespread design concepts used in practice include tool change systems with an indirect tool change, system with a tool mag- azine positioned close to the spindle, machines with multiple spindles, and other innovations. A modern CNC machine tool is unthinkable without some type of ATC that has been proven as a powerful tool in improving the productivity and accuracy, and decreasing the possibility of a failure. In [6] and [7], the authors develop an ATC for two types of milling machines: horizontal and vertical machine tools. [8] presents pioneer work for operation scheduling using multiple spindles in CNC machines. [9] highlights the importance of integrating hierarchical and collaborative control structures into an intelligent manufacturing system. [10] presents several approaches to increase the energy efficiency of the CNC machining process, including redesigned machines and controllers, and additional external energy saving devices. [11] combines two independent tools, i.e., a laser and a micro-milling tool on a five-axis machine tool. An extensive work has been done in developing a hardware solution that incorporates a laser module in an off-the-shell numeric controller. However, there has been no algorithm presented to control the change of the tools, and no coordinate system offset caused by a tool change has been taken into account. The developed solution which uses only two different tools limits the flexibility. [12] describes an open control architecture built in the Microsoft Visual C for a micro- milling machine with three axes and a single spindle. However, control system provides no novelties for the machine control system compared to the commercial CNC systems. The control system exhibits no flexibility and scalability to implement its principles in different types of machine tools. [13] proposes an algorithm to control the automatic tool changer for a vertical machining center. It searches for a programmed tool located in a turret head using the shortest path. The solution uses the well known ladder diagram and combines it with an existing machine numeric controller. [14] recently introduces a concept of an invisible numerical control with a distributed and networked architecture to achieve a high recon- figurability, scalability and functional reusability. The limitations of the traditional CNC controllers are defined and a novel numeric control paradigm improves the performances of flexible manufacturing systems. [15], [16], [17] introduce well known concept of Industry 4.0, a networked system of multiple objects such as humans, resources and machines to create an intelligent factory. Though the traditional CNC systems have been used for decades, manufacturing demands of the modern industry have raised many new challenges that machine tools should be able to cope with, including the part complexity, speed, product diversity, short product life- time and etc. [18] provides a comprehensive overview of the limitations of the CNC system. A possible approach to cope with those limitations includes new standards [19] to enhance the adaptability and interoperability of the CNC machine tools. The paper emphasizes the potential of such technologies in replacing traditional CNC programming methods for being a driving inno- vation in manufacturing systems. [20] presents several solutions to improve the manufacturing productivity and efficiency by using the advantages of high-speed industrial communication networks. [21] studies some similar approaches to minimize the total non-machining time on machines with cutting tools located in the turret magazine. In such magazine, the rotation time needed to turn the turret for a single position is considered constant. Therefore, the optimization problem comes down to the problem of minimization of the total turret rotations. [22] implements an interesting solution to the allocation tool problem in the turret magazine. The Dijkstra shortest path algorithm is proposed to minimize the indexing time of the turret magazine. [23] introduces the shortest path search on a graph created by a genetic algorithm to generate a graph of all routing alternatives. Since the milling machine centers are the most widespread type of the machine in industry, the paper proposes a solution to increase the efficiency of the ma- chine center by adding an additional spindle. A detailed analysis is made of the time taken to switch the tools between the machining operations. The aim of the anal- ysis is to provide a basis for developing a benchmarking model to evaluate the effectiveness of the proposed optimization algorithm and control strategy. Our main objective is to reduce the time taken to exchange the tool in order to increase the effectiveness. The machine is therefore mechanically redesigned to provide the basis for a novel control framework to improve the efficiency and energy consumption as well as but also the accuracy machining. A combinatorial optimization problem to solve the tool scheduling problem is proposed. The optimization problem takes into account the magazine holders positions, and the initial and final positions of each operation. The rest of the paper is organized as follows. Sec- tion 2 describes the CNC milling center, explains the machine elements of the automatic tool change system and presents the modifications implemented to install the second spindle. Section 3 presents the CNC control architecture and the proposed controller based on the Moore finite-state machine for multiple spindles. Section 4 formulates the tool scheduling in a form of a combi- natorial optimization problem. Sections 5 and 6 provide experimental results and draw conclusions of the paper. A CONTROL FRAMEWORK FOR A MACHINING CENTER WITH MULTIPLE SPINDLES 183 Figure 1.: Machining center Biesse Rover 336 ATC with four axes, two spindles and two tool magazines located at different sides of the working space. (a) Spindle SA Spindle SB Working table (b) Figure 2.: Machine spindles real (a) and graphical representation (b). The left spindle is labeled with SA and the right with SB. 2 SYSTEM DESCRIPTION The used machine tool is a CNC milling center Biesse Rover 336 ATC presented in Fig. 1. It has undergone mechanical upgrades and electrical retrofitting. It fea- tures four axes (three linear and one rotational), two vertically positioned spindles and two tool magazines. The spindles moves within the Cartesian coordinated system, where one of the spindles rotates its head around axis Z. The rotational axis, referred to as axis C, does not affect the automatic tool exchange system. The axis displacement is implemented using three linear and one rotational controlled servomotors, where the maximum axis stroke is 3200 mm for the X axis, 1250 mm for the Y axis and 185 mm for the Z axis. The machine is equipped with two tool magazines, each containing five tool holders located on different sides of the working area. The milling center is designed, but not limited, for advanced woodworking tasks, therefore the rotational speed of the used spindles is up to 24 000 rpm with a maximal power of 6.8 kW. Basically, each spindle is an independent AC motor on which shaft is a standardized 184 GRIPARI ´ C, SU ˇ SANJ, MATO ˇ SEVI ´ C ISO 30 conical slot for the tool holder. An automatic tool change is enabled through a pneumatic system located in the motor housing and controlled by electromag- netic valves. The rotational speed is adjustable using a frequency drive, where the driver is connected in the manner that it can be switched between two spindles. This means that only one spindle can be in operation at a time, thus significantly reducing the overall cost of the system because only one driver is used to power both spindles. As shown in Fig. 2a, the machine head contains two spindles labeled SA and SB, starting from the spindle on the left. Spindle SB is equipped with the rotational C axis, and is used for operation where tool orientation is important, like a circular saw blade or milling cutter whose rotational axis is not collinear with the Z axis. As seen, the spindles are located at a certain distance from each other, causing an offset in the machine coordinate system. The offset varies according to the active spindle. The offset of the coordinate sys- tem and the procedure for switching the single driver between the two spindles are integrated into the control algorithm presented in Section 3. As mentioned above, the machine uses a pneumatic mechanical solution to facilitate a quick and efficient tool exchange. Each spindle is mounted on a mechanical support that can be translated along the Z axis for a certain distance by using a pneumatically-controlled cylinder. The inactive spindle is positioned farther from the working table, eliminating the need to unload and store its tool in the magazine. The advantage of the solution is that one spindle can work while the other is in a position that does not interfere with the machining operation. Hence, two combinations are possible: the first is when the SA spindle is in operation and the SB spindle is deactivated. The second is a situation when the SB spindle is in operation. When the SA spindle is active, as depicted in Fig. 2b, the pneumatic support is repositioned to the lowest possible position referred from the working table, while the SB spindle is inactive and is moved to the upper position. When a command from the machine controller is received the active spindle stops its rotation if running. Then one pneumatic cylinder is activated and the other one deactivated, causing the first spindle to be translated to the working position and the other one to be moved to a standby position. The pneumatic support is equipped with electromagnetic sensors confirming the spindles have reached their requested positions. If the support is not adequately positioned the system issues an alarm to prevent a collision of the tool loaded in the nonactive spindle with the workpiece in the working area. The tool magazines are located inside the machine body on each side of the working plane. The magazine is closed with a pneumatically controlled cover that prevents material chips and residuals from entering the Figure 3.: CNC control architecture comprising a user interface, G-code interpreter and numerical and machine controllers. The arrows show the coordination between the components. magazine. It is equipped with five tool slots located in a fixed place inside the working plane and mounted on a pneumatic cylinder that comes out during the exchange phase. The procedure for changing a tool depends on the requested action. It can either be returning or taking the tool to/from the magazine. The following steps are taken to remove the tool from the spindle and to load a one tool into it: 1) Opening the tool magazine cover, 2) Moving the spindle at the slot location where the active tool should be returned, 3) Rising up the relevant slot using the pneumatic cylinder, 4) Moving the spindle in the position above the tool holder enters the slot, 5) Unloading the tool and setting down the slot, 6) Moving the spindle at the slot location where the new tool is located, 7) Rising up the relevant slot using the pneumatic cylinder, 8) Moving the spindle in the position when the tool holder enters the spindle and 9) Loading the tool and set down the slot. 3 THE PROPOSED CONTROLLER The CNC controller architecture (see Fig. 3 is hierar- chically divided into two levels: the numerical and the machine controller. The main task of the CNC system, embodied in the numerical controller, is to guarantee the movement of the axes of the machine within its working space while taking into account the acceleration, ve- locity, and positional accuracy of each axis. The aim A CONTROL FRAMEWORK FOR A MACHINING CENTER WITH MULTIPLE SPINDLES 185 is to synchronize the movement of the axes according to the static and dynamic requirements. Typically, the movement of the axis is implemented inside a cascade closed control loop. The commonly used components of the machine tools for positioning include an AC servomotor, ball screws, and an encoder. An effective control of various machine tool components, including hydraulic systems, pneumatic cylinders, tool magazines, safety barriers, etc., is essential for an overall control of the machine, and is typically implemented in the machine controller. This is mainly achieved with a programmable logic controller (PLC) adapted for the use in machine tool applications. It continuously monitors the input signals (in most cases the digital input signals), executes decisions based on a predefined logic, and sets the state of the digital output signals. The numeric and machine controllers are both equipped with internal communication interfaces that facilitate their synchro- nization throughout the machining process. Finally, the entire system is supervised via a user interface and G- code interpreter, which is a part of the highest level of the CNC controller architecture. The G-code is a widely used standardized program- ming language for machine tools [24]. Besides the axis movements, it supports a vast range of other commands needed in the machining process. The tool exchange is one of the auxiliary actions that are typically initiated by a command in the G-code, i.e., when the tool identification number and the exchange request (M6) are issued. The machine controller should then executes the necessary steps to replace the old tool with a new one. During the exchange process, the numeric controller waits with the program execution until it receives a confirmation from the machine controller that the new tool is ready for operation. A concise overview of the control framework to handle ATC for the machining center with multiple spindles and tool magazines is given below. Based on the requirements for a single spindle, the steps needed to control the tool exchange process between the spindle and the magazine are identified. To design an effective spindle controller, we propose a finite-state machine (FSM) for each spindle. The approach provides a scalable and reusable control method, allowing an easy expansion by adding numerous spindles. A type of FSM is the Moore state machine, in which the output depends on the current state. The digital input signals, which can be periodically read by the machine controller, affect the transitions between the states. In other words, the next state of the Moore state machine is determined by the current state and input signals. The Moore FSM can be defined by: M = (I,O,S,ρ,λ,s 0 ), (1) where I is the finite set of inputs, O is the finite set of outputs, S is the finite set of the states, ρ :S×I→S is the state transition function, λ :S→O is the output function, and s 0 is the initial state of the machine. A comprehensive FSM overview is given in [25]. The Moore FSM to control the tool exchange task of a single spindle in the machining center is designed by identifying every state that can occur in a change maneuver. The control framework is designed based on the following requirements: • The spindle can be either in an active or inactive state. In the active state, the spindle performs the machining and vice versa. • The spindle can be in an inactive state without a loaded tool. • The exchange process does not depend on the tool location inside the magazine. Thus, when a machine tool has multiple magazines, the spindle exchanges the tools with each magazine. • The manual operation mode is allowed when the operator can sets the tool manually. • At an unexpected behavior, an error is issued. State Description S 1 The spindle is empty S 2 The tool exchange is in progress S 3 The spindle is loaded and active S 4 The spindle is loaded and inactive S 5 The spindle error Table 1.: The description of the states of the Moore finite-state machine. Figure 4.: State transition diagram of a spindle where states S i are represented with circles and transitions I i are indicated with arrows. A state table for the spindle tool exchange control framework to list the possible states is developed. Table 1 identifies the states that satisfy the requirements. The corresponding state transition diagram visualizing the states and transitions is shown in Fig. 4. The states are represented with a circle, while transitions between states, associated with input signals I i , are indicated with arrows. One of the benefits of the proposed FSM 186 GRIPARI ´ C, SU ˇ SANJ, MATO ˇ SEVI ´ C Figure 5.: Complete control architecture of the ATC for a machining center with multiple spindles. is its simplicity to determine the input signals neces- sary for the state transitions. The implemented input signals are read from numerous subsystems, such as the numerical controller, digital sensors, error flags, and user commands (see Table 2). The signal of the numerical controller represents the commands written in the G-code executed during the machining program. The digital signals are generated from inductive sensors connected to the general purpose digital inputs. The error signals monitor any forbidden condition in case of its appearance, along with eventual time delays, the machine controller issues an alarm. If the alarm occurs during the execution of the user program, the process is stopped immediately. Input Description I 1 Tool exchange request (M6 command) I 2 Tool exchange completed I 3 Spindle inactive command I 4 Spindle active command I 5 Tool exchange request (M6 command) I 6 Spindle empty command I 6 ... I 10 Error signal I 11 Reset error command Table 2.: The description of the input signals. In the final step, designing the control system to manage two spindles and two magazines is described. The NC issues a tool exchange request which is then handled by the machine controller. The used tools are scheduled in the magazine holders during the planning and programming stage of certain machining operations. The task of the machine controller is to coordinate the execution between two finite-state machines, handle the necessary steps for thr tool replacement, and com- municate with the upper control level. Once the tool change is completed, the machine controller sends an acknowledgment to NC, confirming that the operation has been successfully executed. Fig. 5 presents a com- plete ATC control architecture for a machining center with multiple spindles. The machine controller manages the tool exchange process using two identical FSMs, one controls the SA spindle and the other the SB spindle. 4 THE TOOL SCHEDULING PROBLEM 4.1 Problem statement In general, the problem of scheduling a set of N machining tools T ∈{T 1 ,T 2 ,...,T N } of a CNC ma- chine is assumed with single and multiple spindles and the M ∈ R tool magazines placed at different locations within machine working space W . In case of multiple spindles, they assumed to be located on the same head, i.e. they move simultaneously along with the axis movement. S is the number of spindles and m denote the number of tool magazines, where s> 1 and m > 1. In the machining center, each tool holder is located at different positions inside machine workspace W . Set P = [p 1 ,...,p j ,...,p P ] defines the location of tool holder j within workspace W where p j = (x j ,y j ) are the coordinates of tool holderj from the basic origin of machine O. The initial working position of tool T i is denoted by S i (x s i ,y s i ). The final position is given by F i (x f i ,y f i ). Hence, the distance between tool holder p j and the initial or final position of tool T i is defined as d s ij and d f ij , respectively. A schematic overview of the machine tool scheduling problem is depicted in Fig. 6. Initial S i and final F i point of tool i are assumed to be available prior to the program execution. The distance between each tool position and holder is then defined by the following expression: d s ij = q (x s i −x j ) 2 + (y s i −y j ) 2 , d f ij = q (x f i −x j ) 2 + (y f i −y j ) 2 , (2) A CONTROL FRAMEWORK FOR A MACHINING CENTER WITH MULTIPLE SPINDLES 187 p 1 p 2 p 4 p 3 p 5 p 6 p 7 p 9 p 8 Magazine 1 Magazine 2 S i (x i s , y i s ) F i (x i s , y i s ) d ij s d ij f Machine working space p 10 Figure 6.: Schematic overview of the machine tools scheduling problem. where i∈ [1, 2,...,N] and j∈ [1, 2,...,P ]. Our goal is to design an optimization algorithm to improve the tool scheduling approach of the CNC machining centers. When the tool scheduling strategy is not applied, the tools are usually assigned by the order of the appearance in the machining operation plan. The presented optimization algorithm eliminates a prior allocation of the tools inside the magazine holders by en- suring that the total exchange time is minimal. Moreover, the algorithm enhances the scalability by taking into account the optimization problem of both the exchange time between the spindle and the magazine position, as well as the initial and final working position of each tool. It should be noted that the type of the machine is important when applying an adequate tool assignment optimization strategy. For instance, if a machine has a turret type magazine located on the machine head and it moves along with the spindle, the start and the finish positions of each operation do not affect the tool exchange time. In the machining operation strategy, the operation sequence and the tools paths are written in the G code and executed online by the CNC system. Therefore, a new tool is set when the numeric controller executes an adequate command. After a tool request command is executed, the active tool defined by the machine controller physically sets inside the spindle and the spindle support is moved to an appropriate position, i.e. a position in which machining is possible. It is assumed that a set of the tools needed to execute a certain machining task, is available in one of the M magazines whose tool parameters and each tool length and diameter are stored in the controller memory prior to a program execution. Generally a tool exchange operation using ATC on a CNC milling machine is performed in three steps: 1) removing the used tool from the spindle and putting it in an adequate magazine position, 2) positioning the magazine to receive a new cutting tool, and 3) inserting the new cutting tool into the spindle. The total tool change time can generally be defined as the duration of the three steps. 4.2 Optimization The aim of our optimization problem is to minimize the time taken during the tool exchange process on machines that require multiple operations using different tools. We seek the optimal value from a large number of finite data. Our selection is based on the objective function that evaluates each candidate’s solution. In the context of the decision problems, the results are binary, with only two possible solutions: toolT i is not assigned to holder H j , or tool T i is assigned to holder H j . The combinatorial optimization problems, such as the knapsack problem [26], the traveling salesman problem, the job scheduling [27], and the routing problems, can be effectively addressed using the linear assignment problem [28]. The overall machining time for a specific part includes both the time taken to complete each operation and the time taken for tool exchanges between these operations. In the initial experiment, our goal is to optimize the arrangement of the tools so as to reduce the total time taken for all tool exchanges, considering the distance between each holder and the initial and final points for each operation. Here, decision variablev ij indicates the assignment of tool T i to holder H j . The problem is 188 GRIPARI ´ C, SU ˇ SANJ, MATO ˇ SEVI ´ C Number of exchanges 2 3 4 5 6 7 8 9 10 T 1 [s] 30 60 90 120 150 180 210 240 270 T 2 [s] 4 38 52 86 100 134 148 182 196 ∆t [s] 26 22 38 34 50 46 62 58 74 ∆t [%] -86.6 -36.6 -42.2 -28.3 -33.3 -25.5 -29.5 -24.2 -27.4 Table 3.: The time taken for an exchange in two scenarios. T 1 is the total time taken to conduct an exchange of n tools in the first scenario where a single spindle is used. T 2 is the total exchange time when using two spindles. modeled as a combinatorial optimization problem: min N X i=1 P X j=1 c ij v ij s.t. N X i=1 v ij = 1, ∀j∈P, P X j=1 v ij = 1, ∀i∈N, v ij ∈{0, 1}. (3) Cost coefficient c ij ∈R for tool i and holder j is determined as a sum of the distances between the holder and the initial point (S i ) of operationd s ij and the distance from the final point (F i ) to the holder of tool d f ij . c ij =d s ij +d f ij . (4) The investigated optimization problem belongs to the class of integer optimization problems that are NP- complete, while the algorithms used to solve them have no polynomial convergence time [29]. In some cases, these problems can be resolved as a linear sum assign- ment problem if the linear relaxation yields a solution. The optimization algorithm should determine one tool holder for each tool only once, thus minimizing the sum of the selected elements. 5 EXPERIMENTAL VERIFICATION To evaluate the benefits of introducing the proposed modification and the novel control strategy for the described machining center with two spindles and two magazines, several experiments on the base model of the machine are performed. Our benchmarking experiment is made using a single spindle. Generally speaking, the total time taken to exchange tools the between spindle and the magazine in a single working cycle is related to the number of the tools used to complete the machining operation plan. The experimental results given in Table 3 show the total execution times obtained by varying the number of the tools from two to ten in two possible cases. In the first scenario, the total exchange time involves using n tools with a single spindle. In the sec- ond scenario, the time is determined when two closely mounted spindles are used. A graphical representation is given in Fig. 7. 1 2 3 4 5 6 7 8 9 10 Number of tools 0 50 100 150 200 250 300 t [s] 1 spindle 2 spindles Figure 7.: Graphical comparison of the total exchange time in conducted experiments with one and two spin- dles. An evaluation program is used for the numeric con- troller. The elapsed time taken is sampled from the machine controller. Given that the single spindle setup is the most common configuration for milling machines, the time difference, denoted as ∆t, is calculated, in the duration of the tool exchange process between a single and a double spindle machine configuration. The difference time is ∆t = T 1 −T 2 . The reduction in the run time for a double spindle machine configuration is also calculated in the percentages denoted as ∆t[%]. The results show that when two tools are utilized, the time is 26 seconds shorter, representing an 86.6% reduction. In the scenario using ten tools the time taken for the tool exchange is 74 seconds shorter, representing a 27.4% decrease. In our experiments, the initial position of the tool before the exchange is assumed at the center of the machine working area. 5.1 Tool scheduling strategy To validate the proposed tool scheduling strategy, solved by using a combinatorial optimization algorithm implemented in Python using the SciPy library, exper- iments are conducted to evaluate the performance of the tool allocation in magazine slots. In the machines A CONTROL FRAMEWORK FOR A MACHINING CENTER WITH MULTIPLE SPINDLES 189 Tool ID 1 2 3 4 5 6 7 8 9 10 x s [mm] 2718 1079 2363 379 1768 2482 1983 1686 2092 2363 y s [mm] 62 612 139 505 1196 441 211 564 236 782 x f [mm] 468 907 557 2421 2398 2563 2255 2148 381 2856 y f [mm] 1142 684 1214 177 1200 1168 490 39 1030 43 Table 4.: The start and finish positions in millimeters for each tool. Slot no. 1 2 3 4 5 6 7 8 9 10 Ex. 1 T2 T1 T4 T3 T9 T5 T10 T6 T8 T7 Ex. 2 T2 T4 T3 0 0 T5 0 0 T1 0 Table 5.: Experimental results of the tool scheduling. Experiment 1 Experiment 2 10 tools 5 tools T B [s] 419.72 216.82 T O [s] 405.60 207.71 ∆t [s] 14.12 9.11 ∆t [%] 3.36 4.20 Table 6.: The total exchange time for the tools ordered in an ascending order (T B ) and scheduled by the opti- mization algorithm (T O ). with a large working space, the travel time from the tool slot in the magazine can be divided into two groups. The travel time from the magazine slot to the first point (starting point) in the working area, where the tool begins its operation at a programmed working velocity, to the finish point where it can again restart the movement at a maximal velocity. In our experiments the starting (x s ,y s ) and end points (x f ,y f ) of each tool are determined randomly (see Table 4). The total exchange time (T B ) is measured for the scenario in which the tools arranged in holders are in an ascending order, unlike in the case where the tools are assigned to holders on the basis of their starting and finishing positions within the working area and holder location. The tool allocation is determined out prior to the execution of the machining program. The maximum feed rate for a rapid movement is set to 15 m/min. The objective of our experiments is to schedule the machining tools inside the magazines in order to minimize the total exchange time. Since the sequence of the tools is defined by the machining technology, their order of appearance can not be changed. Two machining experiments of a differed number of the cutting tools are performed. The first experiment (Ex.1) evaluates the performance of the optimization algorithm when all magazine slots are used, specifically the tools. The second experiment (Ex.2) utilizes five tools. The obtained results are given in Table 5, where tool Tx is placed in a slot numbered from 1 to 10. Table 6 shows the total exchange time for the tools or- dered in an ascending order (T B ), the exchange time for the tools scheduled by the optimization algorithm (T O ), the difference between the duration of the exchange without and with applying the scheduling approach where ∆t =T B −T O , and the difference expressed in percentages. Compared to the benchmarking experiment, our approach, reduces the tool exchange time by 3.36% in case of ten tools, and by 4.20% in case of five tools. 6 CONCLUSION The paper presents results of an attempt to improve the machining center by mechanically upgrading it with an additional spindle. It proposes a control framework embodied in the machine computer numeric controller based on the Moore finite-state machine. The adaptabil- ity of the approach enables an effective handling of a second tool placed on the machine head. As to the programming perspective in the G-code, the second spin- dle is accessed in the same way as the master spindle, thus, avoiding any additional commands in the program and being one of the main advantages of the proposed approach to control multiple spindles by using a finite- state machine. The experimental verification performed on a large milling machine showns that the proposed method significantly reduces the tool exchange time. A combinatorial optimization algorithm to schedule the tools inside the magazine slots is also proposed. The approach minimizes the total travel time between the magazine slots and tool positions in the working area. The experimental results are obtained for the machine with two specially distributed magazines. While the results presented in the paper are obtained for a machining center in which ATC combines multiple spindles and multiple tool magazines, the methodology used is not limited to above application. It can be used to control switching between tools in cases where an additional task is required or where an external han- dling system, like a robot, is introduced. Reducing the exchange time is important in situations when machining an item does not take much time but requires a large number of tools to complete the operation plan. The 190 GRIPARI ´ C, SU ˇ SANJ, MATO ˇ SEVI ´ C proposed methodology thus significantly improves both the productivity and flexibility of a machine tool. REFERENCES [1] Kunpeng Zhu and Yu Zhang. A cyber-physical production system framework of smart cnc machining monitoring system. IEEE/ASME Transactions on Mechatronics, 23(6):2579–2586, December 2018. [2] Mirco Piron, Junzhang Wu, Andrea Fedele, and Alessandro Manzardo. Industry 4.0 and life cycle assessment: Evaluation of the technology applications as an asset for the life cycle inventory. Science of The Total Environment, 916, March 2024. [3] Daniel Klic, Martin Minarcik, Ales Polzer, Jiri Tuma, Jiri Marek, and Michal Holub. Digital twin for cnc machine tools design. In 2024 21st International Conference on Mechatronics - Mecha- tronika (ME). IEEE, December 2024. [4] Suk-Hwan Suh, Seong Kyoon Kang, Dae-Hyuk Chung, and Ian Stroud. Theory and Design of CNC Systems. Springer London, 2008. [5] Alessandro Fortunato and Alessandro Ascari. The virtual design of machining centers for hsm: Towards new integrated tools. Mechatronics, 23(3), April 2013. [6] Selcuk Avci and M.Selim Akturk. Tool magazine arrangement and operations sequencing on cnc machines. Computers & Operations Research, 23(11), November 1996. [7] J. P. Rogelio and R. G. Baldovino. Development of an automatic tool changer (atc) system for the 3-axis computer numerically- controlled (cnc) router machine. In 2014 International Con- ference on Humanoid, Nanotechnology, Information Technology, Communication and Control, Environment and Management (HNICEM), pages 1–5, 2014. [8] B. A. Norman and J. C. Bean. Multiple spindle cnc machines. In Proceedings of 1997 IEEE International Conference on Evo- lutionary Computation (ICEC ’97), pages 425–429, 1997. [9] Ming Lei, Xiaohong Yang, Mitchell M. Tseng, and Shuzi Yang. Design an intelligent machine center—strategy and practice. Mechatronics, 8(3):271–285, April 1998. [10] S.T. Newman, A. Nassehi, R. Imani-Asrai, and V . Dhokia. Energy efficient process planning for CNC machining. CIRP Journal of Manufacturing Science and Technology, 5(2):127– 136, January 2012. [11] Zhenyuan Jia, Yuqin Chen, Wei Liu, Kai Zhao, Ling Wang, and Xianming Tu. The control system for precise five-axis laser/micro-milling machine tool. International Journal of In- dustrial and Systems Engineering, 22(2):145, 2016. [12] Xinxin Wang, Xiaohong Lu, Zhenyuan Jia, Wentao Wang, and Fengchen Wang. Control system for micro milling machine. International Journal of Industrial and Systems Engineering, 21(1):83, 2015. [13] M. Mikhov and M. Zhilevski. Control device for tool magazine drives of vertical machining centers with cnc. In 2020 Interna- tional Congress on Human-Computer Interaction, Optimization and Robotic Applications (HORA), pages 1–5, 2020. [14] Yingxue Yao, Miao Liu, Jianjun Du, and Liang Zhou. Design of a machine tool control system for function reconfiguration and reuse in network environment. Robotics and Computer- Integrated Manufacturing, 56:117–126, April 2019. [15] L. Monostori, B. K´ ad´ ar, T. Bauernhansl, S. Kondoh, S. Kumara, G. Reinhart, O. Sauer, G. Schuh, W. Sihn, and K. Ueda. Cyber- physical systems in manufacturing. CIRP Annals, 65(2):621– 641, 2016. [16] W. Chang and S. Wu. Investigated information data of cnc machine tool for established productivity of industry 4.0. In 2016 5th IIAI International Congress on Advanced Applied Informatics (IIAI-AAI), pages 1088–1092, 2016. [17] B. Kada, A. Alzubairi, and A. Tameem. Industrial communica- tion networks and the future of industrial automation. In 2019 Industrial Systems Engineering Conference (ISEC), pages 1–5, 2019. [18] X.W. Xu and S.T. Newman. Making CNC machine tools more open, interoperable and intelligent—a review of the technologies. Computers in Industry, 57(2):141–152, February 2006. [19] X.W. Xu, Lihui Wang, and Yiming Rong. Step-nc and function blocks for interoperable manufacturing. IEEE Transactions on Automation Science and Engineering, 3(3):297–308, July 2006. [20] Dong Yu, Yi Hu, X.W. Xu, Yan Huang, and Shaohua Du. An open CNC system based on component technology. IEEE Transactions on Automation Science and Engineering, 6(2):302– 310, April 2009. [21] Kaveh Amouzgar, Amir Nourmohammadi, and Amos H.C. Ng. Multi-objective optimisation of tool indexing problem: a mathematical model and a modified genetic algorithm. In- ternational Journal of Production Research, 59(12):3572–3590, March 2021. [22] Adil Baykasoglu and Fehmi Burcin Ozsoydan. An improved approach for determination of index positions on cnc magazines with cutting tool duplications by integrating shortest path algo- rithm. International Journal of Production Research, 54(3):742– 760, June 2015. [23] T¨ urkay Dereli and A. H¨ useyin Filiz. Allocating optimal index positions on tool magazines using genetic algorithms. Robotics and Autonomous Systems, 33(2-3):155–167, November 2000. [24] Alan Overby. CNC Machining Handbook: Building, Program- ming, and Implementation. McGraw-Hill, Inc., USA, 1 edition, 2010. [25] Arthur Gill. Introduction to theory of finite-state machines. McGraw-Hill, New York, NY , December 1962. [26] N. VanHop. The tool-switching problem with magazine capacity and tool size constraints. IEEE Transactions on Systems, Man, and Cybernetics - Part A: Systems and Humans, 35(5):617–628, September 2005. [27] Min Dai, Dunbing Tang, Adriana Giret, and Miguel A. Salido. Multi-objective optimization for energy-efficient flexible job shop scheduling problem with transportation constraints. Robotics and Computer-Integrated Manufacturing, 59:143–157, October 2019. [28] Majid Soolaki and Naeme Zarrinpoor. A new 0-1 linear program- ming approach and genetic algorithm for solving assignment problem in flexible manufacturing system. The International Journal of Advanced Manufacturing Technology, 75(1-4):385– 394, July 2014. [29] Egon Balas. Integer programming. Encyclopedia of optimization, pages 1617–1624, 2009. Karlo Gripari´ c received his Ph.D. degree in electrical engineering from the University of Zagreb, Faculty of Electrical Engineering and Computing in 2018. Currently he is an Assistant Professor and Head of Department for Computing at the Juraj Dobrila University of Pula, Faculty of Engineering. His research interests include decentralized control, multi-agent systems, robotics and industrial automation. Diego Suˇ sanj is an Associate Professor and Head of the Laboratory for Intelligent Systems and Computer Perception at the Juraj Dobrila University of Pula, Faculty of Engineering. He received his PhD in Computer Science in 2021 from the University of Rijeka, Faculty of Engineering. His research focuses on computer vision, machine learning, image processing, and embedded systems. Vilijan Matoˇ sevi´ c is an electrical engineer specializing in the de- sign and development of electric machines. He received his PhD in Electrical Engineering from the University of Zagreb, Croatia. His research interests include electric machine systems, electromagnetic and multiphysics modeling, and automatic control.