cancel
Showing results for 
Search instead for 
Did you mean: 

Is there an error in the code for bus voltage compensation?

propu
Associate II

My configuration:

  • [VERSION]: MCSDK 6.3.2
  • [TOOL]: MC Workbench, ST MOTOR Pilot
  • I am using the HSO on a custom board with an STSPIN32G4 at 15 kHz.

propu_0-1749534917183.png

The basic algorithm here should be the reciprocal of the bus voltage,  using LPF filtering for result. So the code should be modified as follows. Please help me confirm whether my understanding is incorrect or if there is indeed an error here?

propu_1-1749535157651.png

 

1 REPLY 1
Gael A
ST Employee

Hello propu,

Although I'm not sure of the exact reason why the current busVoltageComp filtering is implemented this way, it is still a valid filter and I don't see any reason to change it. It is true that the filter you are talking about is the closest way to a LPF. However, it requires a division in that case, which we would rather avoid in an embedded context. The current implementation is therefore more adapted to our constraints.

If you agree with my answer, please consider accepting it by clicking on 'Accept as solution'.

Hope this will help,
Gaël A.