nD-enerserve Forums
Constants per phase - Printable Version

+- nD-enerserve Forums (https://forum.enerserve.eu)
+-- Forum: SmartPi (https://forum.enerserve.eu/forumdisplay.php?fid=1)
+--- Forum: SmartPi - English (https://forum.enerserve.eu/forumdisplay.php?fid=2)
+--- Thread: Constants per phase (/showthread.php?tid=8)

Constants per phase - SuperQ - 02.05.2017

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

RE: Constants per phase - jens - 03.05.2017

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.

RE: Constants per phase - SuperQ - 03.05.2017

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.

RE: Constants per phase - jens - 04.05.2017

My suggestion is to transfer the constants for each phase into the configuration file.

RE: Constants per phase - SuperQ - 05.05.2017

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:


RE: Constants per phase - SuperQ - 06.05.2017

I've implemented this in https://github.com/nDenerserve/SmartPi/pull/34