Increase productivity of CNC-machining of aerospace engine parts with Python

CNC machining of aerospace engine parts, such as turbine shafts and cases, faces productivity challenges due to strict qualification processes, high-cost specialized machinery, and a diverse range of legacy NC controllers. Because these parts are subject to rigorous safety documentation for up to 40 years, production must follow a strict lot-size-one philosophy, ensuring only the specific NC program version for a single serial number is present on the machine at any given time.

To address these constraints, a custom Production Execution System (PES) was developed to act as a universal SCADA system. The PES orchestrates communication between the ERP system, the machine tool, and the operator. The backend is built with Python using AsyncIO for asynchronous task management, while the frontend uses JavaScript. Communication is handled via WebSockets to provide real-time updates without polling and MQTT for telemetry and machine commands. To standardize across different hardware generations, the system utilizes OPC UA for new "greenfield" machines and a Siemens-based gateway that translates legacy "brownfield" controller data into MQTT.

The PES enables unmanned production by decoupling the operator from the machine work cycle through automated part changing. If a process is interrupted—for example, by a tool break—the system automatically bypasses the stalled part and loads the next available operation for a different part to keep the machine running. On a horizontal turning machine with five stations, this approach eliminated idle time gaps, resulting in a productivity increase equivalent to 1.2 million USD in additional parts per year.

This description was generated by Open-Source AI using the transcript of the session and the original submission contents.

This session took place in track Programming & Software Engineering & Testing and was classified suitable for novice domain / intermediate python by the speaker.

Submission

The proposal as submitted by the speaker before the conference.

Python is not exclusively a powerful tool for datascience and web-development. It gains in importance on the shopfloor in industrial production, too. Increasing unit labour costs and the imperative need to reduce energy consumption raises the need to enhance productivity in industrial production in general.

For GKN Aerospace, as the world’s leading tier one aerospace supplier of systems and components, this leads to higher utilization and unmanned operation of a high variety of production processes and CNC-machining tools. On its site in Kongsberg, Norway, GKN produces mainly turbine shafts and casings for civil and military engines, which are used for up to 100.000 flights every day around the globe.

The programming language Python enables fast and forward-thinking development of powerful applications which supports the operators and increases the degree of automation in the next years by concurrent assurance to fulfill demanding quality requirements and to cope the workload.

Standardization of applications is a key factor for increasing robustness of the automated production and reduce maintenance effort. Therefore a standardized interface to NC-controller and PLC’s from the “pre ASCII era” in the 70ies to up-to-date systems had to be found and suitable gateway services had to be developed.

As an example for the usage of Python on the GKN shopfloor in Norway, a standardized in-house developed “Production Execution System”, consisting of a Python backend and a REACT frontend is presented. Connected to more than 25 different machining tools on the shopfloor and additional digital services of the company’s IT environment, the application orchestrates all necessary data on cell-level. It provides data, like NC-programs and part meta-data to the machining tools and additional process information to the operators, necessary to produce a high variety of different engine components.

It enables unmanned production by selecting the next part for machining and commanding part changes to the machine to maximize utilization of the means of production. Furthermore, it reports back collected data for usage by other processes downstream in production.

Cloud-based and due to its restart capability in running production, bugfixes and implementation of new features can be carried out “on-the-fly”. Thereby automated unit- and integration testing for the core functionalities ensure robustness for the high variety of used machining tools.

The development and usage of the “Production Execution System” on GKN Aerospace’s shopfloor are an excellent example for the increasing importance of the programming language Python to ensures highest quality of engine parts in a work environment of increasing digitalization and workload.

Transcript (auto)

Auto-generated from the recording utilizing Open-Source AI. Speaker labels (Speaker 1, Speaker 2) reflect diarization, not identity. Timestamps refer to the recording.

Speaker 1 [00:00]

Check. Hey, I hope you had a nice lunch. Without further ado, I'm going to introduce Nick Brühl. He's going to speak on the increasing productivity of CNC machines, of aerospace engine parts using Python. Please give him a nice warm welcome.

Speaker 2 [00:24]

