applying conversions at different times of day


Recommended Posts

Hi i am using DAQF to read electricity meters i want to convert the KW reading to pound and pence, the day tarrif can just be multiplied by the appropriate amount but after say 6pm until 8am the tarrif changes how can i split up the channel into different chunks so i can apply different tarrifs at different times of day?

Thanks for any help

Link to comment
Share on other sites

I'd probably create a Test channel, called, say, Tariff, I/O type A/D, Timing = 0. Then in the event of the energy meter, put something like this:

private temp
if ((temp.time % 86400 < 8*3600) || (temp.time % 86400 > 18*3600))
   temp = 30
   temp = 20
temp.time = meter.time[0]  // meter is the name of the meter channel

% is modulus and doing % 86400 returns the seconds into the day.

Once you have this, you can use the tariff channel in calcs with the meter channel.

Link to comment
Share on other sites

  • 1 month later...


This topic is now archived and is closed to further replies.