landry wrote:... Not fully understanding ration metric voltage verses voltage regarding Sensor Value , for both sensors AC and DC I set the sensor to 0999b-Generic Sensor Value 0-1000.
And I use the the following phidget scripts to calculate an indigo variable representing amperage:
AC script:
#Script Calculates SHW Pump Amperage from
...myvar=(((analoginput/1000.00)*5.00)*8.403)*1.0
...
DC script:
...myvar=(((analoginput/1000.00)*75.76)-37.8787)*1.0
It is not clear why you are calculating the value outside the plugin rather than just selecting the
1122 type sensor and letting the plugin do all the work.
If you really don't want to select the 1122 for some reason, then why not just use the 0999c type and enter the lambda formulas. They are the same as I noted in my previous post regarding the phidgets.dict file.
DC: (x / 13.2) - 37.8787
AC: x * 0.04204
However, given the way you are doing it, with Python code, I believe you have the wrong formulas. You need to use the formulas noted above, which are derived from the original 1122 phidgets21 libs documentation. The formulas you have used are from the phidgets22 libs. The results will be similar, but not the same.
So,
DC: myvar=((analoginput/13.2) -37.8787)
AC: myvar=(analoginput * 0.04204)
Also, In your code it is not clear why you enter the divisor as a whole number with 2 decimal places, and why you multiply the results by 1. Finally, just removing the division by 1000 would change the result from milliamps to amps.