This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SLAA577F 3-phase Watt-Hour Meter Report

Other Parts Discussed in Thread: MSP430F67791A

Hi everyone

I am trying to develop a Three-Phase Watt-Hour Meter based on the SLAA577F Application Report with the MSP430F67791A device.

Dynamic phase correction will be needed in this project and since the SLAA577F implementation does not do dynamic phase correction and also does not use the SD24 phase correction hardware of the VOLTAGE ADC’s, I thought I could use this structure to do my small dynamic corrections (less than 2 deg) without disturbing the SLAA577F routines.

More specifically, I am loading the SD24BPREx voltage preload registers directly with my dynamic corrections, being aware of the recommendation that "conversions on the SD must be stopped while changes are made to the phase compensation". To attend this requisite, I am disabling interrupts, delaying conversion restart, etc, with no success. For some combinations of preload values, the software always hangs in the ISR, even if I load the SD24BPREx voltage registers in the initialization. Could someone help me with this problem?

In addition, I also need to be able to load (only once, in the beginning of the execution) the SD24BPREx current preload registers, writing my values to the nv segment constants ( DEFAULT_BASE_PHASE_x_CORRECTION_LOW ) prior to the moment they are read by the SLAA577F routines. To do so, I had to understand the SLAA577F process, and came across some apparent incoherences:

 Setting  different DEFAULT_BASE_PHASE_A_CORRECTION_LOW values in the source program, compiling, executing and reading registers/values with the debugger, I got the following results: 

DEFAULT_BASE_PHASE_A_CORRECTION_LOW               SD24BPRE4                                               STEPS

         0                                                                                                  0                                                      2 (I_HISTORY_STEPS)

         1                                                                                                 255                                                   2 (should be 1, I think)

        -1                                                                                                 1                                                       3 (should be 2)

        256                                                                                               0                                                      1

         10                                                                                                246                                                   2 (should be 1)

        -10                                                                                               10                                                     3 (should be 2)

        300                                                                                              212                                                   1 (should be 0)

       -300                                                                                              44                                                     4 (should be 3)

   

I interpreted these results assuming that:

1) a negative DEFAULT_BASE_PHASE_A_CORRECTION_LOW  means a delay in the current of phase A with respect to all other ADC’s (currents and voltages),  and that

2) I_HISTORY_STEPS = 2 means that all SD24 ADC’s start with a default delay of 2 SD24 samples or 2*256 units of SD24 delays (not 128 as SLAA577F suggests).

This being the case, the second example (DEFAULT_BASE_PHASE_A_CORRECTION_LOW  = 1) means an anticipation of 1 in 256 units of SD24 delays. Since all SD24 ADC’s start with a delay of 2 STEPS (2*256 SD24 delay units), the correct setting for the anticipation of one unit is to set a delay of 255 in the SD24 plus one STEP (one sample period), not two.

In the last example, DEFAULT_BASE_PHASE_A_CORRECTION_LOW  = -300 means a delay of  44 + 256 units of SD24 delays plus the 2 default STEPS, which results in 44 SD24 delay units plus 3 STEPS (3 sample periods), not 4.

I would appreciate it very much if someone could help me with these questions.

Thanks

