Jump to content
 

Programmable Logic Controllers


RobertW

Recommended Posts

Hi

I am an Electrical Engineering student and was wondering what applications for Programmable Logic Controllers and Ladder Logic in model railways for the purpose of planning wiring schemes in Automatic Control. Ladder logic is designed for PLCs and Relays.

Cheers
Rob

Link to post
Share on other sites

  • RMweb Gold

This is an example of “Ladder Logic”.

 

====

|
|
| Modelling    SWIMBO      in laws                            happiness
|   i1.0        i2.0        i2.1   
|----] [----|----]/[----|----]/[----|-----------|-----------|--( q0.0 )--|
|           |
|   beer    |
|   i1.1    |
|----] [----|
|
|
====

 

It is basically a software representation of  “Relays” that are wired together so that the output is only “switched on” when ALL the input conditions are met (or even NOT met!).

 

So, in the above example happiness can only be achieved if you have beer time OR modelling time AND SWMBO is NOT around AND the in-laws are NOT around.

 

 

BUT, unlike real relays, that will require rewiring if the “logic changes”, Ladder Logic is software so a quick edit, (and test), the new programming is running – often without any additional hardware being involved at all.

 

====

|
|
| Modelling    SWIMBO      in laws                            happiness
|   i1.0        i2.0        i2.1   
|----] [----|----]/[----|----]/[----|-----------|-----------|--( q0.0 )--|
|           |                       |
|   beer    | permission            |
|   i1.1    |   f2.5                |
|----] [----|----] [----|-----------|
|
|
====

 

Ladder logic is a “visual” method of programming “industrialised” computers (PLC's or Programmable Logic Controllers).

 

 

20 years ago, I used to program PLCs, professionally, on large industrial machines, (Printings Presses, Metalizers, etc), but I have not touched one for years now.

 

I used to mainly program Siemens S5 PLCs. The S7 range was just being introduced then.

The S7s small size, cheapness, features seemed to lend itself to a far more wider field of applications. One of which I thought could be model railways.

 

 

I will have a think and see what “suitable” model railway uses a PLC can be put to.

 

 

Kev.

 

Link to post
Share on other sites

Hi Rob, SHMD

 

Like SHMD I also used to program PLCs although generally they were Allen Bradley, Klockner-Mueller, Texas Instruments or Omron. They are very much applicable to Model Railway automation. For example all your signalling and turnouts could be interlocked, routes set and if required you could control power to sections of track

to start and stop trains. However, there are several reasons why you wouldn't use them:

 

  • Cost, even the cheapest PLCs with a few digital IO (Inputs and Outputs) are relatively expensive. If you also add the cost of the programming software they are almost prohibitive.
  • They generally need some form of SCADA system to view activity, again a lot of additional cost.
  • They are physically large.
  • Ladder logic is old technology adopted in the days when relays were the main control media. Ladder Logic, supposedly made life easier for electricians who were used to reading relay diagrams and reduced the need to train them as software engineers.

There are several alternatives to commercial PLCs

 

  • Hornby Railmaster
  • RocRail
  • Arduino
  • Raspberry Pi
  • Traincontroller
  • PIC microcontrollers

 

The advantage of these is

 

  • Specialist packages, 
  • Hornby Railmaster is perhaps the cheapest complete package but doesn't seem quite as sophisticated as Traincontroller.
  • Probably the most expensive of these is Traincontroller. However it comprises a complete model railway control package of logic and SCADA. The hardware is extra. It is purpose designed to make all those interlockings and signals and train control fairly simple operations.

 

  • If you want more work and less specialization then:
  • Raspberry Pi can work as a PLC 
  • Arduino can be programmed to act like a PLC and have in built IO but requires a PC to program it
  • PIC microcontrollers are much the same as the Arduino but require additional hardware for IO and again an external PC to program.

 

I have quickly listed items that may be of interest that are practical alternatives to PLCs and some of my statements are generalized but I hope this helps.

 

Cheers Godders

Link to post
Share on other sites

  • RMweb Gold

Try a Google search with "farnell electronics siemens S7 starter kit".

 

Farnell Electronics comes up with 28 different starter PLCs (different makes) for around £200 - including software and cable.

 

Although I agree, expensive for model railway use, but the primary purpose here is to learn PLC programming via a suitable application.

 

 

Kev.

Link to post
Share on other sites

Try a Google search with "farnell electronics siemens S7 starter kit".

 

Farnell Electronics comes up with 28 different starter PLCs (different makes) for around £200 - including software and cable.

 

Although I agree, expensive for model railway use, but the primary purpose here is to learn PLC programming via a suitable application.

 

 

Kev.

 

Hi Kev,

 

If indeed you are correct and the op wants to use a PLC as a learning aid then fine. However he's not going to get far along the automation of a model railway unless he's got a lot of money. 

 

The Siemens S7 Starter Kit comes in @ £377 and is supplied with an IO simulator but no physical IO. 16DI/16DO modules are £237

 

As for ladder logic, the majority of job offers I get ask for High Level PLC Programming (Function blocks, Dynamic controllers, Structured Text) 

 

anyway good luck

 

Cheers Godders

Link to post
Share on other sites

  • RMweb Premium

I will have a think and see what “suitable” model railway uses a PLC can be put to.

 I have a couple of small MELSEC PLC's  that I salvaged from some scrap machines. The programming software can be obtained free providing the program does not exceed a limited number of lines of instructions. I intended to use this for Signal Interlocking but with the advent of the Raspberry Pi and Arduino I'm not too sure which way I will end up going.

Link to post
Share on other sites

  • RMweb Gold

Hi Kev,

 

If indeed you are correct and the op wants to use a PLC as a learning aid then fine. However he's not going to get far along the automation of a model railway unless he's got a lot of money. 

 

The Siemens S7 Starter Kit comes in @ £377 and is supplied with an IO simulator but no physical IO. 16DI/16DO modules are £237

 

As for ladder logic, the majority of job offers I get ask for High Level PLC Programming (Function blocks, Dynamic controllers, Structured Text) 

 

anyway good luck

 

Cheers Godders

 

Hi Godders,

 

The word "student", in the OP, is a bit of a clue but mainly I know because Rob PM'ed me, regarding PLCs, and I encouraged him to post here where he would benefit from a wider, more balanced selection of views than I could provide.

 

"Melsec, Mitsubishi, Allen Bradley, TI, Omron" - all names I had forgotten about!   :)

 

 

One of the kits on that list, (6ED1057-3BA00-0AA6), is £163 +VAT.

This includes a PLC, Lead and software. (PSU, wiring, buttons, interface boards, cabinet, etc will all have to be provided too.)

This "tiny" PLC has (I think) 8 inputs and 4 outputs. I may even have one that I bought in the 1990s for evaluation purposes!

PWM, ADCs and 12/24 volt IO/operation were what originally caught my eye with respect to model railway use.

(Remember uControllers were rubbish at the time.)

 

BUT price is still prohibitive.

I did rather assume that Robs college/university may be providing the hardware.

 

 

Kev.

Link to post
Share on other sites

I am studying a HND in Electrical/Electronic Engineering, and one of the units that I am studying is PLCs. I was considering Ladder Logic as a method of planning the relay sequencing, and then producing a relay board as a form of automatic control. I don't have any experience of Structured Text Language, and a limited idea about Function Block Diagram programming. I haven't got a particular problem in mind, but was simply wanting to discuss the ideas of PLCs and Ladder logic with an idea to automatic control.

 

Rob

Link to post
Share on other sites

  • RMweb Gold

Hi Robert,

 

Does your course reference a particular make of PLC?

 

STL (CSF, LDR?), sound like Siemens terms too my fading brain.

 

 

 

Kev.

Link to post
Share on other sites

I am studying a HND in Electrical/Electronic Engineering, and one of the units that I am studying is PLCs. I was considering Ladder Logic as a method of planning the relay sequencing, and then producing a relay board as a form of automatic control. I don't have any experience of Structured Text Language, and a limited idea about Function Block Diagram programming. I haven't got a particular problem in mind, but was simply wanting to discuss the ideas of PLCs and Ladder logic with an idea to automatic control.

 

Rob

Hi Rob

 

Despite the comments I made earlier PLC programming in Ladder Logic is enjoyable and fun, it's just not affordable if you want much automation on a model railway. I learned an awful lot in the early days using ladder logic and a PLC connected to a spreadsheet used as a simulator. This taught many things; Ladder Logic, comms with other machines, simple spreadsheet use and later the use of VBA within the spreadsheet. 

 

Kev has already provided an example of Ladder Logic in #2 above and he has also provided a translation into "pseudo code"  ...." if you have beer time OR modelling time AND SWMBO is NOT around AND the in-laws are NOT around."

In my opinion the written code version of this is much more efficient and maintainable, particularly when it comes to sub-routines.

 

PLC programmers seem mainly to be self taught which has its advantages and disadvantages; Disadvantage it takes longer to get to the "structured" approach, advantage it leaves the mind free to innovate.

 

But I'm rambling, if I can help at all PM me I'm in my dotage but the brain is still pretty active or at least I thought it was until kev picked on my frailty of not acknowledging that you had written you were a student.

 

Cheers Godders

Link to post
Share on other sites

Hi Robert,

 

Does your course reference a particular make of PLC?

 

STL (CSF, LDR?), sound like Siemens terms too my fading brain.

 

 

 

Kev.

 

Hi Kev

 

or should I say "cheat" for actually reading what the OP writes.

 

One of the pitfalls I found with PLC programming was the fact that they all used their own languages which meant moving from system to system meant learning all over again. One of the advantages of the generic "German" PLCs Siemens, Klockner-Moeller, is that they tended to used standardized methods based on some euro standard which I can't bring to mind at the moment. In Germany I think these methods were taught in their technical colleges, something that wasn't done in England.

 

 

I've just searched for the language reference it's: IEC 61131 - 3. There seems to be lot's about it on Google which shows examples of the different types of programming such as; 

 

  • Ladder diagram (LD), graphical
  • Function block diagram (FBD), graphical
  • Structured text (ST), textual
  • Instruction list (IL), textual
  • Sequential function chart (SFC), has elements to organize programs for sequential and parallel control processing.

BTW when I started my tertiary education we were taught about thermionic valves, in the last couple of weeks of the course we were shown the principles of transistors. How things have changed.

 

Cheers Godders

Link to post
Share on other sites

I think that we are using Mitsubisi MELSEC units. They began to teach the basics of Ladder Programming last week using the worlds most inefficent PLC programmer. StL is The three letter word for Statement Listing (like FBD (Function Block Diagram)).

 

Rob

Link to post
Share on other sites

  • 2 months later...

What about CPLDs? There a few on farnell at about £5 each, DIP package so could go on veroboard. Would require a few passive components and a crystal oscillator, and a USB to TTL converter, but still very cheap. I'd imagine the manufacturer does an IDE for free that will allow simple simulation, compiling and upload to the chip.

Link to post
Share on other sites

I think that a Raspberry Pi with JMRI makes life a lot easier and cheaper, but I did meet Rex Garrod once (Channel Four's secret life of machines) and he used PLCs for automating everything because they are virtually free from scrapyards when recovered from redundant machinery. That said I think that even if I was given PLCs I would still buy a Pi and use JMRI instead.

Link to post
Share on other sites

An Arduino microprocessor board should be able to do everything a PLC can do and more at an affordable price - down to £10 or less for some of the boards. The only downside is that there may be a slightly steeper learning curve. There is a huge amount of support on the Arduino forum and there are several Threads in this Forum where Arduinos have been used.

 

An Arduino is better for directly controlling external devices and for collecting signals from external devices than a RaspberryPI. On the other hand the PI can run regular PC programs. The PI (or a PC) can easily interface with an Arduino to get the best of both worlds.

 

...R

Link to post
Share on other sites

  • RMweb Gold

There is more to PLCs than raw computing.

(Just as well because Ladder Logic is a rubbish medium for computer algorithms anyway!)

 

Yes, the Arduino, PCs, VME, Pi’s, PICs and other Single Board Computers are very good on memory, processing and (online) support but they lack completely one of the advantages of a PLC – ruggedized I/O. (Just one of the bits that make them expensive!)

 

Generally, PLCs don’t need any external interfacing circuitry.

Arduinos, PICs, Pi’s and the such do. TTL/CMOS level signals are not much good at driving anything heavier than an LEDs, a Transistor’s base or a Servo’s input signal.

PLCs happily drive relays, Contactors, Drives, Solenoids, etc and get real world signals in return directly Proximity Sensors/Drives/Auxiliary contacts all directly from 24volts AC/DC up to 240vac too.

Even the PLCs slow speed and built in Opto-Isolation was an advantage in noise/chatter elimination!

 

Don’t get me wrong, I’ve dropped PLCs in favour of PIC MicroControllers for the very good reasons outlined above.

 

It’s Horses for courses.

Single Board Computers do a different job to PLCs.

PLCs run machinery directly. Single Board Computers wont.

(One of the OPs requirements was to Learn/program in Ladder Logic and – presumably – PLC applications.)

 

 

Kev.

Link to post
Share on other sites

  • 3 weeks later...

Hi All, just like to throw in my two penn'orth. My layout is entirely controlled by an Allen Bradley SLC504 with Fix32 scada system providing the interface. I control speed with an analog output module feeding a pwm, the Plc provides ramped start and stop speeds. I can control the layout fully manually from my Pc or select pre-programmed 'routes' and sit back and watch. All points, siding power, signals and level crossings are via the Plc.

 

regards

 

Bill

Link to post
Share on other sites

  • 2 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...