LSTM Replaces PID Control

Поделиться
HTML-код
  • Опубликовано: 28 авг 2024
  • The purpose of this exercise is to automate a temperature control process with an LSTM network. The LSTM network is trained from a PID (Proportional Integral Derivative) controller or a Model Predictive Controller (MPC). LSTM (Long Short Term Memory) networks are a special type of RNN (Recurrent Neural Network) that is structured to remember and predict based on long-term dependencies that are trained with time-series data. An LSTM repeating module has four interacting components.
    The LSTM is trained (parameters adjusted) with an input window of prior data and minimized difference between the predicted and next measured value. Sequential methods predict just one next value based on the window of prior data. In this case, the error between the set point and measured value is the feature and the heater value is the output label. Proportional Integral Derivative (PID) control automatically adjusts a control output based on the difference between a set point (SP) and a measured process variable (PV).
    Objective: Train and deploy an LSTM network to adjust the heater (Q) to regulate the TCLab temperature to a requested set point.
    ML for Engineers: apmonitor.com/pds
    LSTM Case Study: apmonitor.com/...

Комментарии • 32

  • @WWG1-WGA
    @WWG1-WGA Год назад +1

    Im an automation engineer but I haven’t work on my career for almost for 10 years, I’m coming back into the web developer, data scientists and Automation . My expertise used to be into industrial control , not coding at all , but with this PID and machine learning example now I can see how to make it in this life haha everything change a lot . And I have experience in neuronal network but so confusing to know where to go with so many online careers .
    Thanks for the video !

  • @apm
    @apm  2 года назад +6

    A couple minor corrections: Anti-Reset Windup is included with the PID control at 6:56. The features (inputs) of the LSTM are Tsp and Error=(Tsp-T), not Tsp and T at 10:15.

  • @techwithcomparision2941
    @techwithcomparision2941 2 года назад +3

    Thanks for sharing !!!

  •  2 года назад +2

    Thank you for sharing.

  • @Anyone.c
    @Anyone.c 2 года назад +2

    Thank you so much!

  • @johntryl8009
    @johntryl8009 2 года назад +7

    Very cool stuff, but I have a genuine question about the applicability of this: why would anyone ever want to emulate/mimic/train an AI model to behave like PID controller, when a PID controller already behaves like a PID controller? I don't see where this makes sense to use, if a simple PID controller is already performing the work needed. Can you make a video showing an example of where a PID controller can NOT perform the duties of an LSTM controller? Maybe there's an application where a PID controller can never work, but an LSTM can? Can you provide insights into that topic please? Thanks again for the video, it was cool to watch!

    • @apm
      @apm  2 года назад +7

      Great question! You would certainly prefer a PID controller that is already working well. Suppose there is historical data that you want to learn from and build an automation solution, such as training from open loop data from the best operator. There are subsequent videos on LSTM controllers that emulate MPC. MPC can be difficult to deploy on microchips or embedded devices with limited compute resources. There are many other cases as well. The PID case study isn't the most motivating but it does show the process of learning.

    • @johntryl8009
      @johntryl8009 2 года назад +2

      ​@@apm Got it! Thanks for the info and ideas! I've still got a lot of content to learn when it comes to control theory. I haven't dabbled yet with 'adaptive control', or 'mpc', or 'lstm', or even MIMO yet...I'm at a firm undergraduate level so far in controls in terms of practice and understanding, so I appreciate the feedback..haha, get it? Cheers!

  • @ivanoxford5796
    @ivanoxford5796 2 года назад +1

    Thanks for sharing teacher

  • @JujuhTuberr
    @JujuhTuberr Год назад +2

    Awesome!

  • @destroyo5457
    @destroyo5457 2 года назад +2

    This is awesome!

  • @Frost_Byte_Tech
    @Frost_Byte_Tech 2 года назад +1

    Congratulations, I'm now a permanent subscriber.. Your content is fireeeee Sir 🔥🔥🔥🔥🔥🔥

    • @apm
      @apm  2 года назад

      Thanks for the feedback!

  • @TEC_STE
    @TEC_STE 2 года назад +3

    Could we let lstm to learn from fuzzy controller instead of pid?
    Maybe the results will be better.
    Thanks very much.

    • @apm
      @apm  2 года назад +2

      Yes, it can learn from any sequence.

  • @vahidvajihinejad3178
    @vahidvajihinejad3178 2 года назад +1

    Thanks for sharing, great stuff indeed, I enjoyed it!
    I was wondering if you had any thoughts to share on how that would be implemented on a controller in real plant. The controllers on DCS usually do not have the capacity to run an outsource model, may be inputting it from cloud or a interface like what's done in APC/MPC? Then any thought on the latency issue in real applications?

    • @apm
      @apm  2 года назад +3

      Initially it would need to be communication through MODBUS, OPC, or similar communication protocol. Some forward-thinking companies have made Python available as a calculation block in the DCS, although with limited cycle time to prevent overloading the CPU. You can likely expect more sophisticated DCS/PLC interfaces to Python in the future.

  • @ayoubtech6930
    @ayoubtech6930 Год назад +2

    can you make a vidio to optimize pv systeme with lstm

    • @apm
      @apm  Год назад

      See apmonitor.com/do for similar content.

  • @Harikrishnan-me9dn
    @Harikrishnan-me9dn 5 месяцев назад +1

    Hi
    Is it possible to model the PI controller which is used for DC-DC converter control using LSTM. Can you please recommend a way to generate data to train the model if its possible. Thank you

    • @apm
      @apm  5 месяцев назад

      Sure, just follow the same example but replace the PV, OP, and SP values with that for the DC-DC converter.

    • @Harikrishnan-me9dn
      @Harikrishnan-me9dn 5 месяцев назад

      @@apm Thanks a lot. We were planning to train the model using error, change in error and change in duty ratio.
      Is it possible to generate the volume of data required using a boost converter with pid controller model in matlab simulink?

  • @Rahul-jg5sd
    @Rahul-jg5sd 6 месяцев назад +1

    Let's I want to control some other parameters of a system such as "speed control of a motor", then where to get libraries for that?

    • @apm
      @apm  6 месяцев назад

      Same libraries, just different data with the LSTM control. If you are looking for interfaces to hardware with Python then see the Data-Driven Engineering website at apmonitor.com/dde with communication examples with Modbus & OPC and tutorials on connecting to hardware with microcontrollers and I2C.

    • @Rahul-jg5sd
      @Rahul-jg5sd 6 месяцев назад

      Thank you very much! Helped me a lot.

  • @jenefaravind
    @jenefaravind Год назад +2

    Can LSTM replace PID controller for Multivariable control?

    • @apm
      @apm  Год назад +1

      Sure, see Exercise 2 here: apmonitor.com/do/index.php/Main/LSTMNetwork

  • @javierenriquepozzohuerta8075
    @javierenriquepozzohuerta8075 23 дня назад

    Amazing case! is there a portal where we can post questions and doubts? I`m having some issues trying to implement in Python 3.12 and moved to Python 3.9.1 as you show in the video same error. Thanks in advance for your help.

    • @apm
      @apm  23 дня назад

      I'd recommend StackOverflow for questions. RUclips comments are okay for simple issues.

  • @wilfredralphgomez8325
    @wilfredralphgomez8325 10 месяцев назад +1

    could you share your code sir?

    • @apm
      @apm  10 месяцев назад

      Sure, it is available here: apmonitor.com/pds/index.php/Main/LSTMAutomation (see LSTM Emulates SISO MPC section)

  • @avibank
    @avibank 2 года назад +1

    Big 'hmmm'