SimonGoldsworthy said:
An alternative opinion:
If you have code in OB1 that you cannot see in ladder, then its badly written code. As OB1 is the starting point, using ladder will give any prospective user a greater chance of understanding what is going on. If it's in ladder and your familiar with Step 7, then Ladder or STL will be ok. If you're not familiar (everyone has to start somewhere), Ladder will be better than STL. Of course as you drill down deeper and start looking at functions and the like, the dividing line will shift.
When I write code OB1 it usually just calls to other blocks, this is in STL not ladder and it cannot be converted, due to the way it is written.
These blocks would be called something along the lines of 'input conditioning', communication handling', 'alarm handling', 'equipment control', etc.
Once these blocks are opened, these again would normally be just calls to other blocks, where the code actually starts. For example 'input conditioning' could have things like 'proximity conditioning', PEC conditioning', 'analog conditioning' (which again could be split down inside'.
The 'equipment control' would be split into sections of the machine/plant.
This way, someone who does not know the code can quickly manouvre themselves through the code to the section of code that they need, its not hidden in a mass of other code.
SimonGoldsworthy said:
My OB1 is full of my machine mode control blocks, these blocks are fed with digital i/o. I could take it all out, put it in a function and call it from OB1 but it's been like that for ever (including previous Step 5 systems) and I'm sure my testing and commissioning colleagues would not appreciate the change (Hey where's the stuff usually done in OB1 gone ?) Note I work for an OEM and the machines we produce do pretty much the same thing all the time so I don't produce code that has to control lots of different types of equipment.
As I said, the second point could be argued, depending on application. I prefer not to have specifics in OB1, just logical distribution to where the specifics are done.
SimonGoldsworthy said:
All the code in OB1 ? - unusual I would agree but it would be the fastest code. If it's working and you haven't got to touch it again who cares ?
Why would it be the fastest? The only time I've seen this (or close to, more than a 100 networks in OB1), it was written by a Siemens newby, used to there being one program file and programmed accordingly. (Can't blame someone doing as he knows).
One of the advantages of Siemens is the block structure, where you break your code down into smaller logical elements, which makes it easier to find the areas of the code you are looking for.