Yeah, thank you. So first I have to mention in the last two and a half days I saw a lot of great presentations about Python and especially details of Python. My presentation perhaps is a little bit different, but that's also okay for the last afternoon of the convention. I will talk a little bit more about a specific task or a specific challenge we have in the mechanical production of aerospace engine parts to increase the productivity. What does this mean? And Python, in the end, was the tool to program an application which do the job for us. So I structured my presentation as follows. I will start with a really short and rough overview about the company I'm working for, GKN Aerospace. I will talk a little bit about specific challenges we have in the aerospace industry when we develop a new tool or a new application we want to use in the production. Then I have some pictures from our shop floor with me, just to give you an idea how it looks like on the shop floor in aerospace industry. After this, I will talk about the production execution system, or shortly PES. That's the application we developed. I will talk about what it is, what it does, what are the key functionalities. And then I will come to more context-related information, so why unmanned production and automated part change plays a key role to increase the productivity. But then I will show something of the application, the front end of one machine we use the application. After this, I will talk a little bit about standardized machine interfaces for so-called green and brownfield NC controllers. And, yeah, then I have an example for the outcome. What does it mean for the productivity of one machine using a part changing and our application? And then I finish the presentation with a short outlook. So, as I mentioned, I'm working for GKN. GKN Aerospace is a tier one supplier of the aerospace industry. We have three major divisions. We produce parts for civil airframe structures, military airframe structures, and the third division is I'm working for the aerospace engines. I'm located on our site in Norway, in Kongsberg. That's around about 70 kilometers west of Oslo. But, for example, we have also a site in Germany next to Munich. One number I want to mention is we are around about on 100,000 flights every day on board. So when you traveled by airplane to the PyCon, perhaps not in the last days with Lufthansa, then there's a high chance that a GKN part was on board and not just a spare part, a real working part. Okay, typical parts or the major parts we are producing in Norway are turbine shafts and turbine cases. Here on the right side you see examples for both. On the left side you see a cross-section of a state-of-the-art turbofan engine with the cold side on the left side where the air goes into the engine and also the fan is located and the hot end on the right side where the turbine is located where the hot exhaust gas comes out And the turbine shaft transfers the torque generated by the hot exhaust gas in the turbine to the cold end, to the fan, which creates the biggest part of the propulsion, around about 80%, but also drives the compressor, which compresses the incoming air to keep the cycle running. The turbine case is such a ringish part. It is housing the engine. The turbine case itself is housing the part of the engine containing the turbine. And the reason why it is designed in rings is we are using different kinds of materials for the different sections of the engine due to the different temperature ranges. So turbine cases are mainly made out of nickel-based alloys, but we're also machining titanium and stainless steel. Okay, typical challenges in the aerospace industry when we're talking about digitalization. We have a big number, a high variety of qualified processes. And when I talk about processes, then I do not mean a Python process. Then I mean something like milling, turning, surface treatment. And all of these processes are qualified. That means we have exact instructions from our customer how to do something and we cannot change easily something, what we are doing. And when we develop a new tool, then we have to take care that we have a really good understanding how we are interacting with the machines and the processes on the shop floor, not to change something in the process. effectively because then we have to re-qualify it and that creates a lot of effort and we need really good arguments for this to re-qualify something. Our machine tools are goods of high invest and lead time so we have big machines, 90% of the machines are special purpose built for machining individual parts. We have a lot of different suppliers and that leads to the fact that we have no real test machine available so when we want to test an application together with the machine and the production then we have to plan a production stop and we have to use production hardware to test it and again we have to be really careful or have a have to have a good understanding what we are doing because when we're crashing the machine then this will have a real effect on the production yeah we need to increase the productivity as all the industry branches, I think, due to growing cost pressure, but also to reduce the amount of resources we are using, human resources, energy, and also the material we are machining. With this high number of different kinds of machines from different suppliers, also a number of big various of NC controller generations come with. So because the machines are so expensive we have to use them for many decades. So we have NC controllers from the end of the 70s still running in production until new controllers. But we have one advantage in Norway on our side we are mainly use Siemens NC controllers and that makes a little bit simpler for us to standardize. I will come to this on a slide later. We have different codecs for NC programs, so this is also something we have to keep in mind when we're handling the data that we have AYA encoded. It's quite hard to find something about this in the internet because it's so old. ASCII encoded NC programs and also all the newer codecs. We have various interface generations that comes also with the different generations of the NC controllers from modified punch tape drives where we send data to the machine over parallel interfaces but also serial interfaces and on the newest machine we are using, OPC UA. Now, all these reasons or all these points are hurdles for software standardization but that's also one of our main goals. We want to standardize our own tools in one or another way because the development phase just consumes up to 30% of the resources, but the maintenance phase, and we use the tools for many years, consumes up to 80%. So when you want to save resources, then, in our opinion, this happens in the maintenance and the usage of the application. Here, some impressions from our shop floor. The image on the left side, that's an image of an ale in our turbine department. On the left side of the ale you see a turning machine or combined turning milling machine for turbine shafts. So a turbine shaft has a length of around about two meter twenty and the whole machine has a length of around about eight meters on the on the right side you see an image of the ale of from our turbine casing uh department so the image on the bottom and there you see horizontal turning machines on both sides and also the size of the of the nc controller screen gives you an idea how big the machines are so you can really open the door of the machining room and can go inside and on the top of this image on the right side you see an older machine we're still using with also an older NC controller just to give you an idea, okay, we have still legacy hardware around. So what is the production execution system or shortly PES? That's our own acronym for universal SCADA system. What is now a SCADA system? Simplified, it tells a machine what to do and when to do it. And normally a Scala system is, you buy it from the supplier of the machine and it is highly individualized for the machine. But due to reasons of standardization we want to use a common code base and that's the reason why we developed our own system for talking to the machines especially when we talk this creates benefits especially when we're talking about connecting this own SCADA system to the rest of our IT and OT infrastructure. The PES orchestrates the communication between the machine tool the operator and the ERP system focused on unmanned production on cell level low configuration and maintenance effort. At the moment we are using it on around about 20 different machine tools, but mainly milling and turning machines. That's also something we want to address in the future. We'll come to this in the outlook. Key functionalities, it's quite simple what the program is doing. It is downloading data package with the necessary machining data from our ERP system and then transfer it to the machine on the right time and it also commands necessary part changes. And all this happens in a quite simple communication sequence. So when the machine tool finishes the job or the operator starts the process of producing with a physical button on the machine panel, then the machine tool sets a request flag, the PES back-end reacts on this and then is checking, okay, where is the next operation ready for machining, and if this operation is ready for machining for a part which is already inside the machining room, then it just transfers the data and responds with a response code telling the machine, okay, you have all the data you need, so select it and run it. Or when we have to move the parts, then it commands the necessary palette change. why we have to transfer the data for each part because that's also come with a requirement from a qualified process how we work in the production and we're following a strict lot size one philosophy that means on the machining tool only the data of the individual part which is right now inside the machining room is available so we have to delete everything from the machine when the part was finished and the reason for this is because you can have the situation that you want to machine two identical looking parts but between these two parts was a change in the NC program so a new revision of the NC program was created and we have to take care that an individual part marked by the serial number really was machined with the correct NC program because that's also documented and these documents are stored for 40 years. So when we have, for example, an accident with an airplane engine involved, then we have to have the possibility to check, okay, which NC program version was used for machining this part. you can use the system for monitoring down-end production so we have operators working with multiple machines and monitoring what the machine is doing from a central desk and it is realized in modern technology we run back-end and front-end on on-premise cloud and the back-end is programmed in Python, that's the reason why I thought perhaps it's interesting for you too and the front-end is realized in JavaScript. So what does it mean, unmanned production? For us, this means we want to discouple the operator from the work cycle of the machine. And this means when the machine finished a job, the operator does not have to be right in front of the machine to change a part and to keep the machine running. So we're increasing the flexibility because the operator has more time to work together with the machine. And one key for this is to have the possibility to change the parts automatically. I call this keep the machines running during the night. So, for example, in Kongsberg, we're running two shifts, and we have during the night multiple hours without an operator available. And when the machine finished a part during this time span, and then normally the machine will stop and we will lose machining time. Here on the right side, you see such a schematic workflow or machining flow with three parts, that's the columns, and for each part, three operations are prepared, that's the rows. An operation is, for example, you're turning the surface of a part, the outer surface of a turbine case, And then the second operation could be, okay, now you have to drill holes. And the third operation is, now you have to mark something on the outer surface. And why three different operations? Because three different people are responsible for these operations. So three different people have to sign that the operation fulfills all the requirements. And that's the reason why we have, in the end, three different NC programs then. It can make sense to combine this, but there are also reasons to split it up, as I explained before. So, okay, the operator prepared three parts with three operations. Then he pressed the physical start button. Then the machine asked the PS, okay, what is the next task for me to do? Okay, you have to machine operation P1 for part A. You have everything you need. Select the program started. and then this is successfully finished. Then the machine asks again, okay, what is the next task? And then the PES recognizes, okay, the correct part is still inside the machining room. Just change the data on the machine and give the response code again. Okay, you have everything you need. Select the program, start the program. And the machine controller will select the program of the operation two because this is the only NC program available on the controller. But during this operation, something happened, so we have to interrupt the operation, and normally now the machine would stop. But by using automatic part change and the PS, the machine asks again, OK, what's the next step for me to do? And then the PS recognizes, OK, I cannot go further with operation 3 because first I have to finish operation 2, but I can start operation one for part B so move part B in, start part B part B, all three operations are successful and on C, the first operation failed and now the machine stops in the end. It's a bad example for process robustness but I think you got the point what it means to keep the machine running. A reason to interrupt the operation in machining could be, for example, a tool break and we have to take care that the surface was not damaged due to the tool break or a deviation during automated probing or sometimes we have also manual tasks we cannot really execute automatically because we have to interrupt the operation to do a manual measurement in general everything we cannot we cannot decide in a simple logic inside the NC program Everything, a human has to do an evaluation of what happens next. And, yeah, the operator then sees the data situation on the machine with these two operations interrupted, still three operations to do. Then he has to check the parts and have to decide, okay, I have to restart the operation from the beginning or I have to restart the operation in the middle of the program and then he can start these operations again. So here you see the technical implementation of such an automated part changing. That's a horizontal turning machine for turbine cases with five stations. So the three white ones in the foreground are buffer stations where we can prepare parts. On the left station you see also one turbine case prepared for machining. blue in the middle is a palette changer to make it possible to move the part to each station and behind the two doors you see a second part already under machining. And here you see the front end of the application of exactly this machine with the five stations. On the left side you have the machine layout and there you see on the bottom one empty palette and in the machining on the machining station there is a part ongoing indicated by this color code and also this machining station is selected so the operator can by pressing on the on the on the station he can select a station on the right side you see on the top telemetry data so we have also an additional telemetry system collecting data from the machines what the machine are doing and the front end is subscribing on these MQTT topics to visualize it also. Below this, functionalities, okay, what do you want to show in the main window and on the bottom you see the functions for the selected station where you can see also the part which is actually running or you can add another operation to this part and you see also which operation now is active. So it's Dreie, Ferdie, Ute, Wenny. That's NOSC for the final cut on the outer surface. The workflow is as follows. So the operator selects the station. You want to physically add the part. He presses add operation. Then a pop-up appears. He has to enter an identification number. Pressing submit. Download the whole data package from the ERP system. This data package is placed in inside the memory of the PES back-end. Then he adds physically the part to this station and changes the status to ready for machining to tell the PES, okay, this is now ready for machining. Some additional functionalities like, okay, show what happened over time with the operation, when was the status changed, or also make visible all the internal automatic measuring cycles. Because when we download the NC program, then we check each line inside the NC program for automated measuring cycles, and the results after transferring this data to our long-term storage is also visible here. So as I mentioned, we have different machines, different suppliers, different generation of NC controllers, but we want to standardize something so we need one level of standardization and for us this is the interface to the NC controller. So we tell this the so-called Greenfield machine NC controllers and Brownfield NC controllers. Greenfield machine controllers are new machines that we can select what we want. They are using OPC UA and on the Brownfield controllers we are using a Siemens solution handling the communication to these different generations and this is publishing the data in MQTT and we can also send MQTT messages to the gateway to write to the machines. When we now spin up a PS instance, then the backend is connecting to the OPC UA server, browsing the data model and by discovering the nodes on it, it can configure itself. So when there's a node necessary for commanding a palette change, then the system understands, okay, I have to, this is a machine, I can do a palette change. And it also, for example, discovers the nodes for each station. And by this, it understands, okay, this machine has five stations. These are the identification numbers of these stations necessary for commanding the palette change. For the brownfield machines, in the end, the same happens, but we download the client configuration from the gateway containing data points, and these data points have exactly the same function as the nodes in the OPC UA data model. Here you see an example for the outcome of using the application, it's the same machine on the top, it's not using the part changer and the PS system, on the bottom it is using this. What you see here is a production run of 24 hours, on the x-axis is the timeline, on the y-axis is the active block number, so in the end the line of the NC program, and each of this green one slide left one each of the screen figures is one product one machine part so you can see how then see the NC controller is going through the NC program line for line over time we can produce more parts by using the part changer and the PS because we can fill the time gaps between the parts and for this machine, this means additional parts worth of 1.2 million US dollars every year just by using a Python programmed application and a little bit of hardware. Okay, so then I come to the end. The PS is not finished yet, so we're still developing it. We want to use it for more existing machines, and we want to use it for multiple machines which is sharing one big pallet changer. Then we want to add support for special processes like surface and heat treatment, streamline our OPC UA data model with international standards, and the most exciting task, I think, is work together with AGV. So we got the first modern AGV with such omni-wheels moving in all directions, and then we want to send the transport commands automatically based on the data we have in different PS instances available. So then I'm finished with my presentation. Thank you for your attention.

