Scales (Rice Lake Systems) connection to Ignition

Hi everyone,

I have connected to some scales in the plant. But, I am seeing some characters which are not required. I just need the integer value coming from scales.


Is there a way, I can use these additional settings that can help me achieve my objective. I didn’t get much documentation regarding delimiters and wanted to know regarding that.

Thank you,
Jatin
Saint-Gobain CertainTeed

What I did with my scales is to put a change script on the tag to process the response and then stick the result into a memory tag with just the actual weight. That can get complicated if you get partial messages like with a serial port and can’t lose any data. It can also be as easy as looping through the message string. Start saving characters after your start of message character and stop at the end of message character. It helps if you know for sure what those are but you can figure it out if you need to.
It ends up being something like:

msg = system.tag.read('[RiceLake Scale 1]100001/Message').value
result = ""

for index in range(len(msg)):
	ch = msg[index] 
	asciiCode = ord(ch)
    if asciiCode > 47 and asciiCode < 58: # numbers only
		result = result + ch
weight = int(result)

If you get more than one reading in a single message, you can throw in a break instruction once you encounter a specific ord/ch This is generally enough for a scale that is streaming constantly so you don’t care if you lose some message fragments.

Hey there! Thank you for the suggestion. It works for scales which have one reading!!!

But we have a scale that is constantly streaming more than one reading in a single message, how can I introduce a break instruction in the logic you mentioned.

Thank you for your help!!

Check out the string.split function. If you don’t know the delimiter, you may have to loop through as suggested before and print each character to watch for the pattern. Then just split the stream on that delimiter and do some checks on the slices, or just the first slice, to make sure it is a whole reading.
Strings - Ignition User Manual 8.0 - Ignition Documentation (inductiveautomation.com)

Hi, bebel. Tip: there’s a </> code formatting button which will preserve the indentation and give syntax highlighting too. Preserving the indents is essential for Python code. There’s also an edit button (pencil icon) below your post so you can fix it.

Thank-you. First time on this side of a forum post but I’ve done my share of this kind of work so I figured I could help on this one.