Basic PLC question that challenges the best:

As an electrician, I could probably hook this up with as little as 120 jumpers and 25 well tuned pnuematic timers, Keep It Simple. Y'all overcomplicate things.
 
I’m more talking about all of the variable declarations and such at the top while the LAD was allowed to reference global variable registers.

Sure...it’s all equal for small/trivial examples. Everything is fast for small n too...

Sorry, I was not trying to suggest code golf as a metric; I know the declarations are hidden/separate in LAD. When I look at that ST-ish code, even if I cut it down, I still see roughly the same "instruction" count i.e. baker's dozen.

I’m not sure it helps to point out that they’re all Turing complete.
Sorry, the "Turing complete" reference was intended only to make the point that products written in either LAD or ST behave in the same way; any differences in execution would be meaningless. I'm not suggesting anyone code in Logo.

My own personal preference would depend on the application. For example, PLCs are a hobby for me and my real job in procedural/OO* languages, so ST would be a step back, while LAD is novel. But those are purely subjective metrics; they do not suggest to me in the least that one is better than the other. If I had an actual project, I would likely go with ST for the simple reason that its textual nature would be easier to integrate with Git, specifically the [git diff] command, and also because I was more familiar with the style. For this particular task, the OP asked for ladder. Those are all subjective or application-specific reasons.

To state that LAD is obsolete or that people are obsessed*** with it, because the miracle of ST exists, does not make any sense; at a minimum it is wrong.

* I think those are the right terms
** although there was a recent thread about integrating LAD into Git
*** Certainly some are one-trick ponies, but the circus (industry) is big enough that it does not matter.

P.S. the C version has a bug and will not work as written.
 
As an electrician, I could probably hook this up with as little as 120 jumpers and 25 well tuned pnuematic timers, Keep It Simple. Y'all overcomplicate things.

One of my guys carries two DIN timers in his truck. Reckons if we ever have a PLC failure at a pump station or one of the smaller treatment plants we look after, he can get the essentials running again with that and a couple of relays. He has done it once before...
 
Sorry, I was not trying to suggest code golf as a metric; I know the declarations are hidden/separate in LAD. When I look at that ST-ish code, even if I cut it down, I still see roughly the same "instruction" count i.e. baker's dozen.

Sorry, the "Turing complete" reference was intended only to make the point that products written in either LAD or ST behave in the same way; any differences in execution would be meaningless. I'm not suggesting anyone code in Logo.

My own personal preference would depend on the application. For example, PLCs are a hobby for me and my real job in procedural/OO* languages, so ST would be a step back, while LAD is novel. But those are purely subjective metrics; they do not suggest to me in the least that one is better than the other. If I had an actual project, I would likely go with ST for the simple reason that its textual nature would be easier to integrate with Git, specifically the [git diff] command, and also because I was more familiar with the style. For this particular task, the OP asked for ladder. Those are all subjective or application-specific reasons.

To state that LAD is obsolete or that people are obsessed*** with it, because the miracle of ST exists, does not make any sense; at a minimum it is wrong.

* I think those are the right terms
** although there was a recent thread about integrating LAD into Git
*** Certainly some are one-trick ponies, but the circus (industry) is big enough that it does not matter.

P.S. the C version has a bug and will not work as written.

Sorry, I was specifically irked that you were showing the longer example of ST with extra fluff that was omitted from the LAD and suggesting equivalence.

Yes, VCS is one of the reasons text is better than graphical languages.

I didn’t say that ST is a miracle or that I even like it (in fact, I think I explicitly said I don’t like it in one post). I prefer structural typing and languages that allow both OOP* and FP (OOP for behavior modeling and FP for data transformations). But out the the IEC languages, ST is my preference. LAD just exists as a vague reference to electrical schematics and relay logic.

I’ll leave it as, simple LAD and simple ST may have no difference, but the most complicated LAD looks roughly equivalent in ST while the most complicated ST looks like a train wreck in LAD. So why bother supporting multiple languages?

*For anyone interested, TwinCAT has IEC with OO extensions, function passing (IIRC), runtime memory allocation, and recursive functions (have to use pointers) (and it’s free)
 
Yeah, I noticed your "least worst" description.



*For anyone interested, TwinCAT has IEC with OO extensions, function passing (IIRC), runtime memory allocation, and recursive functions (have to use pointers) (and it’s free)


woo hoo, now that's interesting (subjectively, to me ;))
 
Yeah, I noticed your "least worst" description.

woo hoo, now that's interesting (subjectively, to me ;))

For the record, it’s not supposed to support recursive functions. But if you use an FB with a method, the method can call itself if you pass it’s own FB pointer to it. TwinCAT can’t stop what it doesn’t know about...

And it also supports recursive data definitions using pointers (no special trickery there) which is nice for tree structures (especially with runtime memory).
 
Thank you everyone for your attempt to help solving the challenging question!

Special thanks to Mr. drbitboy and Mr. jhenson29 for coming through with the two different approach solutions. I am really great full for your help!

But to address the your thoughts on the reason behind the question;

I am an electrical engineer with old history of experience in ladder logic. I have applied for a position recently to a company that provided me with this question as part of the first step in the interview. They have informed me that they are willing to train if need be but still wanted to provide this question along with other questions which I answered already.

So again thank you soo much!
 
I once applied for a job with a large company and they sent me their standard preliminary test document where I was supposed to answer the questions & send it back, just like the OP's question, there were a number of obscure scenarios with little information, I wrote on those questions garbage in garbage out & sent it back, I was called in for an interview (I suppose it was curiosity on the chief engineers part), he asked me why I wrote those comments & I explained that yes those questions could possibly be answered, however, as the information was lacking in the questions then it could not be answered only by assumption, he then realised that I had done work for their company commissioning a number of plants as a contractor, he was the guy that pulled me off a job to look at a system because they had a problem on a small Siemens PLC & none of their guys could find the problem, I promptly sorted it out. I didn't get the job, then again I would not have accepted it, I felt that the document he himself had compiled gave me an insight to the type of boss I would struggle to work with.
 
I once applied for a job with a large company ...

I applied for a job at a shop here in Detroit and their employment 'test' was I was taken to a down machine in the shop and told to find the problem, and see if it concurred with what their guy found.

Talking to their guy it was obvious he knew nothing about controls, and they just wanted troubleshooting of their machine for free by posting help wanted for a controls engineer.

I told them if I was hired the repair would be cost about $150 in parts and a half hour, otherwise if they wanted my consultation on the job my consultation fee was $350 per hour, 4 hour minimum.

Found out later from other this was the standard practice for this shop. "Help Wanted" = Free Servicecall.
 
Way too big, they are too hard to fold in half when I need to divide a length ;)

I have gone through so many tape measures I just go to the dollar store and buy a few at a time.

For $1 I can cut it for pieces, lose it or just never find it. ( I know I have to have at least a dozen in my house but still have to search when I need one)
 

Similar Topics

What ladder logic is required to have an HMI button that gives output when you push it then removes that output when you push it again? For...
Replies
9
Views
3,803
I will apologize in advance for this question. In a PLC scan I understand the inputs are read, then the PLC carries out a scan out the logic and...
Replies
11
Views
4,090
:banghead: I am a newbie trying PSIM and am facing difficulty with a counter in the Batch program. I observe that there is significance in the...
Replies
2
Views
2,163
Hello Everyone, I am brand new to PLC's (learned they even existed 3 days ago) and have gone through the tutorial on this site. I am a little...
Replies
4
Views
5,203
Please,: Explain the meaning of Scan cycle in a PLC when it is running a program?
Replies
2
Views
3,199
Back
Top Bottom