Jump to content

Recommended Posts

Posted (edited)
I have been given a project to do (explained below), this is the first major project ive had to do. So far i have coded the water mixing by using multiple timers and ORB'ing them to create an output on the valves. But im stuck on how to proceed further especially the part on spin cycle - Where if vibration is detected slow forward/reverse kicks in until vibration is not detected and the fast forward cycle continues its timer (does not start again). Any advice on how to go about doing this would be most grateful (Im not asking anyone to do it for me, i just want some advice) Inputs Hot Wash Switch – User selected prior to start Cold Wash Switch – User selected prior to start N.B – Normal Wash will be selected if both or none of the above switches are selected Spin Selection Switch - Machine will spin load after wash and rinse cycle Half Load Selection Switch – Machine will half fill with water Start Switch – Starts cycle Drum Empty Sensor – Indicates water has fully emptied the drum Vibration Sensor – If vibration has occurred during spin cycle only, machine needs to slow forward/reverse until sensor goes off Tub Full Sensor – Machine has reached its full water mark Tub Half Full Sensor – Machine has reached its half water mark Door Sensor – Indicates if the door is open or closed Outputs Slow Forward – Motor is to drive slowly forward Slow Reverse – Motor is to drive slowly in reverse Fast forward Spin – Fast spin @ 1000rpm Door Lock – Locks the door Hot water valve – Allows machine to fill with hot water (supplied at correct temp) Cold water valve – Allows machine to fill with cold water Pump on – Empties water from the machine Wash Timings – • Full Hot Wash – Open hot valve for 64 Seconds • Full Normal Wash – Open hot valve for 48 seconds and cold for 16 seconds • Full Cold Wash – Open cold and hot valve for 32 seconds • Half Hot Wash – Open hot valve for 32 seconds • Half Normal Wash – Open hot valve for 24 seconds and cold for 8 seconds • Half Cold Wash – Open cold and hot valve for 16 seconds Once drum has been filled with water the following cycle can start; • Wash cycle for 3 minutes – alternating between slow forward/reverse • On completion of wash cycle, pump turns on and empties drum • Rinse cycle for 2 minutes - starts filling the drum with water dependent on full/half load and will fill twice, after both fills the drum will be emptied using the pump. • On completion of rinse cycle, drum should be empty • Spin Cycle (If selected) for 2minutes – Spins @ 1000rpm for 2 minutes if vibration sensor activates fast forward cancels and slow forward/reverse activates until sensor goes off, fast forward continues its timer. • Once spin cycles completes, door can unlock nic0 Edited by nic00
Posted
this is very simple task which can be done in number of ways. since it does have sequence, i would use sequencer even though sequence is so short. check download section for sample code.
Posted
It may be a simple task for you :), although the exam board state that for a pass only 30 lines of code are needed. Ive coded the water mixing part and im on around 1xx lines. Could you link me to the sample code project as ive checked out the "STL forward pause reverse" but dont understand some of the functions
Posted
there is more than one sample, check the pick and place for example: http://forums.mrplc.com/index.php?autocom=downloads&showfile=631 it's also short and simple, has alarms, sequencer, manual controls etc. in fact i use such logic on practically every project (regardless of size) and all my startups are very quick and easy (just download program, do I/O check and it usually runs in no time...). alarms are generated by bunch of conditions - use every single I/O point to create at least one alarm just to start with, then add PLC and connection status bits, motion controller errors and what ever else is there. this is how you make project that is easy to troubleshoot. posted code doesn't have step mode for example but this is very easy to add (that's very nice debugging tool). basically every time, step is incremented as usual but if step mode is active, set the pause bit that will prevent further incrementing... press on Next Step push button turns of pause and cycle continues - one step only... and you can swith between modes any time. the heart of sequencer is condition that checks if current sequence step is complete, you will see each step bit followed by condition, this is easy to follow since it's linear. sometimes it is needed to do looping, jumping etc. and it may be useful to have record of last few steps (or few hundred...) but this is good exercise, i don't want to spoil all the fun...
Posted (edited)
Here is a simple step sequence for you to see the principle. It decodes a data register (D0) into flags (M0-M15). The register is incremented when the 'Business' of that step is done (timers in this case). This was written for the A1S as it is the PLC I have at home at the moment, but can be adapted to any with the following precautions. 1. If changing to FX series change the M9036 to M8000 and the Outputs Y0A0 - Y0A5 to Y0 - Y5 2. If you are using FX0 series, you will have to pulse a flag and use that flag to INC the register as INCP is not supported. Good luck with your work Regards Paul Ked Sorry Panic, you must have posted as I was writing the code Simple_Step.zip Edited by Paul Ked
Posted
nic00: here you go... what version of software you have? is it maybe for FX PLCs only? paul: i know the feeling, it happend so often to me too. i start the reply and just about when it's finished something happens or i'm called away. by the time i'm back there is whole tread... question: what is the reason for INCP and pulsing? everything works fine with INC... Step_A1S.zip
Posted (edited)
Not asking anyone to write it at all, just asking for some advice. As the only way i will learn is doing it by myself Thanks for the help all. Ill tell you how it goes Edited by nic00
Posted
question: what is the reason for INCP and pulsing? everything works fine with INC... It is a precaution in case of scan time overtaking I/O reaction time. If you use an INCP the register can only increment by 1 rather than every scan time of the PLC. Maybe not necessary these days, but I like things to be 'bullet proof'. It could also be a habit from my old F1 days I'll give INC (rather than INCP) a go and try to put my worries to sleep. Best Regards Paul Ked
Posted
Coded the program today, used monitors to say when cycles where complete. Everything got tested and worked fine and came out with what i wanted. Thanks for the advice guys, I can post the code if anyone is interested (its not very efficient coding)
Posted (edited)
There u go, there are a few minor mistakes but no major biggies. Be Gentle Please :( Ive had minimal PLC programming experience ie LD x0 OUT y0 really Edited by nic00
Posted
issues: - door lock is locked only while button is pressed. worse, the door lock will release if door sensor goes off (switch not adjusted, loose wire or whatever) even if you hold the button pressed. on washing machines with front loading this would mean water comming out... on top loaded machines one could open door and stick arm inside while running and get burned by hot water or have the arm broken. - the unlock monitor only shows status of M11 (Spin cycle complete), has nothing to do with actual lock or X10 (spin cycle switch). note those are only first and last rung, i didn't look in between... ah, what the heck... looked at that M11 and it turns out your unlock monitor is on when tub is more than half-full but not full. this makes no sense. also the y003 (slow forward) will never come on because your spin cycle timer preset is zero (this is same as M11). you slow reverse is never used, it's not even assigned to an output... so you forward and reverse are dead, how are you supposed to alternate for 3min during wash cycle? same goes with vibration sw. etc. YOU FAIL maybe you can fool teacher if has bad day, but that doesn't work here... keep on trying... suggestion - learn how motor starter circuit works (start/stop circuit using relay and seal in contact)
Posted
U gotta bare in mind this is my first major project been thrown in the deep end with this. There are bugs in it yes i agree dont think its bad for a first attempt
Posted
i do understand that but sorry.... i don't want to discourage you but this doesn't work and doesn't even look close to it. this is much closer to some randomly tossed together instructions and comments meant to produce desired code length for cosmetic purpose than actual program (with or without bugs) that follows the assigned task. this is wash machine and the most basic feature is using water and agitating. i didn't bother to see if the program would even let the water in and out but agitating part doesn't work because two outputs meant to do it never get on (one is not even in program). you can hope hope that looks alone will do, in that case leave it as it is and your programming is finished (posibly forever). i'm not the one to grade it but you can and should do much better if you want to give it a try, it takes a bit of effort and if you try and ask for help, you will get it... as said before, using just conditional logic for such small task is fine but you should look into start/stop circuit. this will allow you to keep certain signals high even if condition is not true any more.
Posted
The water mixing works fine although im askin for advice and ways to solve some problems that im having. Not to get slated :) Im currently reading http://www.amazon.co.uk/Programmable-Logic...0024&sr=8-1 To help try and correct my code, before i start using sequences i need to understand how they work etc, Best way to learn is to learn from your mistakes :D
Posted
Goody is absolutely right. that code CANNOT work... you can write conditional logic which is what you have done already. the problem becomes when number of states increases and one has to refer to particular state or situation. sequencer is additional control that enforces series of individual steps. it does not replace conditions, it adds more rigidity (and flexibility). basic idea is to use some sort of index or counter and enumerate all steps. indexing (incrementing counter) occurs only when current state is complete (required condition is satisfied). one of the major advantages is simplicity in following sequence - states are indexed in linear fashion. for example to cut pipe in pieces one can think of sequence like this: 1. check is saw and pipe indexer are retracted (use sensors saw retracted and indexer retracted) 2. open gripper (verify by gripper open sensor) 3. check if pipe is present (verify by pipe present sensor) 4. close pipe gripper (verify by gripper closed sensor) 5. advance saw to make the cut (saw advanced sensor) 6. retract saw (saw retracted sensor) 7. index pipe (index is advanced sensor) 8. release gripper to drop the cut of piece (verify by gripper released sensor) 9. complete (repeat sequence) to start sequence we go to step1 (set value 1 into step counter) and: - turn on outputs to retract indexer and saw - wait until the first condition is true (both devices are really retracted). once this is done, we increment counter which takes us to step 2: - turn on gripper open output - wait until that condition is true (and then increment counter to go to next step) once you reach last step, (or operator preses reset button) we return sequencer to step 1 That's it. sounds simple on paper eh? wait, you have to see the code.... step1 saw_ret index_ret run_enable ---| |--------| |--------| |-------+--| |----[increment step_counter] | step2 gripper_open | ---| |--------| |------------------+ | step3 pipe_present | ---| |--------| |------------------+ | step4 gripper_closed | ---| |--------| |------------------+ | (etc.) | | | step8 gripper_open | ---| |--------| |------------------+ step9 ---| |----+-------------------------------------[move 1 to step_counter] | reset | ---| |----+ that's it... that is whole sequencer. as you can see it matches the text describing sequence in every little detail...! first step had two conditions and code shows two conditions. it looks exactly the same. and the best part is watching it run. you see how contacts energize one by one and how sequence moves from one step to another. but how do we turn outputs? let's first think when each output has to be on. for example saw advance is only active is step5 step5 ---| |------------------------------------------( ) saw_advance saw_advance ---|/|------------------------------------------( ) saw_retract but how about pipe indexing? it has to be advanced in steps 7, 8 and 9: step7 ---| |-----+------------------------------------( ) indexer_advance | step8 | ---| |-----+ | step9 | ---| |-----+ indexer_advance ---|/|------------------------------------------( ) indexer_retract actually step9 is reset, it happens only for 1 scan and it is transitional point between indexer_advance and indexer_retract. we can get rid of it to keep code shorter so indexer_advance would only be turned on by steps 7 and 8. and how about that gripper? it has to be closed in steps 4,5,6 and7: step4 ---| |-----+------------------------------------( ) gripper_advance | step5 | ---| |-----+ | step6 | ---| |-----+ | step7 | ---| |-----+ gripper_advance ---|/|------------------------------------------( ) gripper_retract this is what you need to do for all outputs and you are done. but how do we get those bits like step1 step2 etc.? one way is to use comparison blocks: [= step_counter k1]-------------------( ) step1 [= step_counter k2]-------------------( ) step2 [= step_counter k3]-------------------( ) step3 etc. but this is lot's of code. one can also put those compare blocks directly in place os step1, step2 etc. but this also looks messy and takes lot's of screen space although it works perfectly. normally in this case we use decode instruction (DECO) which converts step_counter value into series of bits. for example value range 0-15 converts into bits M100-M115 for example (or whatever bit range you pick). you also need something to control the run_enable bit using start and stop buttons and finaly we may need some alarms. for example if we say close gripper but gripper doesn't close in expected time, set alarm bit gripper_close_timeout etc. don't tell me this is not easy to follow. you can open that pick and place program and see if you can recognize any of this now go back and study...
Posted
I am not a Mitsi PLC regular, but had to read this thread and found it interesting and encouraging. While I cannot any Mitsi specific comments I do have this to ask. NIC If I gave you relays, timer relays, switches and wire. Could you build this circuit and make it work without a PLC? Not to say you can write the program for PLC without understanding how the discrete relay system works, but it always helps.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...