Speaker 1 [25:45]

Thank you that was cool There's a couple questions if you have any others, please enter them into the app The first question is what technology is used for PSE back-end for the workflows solution like temporal IO or some self-created solution

Speaker 2 [26:05]

it's a question related to the use protocols or?

Speaker 1 [26:12]

It says the technology using the PSE back in for the workflows.

Speaker 2 [26:18]

PS my bad. Yeah, okay, so when you talk about the communication sequence or I'm not really Okay, okay

Speaker 1 [26:33]

Anybody want to expand on their question? What are you using actually in the back? Let's say what libraries are you using in the back?

Speaker 2 [26:42]

Yeah, so the backend is completely programmed in AsyncIO and we are using libraries, standard libraries for the MQTT communication, for the communication between the frontend and the backend we are using WebSockets because we have to have the possibility to update the frontend from the backend side without polling all the time because, for example, an operation can take up to 12 hours.

Speaker 1 [26:43]

Yeah, so...

Speaker 2 [27:09]

and during this 12 hours nothing happens and we do not want to poll every second. That's the reason why we have an active WebSocket connection. Yes, and then we have multiple tasks running inside the event loop to work with the WebSocket connection and the MQTT connection to the Pellet Changer or the OPC UA connection. It depends on the configuration and the machine itself.

