Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Constants per phase
In the ade7878.go source, there are a bunch of constants defined per phase.  It doesn't seem necessary to do this, as all of the values are the same per phase.  It would greatly simplify things if we could eliminate the per-phase component.

 CURRENT_RESISTOR_A        float32 = 7.07107
 CURRENT_RESISTOR_B        float32 = 7.07107
 CURRENT_RESISTOR_C        float32 = 7.07107
 CURRENT_RESISTOR_N        float32 = 7.07107
 CURRENT_CLAMP_FACTOR_A    float32 = 0.05
 CURRENT_CLAMP_FACTOR_B    float32 = 0.05
 CURRENT_CLAMP_FACTOR_C    float32 = 0.05
 CURRENT_CLAMP_FACTOR_N    float32 = 0.05
 OFFSET_CURRENT_A          float32 = 0.97129167
 OFFSET_CURRENT_B          float32 = 0.97129167
 OFFSET_CURRENT_C          float32 = 0.97129167
 OFFSET_CURRENT_N          float32 = 0.97129167
 OFFSET_VOLTAGE_A          float32 = 1.0
 OFFSET_VOLTAGE_B          float32 = 1.0
 OFFSET_VOLTAGE_C          float32 = 1.0
 POWER_CORRECTION_FACTOR_A float32 = 0.019413
 POWER_CORRECTION_FACTOR_B float32 = 0.019413
 POWER_CORRECTION_FACTOR_C float32 = 0.019413
Hello SuperQ,

in the second hardware version of the SmartPi there will be the possibility to connect different current terminals. For each phase it can then be decided whether a cable transformer with 50 mA or 1A secondary current is connected. Then the translation ratios change.
Therefore, I find it better if the constants remain separate. These will soon be available via the website.
Good to know, but it sounds like these will need to be configured per phase, so we'll need to replace the consts with some lookup options.  This will have the same simplification that I'm already thinking about.
My suggestion is to transfer the constants for each phase into the configuration file.
Another option would be to have a table (map of structs in Go) in the code of constants for different CTs.

Then in the config we could have something like this:


or the model number:

I've implemented this in

Forum Jump:

Users browsing this thread: 1 Guest(s)