PID Autotuner block issues

18 views (last 30 days)
Antony Smith
Antony Smith on 3 Nov 2022
Edited: Antony Smith on 29 May 2023
I am currently struggling quite a bit to get any sort of value out of either of the PID Autotune blocks (open-loop / closed-loop).
My model includes a motor output and pressure sensor input, where the input to PID (pos/neg) is in pressure and the output value to the motor is converted to an I2C (0-255) control value. - Both of the following models are run on Com_Port_4 using "Monitor & Tune", and I am "activating" the start/stop input about midway.
I have set everything up according to the EXAMPLE model, however, when I run the closed-loop block version it compiles fine and end the run successfully, only the <P>, <I>, <D> output (displays) are blank?
When I run the open-loop version, it runs the entire duration till stop time, but throws this error right at the end (also no P, I, or D values are output?):
ERROR:
External Mode Open Protocol CheckData command failed
Caused by:
* Multiple errors detected.
* XCP internal error: timeout expired, in response to XCP SYNCH command
* Error detected while trying to disconnect Simulink from target application.
* XCP error: XCP internal error: No server connected

Answers (2)

Sivapriya Srinivasan
Sivapriya Srinivasan on 25 May 2023
Hey Antony Smith,
It seems like you're encountering some issues with the PID Autotune blocks in your model. Let's try to troubleshoot the problems you're facing.
Closed-Loop Autotune:
The fact that the <P>, <I>, <D> outputs are blank suggests that there might be an issue with the block's configuration or signal connectivity. Here are a few things you can check:
1.Ensure that the input and output signals are correctly connected to the PID Autotune block.
2.Double-check the block parameters, such as the sample time, input/output signal types, and limits. Make sure they are set correctly for your system.
3.Verify that the pressure sensor input signal is within the expected range for the Autotune block.
4.Confirm that the Autotune block is correctly configured to use the pressure input for tuning the PID parameters.
5.Check if there are any error messages or warnings in the simulation console or MATLAB command window that could provide additional information about the issue.
Open-Loop Autotune:
The error message you provided suggests a communication problem between the Simulink model and the target application. Here are some steps to troubleshoot the issue:
1.Make sure that the target application is properly connected and configured to communicate with Simulink. Check the connection settings, such as the port number and communication protocol (e.g., XCP).
2.Verify that the target application is running and ready to receive commands from Simulink.
3.Check if there are any firewall settings or antivirus software that might be blocking the communication between Simulink and the target application. Temporarily disabling them can help identify if they are causing the issue.
4.If you have multiple instances of the target application running, ensure that the correct instance is connected to Simulink.
5.Restarting both the target application and Simulink, and then reconnecting them, may also resolve the communication problem.
If the above troubleshooting steps do not resolve the issues, it may be helpful to consult the documentation or support resources for the specific PID Autotune blocks you are using. Additionally, sharing more details about your model configuration and the specific blocks you are using could assist in providing more targeted assistance.
You can refer to MathWorks Documentation for further assistance!

Antony Smith
Antony Smith on 29 May 2023
Edited: Antony Smith on 29 May 2023
Hello again, and thank you for your response and advise.
I did manage to get swome sort values out of the <P>, <I> & <D> auto-tuning blocks, however, they are not produced at the output points where stated. When triggering the tuner until general convergence of the "conv" parameter, and then untriggering, the PID values can be found in the DataInspector if signal logging is set up on each of the output lines.
Using this method, as well as proper setup of the hardware parameters and physical loop hardware, I was able to successfully tune with both open and closed loop blcoks.
There are 2 thing Worth noting:
1.) Scaling: The desired input, feedback input and output values must all be scaled to the same range. Normalising all of them to between 0 and 1 allowed for proper functionality.
2.) Although P, I and D values are produced by the auto-tuning block, and the values are withing the correct range, the tuner does not (as far as I've seen) fine-tune to a point of desired signal output (acceptable wave characteristics).

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!