Changes in AES c code to make HD model work

I’m not Colin but I can try to answer!
Yes, you’re understanding the code correctly.
What is your goal in using the HW model, since the HD model is successful?
In this case, I believe that the applicability of one model or the other is determined by the underlying transistor-level hardware and there’s not much you can do to the C code to change that.

This has been covered on this forum, e.g. here and here.

If your goal is to better understand the theory behind the models and attacks, I recommend this book.
You can also find tons of freely available academic papers on the subject, e.g this one.

Hope this helps,
Jean-Pierre