SHM Posted Sunday at 01:26 AM Posted Sunday at 01:26 AM 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 Quote
paulbates Posted Sunday at 01:33 AM Posted Sunday at 01:33 AM Take a look here https://wiki.universal-devices.com/ISY_Users:V5:Program_Variables Quote
larryllix Posted Sunday at 03:06 AM Posted Sunday at 03:06 AM 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. Quote
SHM Posted Sunday at 04:21 AM Author Posted Sunday at 04:21 AM 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. Quote
Solution paulbates Posted Sunday at 09:44 AM Solution Posted Sunday at 09:44 AM (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 Sunday at 09:48 AM by paulbates Quote
SHM Posted yesterday at 01:14 AM Author Posted yesterday at 01:14 AM I see. Thanks. Works perfectly. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.