Reading a Temperature Sensor?

Discussion in 'Pascal Logic Code Examples' started by Ingo, Dec 30, 2013.

  1. Ingo

    Ingo

    Joined:
    Dec 2, 2006
    Messages:
    290
    Likes Received:
    1
    Location:
    South Africa
    I am looking for an efficient way to read my temperature sensors. What I currently have is outlined below:

    Code:
    if GetBoolIBSystemIO("Measurement App Valid Value", 254, 21, 1) then
    begin
       TMainCollector := GetIntIBSystemIO("Measurement App Integer Value", 254, 21, 1); { Get Temperature's Integer value }
       if HasChanged (TMainCollector) then  { If temperature has changed from previous then update Group }
       begin
          SetLightingLevel("Group 242 - TMainCol", TMainCollector, "0s");
       end;
    end;
    Can the above code be improved upon?

    Ingo
     
    Ingo, Dec 30, 2013
    #1
  2. Ingo

    znelbok

    Joined:
    Aug 3, 2004
    Messages:
    1,151
    Likes Received:
    17
    I know this is old but it fits my question

    Is the temperature value an integer or a real?

    I am trying to read (as a real) a value using code similar to the above and I keep getting what I think is 0.

    The valid value is returning false as well.

    The temp sensor is on the network and I can read the value in toolkit.
     
    znelbok, Sep 18, 2017
    #2
  3. Ingo

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,420
    Likes Received:
    62
    Location:
    Adelaide
    Forgive me if I'm stating the obvious, but that method is only useful if the temperature sensor you have is broadcasting on the Measurement Application.

    The old 5031TS temperature sensors didn't broadcast, so you have to use a "Monitor" component, which polls the sensor. Only the newer ones like the 5031RDTSL and 5104DTSI support the Measurement Application (although I think the 5031RDTSL also supports the old way).

    If the "Valid Value" is returning false then it means it hasn't received a broadcast yet.

    All the Measurement Application messages are broadcast as a real number (the format on the bus is a bit wierd), but they are converted to floating point and stored like that in the logic engine. If you ask for the integer value it is converted to a signed integer and returned as such.

    A few possibilities for where to look...
    1) In order to use measurements like this in the you need to add the channel in the Measurement Manager (Project C-Bus Applications->Measurement Manager)
    2) Make sure you have the correct DeviceID and Channel number, noting that some devices start from Channel 0, others from Channel 1 (don't ask...).

    Nick
     
    Last edited by a moderator: Sep 18, 2017
    NickD, Sep 18, 2017
    #3
  4. Ingo

    znelbok

    Joined:
    Aug 3, 2004
    Messages:
    1,151
    Likes Received:
    17
    Thanks Nick

    The sensors are all 5031RDTSL.

    They were in the Measurement Manager Application with the ID matching the address. The channel number is 0 - I cant find any reference to which channel number should be used for these temp sensors.

    So unless the channel is the problem I can't see what would be wrong otherwise.

    Is there a simple way to see if it is broadcasting the temperature?

    Found it in the logs in toolkit - all are broadcasting temperatures on channel 1.
     
    Last edited by a moderator: Sep 23, 2017
    znelbok, Sep 23, 2017
    #4
  5. Ingo

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,420
    Likes Received:
    62
    Location:
    Adelaide
    Hi Mick,

    I just checked myself... you need to use channel 1 in the measurement manager for the RDTSL.

    Nick
     
    NickD, Sep 25, 2017
    #5
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.