Jump to content

Arithmetic calculations


SHM
Go to solution Solved by paulbates,

Recommended Posts

Posted

How do I perform simple arithmetic on several integer variables with the result assigned to a new variable?  For example:

$TempGradient = $inside temp - $ outside temp

Posted

Results are always assigned to the variable register they originate from.

Try not to use STATE variables for complex calculations as they may trigger your dependent programs repeatedly with premature results. For multiple operation calculations, it may be best to use an Integer variable and then transfer the resultant into the STATE variable.

Use of a lower precision variable, during calculations,  will result in truncated decimal places for the final variable precision regardless of the final variable set precision.

Posted

Hmmm.  I looked at the ISY manual but it's not clear.  I am using integer variables. in a program, I assign an integer variable (X) the result of a sensor temperature outside the house.  In the same program, I assign a second variable (Y) the result of a temperature  inside the house from a separate sensor (thermostat).  What I want to do is get the difference between the 2 variables (Y -X) and assign that to a third integer variable (Z).  Then, if the difference is greater than 15 degrees F, the program turns the furnace on.  

  • Solution
Posted (edited)

It will take to statements to get the total in the variable:

$TempGradient = $inside temp
$TempGradient -= $outside temp

The -= means subtract $outside temp from $Tempgradient.

$Tempgradient has to be a state variable, as is any variable that is used in an If statement

Edited by paulbates

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...