Real-time control PLC connected to Simulink is faulty

1 次查看(过去 30 天)
Hi, everyone
I am trying to build a stepper motor speed control model using simulink with PLC using OPC toolbox. I set Sample Time = 0.01s for all blocks. OPC Read and OPC Write block (Asyn. mode). The PLC Encoder sampling rate is 100ms. I have identified the transfer function as shown in the red circle. The problem with the PID here is that when running a real-time model that only matches (100,110,30), Settling Time = 8s. According to theory, the better set of numbers (16593,31551,4087) is Settling Time = 2s, but when running the real-time model, it is not true when running the simulation. Does anyone know why?

回答(1 个)

MULI
MULI 2024-10-11
Hi Hoang,
It seems like the issue you are facing arises from the mismatch between the sampling rates of your system components. It can arise due to following reasons:
  • Your Simulink model expects data updates every 10ms, but the encoder only provides updates every 100ms. This can lead to inaccurate control signals from the PID controller.
  • Simulations run in sync, but real-time systems experience delays due to hardware, causing mismatches in behaviour.
You can follow the below suggestions to resolve the issue:
1. Increase Sample Time in Simulink:
Set the Simulink model's sample time to 100ms to match the encoder. This synchronizes the model with the encoder data.
2. Implement Data Interpolation:
Use interpolation (e.g., linear interpolation) to estimate encoder values between updates, allowing Simulink to work with estimated data at 10ms.
3.Tune the PID Controller for Real-Time:
Re-tune the PID controller to account for the slower 100ms data updates. Use less aggressive parameters to improve real-time performance.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by