Pular para o conteúdo
Logotipo Altus Logotipo Altus
Products
Segments
Solutions
Company
Support
Contact
Blog
Knowledge Base
EN
Produtos

Our Products

An exclusive combination of equipment that combines high performance and competitiveness to overcome the challenges of Industry 4.0

    • the Control and I/O menu
    • PLC
    • I/O Systems
    • RTU
    • Terminals
    • HMI
    • Softwares
    • PLC Programming
    • SCADA
    • Asset Management
    • Components
    • Power Supply
    • Power Multimeter
    • Weight Transmitter and Indicator
    • Relay Terminal
    • Dara Acquisition and Communication
    • Network Converters
    • Gateways
    • Datalogger
    • Industrial Switches
    • Drive and Movement
    • Inversores de frequência
    • Stepper Motor
    • Servo Driver
    • Instrumentation
    • Position
    • Pressure
    • Temperature
    • Panels
    • Automation Panels
    • Electrical Panels
Segmentos

Industries we serve

At Altus, we have the necessary know-how to provide integrated systems for the most varied demands of the industrial market

    • Oil and Gas
    • Offshore
    • Refine
    • Electrical Energy
    • Hydropower
    • Wind Power
    • Solar Power
    • Process Industry
    • Water and Wastewater
    • Agroindustry
    • Metals and Mining
    • Chemical Industry
    • Sugar and Ethanol
    • Pulp and Paper
    • Marine
    • Manufacturing Industry
    • Food and Beverage
    • Textile
    • Pharmacist and Health
    • Automotive
    • Plastic
    • Infrastructure
    • Subways and Railways
    • Highways and Tunnels
    • BMS
Soluções

Solutions

Discover our solutions and discover how our expertise can help boost your business performance

  • CSS Offshore
  • DCS for Hydroelectric Plants
  • AutobaseWEB
  • Photovoltaic Plants
  • Machine Manufacturers
  • Cybersecurity
Empresa

Company

