Can I use well-trained ANN model and "place" function for Hardware in the loop (HIL) testing?
Show older comments
I have a trained ANN in MATLAB that estimates the plant’s parameters. These estimates go to an adaptive-control block that recomputes the controller gain K with the place function.
The snag: place is not supported for code generation.
Can I keep the ANN and adaptive-control logic (including the place call) running in MATLAB/Python on a host PC, while
- the plant runs in real-time on a simulator such as Typhoon HIL or OPAL-RT, and
- the main controller code executes on a TI C2000 DSP?
Hope someone can help me for this question!
Answers (1)
Manish
on 16 May 2025
Hi,
I understand that you want to generate code for the 'place' function.
This can be achieved with the help of 'coder.extrinsic'
Here is a sample code snippet:
function K = computeK(A, B, p)
coder.extrinsic('place');
K = zeros(size(B, 2), size(A, 1));
K(:,:) = place(A, B, p);
end
Refer to the documentation link below for a better understanding:
Hope it helps!
1 Comment
Quang Manh
on 16 May 2025
Categories
Find more on Simulink Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!