Can I use well-trained ANN model and "place" function for Hardware in the loop (HIL) testing?
5 views (last 30 days)
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!
0 Comments
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!
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!