Good news, bad news!
The good news - been having another look at adding the mid period sample point and in the process have discovered why SyncDel needs to be set so high
The bad new - it's a fundamental error on my part that throws some of the results to date into question
The motor model had been taking the angle and phase voltages to calculate Iq and Id then using the equations to calculate the new Iq and Id values before translating these back into phase currents. Unfortunately it was doing the conversion from Iq and Id to voltages before updating the rotor position, it should have been calculating them after updating the motor position. Fixing this removes the extra 113us on SyncDel that has been bothering johu and I for a while. The other 167us correctly matches the SynDel setting of 10 (which is probably too high for other reasons).
Unfortunately this change does bring into questions some of the results produced to date so this evening job to go though the results and check whether the conclusions drawn from them are still valid.
I've also messed around with the model code a bit to allow it to produce phase voltages at variable sample points within the preiod so that it can be used to gauge the impact of the various ADC sampling schemes that could be used in the OpenInverter software. So the first question is does it all still work?
First plot is a rerun of the simulator agains the original OpenInverter software using all the same settings:
Near enough for me to say it's still working. You can see the effect of the code change though. The Iq and Id in the motor plot are gently drifting with motor speed because it's still running with SyncDel of 280. Changing SyncDel to 167 (280-113) gives:
Much better.
The next question is does it still demonstrate the unexpected deceleration so a 15sec run to above base speed followed by a 5sec coast:
That's a yes so that finding still stands
I'll run though the next few tests/plots now and post when they are ready.