I am attempting to write to an analog output tag in Ignition, but the tag does not seem to store the value.
I am connected to a WAGO Fieldbus coupler via Modbus RTU (Config>OpcUA). I am able to write to the coils (on/off) fine, but I cannot seem to write to the holding registers. If I write to the tag using the Gateway (Config>Opc>Opc Quick Client), it says it was able to write to the value, but when I read the value back, it has reverted to what it was before. If I change the tag in the tag browser in designer, it appears to revert back immediately.
Read only is not selected in the gateway or under the individual tags.
If this is a modbus device then you might possibly have the addressing incorrect for the holding registers.
Show your address mapping configuration for those analog outputs. If possible, also provide the modbus mapping provided by WAGO.
Also, are there any other devices (PLC?) that are connected to the WAG as well that may be interfering/overwriting the values? Check the logs of your gateway as well, it may have some warnings/errors from when you attempt to write a value.
Definitely possible my addressing is wrong, but I have not been able to find the error. Here is what I have put together for the modbus addressing. It appears that the input registers are also duplicated as the first holding registers as the values are identical.
The values of the tags appear to match up with what I have in my mapping. 1-12 in the holding register display the same values as 1-12 in the input register, then 13-20 (where I think my outputs should be) display 0.
Fieldbus is not connect to a PLC currently, just my PC. I am attempting to control the I/O points connected to this hardware with just Ignition and my PC. I am using this setpoint control add in. I can get the on/off loops to work correctly as those outputs correspond to coils, but I cannot get the PID loops to work as it appears the system does not want to "hold" the output value that the program is attempting to write.
That is probably the root cause. It is common for modbus I/O devices to require repeating writes to outputs to keep them alive. Ignition won't do that for you.
Look for a setting in the device that controls the timeout for this, and arrange your Ignition logic to write on a faster timer using system.opc.writeValues(), even when the values are not changing.
For such points, if you make Ignition tags at all, make them read only. So only the timer event will write.
(You should not use the "Mapping" tool in the Modbus device driver. It makes it much harder for us to help you troubleshoot. Use manual addressing in your Ignition tags.)
Here is how I have my first analog input tag configured. I have verified this is mapped to the correct place as the sensor it is connected to responds to condition changes.
And my first digital input. This will physically open the valve when I change the value from 0 to 1, but the value reverts back to 0 immediately, but the valve stays open.
I am wondering if maybe my offset is incorrect somewhere? As far as I can tell, my input registers are mirrored to the holding registers (i.e. the first 12 holding register values are equal to the first 12 input register values). I tried common offsets of 1024 and 2048, but both of those come up as "BAD."
Write access to output data is possible starting from MODBUS address 0x0000. In divergence from the MODBUS standard, an offset of 200hex (0x0200) must be added to the MODBUS address for read access to output data. Output data can be
read back in under the same addresses both with the MODBUS functions for read
access to output data (FC1, FC3, FC23) and with the MODBUS functions for read
access to input data (FC2, FC4).
Seems relevant? The text following what I bolded seems to contradict, but who knows.
edit: eh, I think it's just saying you can use these same offset addresses with any of the function codes.
I found this in the manual for the coupler; however, it does not seem to align with the holding register/input register/coil/discrete input address that I am familiar with.
If I try to map my analog outputs to 400512, I get bad data returned.
I also tried this in addition to turning off watchdog. Set up the timer script to write a value from the memory tag to the analog output tag, but it did not seem to work. I tried multiple addresses for the AO tag (13, 200, 201, 521, 525, etc.), but none seemed to take.
Have you checked the one-based versus zero-based addressing setting in the Ignition device? Your sample table from the vendor suggests you should be using zero-based addresses, while Ignition defaults to one-based addressing. (Advanced settings.)
With 0 based addressing setting turned on, 251-625 comes back as "bad," and none of the values I am writing stick.
I am still thinking that I need to be in 1 based mode as my analog inputs and digital outputs are as I would expect here, despite the manual. For example, my first analog input is a temp probe. When I scale the number per the calibration, it reads back the correct temp. In 0 based base, my first analog input reads the max (correlating to 20 mA).
HOWEVER, I hooked air up to my system to see if I could get my PCV (first analog output) to function by inputting a value to any of the holding registers. When I input a value to 521, it DOES send a signal to the control valve, but the value in Ignition still reads as "bad." Any idea why this might be?
Could I consider mapping my analog output to a memory tag? Either using a timer script to update every x seconds, or using a value changed script to write the new value from the memory tag to the analog output? What would you recommend?