HOA Switch


Recommended Posts

I have an existing Channel Event controlling a DO to toggle a valve based on an analog tank level signal. I want to add an HOA switch to open or close the valve at will or allow the Event to do its thing. I have very little coding experience.

Thanks,

Terry

Link to comment
Share on other sites

You'd have to use a variable or a Test D/A channel to hold the HOA state.  Let's say you did a variable.  Initialize it in a sequence marked Auto-Start:

global HOA = 2   // 0 = off, 1 = on, 2 = auto.  Default is auto

Then in your Channel Event, let's say you had:

if (tankLevel[0] > 10)
   DO = 1
endif
if (tanklevel[0] < 9)
   DO = 0
endif

Replace that with:

if (hoa == 2)
   if (tankLevel[0] > 10)
      DO = 1
   endif
   if (tanklevel[0] < 9)
      DO = 0
   endif
else
   DO = HOA
endif

 

Link to comment
Share on other sites

That is really up to you.  If you have Pro you there is a 3 position switch in the symbol library, or I should say, three different images you can use to create a three position switch.  But you can do it with your own images, or just use 3 buttons.  It just depends on what you want it to look like.

Link to comment
Share on other sites

  • 4 weeks later...

Use a single Symbol component and add the three images, giving each image a different threshold depending on your coding.  I recommend 0 for off, 1 for hand and 2 for auto.  Then in the action, if you just want to step through the states put script like this (assuming "hoa" is the variable/channel with the hoa status):

private temp = hoa+1
if (temp > 2)
   temp = 0
endif
hoa = temp

 

Link to comment
Share on other sites

Thanks for your help. So if I understand correctly, there is no animated symbol that rotates between left, up, and right like a real HOA switch, and I have to, for example, place three separate symbols on the screen showing the L, U, and R positions configured to produce the H, O, and A actions when each is pressed?

Link to comment
Share on other sites

Yes and no.  There isn't a built in HOA switch, but you can easily create your own using symbols from the Symbol Factory (or any other image you want to use).  I've attached a sample showing it.  It is made of 4 components to provide labels.  The main component is a symbol component that contains three symbols, one for each possible switch position.  Which is displayed is determined by the HOA channel.  Clicking the symbol steps through the options, Off then Hand then Auto then back to Off.  There are then 3 labels for each of the positions.  If you click on the label it will jump to that state.

You can, if you expect to use the switch a lot, group it and basically make your own component out of it.  I would likely add script to allow for changing of the output channel, but that is a bit more involved.  If you are only going to use a few of these, you can just copy and paste the four components and manually change it.

 

hoaSample.ctl

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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.