Jump to content

Best Way to get the ISY to Interact with an Analog Input


PLCGuy

Recommended Posts

Posted
If memory servers me, Elk voltage is not a trigger, it is only checked once the other triggers (5am or f4) causes the "if" to execute.

To me, you have described the crux of the matter. If Elk voltage is a trigger, then that would explain my troubles. And I think it could cause havoc with this program too, because if the system has any "level bounce", then this program would fail to completely execute, because the bounce in Elk voltage would cause the program to be reevaluated midway through the first THEN stage, but then the AND condition might not be true, so it would head off to ELSE.

 

If Elk voltage isn't a trigger, then all is cool.

 

Interestingly I can't get this problem to happen any more, so I can't really test any solution now. Go figure...

Posted

If you go further down the line of Elk Voltage being a trigger:

 

For my 1 wire temperatures I set up a conversion program (I actually do this for almost all my variables):

 

If State is not Integer Then
- Integer = State
- Integer init to State
- State init to State

 

 

In this way, most of my variables have a _State and a _Integer version of them. I can then choose to use the triggered or non triggered version in my programming.

 

 

Now since you are using the And condition along with the Program State, the solution to remove the multiplication from that step would work with and without voltage being a trigger.

Posted
If you go further down the line of Elk Voltage being a trigger:

 

For my 1 wire temperatures I set up a conversion program (I actually do this for almost all my variables):

 

If State is not Integer Then
- Integer = State
- Integer init to State
- State init to State

 

 

In this way, most of my variables have a _State and a _Integer version of them. I can then choose to use the triggered or non triggered version in my programming.

 

 

Now since you are using the And condition along with the Program State, the solution to remove the multiplication from that step would work with and without voltage being a trigger.

 

Nice! I nominate this for inclusion in the variables section of the Wiki.

 

-Xathros

Posted

Just an update on the tank level project.

 

First, we rewrote the whole level system logic as per apostolakisl's great suggestions. Stripped down the voltage comparison programs and created only one calculation program. Yes there are 83 voltage comparison programs :( , but they are easy to create with ISY Import/Export and a text editor :) . All state machine strategy is gone.

// ChkWireBreak - Test if the Elk Voltage is under voltage (1.9 V or less )and if so, set $ElkVoltagex10 to -999 (i.e. error)
If
       Elk Zone 'Water Level' 'Voltage' <= 1.9 Volts
Then
       $ElkVoltageX10  = -999
       $State_WireBreak  = 1
Else
       $State_Wirebreak  = 0

// Chk020Volt  - Test if the Elk Voltage is 2.0 Volts and if so, set $ElkVoltagex10 to 20 (i.e. ten times the voltage)
If
       Elk Zone 'Water Level' 'Voltage' is 2.0 Volts
Then
       $ElkVoltageX10  = 20

// Chk021Volt - Test if the Elk Voltage is 2.1 Volts and if so, set $ElkVoltagex10 to 21 (i.e. ten times the voltage)
If
       Elk Zone 'Water Level' 'Voltage' is 2.1 Volts
Then
       $ElkVoltageX10  = 21
.
.
.
// Chk100Volt - Test if the Elk Voltage is 10.0 Volts and if so, set $ElkVoltagex10 to 100 (i.e. ten times the voltage)
If
       Elk Zone 'Water Level' 'Voltage' is 10.0 Volts
Then
       $ElkVoltageX10  = 100

// ChkOverVolt - Test if the Elk Voltage is over voltage (10.1 V or greater)and if so, set $ElkVoltagex10 to 999 (i.e. error)
If
       Elk Zone 'Water Level' 'Voltage' >= 10.1 Volts
Then
       $ElkVoltageX10  = 999
       $State_OverVoltage  = 1
Else
       $State_OverVoltage  = 0

 

And the 83 programs are arranged in 8 folders with voltage range conditions, so it is easy to watch what has executed and when. For example all ten test programs for Elk Zone 'Voltage' between 2.0 Volts and 2.9 Volts live in this folder called Chk02xVolt.

Folder Conditions for 'Chk02xVolt'
Add conditions to limit when programs in this folder are allowed to run.
If
       Elk Zone 'Water Level' 'Voltage' >= 2.0 Volts
   And Elk Zone 'Water Level' 'Voltage' <= 2.9 Volts
Then
  Allow the programs in this folder to run.

 

The calculation logic looks like this:

//Wait for a trigger to calculate $WtrGallons ($ElkVoltagex10 x $SlopeDiv10 - $Offset), $WtrLvL ($WtrGallons / $GallonsPerInch), and then display the level on the Elk Keypad
If
       Time is 12:00:00AM
    Or Elk Keypad 'Main Keypad' 'F4' is Pressed

Then
       Set Elk Zone 'Water Level' Query Voltage
       Wait 2 seconds
       $WtrGallons  = $ElkVoltageX10
       $WtrGallons *= $SlopeDiv10
       $WtrGallons -= $Offset
       $WtrLvl  = $WtrGallons
       $WtrLvl /= $GallonsPerInch
       Set Elk Area 'House' Display Text on Keypads, Content 'Elk_WaterLevel'

 

Second, after a fair amount of testing, it seems that Elk Voltage Levels act differently than other Elk variables when used as triggers. I have a post requesting verification of this in the Elk portion of this forum: viewtopic.php?f=17&t=12637

 

This seems to be working, so we have our fingers crossed... By the way, the Wait is needed so that the voltage check routines have time to do their thing before the calculations are done.

 

In summary, I have to agree with Autonow when it comes to analog I/O handling:

 

I too have been extremely frustrated by the lack of analog IO in home automation systems... the Elk has analog capabilities, but they are limited. The ISY has none. So what are your options?...

Use the Elk as a low cost Digital IO platform. Lots of local digital IO as well as a nice security features. I like the ISY because of its ability to connect to the Elk and the simple script and scene functions for the homey stuff. For the analog and the more industrial IO like pump control related to nearby analog USE A PLC!

The ISY rocks in terms of handling dimmers, KPLs and like (and the service also rocks). The Elk does give you cheap digital I/O, something not available in the Insteon world. But if you have any analog needs or rougher digital needs (like pumps) or moderately complex math needs, better buy a small PLC.

Guest
This topic is now closed to further replies.

×
×
  • Create New...