Speaker 1 [27:38]

I think that was very encompassing.

Speaker 2 [27:40]

Okay, so.

Speaker 1 [27:42]

Another question is, are you doing any ML analysis for predictive maintenance or similar cases?

Speaker 2 [27:48]

We have projects like this, but it's not in the scope of the PES system. So the PES, there we are just... In the end, the logic inside the backend is quite simple and deterministic, so we really have to understand what happened in the logic, and there we are using no machine learning for, but based on the data we collected in the telemetry system, we have projects running, working with predictive maintenance.

Speaker 1 [28:18]

So it's still in the development stages or?

Speaker 2 [28:18]

So it's still in the device. Yeah, so it's on a different site in Sweden.

Speaker 1 [28:29]

Nice. Then we have, do you use open source Python packages, I suppose, and were there any governance issues related to using this?

Speaker 2 [28:40]

Yes, so we have to take care that we are, or we handle it in this way that we have to document very good what we are using and we have to take care that, or we handle it in this way that we are not update every time to the newest version without checking, okay, is it really necessary to update. So we are not jumping to each new version. Automatically, we hard-code the versions of the packages we are using. And then when a new package arrives, then we check the pull requests on GitHub if it is really necessary for us to update it or if 120,000 lines of code were changed.

Speaker 1 [29:28]