Claudio R. Sonnenburg

  • Hi Claudio,

    I'm working to find someone to help answer your question - sorry for the long delay.

    -Katie
  • Hello Claudio,

    Are you sure that you are reading all voltage channels at the correct time? In the code all voltage samples are ready at the same time since the voltage preload registers are not used. If writing to the voltage preload channels then this is no longer true. Therefore, as a precaution, please make sure that you read each voltage channel’s result only when it is ready.

    In addition, to minimize interruptions to the Sigma Delta module’s operation, you can also try to provide delays using an FIR filter. Since a FIR filter is used to provide the fractional shifts necessary to shift voltage by 90 degrees you can probably reuse this code if interested.

    Regards,
    Ryan
  • Hello Ryan

    Thanks for your email.

    Let me briefly explain my motivation to develop a Watt-Hour Meter based on the SLAA577F report.

    Recently, in Brazil, due to very bad government decisions about inflation control and extremely dry seasons (last two) which obliged the activation of expensive thermo electric power generators, the price of electricity is skyrocketing. Due to this, I think that brazilians will begin to use electricity with more parsimony and sense of economy. This means that it will be important to know, for example, the cost of a hot shower, or how much is the home air conditioning costing, or a week of normal washing machine usage, or even how much it costs to leave a TV on standby for a month. The meter that I am trying to develop, I hope, will help answer these questions. It will have the communication characteristics of the TIDU531 smart plug (with WI-FI Direct or Bluetooth) and be based on the SLAA577F project using split core Current Transformers.

    Simplicity and flexibility will be important aspects of this meter. This is why I would like to provide an automatic and easy way for the (1 phase) meter to be calibrated. In this case, the user (a technician) should have access to a single phase voltage (110 or 220V) connected to a resistive load that should demand a current of approximately a 5 Amps, and set up the meter to measure this voltage and current. In parallel, with a good multimeter, the voltage and current should also be measured and the values passed to the meter software by means of a celphone with WI-FI Direct communication. This way, the scale factors for voltage, current and apparent power can be determined and stored in the proper non volatile NV segment of memory. In addition, since the load is purely resistive, the phase delay introduced by the Current Transformer can also be determined. Additional current values to determine a dynamic phase correction curve can easily be obtained.

    About your first observation, concerning the moment I read the voltage channels, I would like to say that I am not reading the voltages directly. Instead I am calling SLAA577F routines for that and am assuming that if I load a SD24BPREx voltage register with some value Z < 256, that the respective voltage will be read by the SLAA577F software Z*1/255*1/60 seconds later, same way as the current SD24BPRE registers.

    Note that the SLAA577F software admits the setting of the Voltage Preload Registers by means of the parameter DEFAULT_V_PRESCALE_FACTOR of the configuration data file, which initializes the 3 voltage preload registers SD24BPRE[0,1,2] with the same DEFAULT value.

    Could you also please give an opinion about my question relative to the STEPs calculation.

    Thanks for your advice.

     

    Regards

    Claudio R. Sonnenburg

  • Hi Claudio,

    Please regard the following comments:

    • The preload register provides delays in modulation clock cycles. Therefore, you would expect Z/(4096*256) seconds delay when applying a preload value of Z.
    • A preload value of 128 is not applied as you mentioned. This part of the application note is meant to just mention one method of providing phase shifts.
    • Please also keep in mind that the delay due to I_HISTORY_STEPS is seen not only in the current samples used for calculating power but also the voltage samples.
    • The phase correction calibration value can be seen as the delay between voltage and current pairings. Please keep in mind that a voltage sample is paired with a current sample that is ready before and not after this voltage sample is ready. In addition, generally, a smaller and more negative value of this calibration value corresponds to a voltage being more delayed with respect to the current sample that it is grouped with.

    Regards,
    Ryan
  • Hi Ryan

     

    Thanks very much for your comments.

    For economy, please let me answer directly in your text.

     

    • The preload register provides delays in modulation clock cycles. Therefore, you would expect

    Z/(4096*256) seconds delay when applying a preload value of Z.

    Sure. I mistakenly wrote the frequency instead of the sampling rate.

     

    • A preload value of 128 is not applied as you mentioned. This part of the application note is meant to

    just mention one method of providing phase shifts.

    OK

     

    • Please also keep in mind that the delay due to I_HISTORY_STEPS is seen not only in the current

    samples used for calculating power but also the voltage samples.

    OK

     

    • The phase correction calibration value can be seen as the delay between voltage and current

    pairings. Please keep in mind that a voltage sample is paired with a current sample that is ready

    before and not after this voltage sample is ready. In addition, generally, a smaller and more negative

    value of this calibration value corresponds to a voltage being more delayed with respect to the

    current sample that it is grouped with.

     

    I assumed that:

    1. All voltages and currents start with 2 delay STEP’s (I_HISTORY_STEPS) which facilitates the anticipation of any individual current or voltage;

    2. STEP=1  for a specific current is equivalent to 256 units of SD24BPRE correction (delay); In other words, starting with SD24BPRE4 = 0 and STEP = 2 is the same as starting with SD24BPRE4 = 256 and STEP = 1;

    3. DEFAULT_BASE_PHASE_A_CORRECTION_LOW = +1 (or -1) means that the phase A current will be anticipated (or delayed) by 1/(256 * 4096) sec.  If this is correct, the values of STEP’s derived by SLAA577F are not OK.

     

    Please comment.

     

    Regards,

    Claudio

  • Hello Claudio,

    1. The step variable is only applicable to voltage. To make things less confusing let's just say that there is a I_HISTORY_STEPS (set to 2 in the code) sample delay for voltage and current if the phase correction calibration value is zero.

    2. Step is only applicable to voltage. Could you elaborate what you mean by this statement?

    3. This variable represents the relative delay between a voltage sample and the corresponding current sample that it is grouped with. This delay is done by using the current preload register to provide fractional sample delays and using the step variable to provide whole sample delays of voltage. The variable should not be thought of as the absolute delay of a current channel.

    Regards,
    Ryan
  • Hello Ryan

    With respect to item 2, I meant the following:

    If I initialize the phase A current STEP variable with STEP=1 and the corresponding ADC SD24BPRE register with 256, the end result, as far as phase correction is concerned, is the same as if I initialize phase A with STEP=2 and the corresponding SD24BPRE register with 0.

    Thanks for your time.

    Regards

    Claudio

  • Claudio,

    When you are referring to the “corresponding ADC SD24BPRE”, if you are referring to the corresponding preload register for voltage and not current then you are correct. However, please note that the software does not provide phase compensation by modifying this voltage preload register. Instead it modifies the current preload register to provide fractional delays. In contrast the step variable is used to provide entire sample delays of the voltage samples and not the current samples.

    Regards,
    Ryan

**Attention** This is a public forum