Rob...
Lifetime Supporting Member
Why are you changing a system that works?
Hi Bro
what burns my mind is when i do the first cut manually in the middle of the hole then i give a cutting distance as an input (eg 10cm) starting from the middle of the previously cutted hole as the start of counting
the length of the cutted pieace is 10cm (-/+2mm) but the cut is not in the middle of the the hole even that the distance between hole is 1cm
the holes width is 5mm
if the cutt is not exacly in the middle that is exactable (just cut the hole between its width)) and that's what am not gatting
Hi Bro
in the old system when s1=1 means that the cutter blade is in the middle of the hole, also and somehow s1 is included in the measurement cause when removing one of the sensors you won't get a good results
Hi broI still do not fully understand how the old system works, so I will make a guess.
Am I closer to understanding the process?
- The holes in the coil material are 1cm apart.
- The width of the gaps and of the teeth on the pinion gear represent 1cm movement of the coil material.
- The S1 and S2 sensors never have the same value, so if S1 is 1, then S2 is 0, and if S1 is 0 then S2 is 0.
- This means that if S1 is detecting a tooth, then S2 is detecting a gap (no tooth), and vice versa
- This also means that, if S1 sees a rising edge (0 to 1, gap to tooth, transition), then S2 has a falling edge (1 to 0, tooth to gap, transition), and vice versa
- When starting a series of cuts of the same length of some integral number of cm,
- 1) The machine is stopped
- 2) The operator manually aligns the system so it will cut in the middle of a hole
- 3) The operator makes the cut at that first (zero-th) hole
- 4) The operator adjusts the sensors so S1 is at the start of a gap and S2 is at the start of a tooth
- So
- after 1cm of total movement, S1 will have a rising edge
- after 2cm of total movement, S2 will have a rising edge
- after 3cm, S1 will have a rising edge
- after 4cm, S2 will have a rising edge
- etc.
- Perhaps S1 and S2 are on a jig that keeps the distance between them fixed i.e. a distance of 1cm of the material
- 5) The operator selects the length of subsequent cuts as an integral number of cm
- 6) The operator starts the machine,
- 7) The machine uses a single counter to count the rising edges (transitions) of either S1 and S2,
- Since S1 and S2 are 1cm apart in "phase," only one of those transitions will happens on every single cm, which is why two sensors are needed i.e. to handle odd (1, 3, 5, ...) integral lengths in cm
If yes, can you give the details of the physical encoder setup: coil drive wheel diameter; gearing between encoder and coil wheel if the encoder is on a different shaft; [A] encoder pulses per revolution (PPR; assume B PPR are the same); speed; whether the process stops to make each cut; was a PLC used for the old system; is a PLC used for the new system; etc.
If the machine moves exactly the commanded distance of 10CM then it did what it was asked to do; regardless of where the holes are. Your drawing shows a distance of 1CM from center of the hole to the center of the hole so if the machine cuts exactly 10CM away that has to be in the center of a hole.
Please give more detail of the system, Peter has already asked but I will ask them again:
General information:
Hardware information:
- Does the machine stop to perform the cutting or is it on the fly?
- Are you cutting every hole? If not, are you cutting the same distance repeatedly, every machine setup?
- How is the machine setup to start the cutting process, is it like you said, manually positioned in the center of the hole and then commanded to cut at a distance from that point?
- Is there any sensor used in the process for any reason and if yes what does it do.
Programming information:
- What is are the specs of your encoder:
- PPR
- Is it two phase? (form your question I would say it is, but good to know for sure)
- How is it mounted to the machine?
- What PLC are you using:
- I assume it is Siemens, which one and which firmware?
- How is the encoder connected to the PLC, A and B?
Note: The old system has been removed so trying to figure out how it worked is purely academic now and may very well be irrelevant to the current system. But, those switches may have been used in many different way and one of them is as an encoder.
- Which TIA version?
- Are your encoder inputs configured for HSC?
- What are the setting in your configuration?
- Are you using hardware interrupt for any reason?
- How is the distance entered processed, converted or otherwise used to initiated the cutting? Meaning, you entered 10CM then how is that number used to position the product?
- How are you using the HSC counter value to determine cutting position, what are you comparing, with what and where in the program?
How many teeth on the pinion?
How fast does the pinion turn (RPM, radian/s, encoder pulses/s, whatever) when the clutch is engaged?
In the old system, how is the cut implemented i.e.
In the old system, does S2 have the state of 0 for very brief times, i.e. when the pinion wheel is positioned such that S2 is halfway between two pinion teeth, and S2 has a state of 1 otherwise?
- is the brake engaged to stop the wheel-pinion shaft, in response to the state of S1 and/or S2, and the cut is made
- OR
- is the cut made while the wheel-pinion shaft is still moving?
In the old system, is the wheel-pinion system, and the position of the cutter, designed such that S2 is 0 when the cutter is exactly in the center of the hole?
Here's another archive with no block call in the interrupt for faster execution and more suitable for your application which is unlikely to be moving that fast. I assumed the conditions necessary to stop the motor and start cutting will have been ready by the time the interrupt is triggered.
Also assumed that both stopping of motor and starting of cutting may occur simultaneously.
Hi BroFixed both versions with preference to use the first version.
The issue with using interrupts is that as the name implies they interrupt the process at any point, between rungs or between instructions. So you have to use a lot of imagination and/or spend hours creating tests to cover all possible and impossible scenarios.
As you may see, if I haven't lost you yet, my comments in version2 in one of the rungs explains what would happen if the interrupt is triggered between those two rungs and how I mitigate it; not pretty which is why I prefer version1; but I know many people find it confusing.