Does anyone have code for a CR1000 that will log both instaneous power and accumulated energy using the pulse outputs from a W-hr meter? I can count pulses to record W-hr with no problem, but for instaneous power I need to measure very long periods, with a wide range of periods between say 30 seconds and .25 seconds. Ideally the power would update with each full pulse cycle from the W-hr meter.
Please submit your question from our support page if you don't find an answer here.
Campbell Scientific Inc.
RE: reading a W-hr meter (power and energy0
11/21/08 9:36 AM
The easiest way is to have both an accumulator variable to track power usage and an instantaneous variable that updates every scan based on the number of pulses. The issue is what to do with the instantaneous variable when there are no pulses. In the program below, it is just left at the last value, but the user may want to put in logic to either reduce this over time (if more time has passed without a pulse than what the current instantaneous variable value would have resulted in, program could reduce the instantaneous variable each subsequent scan until another pulse), or simply set it to 0. This is the problem with a Watt-hour meter: you cannot know exactly what is going on between pulses. A watt-meter that outputs a proportional voltage based on current power usage eliminates this issue.
Public W_Hr_Accum, W_Hr_pulse,Watt_Instant
Const WattMult = 1
Const ScanInterval = 1
'Define Data Tables
Counter = 0
PulseCount (W_Hr_pulse,1,1 ,0,0,WattMult,0)
If W_Hr_Pulse > 0 Then
Watt_Instant = (W_Hr_Pulse/Counter) * 3600/ScanInterval
W_Hr_Accum = W_Hr_Accum + W_Hr_Pulse
Counter = Counter + 1
Please login to post a response.
for Long-term Monitoring