PLC Programming

Kkona

Member
Join Date
Nov 2018
Location
Norway
Posts
14
Hi!
Im totaly new within mechatronics, since I have a mechanical background. Im wondering if anyone could help me out with a task? Its about PLC programming in the software called Codesys. The task is to make an automatic liquid dispenser, that includes valve etc. I do have a drawing off it as well, and will be offering better instructions.
 
Thanks, I will check them out! I have mostly tried to learn Function block diagram. The task is as follwing:

a two color mixer must be controlled with PLS. The device works like this:

- When start switch S0 is operated, lamp H0 (refill) lights up. valve Y1 opens and pump M2 starts

- When sensor S1 is covered with liquid, valve Y1 closes and valve Y2 is opened.

- When sensor S2 is covered with liquid, close valve Y2, pump M2 and lamp H0 turn off and M1 starts

- After 6 seconds, M1 stops

- The unit can be switched off at any time with switch S6, thermal relays F1 or F2 (motor protection) or limit switch S4

- The ready-mixed liquid can then be manually withdrawn from the drain valve located at the bottom of the mixer

- The process can then start over again
 
Heres a question if you don't mind me asking in your thread if you have to add some stuff like photo eyes and a line to an already existing program how do you know where to add it in the program or does it matter where you would insert it......?
 
Heres a question if you don't mind me asking in your thread if you have to add some stuff like photo eyes and a line to an already existing program how do you know where to add it in the program or does it matter where you would insert it......?

It depends on if your PLC is running a synchronous or asynchronous scan cycle.

In synchronous:
1. Scan all IO -- > store states in memory
2. Run logic using the information in memory
3. Write to the output memory (then the hardware switches on the outputs)
4. Housekeeping (the PLC clears the "temporary" data from step one so that it can be scanned again)

In asynchronous, the processor effectively reacts immediately. I would love to hear more specifics about that type of scan cycle.

Next: Ladder logic is interpreted left to right, top to bottom. I'm not sure on FBD flow.

Routines and tasks: generally speaking, you can divide up program execution into tasks and routines to be called at certain events / times / certain orders. For a small job like you have going on I wouldn't worry too much about tasking.

So the answer for Greg is this: Yes it matters where and how you add equipment to the program, but not in the ways you might think.

The following videos also helped me quite a bit:

https://www.youtube.com/playlist?list=PLGzS56y9k4eYr1uS3jPPxGunBTtPcS3Ez

Kkona: You are on the right track. Now you need to start implementing that list in code.
 
Kkona: What stage are you at? Do you have the CoDeSys software? If not, you can download it at the CoDeSys Store. It is free to download the development system. With this you can run simulations on your computer but not download to any hardware.
https://store.codesys.com/tag/product/list/tagId/38/

Are you doing this for a class? Has the instructor given you a simulation to use with your program or are you working with real hardware? If you are a student, you will get a lot more help if you post what you have already done and show a willingness to try things on your own.
 
Hi there!
Yes, Im using the software called Codesys. I've tried to solve the task given in this thread, by using funtion block diagram. I've managed to almost create the program, but im stuck right now. Maybe you could help me out with the things i dont understand?

Also, im at a completely beginner stage in mechatronics.
It is a self study task from the school, and it would really help to complete it, so im prepared for any tests that may come.
 
Take a screen shot of your function block diagram so far. If your variables don’t have descriptive names, let us know what each one represents.
 
Here is the 2 pictures. Also, some of the words are in norwegian, but in the info given further up in this thread, you can see which component is which. Also, I havent added the timer for M1 yet (6 sec)

Also, here is my questions:

- Have I done it right so far?
- I dont know when to use RS/SR..
- Should I set the lamp H0 as output or input? I sat it as input in my diagram..
- I dont know when I should invert the signal.

Here is the link for the pictures:
https://ibb.co/YQSGHhK
https://ibb.co/NyV0jN5
 
Here is the 2 pictures. Also, some of the words are in norwegian, but in the info given further up in this thread, you can see which component is which. Also, I havent added the timer for M1 yet (6 sec)

Also, here is my questions:

- Have I done it right so far?
- I dont know when to use RS/SR..
- Should I set the lamp H0 as output or input? I sat it as input in my diagram..
- I dont know when I should invert the signal.

Here is the link for the pictures:
https://ibb.co/YQSGHhK
https://ibb.co/NyV0jN5

I would not use Set/Reset myself for this. Remember that while inside the PLC, everything is just data. Any boolean value can be used as an input or an output. Where is really makes a difference is when you connect to the hardware. A lamp is an output because the PLC sends an electrical signal out to turn it on and turns the signal off to turn the lamp off.

Inverting a signal us used when the logic makes more sense if you use the inverted value.

You should take some time to look at the attached function block network and see how it works. You can use simulation mode in CoDeSys to make virtual switches and lamps. I made a quick video showing this rung work with some simulated controls.

Note that it's not complete but intended to get you started.

https://youtu.be/GPAOataRL6Q

Rung1.PNG
 
Thank you very much for your video!

Sorry, im a bit confused. Because I thought that using SR was correct, but then I heard using RS is the correct one. I know that the SR is start dominance, and RS is reset domincance, but I dont know when to use which one.. And I dont now any other method that is easier for me than using that.
 

Similar Topics

Hello colleagues, Some time ago I started my adventure with programming. With your help and the courses, things are starting to come together...
Replies
13
Views
593
Dear All, I need a sample PLC program to count the output pulse of a mass flow meter so that a specific amount of mass (for example 100gm)can be...
Replies
2
Views
82
Hi Please I have zeilo smart relay #SR2A201BD but I don't have it's programming cable. Can I use any general usb/rs232 converter? Or need...
Replies
2
Views
80
Hi, Does anyone have thoughts or know of, can point in the right direction any published materials with a plumbing centric point of you explaining...
Replies
1
Views
125
@ All: what is your best guess on a potential range in increase in efficiency in % (i.e. saved programming hours, greater output, etc.) when...
Replies
5
Views
291
Back
Top Bottom