Jump to content
View in the app

A better way to browse. Learn more.

Universal Devices Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

State Variable Math Manipulation

Featured Replies

Posted

Think the answer is no but thought I would ask the genius bar.... I have a voltage transducer that measures the voltage for both the utility and generator.  I use this to send a text if the power goes out to verify the generator turns on.  Also gives a lower reading to indicate if it is in exercise mode.

The value for 220V is 801 and would like to have it read 220 when all is on spec.  Is there a way to do math functions on state variables?

Think the answer is no but thought I would ask the genius bar.... I have a voltage transducer that measures the voltage for both the utility and generator.  I use this to send a text if the power goes out to verify the generator turns on.  Also gives a lower reading to indicate if it is in exercise mode.
The value for 220V is 801 and would like to have it read 220 when all is on spec.  Is there a way to do math functions on state variables?
yup

if
$sStatevar is not -99999
then
$tempvar = %sStatevar
$tempvar *= ratio
else
----

You must have v5 to use fractional variables and ratio 230/801


Sent from my SM-G781W using Tapatalk


29 minutes ago, pjjameso said:

Thank You!

If you want to use the resultant value in a program and be self triggering you need to do your calculations in an Integer variable and then transfer over to a State variable last line to avoid triggering the downstream program with every intermediate result of the calculation process.

Guest
This topic is now closed to further replies.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.