If you are a Unitronics programming guru looking for projects, post here to look for someone in your area. **Disclaimer: Unitronics bears no responsibility. This is just a place for people to find each other**
So if I understand correctly a 12ma signal will be converted to a value of 9830 which would equate to 5,000PSI which would be the result(F) value.
What I am trying to achieve is to turn a motor off when a certain PSI is reached. 4250PSI in this case.
Looking at other videos it looks like I need to use the store function and store the result value(F) into a Global Int16 Tag. I can then use this value and a compare function to enable/disable a bit and in turn, control my motor.
Intro A UniLogic application writer need to keep on some ground rules in order to get the best performance from his UniStream. That’s because a GIF size in is calculated in the next manner:
"Size in memory" = Width * Height * Frames * Bit depth
Meaning that using a GIF without considering it dimensions can affected badly on the UniStream.
?How do I manage my GIFs Let's move on any of the equation elements and see how we can reduce them. Our start point is the "Damper.GIF" which dimensions are:
- By right clicking on the GIF and choosing "Properties" -> "Details"
Width – 1000
Height – 1000
Bit depth – 8
:By entering this link (ezgif.com) and choosing the GIF with "Choose file" and then "Upload". In the page that opened you can use -
To resize the GIF Width & Height. The values that you want to resize to them are the size of the widget linked to the GIF in UniLogic.Enter the values and press "Resize it!". When it's done in the frame below you can press on "Save" to download it to your PC
:(Frames – You can use the same website to remove some unneeded frames (less animated GIFs). In the next tab (1
Pressing on "skip" (2 or 3) can remove the frame (first or fifth). After any change you can use "Animate it!" and see your editing result
:If we edit the example GIF to, let's say 100x100 with 5 frames (the application user can hardly tell) we save
.That's 55,60,000 bits or 6.95M bytes of memory
?To what values do I need to aim
A user needs to aim as lower as possible because the memory divides between his other application features and it depends on the number of images/GIFs on the current screen. As a rule always aim to a GIF that is size is no higher than 50k
notice the padding that added to the struct. That's common in software in order to align the memory so work will perform more effectively. This padding cause every 2 bytes in an INT16 type an extra "weight" of 2 bytes – so every INT16 is 4 bytes. One can think that the struct size is 4 + 2 * 79 = 162 bytes, when in fact it 320 bytes, almost two times bigger (!).
Now, let's try the next approach:
And we got a struct size 162 bytes, as intended. Just imagine we use struct "MyStruct" in a 3,000 line Data Table, we will waste almost 0.5M bytes (3,000 * 158), while "MyStruct_NEW" waste nothing.
For conclusion, when creating structs in UniLogic consider the padding factor in order to reduce your PLC memory consumption.
Thank you for the advice guys. I was actually able to solve the problem yesterday. I was working under the assumption that the general send error was a mistake in the wiring. The weighing indicator was actually continuously sending streams, so I changed the variable in the scan from decimal ascii to a stream with the exact lenght and it worked like a charm. That means Joe is spot on with the recommendation for reading the incoming streams.
Once again thank you for the help and the fast response. You guys are great.