Studio 5000: Shortest comparison of chart of values and output value?

AutomationTechBrian

Lifetime Supporting Member
Join Date
Jul 2013
Location
St. Cloud, MN
Posts
670
I'm trying to get beyond "do-done" programming and utilize higher functions to make my routines smaller and easier to write. I've just started working with SQO, and I'm making a sequence array for the machine's red, yellow, and green LED lights. The first couple of array values empty, then alternating the red, yellow, and green LED bits

----RYG
(0) 010
(1) 000 (no red or green)
(2) 010
(3) 101
(4) 010
(5) 101
(6) 010
(7) 101
(8) 010
(9) 101
(10) 010
(11) 101
etc...

Then I can mask to get:

Flashing Red
Flashing Yellow
Flashing Green
Alternating Red and Yellow
Alternating Green and Yellow

The machine doesn't have an HMI, so I'm using the LEDs to give feedback on what is going on. I use masks to control which color(s) output, and I vary the length of the SQO to vary the number of flashes before a pause (ie... pause, 4 red flashes, pause, 4 red flashes, pause, etc.). There is a homing routine, and a cycle routine, with sequence steps and a 5 or 15 minute timer for the main cycle. The idea I have this morning, is using green flashes to signal how many minutes are left in the cycle. Like this:

Timer.acc value: > 0ms & < 60,000ms, MOV 30 to .len
Timer.acc value: > 60,000ms & < 120,000ms, MOV 29 to .len
Timer.acc value: > 120,000ms & < 180,000ms, MOV 28 to .len
Timer.acc value: > 180,000ms & < 240,000ms, MOV 27 to .len
etc.

What would be the shortest way to create accomplish this? I'm not talking about a long, 30+ rung ladder. That's what I'm trying to get beyond. I want something much shorter, more elegant, maybe utilizing an array of the values that I'm comparing, as well as the MOV length. Structured text is OK, if that is really the best way. I have just started looking at ST this year, but I can't write it without prompts yet. I suspect there is another way.

There are so many opportunities to use this type of comparison. This would be useful to know, not only for me, but lots of other members. Any thoughts?
 
Like this:

Timer.acc value: > 0ms & < 60,000ms, MOV 30 to .len
Timer.acc value: > 60,000ms & < 120,000ms, MOV 29 to .len
Timer.acc value: > 120,000ms & < 180,000ms, MOV 28 to .len
Timer.acc value: > 180,000ms & < 240,000ms, MOV 27 to .len
etc.

What would be the shortest way to create accomplish this?


With A-B syntax and limitations, and a simple-minded approach:

Code:
[MUL Timer.acc 0.07106667 an_INT]
[AND an_int 3ffh an_INT]
[DIV an_int 1024 an_INT]
[SUB 30 an_INT .len]
Caveats

  • Accuracy is some multiple (or fraction?) of ~60ms (better than 600ms; worse than 6ms)
  • Mean accuracy is perfect, or at least in the noise.
  • There may be, and probably are, better approaches
  • I may, and probably do, not understand your process
 
Last edited:

Similar Topics

Hello, We are now working on a software to collet the configuration of different PLC brands ,using a third software to backup all the simens...
Replies
1
Views
64
Hello everyone, I'm new here, I hope someone can help me. I've been trying to install EDS files to my Studio 5000 with the EDS tool installer but...
Replies
3
Views
111
Hi Everyone, I am facing an issue while installing the STUDIO 5000 in my windows 10 PC. During installation I am getting an error that " Error...
Replies
4
Views
181
I am connecting to a remote device. When attempting to upload I receive an error that states: Error: Auto_Functions: The Import was aborted due...
Replies
3
Views
183
Back
Top Bottom