Hello good morning, I have a problem writing data using S7 connection, I am sending a command to edit a memory area, but sometimes this command does not write to this memory area, create a variable to monitor the status of the memory area after the update to check if it has changed, the question is the following, is it possible to create a loop that tries to write this value until the two values are equal? (VALUE SENT and VALUE READ)
You could do something like the following …
- Your workflow kicks off a write request using the S7: Write Node.
- Use a Storage: Set Value Node to set the value you just wrote into workflow storage.
- Separately, have a Timer Trigger running in the same workflow on a frequent interval.
- Use a Storage: Get Value Node to retrieve the last written value.
- Follow that with a Conditional Node to verify a value even exists in storage. If it does …
- Use an S7: Read Node to get the value off the device.
- Use another Conditional Node to compare the read value to the value from storage.
- If the values are different, the write has not occurred.
- If the values match, the write has occurred. Follow up with a Storage: Set Value Node to clear the value from storage.
That said, this makes me wonder if you are running into other issues with the node as we have not encountered this problem with Siemens S7 before. Are you receiving a successful response when invoking the Write Node? Is this a persistent problem across multiple S7 devices or just one?
Thanks for your answer, yes the s7 node sends a successful response but write does not happen, and the problem persists in multiple s7 devices.
To clarify, are you making a single write request, which returns a success response, and then the read requests eventually return the new value?
Or are you making multiple write requests until one of them finally writes the value correctly?
I am making a single write request and I am checking if this value has changed. Initially I was checking if the value has changed directly online on the Siemens S7 1200 PLC, but this value did not change. So I added a read block for a double check and found that this value still did not change. As an alternative to trying to make this value change, I opted for a not very correct solution, which was to put this writing in a loop that tries to write the values 10 times in this memory area, checking with each write if the value has changed and if so, it completes the loop before 10 times. What I have observed so far is that after 2 or 3 attempts the writing occurs successfully.
So after your request last week, we set up a test in our southbound connector lab and successfully wrote and immediately read new values to an S7 PLC. This succeeded 250,000 times without any errors - as in, writing a random value and immediately reading that always returned the same value that was written.
Do you have any other method by which you can write a value to this PLC and then read it, not using Losant’s Gateway Edge Agent? We are trying to determine if there is a bug in our agent or if this problem is specific to your PLCs, firmware, or network.