Writing to Inbuilt System Variables

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by pspeirs, Jun 27, 2017.

  1. pspeirs

    pspeirs

    Joined:
    Nov 23, 2013
    Messages:
    77
    Likes Received:
    0
    Location:
    Sydney
    Hi All,
    I'm trying to configure a current and a value last week type sliders much like the energy monitoring page. I thought I may be able to write to an inbuilt variable then use that with a slider control for example. I'm finding that the value is always 0 although I'm trying to set it at a set interval. What I'm doing at the moment is as per the below as a test.

    1. Using Meas App Manager, set up a new item DeviceID = 1, Channel = 1
    2. Every minute, run the following code.

    Code:
    once (Second = 10) then
    begin
    
      random_number := random(100);
      SetIntSystemIO("TestVar", random_number);
      SetIntIBSystemIO("Measurement App Integer Value", "Local Network", 1, 1, random_number);
    end;
    

    3. Set up a slider / graph and attach it to this variable.

    There are no errors, but the inbuilt variable doesn't appear to contain any values. Can this be done at all or is there a better way.


    Cheers,
    Paul
     
    pspeirs, Jun 27, 2017
    #1
    1. Advertisements

  2. pspeirs

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,309
    Likes Received:
    18
    Location:
    Adelaide
    Some of the inbuilt System IO variables are read only. The help tells you which.

    The Measurement App values are able to be written, but you need to set the channels you want to write as "controllable" in the Measurement Manager first.

    Nick
     
    NickD, Jun 27, 2017
    #2
    1. Advertisements

  3. pspeirs

    pspeirs

    Joined:
    Nov 23, 2013
    Messages:
    77
    Likes Received:
    0
    Location:
    Sydney
    Yes, I saw the docco on the writable system IO. It was the controllable bit that was required. I'm not sure however if they will do what I'm wanting.
    So basically, lets say I'm sending values, pulses or whatever in a measurement message. I want to see what the current value, cumulative totals and previous totals for yesterday, last week or similar.

    I could run some logic to check the value of a Measurement App IO and add that to a user IO then display that number, but I'm running into the issue of how often I run the logic and how do I know if I've already read the current value of the Measurement App IO. Is there a way to check whether the value has changed since it was last read.

    Cheers,
    Paul
     
    pspeirs, Jun 27, 2017
    #3
  4. pspeirs

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,309
    Likes Received:
    18
    Location:
    Adelaide
    Can you take a few steps back and explain what it is you're trying to do?

    If read your original post it's not entirely clear. Are you measuring current and want to translate that to instantaneous power consumption, and then also display accumulated energy usage like on the power meters?

    Where is the current measurement coming from?

    Nick
     
    NickD, Jun 28, 2017
    #4
  5. pspeirs

    pspeirs

    Joined:
    Nov 23, 2013
    Messages:
    77
    Likes Received:
    0
    Location:
    Sydney
    OK, lets say I want to display gas usage based on a conversion of pulses coming in. This is easy if I just want current usage values, ie, send a measurement app message with the pulse count every 10 seconds for example, do the conversion and display the results.

    What I'd like to do is be able to display results for current, yesterday, last week, etc much like the Energy App funcitonality.

    I want to do the following:

    1. Display the current usage (Easy, just grab the System IO)
    2. Display the cumulative usage for today on a slider control
    3. Display yesterdays total usage on a slider control
    4. Display weekly usage and last weeks usage on a slider control
    5. Display the current hourly usage on a graph

    Ideally, I'd like to make use of the Measurement Application Data section used by some of the Inbuilt IO Variables such as "Measurement App Power Maximum" to take advantage of the Period and Offset options.

    The alternative is probably a fair amount of logic to keep track of the cumulative values, etc.

    Hope that makes a little more sense, and I'd like to adapt this to a range of inputs, could be water usage, gas usage, wind speed, etc.

    Cheers,
    Paul
     
    pspeirs, Jun 28, 2017
    #5
  6. pspeirs

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,309
    Likes Received:
    18
    Location:
    Adelaide
    For the gas, given a) it's energy, and b) you have a pulse meter... you could probably adapt the existing pulse power meter system.

    The existing system works on accumulating energy in Wh. Your gas meter probably puts out a pulse every so many MJ.

    1MJ is approximately 278Wh (1W = 1J/s)

    So if you feed your gas pulse into the power meter system as a pulse power meter with a suitable value for Wh/pulse, you should be able to accumulate energy the same way. You may then just need to apply some scaling factors and custom labels on the graphs if you want to convert it back to MJ or MJ/h.

    Nick
     
    NickD, Jun 28, 2017
    #6
  7. pspeirs

    pspeirs

    Joined:
    Nov 23, 2013
    Messages:
    77
    Likes Received:
    0
    Location:
    Sydney
    Hi,

    When you mention pulse meter, I don't have a physical pulse meter as such, I have a unit that can output pulses which are picked up and transmitted onto the cbus network as measurement application messages.

    Regards,

    Paul
     
    pspeirs, Jul 21, 2017
    #7
  8. pspeirs

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,309
    Likes Received:
    18
    Location:
    Adelaide
    What are the pulses connected to? What is converting them to the measurement messages?

    The "Pulse Power Meter" support in the logic/touchscreens assumes the pulse output from the meter is connected into a bus coupler, which generates on/off messages.

    Nick
     
    NickD, Jul 21, 2017
    #8
  9. pspeirs

    pspeirs

    Joined:
    Nov 23, 2013
    Messages:
    77
    Likes Received:
    0
    Location:
    Sydney
    Only over a year late, no matter :) I'm connecting the pulses to a third party unit, just not sure how to send the pulses, possibly accumulated over each 10 sec or 30 sec period, programmable to anything really. So I can basically output any cbus message whether it be to the measurement app, group address, etc.

    Is there a way I can send to a pulse meter config without relying on pulsing a group?

    Paul
     
    pspeirs, Oct 26, 2018
    #9
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.