Multi State Button controlling to separate boolean tags

Hello , I'm trying to create a multi state button using to boolean tags:
1st one is Auto m0015
2nd one is Hand m0016
What I'm looking for is a way to make the Hand button to control the Hand Boolean and the Auto button to control the Auto Boolean and the off button to release either one of them when pushed. I would also like the indicator value to change according likewise also. not sure where to start. I'm pretty new to Ignition Perspective. Thanks in advance.
Lance Moore

I would strongly recommend you NOT use separate booleans. Use a short integer instead, where the low bit of the integer is "Hand" and the next bit is "Auto". In the buttons, just write 0, 1, or 2 to the integer as appropriate.

Separate tags introduces races conditions that can leave you in an invalid state, or pass through an invalid state briefly. The latter can really screw up PLC code.

3 Likes

Ok, I'm not sure where to go from here. I,m using an IDEC plc.



image


I don't recognize D1500. Are you using Modbus with address mappings? (You should be using manual modbus addressing, generally.)

Aside from the recommendation to not use address mapping, is there an error in the Gateway logs?

From the screenshots it looks like the tag is reading without error, which might mean the write is failing because this device doesn't support the function code necessary to write to bits within words.

D = Data Register in IDEC PLC. The IDEC Modbus Mapping for this address is 401501. So in OPC ua I brought it in as a holding Register INT16

Message: Error sending complete subscription set to gateway.
Time: Wed Feb 28 4:43:26PM
Severity: ERROR
Logger: tags.subscriptions
Stack Trace: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: No route to host: no further information
    at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:360)
    at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.getResponse(GatewayInterface.java:556)
    at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:292)
    at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:287)
    at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.invoke(GatewayInterface.java:967)
    at com.inductiveautomation.ignition.client.tags.impl.ClientTagSubscriptionManager.syncSubscriptions(ClientTagSubscriptionManager.java:358)
    at com.inductiveautomation.ignition.common.execution.impl.BasicExecutionEngine$TrackedTask.run(BasicExecutionEngine.java:587)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source)
    at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.net.NoRouteToHostException: No route to host: no further information
    at java.base/sun.nio.ch.Net.pollConnect(Native Method)
    at java.base/sun.nio.ch.Net.pollConnectNow(Unknown Source)
    at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(Unknown Source)
    at java.base/sun.nio.ch.NioSocketImpl.connect(Unknown Source)
    at java.base/java.net.Socket.connect(Unknown Source)
    at java.base/sun.net.NetworkClient.doConnect(Unknown Source)
    at java.base/sun.net.www.http.HttpClient.openServer(Unknown Source)
    at java.base/sun.net.www.http.HttpClient.openServer(Unknown Source)
    at java.base/sun.net.www.http.HttpClient.<init>(Unknown Source)
    at java.base/sun.net.www.http.HttpClient.New(Unknown Source)
    at java.base/sun.net.www.http.HttpClient.New(Unknown Source)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(Unknown Source)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(Unknown Source)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
    at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.getResponse(GatewayInterface.java:423)
    ... 11 common frames omitted

So if my plc doesn't support the bit option, are there any other ways to make this work?

google this and you find

Signals that an error occurred while attempting to connect a socket to a remote address and port. Typically, the remote host cannot be reached because of an intervening firewall, or if an intermediate router is down.

I don't think the error you posted is related, so let's figure that out first. Can you upload your logs here (or somewhere)?

Ignition-vultr-guest_Ignition_logs_20240301-1618.idb (4.7 MB)

I just posted the logs.

Okay, so it does seem this device doesn't implement Mask Write Registers:

2024-02-28 15:45:18:193 drivers-modbusdriver2-BHD-1   Received response with ExceptionCode: 0x01 (IllegalFunction). unitId=1, referenceAddress=1499 
2024-02-28 15:51:21:055 drivers-modbusdriver2-BHD-2   Received response with ExceptionCode: 0x01 (IllegalFunction). unitId=1, referenceAddress=1500 

Unfortunately this means a bit of work to get around it... you have to assemble any bits you want to write into a whole word and then write that word to the register. You can create a Derived Tag for each bit to make things a little easier.

This approach is described here: Troubles making a Derived Boolean Tag work as a mask for a Short Tag - #2 by Kevin.Herron

Or use the whole register for the operating mode, and write 0, 1, or 2 as appropriate. Avoids race conditions and is compatible with broken Modbus implementations.

1 Like

Can you show an example of this approach ?

Bind both controlValue and indicatorValue to your D1500 tag. (controlValue must be a bidirectional binding, so it can write.) Provide your three options in the states property, in the order you want them shown. That's it, functionally. Everything else is just appearance.








Here is the error I'm getting now.

The error popup says there's a problem in line 2 of the multistateButton's onActionPerformed script. You'll need to post that here. Please post as formatted code. See Wiki - how to post code on this forum.

how do i find the script on the multistate button?