See how we have become a reference in the automation market over the course of our more than 40 years

  • The Company
  • Our Commitments
  • Headquarters
  • Career
  • Portal do Cliente
    Suporte

    Support

    We are 100% available to solve problems, answer questions and help you optimize the performance of your application.

    • Support Center
    • Downloads
    • Knowledge Base
    Contato

    Contact

    Get to know our units and find out where to find our sales representatives throughout Brazil

    • Where we are
    • Career
    • Certified Integrators
    • Sales Representative
    • Portuguese

    • English

    • Products
      • the Control and I/O menu
        • PLC
        • I/O Systems
        • RTU
      • Dara Acquisition and Communication
        • Network Converters
        • Gateways
        • Datalogger
        • Industrial Switches
      • Terminals
        • HMI
      • Drive and Movement
        • Frequency Inverters
        • Stepper Motor
        • Servo Driver
      • Softwares
        • PLC Programming
        • SCADA
        • Asset Management
      • Instrumentation
        • Position
        • Pressure
        • Temperature
      • Components
        • Power Supply
        • Power Multimeter
        • Weight Transmitter and Indicator
        • Relay Terminal
      • Panels
        • Painéis de Automação
        • Electrical Panels
    • Segments
      • Oil and Gas
        • Offshore
        • Refine
      • Electrical Energy
        • Hydropower
        • Wind Power
        • Solar Power
      • Process Industry
        • Sugar and Ethanol
        • Agroindustry
        • Marine
        • Metals and Mining
        • Papel & Celulose
        • Chemical Industry
        • Water and Wastewater
      • Manufacturing Industry
        • Food and Beverage
        • Automotive
        • Pharmacist and Health
        • Plastic
      • Infrastructure
        • Subways and Railways
        • BMS
        • Highways and Tunnels
    • Solutions
      • AutobaseWEB
      • Machine Manufacturers
      • CSS Offshore
      • DCS for Hydroelectric Plants
      • Cybersecurity
      • Photovoltaic Plants
    • Company
      • Career
      • Our Commitments
      • Headquarters
    • Support
      • Support Center
      • Downloads
      • Knowledge Base
    • Blog
    EN
    EN BR

    Categorias:

    • Success Cases
    • Events
    • Company
    • Perspectives
    • Products
    • Projects
    • Success Cases
    • Events
    • Company
    • Perspectives
    • Products
    • Projects
    Blog

    Python application in the industry: control logic for smart automation 

    Python application in the industry: control logic for smart automation 

    Industrial automation is a field of rigor and precision, where every detail makes a difference to process efficiency. On the factory floor, the synchronization between equipment, production lines, and software is built by complex, but almost invisible systems, and the PLC, the key equipment that guarantees reliability, continuity, and operational intelligence, commands this silent operation. Its programming languages, such as those defined by the IEC 61131-3 standard, are optimized to ensure that every command is executed in the correct order and time, without failures.  

    However, the Industry 4.0 era has brought a new paradigm where the relentless pursuit of efficiency has evolved. Now, industries seek not only to control the present but also to predict the future: anticipate equipment failures, optimize production in real time based on market data, and integrate factories with management systems. It is in this context that Python emerges not as a substitute, but as an operations partner. The programming language acts as a fluid bridge between the ruggedness and determinism of the control hardware, and the flexibility and power of data analysis and operational intelligence.  

    In this article, we will explore how Python can be integrated into existing automation environments, and we will analyze the advantages and challenges of integration. 

    The convergence between IT and OT 

    Historically, OT (Operational Technology) focused on the real-time control of physical machines and processes, using specific hardware and software to ensure safety and continuous operation. In contrast, IT (Information Technology) deals with data, corporate networks, and business management systems (ERP and CRM, for example).  

    Now, Industry 4.0 seeks to unite these two worlds, enabling data generated by sensors and controllers on the factory floor to be accessed and analyzed by increasingly complex and connected software systems, enabling production optimization, predictive maintenance, and process personalization, and for this fusion to occur effectively, tools are needed that can bridge the gap between the rigorous demands of industrial control and the flexibility of equipment. 

    IEC 61131-3: the real-time control standard  

    This global standard defines five programming languages: Structured Text (ST), Function Block Diagram (FBD), Ladder Diagram (LD), Sequential Function Chart (SFC), and Instruction List (IL). Altus' MasterTool IEC XE, for example, is a development environment that natively supports these languages. 

    The differentiator of IEC 61131-3 lies in its ability to guarantee the deterministic and real-time behavior of control equipment. Its languages are designed for Boolean logic, sequencing, and mathematical calculation tasks in a rugged and predictable way, which is essential for maintaining operational safety. While it is possible to use languages like ST for more complex logic, graphical languages like LD and FBD are better for visualizing and debugging the control flow intuitively. Choosing the right language for the right task is one of the premises of this standard, which has become the main safety requirement in the automation industry.  

    In contrast, Python, an interpreted programming language, has emerged as a powerful solution for the other end of the spectrum. The use of Python in automation is an increasingly present reality, and its popularity grows thanks to the ability to integrate with different equipment, databases, devices, and platforms. It is especially effective in executing repetitive tasks with simple syntax, high readability, and a vast collection of libraries and frameworks.  

    Thus, Python is becoming the preferred choice for developers and data analysts who seek agility and efficiency. 

    Why Python: the power of code in a world of interfaces

    Python's programming syntax stands out for facilitating code learning and understanding. For example, while Ladder Diagram (LD) or Structured Text (ST) are ideal for deterministic control logic, Python's concise syntax enables scripts that perform everything from file handling to data analysis to be developed with greater agility.  

    This ease combined with the other available resources functions as a strategic toolkit for solving complex problems where codes can be used for tasks such as: 

    • – Communication: To connect with the control hardware, libraries such as PyModbus and OpenOPC are fundamental. They allow Python to act as a communication client, reading and writing variables in PLCs that function as servers.  
       

    • – Data analysis: The collection of sensor and process data generates enormous volumes of raw information, but it is necessary to transform this data into knowledge. The NumPy library can be used for high-performance numerical operations, while Pandas offers data structures that facilitate manipulation, cleaning, and analysis.  
       

    • – Failure prevention: For the creation of predictive models, the Scikit-Learn library is a standard choice in the industry, as it provides a broad set of classification and clustering algorithms, applicable in areas such as predictive maintenance. 
       

    • – Computer vision: In applications involving visual inspection, the OpenCV library provides a rugged set of tools for image and video processing.  

    However, the central question, then, is not whether Python can replace the IEC 61131-3 languages, but how can the two work together to create more efficient and smart architectures. The IEC languages are unsurpassed in their deterministic control capability, ensuring safety and reliability. Python, in turn, is unmatched in its ability to manipulate, analyze, and contextualize large volumes of data, in addition to automating development tasks. Let's illustrate this complementarity below:: 

    Feature IEC 61131-3  Python 
    Real-time control logic Ideal. Deterministic reliability, predictable scan cycles, optimized for machine control. Inadequate. Interpreted language, not deterministic. Ideal for tasks that do not require real-time. 
    Logic complexity High, but focused on controlling logic and sequencing. High, but with strong support for complex algorithms, AI, and machine learning. 
    Library ecosystem Closed environment, with manufacturer-specific libraries. Vast open ecosystem for data analysis, communication, web, etc. 
    Ease of integration Focused on industrial protocols like Modbus, Profibus, etc. Flexibility to integrate with IT APIs, databases, and web services. 
    Learning curve Requires specific automation knowledge. Low for basic tasks, but high for complex data applications. 
    Common use Process control, safety, machine sequencing. Automation of engineering tasks, data analysis, predictive maintenance, report generation. 

    Note: in the MasterTool IEC XE, the software incorporates high-performance libraries specifically developed by the Altus team (such as NextoPIDA or LibMQTT), which, because they are optimized for the hardware and essential for specific functionalities, have closed code, ensuring the system's reliability and stability. 

    On the other hand, the platform does not restrict user creativity. It is entirely possible to incorporate open libraries; those found in development communities and forums, and even create customized libraries, tailor-equipment to the unique needs of each project.  

    This hybrid model offers the best of both worlds: the security and performance of proprietary libraries for critical control functions, and the adaptability and expansion potential of open and customized libraries for engineering and data integration functions. 

    Python for equipment engineering 

    As emphasized before, one of the most significant differentiators of the language, especially in a development environment with a PLC, lies in its readable and easy-to-use syntax. This characteristic accelerates development and facilitates collaboration between teams, as the code can be maintained and shared with greater clarity, and the ability to execute special scripts allows the user to reduce equipment hours and simplify project development stages, such as: 

    File manipulation and report generation: in Python, libraries can automate the creation, organization, and processing of files. This includes extracting data from spreadsheets or CSV files to generate detailed reports, a task that would be susceptible to errors if done manually. 

    Interface control and automated tests: for graphical interface automation tasks, such as filling out forms in a software or performing a sequence of clicks, libraries like PyAutoGUI and PyWinAuto are ideal. They enable scripts to simulate mouse and keyboard interaction, facilitating the creation of automated equipment tests. For web applications, libraries like Selenium and Splinter allow for the creation of tests that simulate user navigation and interaction. 

    Integrating legacy equipment with new technologies   

    One of the most challenging realities in automation is the presence of architectures with equipment and equipment from different manufacturers operating side by side. Python offers an integrated solution for this problem, functioning as a universal communication bridge. Instead of trying to force interoperability between different software, a Python script can use specific libraries to communicate with each of them, consolidating data from all sources into a single platform.  

    Consider, for example, an automated process with different PLCs producing vital data for production monitoring. A Python program can be designed to read the variables from each of these controllers through their respective protocols, transforming the data into a standardized format and storing it in a centralized database. This approach not only solves the problem of communication between distinct equipment but also makes the data accessible for analysis. 

    Here is a summary of some of the most important libraries for industrial data analysis in Python: 

    Library Main function Example 
    Pandas Manipulation and analysis of tabular data. Cleaning and pre-processing of sensor data, analysis of production logs. 
    NumPy Numerical computing and operations with multidimensional arrays. Execution of high-performance mathematical calculations on machine vibration data. 
    Matplotlib Static data visualization. Creation of temperature or pressure trend graphs for performance analysis. 
    Scikit-learn Machine learning. Training of models for anomaly detection and predictive maintenance. 
    Skforecast Time series forecasting. Optimization of equipment failure forecasts and maintenance planning. 

    Although Python is not suitable for real-time control, it plays an important role in the communication layer for diagnostic, configuration, and data acquisition tasks with its dedicated libraries. The application of Python in the equipment and equipment interaction layer, therefore, does not compete with the deterministic control code, but complements it. 

    Connection and Control in MasterTool IEC XE 

    One of the biggest doubts among automation professionals is how a language like Python can be effectively integrated into an already established and optimized PLC programming environment. The answer to this question lies in the scripting functionality, a feature that operates on a layer above the PLC programming. 

    It is worth noting that MasterTool IEC XE does not specifically have a native environment for the execution of Python scripts within the PLC's control logic. This is not a limitation, but rather a design characteristic that promotes an "architecture of function distinction." The PLC, programmed with the deterministic languages of IEC 61131-3, maintains the functioning of real-time control tasks and system safety. Python, in turn, acts as an external supervisory equipment, or a data client, interacting with the PLC through communication protocols. This approach prevents non-deterministic code from interfering with the critical execution of processes, ensuring the integrity of the equipment as a whole.  

    However, the key to this integration is the CODESYS Development System. The platform, on which MasterTool is based, offers the ScriptEngine plug-in that enables the automation of complex commands and operations of the program through scripts based on IronPython or Python.NET.  

    Thus, ScriptEngine enables a series of tasks that would otherwise require manual interaction to be automated using Python. Instead of acting on the control code, ScriptEngine acts on the project as a whole, manipulating programming objects, hardware configurations, and workflows. This makes it possible to create scripts to load, create, save, close, and compile projects, access-programming objects, configure devices, and manage. 

    Communication between Python and Altus' PLC can be established through open and widely supported protocols, as MasterTool IEC XE offers compatibility with different protocols, which simplifies and expands the possibilities for integration: 

    • – Modbus TCP: the MasterTool platform supports the configuration of the Modbus Ethernet protocol, allowing PLC variables to be mapped to Modbus registers. A Python script, using the PyModbus library, can act as a client, reading and writing these registers to monitor or interact with the process.
       

    • – OPC-UA: an ideal protocol for the exchange of large volumes of data and for the integration of control equipment with higher-level platforms, such as Manufacturing Execution Systems (MES) and Enterprise Resource Planning equipment (ERP). The Python OPC-UA library is the reference tool for creating clients that can navigate the PLC's server address space and read or write data nodes. 

    In addition, to reinforce security the MasterTool platform offers mechanisms such as user and group management for the project and for the PLC itself, in addition to Secure Login, which requires authentication before command execution, ensuring that only authorized scripts and users can interact with the equipment. 

    The PLC as an Edge Controller: Python execution via Docker 

    The Docker platform, present in advanced NX PLCs such as NX3008,elevates Python's role in automation, transforming the controller into a powerful Edge Controller, as Docker enables the virtualization and installation of external programs with a Linux operating system directly on the CPU.  

    Thanks to this architecture, the powerful 64-bit ARM processor of the NX3008, with 1 GHz and 4 GBytes of dedicated memory for Docker, can execute complex Python algorithms locally, without relying on external servers or the cloud. This Edge Computing capability can be a game-changer in operations, as it allows for: 

    • – On-site data analysis: Libraries like Pandas, NumPy, and even machine learning modules can be executed inside a Docker container. This enables predictive analysis and the processing of large volumes of data (Big Data) to happen at the source, with low latency, which is essential for real-time control and immediate responses to operational changes. 

    • – Reduced cloud dependency: By executing the intelligence and data processing logic locally, the equipment ensures greater operational reliability and continuity. 

    • – Advanced customization: Docker support enables the customization of the user's application, going far beyond traditional control logic to include sophisticated data logging and analysis solutions. 

    Docker, therefore, offers the rugged IT infrastructure necessary for Python to operate in conjunction with the deterministic reliability of the IEC control logic. 

    Check out our playlist of tutorials about Docker on the NX3008 CPU

    Learn more about the NX3008 features with our tutorials

    The next level of industrial automation 

    The analysis developed throughout this article shows that Python does not compete with deterministic equipment, but acts as a complementary intelligence layer, standing out as a powerful tool to extract, process, and interpret the data generated by controllers, enabling process optimization and the development of more advanced supervision equipment. Moreover, within this context, Altus' MasterTool IEC XE platform offers a reliable foundation to support this integration.  

    The next level of automation is not only about increasingly rugged hardware, but also about the intelligence that directs the operation, combining the precision of control with the flexibility of programming.

    Share

    Learn more

    Como conectar redes industriais de forma inteligente com conversores de mídia

    Como conectar redes industriais de forma inteligente com conversores de mídia

    Quando a demanda envolve grandes distâncias, imunidade total a EMI/RFI e entrega consistente de dados, o cobre deixa de ser...
    Leia mais
    Como switches com defesa ativa elevam a segurança operacional   

    Como switches com defesa ativa elevam a segurança operacional   

    A nossa Série Connect foi pensada para a diversidade e a complexidade dos ambientes industriais, oferecendo switches que atendem tanto...
    Leia mais
    Um guia prático sobre portas SFP em switches industriais

    Um guia prático sobre portas SFP em switches industriais

    Um dos desafios da indústria é construir uma rede capaz de suportar ambientes hostis e, ao mesmo tempo, flexível para...
    Leia mais
    Tecnologia nacional que impulsiona a indústria: a força da Altus em automação 

    National technology that boosts the industry: the strength of Altus in automation 

    Confira como foi a visita de clientes à nossa fábrica, onde puderam conhecer de perto o processo de fabricação da...
    Leia mais
    Altus confirma presença na SPS 2025 na Alemanha

    Altus confirms presence at SPS 2025 in Germany

    A SPS é o ponto de encontro global da automação industrial. Muito além de uma feira, é o centro de...
    Leia mais
    Switches PoE: otimizando a indústria com energia e dados no mesmo cabo  

    Switches PoE: otimizando a indústria com energia e dados no mesmo cabo  

    Veja em detalhes o que são os switches PoE e como eles simplificam a infraestrutura de rede industrial.
    Leia mais

    Av. Theodomiro Porto da Fonseca, 3101, lote 01 – São Leopoldo/RS – Brasil
    CEP 93022-715

    Headquarters
    +55 51 3589 9500
    São Paulo Branch
    +55 11 2039 1950
    SEGMENTS
    • Oil and Gas
    • Electrical Energy
    • Process Industry
    • Manufacturing Industry
    • Infrastructure
    • Oil and Gas
    • Electrical Energy
    • Process Industry
    • Manufacturing Industry
    • Infrastructure
    SOLUTIONS
    • AutobaseWEB
    • Machine Manufacturers
    • CSS Offshore
    • DCS for Hydroelectric Plants
    • Photovoltaic Plants
    • AutobaseWEB
    • Machine Manufacturers
    • CSS Offshore
    • DCS for Hydroelectric Plants
    • Photovoltaic Plants
    CUSTOMER AREA
    • Data Sheets
    • Tutorials
    • Data Sheets
    • Tutorials
    • Company
    • Support
    • Contact
    • Company
    • Support
    • Contact
    PRODUCTS
    CONTROL AND I/O
    • PLC
    • I/O Systems
    • RTU
    • PLC
    • I/O Systems
    • RTU
    TERMINALS
    • HMI
    • HMI
    SOFTWARE
    • PLC Programming
    • SCADA
    • Asset Management
    • PLC Programming
    • SCADA
    • Asset Management
    COMPONENTS
    • Power Supply
    • Power Multimeter
    • Weight Transmitter and Indicator
    • Relay Terminal
    • Power Supply
    • Power Multimeter
    • Weight Transmitter and Indicator
    • Relay Terminal
    DATA COLLECTING AND COMMUNICATION
    • Network Converters
    • Gateways
    • Datalogger
    • Industrial Switches
    • Network Converters
    • Gateways
    • Datalogger
    • Industrial Switches
    DRIVE AND MOVEMENT
    • Inversores de frequência
    • Stepper Motor
    • Servo Driver
    • Inversores de frequência
    • Stepper Motor
    • Servo Driver
    INSTRUMENTATION
    • Position
    • Pressure
    • Temperature
    • Position
    • Pressure
    • Temperature
    PANELS
    • Automation Panels
    • Electrical Panels
    • Automation Panels
    • Electrical Panels

    © 2025 Altus

    Privacy Policy

    Criação de sites pela Agência de Marketing Digital Orgânica Digital.