I had found this thread, and there didn't seem to be a conclusion. Hence the months later bump...
I've been trying to set up alternator control on my NB2 miata with G4X fury. These are the results of a brief test, still a lot of fiddling to do, but the strategy seems to be on the right track. Definitely better than the bang-bang setup I had before. I'll update this later once I figure out better gains
The PWM frequency is 250Hz constant, not sure if that is appropriate. Given that the math blocks run at 1kHz, averaging the error across some integer multiple of 4ms seems to be a good idea (still need to play with how many averages works best).
I used a 'dt' function, instead of the simple 'current - previous' derivative calc proposed above
I used some different axis breakpoints in the GP PWM table, to normalize the gains in math block 4 - they wouldn't fit otherwise. I think I can also move the "+4" term in math block 4 into the GP PWM table, to claim some more character space back.