S7Guy wrote
Btw, does anyone have a sample SCL project I could look at?
I've been looking for a particluar project I was involved in where we used SCL, but I haven't unearthed it yet. (Don't worry - I haven't looked too deeply - it's not that I have a really bad filing or backup system!)
In this case we used mixed languages where we felt they were appropriate. Basically it was just a conveyor control system, so there was a lot of STL and LAD in it. But there were also two cameras on Profibus returning data values to the PLC about what they were seeing. There wasn't much analysis available in the cameras themselves so a lot of the maths had to be done in the PLC and SCL seemed the right tool. The advantage that it gave was very much on the thinking and designing aspects of the code.
We were working with empty unlabelled whisky bottles. These were
almost square section and would eventually have the label applied slanting from bottom-left up to top-right (got the brand yet?). On the face where the label would be are two parallel moulded ridges (eyebrows) also slanted at the same angle. These are designed to protect the paper label once it has been applied by preventing rubbing, scraping etc. in packing and transit. Part of our job was to ensure the bottles were the right way round before they entered the labelling section. This was where the two cameras, at right-angles to each other, took an image of each bottle as it passed and tried to see where the ridges were. Unfortunately, the bottle glass used is anything but optical quality and has lots of small blemishes, bubbles and swirls in it (presumably it looks more rustic and authentic). Sometimes the reflection of light from these could fool the camera in to 'seeing' a moulded ridge where none existed.
Overall we had to write some code that was working on probability, not binary logic. We had to simultaneously weigh the two images from the cameras, decide whether they agreed about the bottle orientation, and if so which was it. If there was no agreement, was one camera image sufficiently strong in certain key signals that we could trust it alone, even if the other disagreed weakly? How much disagreement would we permit before diverting the bottle for a recycle (and therefore slowing the operation)? We had to map distribution curves where if we thought we detected a ridge within certain zones it was accorded a strong score, but elsewhere it was more likely to be an optical atrefact caused by a blemish. Personally I honestly couldn't imagine even thinking correctly abouut these problems in LAD or STL. That's not to say that SCL is 'superior' or 'better', just that I knew how to express myself using it.
After commissioning and tuning we had the system running at a level of reliability where we were exceeding the user's un-detected error target by a factor of 3x. In fact they became slightly suspicious and installed two people to check the output of our section, sure that some of the bottles we passed had to be the wrong way round! Sure enough they were, but as I said the original spec called for something like no more than 1 undetected wrong bottle per 10000 and we were achieving 30000+. Given more or better data we think we could have achieved 100% (yes, dangerous thing to say, I know), but the user decided the cost of scrapping one wrong bottle (before filling!) every 30000 or so, was cheaper than another camera or enhanced lighting etc.
Now, just where did I put that code, S7Guy?
Regards
Ken.