Why are my toggle switches not staying ON?

I have a couple toggle switches tied to a digital output in perspective.

When I click the switch, it slides ON and sends the output; however, after a couple seconds, the toggle reverts back to the OFF position. It does not send an OFF signal, though--the valve stays open. To close the valve, I have to quickly toggle the switch on and off.

Is there a way to get the switch to stay in the ON position? I would like to indicate that the valve is open.

image
image

Hi Jessica,

Are you using a bi-directional tag binding to control the selected property on the toggle switch?

Just a thought,

  1. Check your trial
  2. Make sure your designer is in read/write mode

As Benjamin said, if you're binding your switch to a tag, make sure you enable the write mode.

Also, show us the configuration of your switch. More generally, when asking for help with something, show us how you're using that thing and how it's set up, otherwise all we can do is guess.

2 Likes

Try pointing your binding to a new memory tag. If it works as intended, there's a problem with your communication and what was said above will help you diagnose it. If it doesn't work as intended, your binding might be wrong

Hi Ben,

Yes, I am using bidirectional binding.

My PC is hooked to a fieldbus system and communicating via Modbus RTU.

I am experiencing the issue both in the designer and in the perspective workstation.

Hi Pascal,

Here is how I have it configured.

Did you resolve your other issue from this thread? Unable to write to tags - #7 by pturmel

It sounds very related...

What does the tooltip say when you hover your mouse over this?
image

I think this is because I was not connected to the fieldbus when I took the screenshot. I was connected earlier today when I was having this issue.

image

No, I think these are separate issues. Ignition is writing this value fine in this case, and the value position/value itself does not revert, only the position of the switch in perspective (i.e. value is still 1 even when the switch flips back to off).

In the other thread, the value of the tag itself is reverted immediately.

Yes, when I remove the binding for bind to a new tag, the switch works as expected and does not revert positions.

I have a hard time believing that the tag in the Ignition Tag Browser is high and the perspective component is low. The binding state propagation for that just doesn't add up.

It is most likely a communication issue with your device. I imagine when you write the value it is doing what the toggle does, visually switches and fires the delegate to write to the tag, and then when the gateway publishes tag values again it reverts back to the value in memory for that tag. If a memory tag works, it is your OPC Configuration for that tag specifically.

2 Likes

Sounds to me like you've got optimistic writes on your tag's tag group, and it's failed to write but assumed it went through. Then after the time out it's read it and its gone back to the actual value

2 Likes

I mapped a toggle switch to a new (boolean) memory tag, and it appears I am still having the same issue. I configured the tag in the same way as previous.

If I flip the toggle, it does not have any affect on the true/false value listed for the tag, and the toggle flips back after a few seconds. Nothing else is writing to this tag. Read only is not on.

EDIT: I forced value to false once and now the switch works. Weird

Writing to add that I solved this issue by mapping the toggle to new memory tag and then using a value changed script to send the value to the DI tag.

Apparently the root of the issue was that the coils can only be written to in Modbus RTU. The switch was trying to read the value.

I anticipate any future programming will have to be mapped to the memory tag to ensure the value of the memory tag/toggle matches the position of the valve.

def valueChanged(tag, tagPath, previousValue, currentValue, initialChange, missedEvents):
	tag = "DI TAG HERE"
	value = system.tag.readBlocking(MEMORY TAG HERE)
	system.tag.writeBlocking(tag, value)

This should really just be this:


def valueChanged(tag, tagPath, previousValue, currentValue, initialChange, missedEvents):
	system.tag.writeAsync(['DI TAG HERE'],[currentValue])

The new value of the memory tag is sent to the change event as the currentValue. Using writeAsync insures that the event will execute as quickly as possible. This is very important if in fact this is the way you will need to program many points.

I’m not personally sold on this being the best solution to your OP, but if it works you should do it with the best possible approach.

4 Likes

Hmm, valve doesn't work anymore when I replace with this code.

Tags are bool, if it makes any difference.