1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] "HIL Model" with Microcontroller STM32 and Python

Discussão em 'Python' iniciado por Stack, Setembro 12, 2024.

  1. Stack

    Stack Membro Participativo

    I am new to the forum and new to the topic, so please be patient with me.

    I am supposed to design a PID controller for a process and implement it on a microcontroller board (STM32 Nucleo). To test this control loop, the real system cannot be used. Instead I have only an STM32 Nucleo board and a model of the system in Python.

    I would like to create kind of hardware in the loop (HIL) model with the help of the STM32, Python and, for example an external filter circuit to simulate the transmission behavior of motors, but I am unsure about the realizability of this and wanted to ask whether my approach could work at all. The simulation of the real-time capability is not the first priority here, but rather a preliminary test with the STM32.


    • The filter circuit is to be connected to the STM32 and imitate the transmission behavior of a motor (e.g. PT2 element): Does this make sense as an electronic filter circuit or would it maybe be better to implement a digital filter circuit on a second microcontroller? How do I get a corresponding electronic circuit from a given monitoring function? I can only think of an RLC circuit for an oscillating PT2 model, but I would need too large capacitors/coils, which is why I am struggling with this approach.


    • Data must be transferred between the PC and the microcontroller (e.g. the measured position of the motor), which will then be used in the system model (Python) to calculate the current value of the process variable, which should be sent back to the STM32 on which the PID controller is implemented: This communication between Python and the STM32 currently runs via UART. I can send values back and forth between the PC (Python) and the STM32. Can I use this communication or is it too slow in combination with a python model running on the PC?

    I would be grateful for any help and advices, I hope it has become clear what I want to achieve. Maybe someone has tried something similar?

    Continue reading...

Compartilhe esta Página