Announcement

Collapse
No announcement yet.

calculations

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    calculations

    I am trying to (1) sum 6 sensors and (2) sum the same 6 sensors and multiply by total by the value of a 7th sensor. My sensors are all Phidgets and are named &1, &2, &3, &4, &5, &6, &7. The formula I put in the calc column is +&1+&2+&3+&4+&5+&6 for the first calculation and +&7*(+&1+&2+&3+&4+&5+&6) for the second calculation. But it isn't working. The fields are set up in the database okay but the values inserted don't have any obvious bearing on the values of &1-&7.

    What am I doing wrong?

    I am familiar with thread http://board.homeseer.com/showthread...46001&t=138325

    More generally what are the rules for calculations and is there a reference for them. For example, are parentheses allowed like I have used? Is division allowed?

    Thx

    #2
    A null inputs results in 0
    A totally numeric input results in a that number (e.g. 123.45)
    If first character of input is numeric then it is evaluated as a numeric expression (e.g. 5/2)
    Otherwise the input is parsed looking for HS Devices and substitutions performed where the device code in the input is replaced by the contents of hs.DeviceString. If the DeviceString is null then the hs.DeviceValue is used. After substitutions the numeric expression is then evaluated
    (e.g. ^15+(R1+12)/56*Round(Z44/3)+1.4 )
    Last edited by Michael McSharry; March 7, 2010, 02:03 PM.

    Comment


      #3
      The &1-&7 devices contain numeric data, as I can plot them individually in mcstemp. And they are in the mcstemp database as numbers.

      But the calculations are not working. Is it okay for the devices to be named with an "&" as in "&1". Are my formulae above okay? The virtual devices created by the calculations are named V1, V2, etc. Is that okay?

      Can you see anything wrong with the sensor page attached. "BattVolt" "WattsRanch" "BatteryVolt" "VoltsBatt" are not working as expected. I have tried different ways of doing calculation. The forumlae are too long to appear in the column completely but are as above.

      Also for my amp sensor, what type should I use. There is not an "amp" type so I chose "temperature."
      Attached Files

      Comment


        #4
        The ampersand at the start is a base designator (e.g. &H10 => hex 10 => dec 16 )so it treats it as a number rather than as a HS device. I made a special check for this situation in 6.1.14 that is posted at the top of the subforum. I also added intermediate outputs in the debug log so the next user will be able to better diagnose expression issues. The General Debug checkbox needs to be enabled to see it and it goes to a .txt file in \Data\mcsTemperature folder.

        If you define a user label, which I think is on the Display setup page, then you can use that label for your device type. Up to 4 labels for user defined types are supported. If you make one of them Amp then you can use that rather than temperture as your type to make the system more understandable.

        Comment


          #5
          That works, thanks!

          Comment

          Working...
          X