Okay, I have two more, but I think we have time for one, and maybe you can talk to Nico personally. Can the downstream processes keep up with the productivity increase? For example, does 44% increase translate into 44% more revenue?

Speaker 2 [29:49]

We have a lot of parts waiting for the machines and that's the reason though in the end We will read by by increasing the productivity. I think the first You observe is that we reduce the buffers between the machines and The the customers ask for this number of parts. So we still see a rising production and Increasing the productivity means for us more or less to be able to fulfill the requirements from the customers in the next years. So we have to increase our productivity now that we are able to produce the number of parts in two years. Cool.

Speaker 1 [30:32]

There's still a couple questions, but Nico's very friendly. I talked to him before the talk, so just come up and talk to him. Give another round of applause for Nico, please. Thank you. Thank you.

Nico Buhl

About — in the speaker's own words

With a background as mechanical engineer and a PhD in material science, I describe myself as a mechanical engineer who can program and not as a software engineer. Started programming in Python, Perl, PHP and C++ as a pupil for fun in the end of the 90ths, I lost track of programming for some years during mechanical studies just to rediscover Python several years ago as a perfect tool for engineers to solve real-world problems in industrial production. The huge eco-system of Python and the intuitive syntax open new opportunities to me to combine domain knowledge in industrial processes with digitalization solution approaches. I enjoy sharing this with all people interested in improving industrial production in context of digitalization.

Social card for talk: Increase productivity of CNC-machining of aerospace engine parts with Python