Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: Bivouac on September 09, 2010, 11:24:09 PM

Title: How to recover from power interuption?
Post by: Bivouac on September 09, 2010, 11:24:09 PM
I have moved to Africa for my old age and would like to do some CNC milling and MACH3 seem the answer.

Problem. -- In this part of the world we often get power outages.
To get over this I could use a UPS to keep things going for a very short time.
It seem to me that I would need an input to MACH3 that would lift the cutter to a safe height and send x & y to zero, (so that when power is restored I can start over without losing registration) then power everything down.
I could do it all, except, the "getting MACH3 to do what is needed when given an external input.
My intention would be to do work that may take many hours to run, so the machine will be un-attended.

Anyone know if this can be done?
Dennis

I think that I posted this in the wrong place at first; sorry!
Title: Re: How to recover from power interuption?
Post by: Hood on September 10, 2010, 02:16:51 AM
If you have accurate home switches then all you need to do is re-home then start from the position you got to when the power went off.
Hood
Title: Re: How to recover from power interuption?
Post by: stirling on September 10, 2010, 05:52:32 AM
Off the top of my head - how about something like this: In any job (ok - some jobs) there are places that are "ok" and "not so ok" to stop maching if you have to. How about putting a custom macro into your code at all the places where a stop would be "ok". That macro would check if the power is on/off. If "on" then just carry on else do the controlled stop thing whilst you still have UPS. Typically the macro might just turn off the spindle, mill and controller, do a feedhold and store the current line for later. Mach could be left running in power saving mode and subsequently shut down by the UPS if neccessary.

Ian
Title: Re: How to recover from power interuption?
Post by: Bivouac on September 10, 2010, 12:58:13 PM
Thanks for the ideas.

What type of home switch is available that can hold to 0.0005 or better?

How would Mach3 know that the power is off? Would I have to use one of the inputs that are in short supply? Maybe a second parallel port!
Is it possible to have the keyboard monitored by Mach3 for some combination of keys? I could fix a solenoid to operate on mains failure?

Dennis
Title: Re: How to recover from power interuption?
Post by: Hood on September 10, 2010, 01:29:41 PM
Optical switches can be very accurate but if used on a machine where dust or coolant is present you really need to shield them in some way. That can be done by housing them in a small box and having a rod protruding from the box at either side. The rod has a flag which interrupts the light in the opto and is held central by two springs.

Hood
Title: Re: How to recover from power interuption?
Post by: stirling on September 11, 2010, 05:53:13 AM
What type of home switch is available that can hold to 0.0005 or better?
Note that my scheme above doesn't require the use of the home switches.

How would Mach3 know that the power is off? Would I have to use one of the inputs that are in short supply? Maybe a second parallel port!
That would be my choice.

Is it possible to have the keyboard monitored by Mach3 for some combination of keys? I could fix a solenoid to operate on mains failure?
Not the route I'd personally take.
Title: Re: How to recover from power interuption?
Post by: Bivouac on September 11, 2010, 12:32:49 PM
Thanks for the comments.

How is this problem solved in other places in the world that have unreliable power? Even if they don't use Mach3 they must have a workaround.
Next week I will start looking a the limit switch idea. To write a macro that checks an input from time to time sounds attractive, but, is there any information on how to do this kind of thing available on the net, or, is it something for programmers only?

I should like to hear from any member who live with the problem at their work.

Dennis
Title: Re: How to recover from power interuption?
Post by: BR549 on September 11, 2010, 04:50:08 PM
It will ALL depend on the tolerance you work with. Hood has the correct and most common method. It is FAR easier to restart an ACURATE machine than try and recover after an outage. It will also depend on when you loose power. During a rough cut no problem, during a finish cut?? BIG problem if you have low tolerance finishes say sub .001"

Unless you have a UPS big enough to run the entire CNCmachine you have a very limited time to react AFTER the power shuts down. Usually about 1 sec or less before the energy stored in the CAPS have been used up. This does NOT give you enought time to react and finish a stored position solution before the machine looses position.

NOW even if you have UPS capacity to run the machine during this time as soon as it does shut down and the drives loose power the axis's can DRIFT and loose position unless you have axis brakes to hold it on position(now we really get complicated)

With Hoods method all you have to do is re home and restart somewhere near where you left off.

I would try and only machine during the times that are LEAST likey to have a power outage maybe at night????

Just a thought, (;-) TP
Title: Re: How to recover from power interuption?
Post by: Promech on September 11, 2010, 05:56:50 PM
Challanging problem.

I would break it in two:

1. If you do job shop work, homing again (with an accurate homing scheme) is the best solution.

2. Suppose serial production is being run unattended at night and you cannot afford to loose production when there is power. Then ................ maybe program the machine to home automatically  after power is recovered and restart the program. Certainly more complicated.

Title: Re: How to recover from power interuption?
Post by: Bivouac on September 12, 2010, 04:05:59 AM
The kind of work that I have in mind is based on a machine that I have with a 0.01 resolution on three axis and involves 3D carving by scanning across the image to give very fine detail.   The UPS can keep the steppers in place under low power for hours; so that's no problem. I will need the line number that the programme was at when the power failed, and that I can get by recording the monitor screen. Question:- If I fit an extra parallel port; is there a way to detect one of the inputs and do a macro/jump to a given line in the programme code/change the way Mach3 continues? (Continues - Not stop)

For the sake of interest; there have been 42 power faults sense I started the request for information. Some just for a few seconds, but long enough to wreck the kind of work I wish to do.

Dennis
Title: Re: How to recover from power interuption?
Post by: Promech on September 12, 2010, 10:41:25 AM
Maybe I would look at it in a simpler way.

Have a relay that senses power outage.  The coil is connected to the main power and the signal is fed with UPS power. When there is a power outage then the relay will send a signal that generates a feed hold command.  Your UPS power will hold your axis position and the spindle will power down. When power comes back then your spindle will come back to speed and the feed hold command will be reset (with some delay so the spindle will have time to pick up speed again).

This is just an idea considering that your UPS is capable of keeping your control and the axis motors on during tipical power outages.

Just as an alternative:  If power outages are short, and the power consumption of your overall system is low, maybe just having a higher capacity UPS to drive the whole system is the simplest solution.

Jorge
Title: Re: How to recover from power interuption?
Post by: Bivouac on September 12, 2010, 01:21:17 PM
Thanks Jorge

How do you get the signal into Mach3 to create the feed hold command?

From reading some of the other posted messages on this site it seems that there are a lot more features in Mach3 than are in the downloadable book.

There has been mention of OEM inputs; is there information about these features anywhere on the net or is it only in the book that comes after you purchase the software?

On a question about "Open Doors Inhibit" Hood replied that the answer was "System Hotkeys from Config menu and set up the Chosen OEM as 1021" why 1021 and what would happen if 1022 is used instead. My feeling is that there is a lot more to this software than most folks know.

Thanks to everyone for all the comments so far..

Dennis
Title: Re: How to recover from power interuption?
Post by: Promech on September 12, 2010, 04:25:20 PM
Dennis,

I have only been working with Mach for a short time. I would tell you what I would do but I am sure other people will give you better advice:

From the relay I told you about configure it as for example:

5V means there is power available (1).
0V means there is no power (0).

That is fed as an input pin in your parallel port. Then you program in pins and ports that input to be say OEM Trig #2. Then I would create a Brain. It would have two rungs. The first one would have as an input OEM Trig #2 and output OEM Code 1001 (feed hold).
The second one would have also as an input OEM Trig #2 and output OEM Code 1000 (cycle start). Obviously one of the two lines has to have an invert signal. There may be timing issues you have to address after your first trials.

That would be my first try.

As for documentation the manual is only good for basic stuff. As for brains there  are instructive videos. Even though brains have bugs I find them very useful. As for OEM leds and buttons, Hood has created a very practical list .

Jorge

Title: Re: How to recover from power interuption?
Post by: Hood on September 12, 2010, 05:56:43 PM

On a question about "Open Doors Inhibit" Hood replied that the answer was "System Hotkeys from Config menu and set up the Chosen OEM as 1021" why 1021 and what would happen if 1022 is used instead. My feeling is that there is a lot more to this software than most folks know.

Thanks to everyone for all the comments so far..

Dennis

That actually had nothing to do with the Inhbit input, it was just the guy wanting an extra E-Stop input and he thought it may be the way. OEM codes can be for DROs, LEDs and Buttons and is just a means of you using VB to write to a specific DRO or look at a specific LED or Operate a specific button from VB or used viar OEM triggers, they can also be used in conjunction with Brains.

I am wondering however why you are going to all this bother when a few home switches would get you back up and running accurately in a few seconds, I would certainly be much happier in myself doing it that way than trying to do an auto routine, but maybe thats just me.

The optical switches I have on my first Mill I did (Bridgeport) were tested with a glass scale DRO and the DRO returned to zero each test I did except once and that was 0.005mm the DRO read, I did 100 runs, so not bad at all ;)



Hood
Title: Re: How to recover from power interuption?
Post by: Hood on September 12, 2010, 05:59:14 PM
As for OEM leds and buttons, Hood has created a very practical list .

Jorge



I only put the OEM codes that were available on the wiki into a xls so it was easier to keep and search, think it was John P that gets the credit for making the list in the first place  :)

Hood
Title: Re: How to recover from power interuption?
Post by: Promech on September 12, 2010, 06:40:38 PM
My perception is that these are profiling programs that take many hours, and it tedious to find out where the program was at the time of the outage. Otherwise the optical switches are a very good solution.

BTW Hood. Do you need some kind of homing routine for homing with the optical switches? Do you always use the same feed rate to home so timing is not an issue. I wonder how that works in order to get good repeatability.

Jorge
Title: Re: How to recover from power interuption?
Post by: Bivouac on September 13, 2010, 12:30:55 AM
Thank you Hood, Jorge

Jorge has understood the type of thing that I hope to do. I estimate that each run will be between 10 and 14 hours using 0.02mm stepovers.
Also, at my age and with my character, it's not just the destinations in life that are important; it's the route that the journey takes.

Hood. Point me please to the information that is around on this subject. There may be an obvious way to find it, but I am new to this subject of computers. (Got my first laptop as a retirement present)

One other point has occurred to me after testing the download trial with the (very old) driver cards that I have. The maximum pulse length from Mach3 is 5us for step and direction. My driver cards require between 5 and 30us. Now I can stretch them with a bit of electronics, but, for the sake of taking the hard road; can it be done in software?
Messing with software is free except for time, and that I have in stock.

I guess it's a work day for you guys!! Not me!

Dennis
Title: Re: How to recover from power interuption?
Post by: Hood on September 13, 2010, 02:17:09 AM
BTW Hood. Do you need some kind of homing routine for homing with the optical switches? Do you always use the same feed rate to home so timing is not an issue. I wonder how that works in order to get good repeatability.

Jorge

On the Bridgeport (the one with optos) I just use the standard homing in Mach, it goes at the % you set of your rapid so as long as you are not changing the rapid it is at a constant speed. On my other machines I do the homing external to Mach as the servo drives can home to a switch then when seen they look for the index pulse of the encoder and then gate it with the A and B channel of the encoder to give an extremely accurate position.
Hood
Title: Re: How to recover from power interuption?
Post by: Hood on September 13, 2010, 02:24:22 AM
Hood. Point me please to the information that is around on this subject. There may be an obvious way to find it, but I am new to this subject of computers. (Got my first laptop as a retirement present)

Download the Mach2 customisation manual, lots of info in it and although it was written for Mach 2 its still moistly relevant.
The Wiki has lots of customisation info.
OEM list available at the top of this part of the forum in the sticky.
One other point has occurred to me after testing the download trial with the (very old) driver cards that I have. The maximum pulse length from Mach3 is 5us for step and direction. My driver cards require between 5 and 30us. Now I can stretch them with a bit of electronics, but, for the sake of taking the hard road; can it be done in software?
Messing with software is free except for time, and that I have in stock.

I guess it's a work day for you guys!! Not me!

Dennis
That pulse width is in addition to the latency your computer already has so setting 5 will definitely be higher than 5uS that your drives require as a min. In addition I think you can actually set up to 10 or possibly even 15. If you still require a wider pulse then using Sherline Mode (Ports and Pins main page) will give you a 40uS(I think) pulse width.

Hood
Title: Re: How to recover from power interuption?
Post by: stirling on September 13, 2010, 09:46:53 AM
Bivouac - a question for you. Have you tried doing a feedhold whilst your machine is actualy cutting? - just wondering.

Ian
Title: Re: How to recover from power interuption?
Post by: Bivouac on September 15, 2010, 12:36:23 PM
Evening all.

Been away for two days, so no followup by me. Sorry.

Ian. No. So far I am at the planning stage. This power outage has me worried so I am not spending money for the moment. How do you think using "Feedhold" will help?

The idea of accurate limited switches has my interest. Has anyone tried using "Linear variable differential transformer" LVDT techniques. These have been around from before my young days as an engineer and seem to have a lot going for them. This afternoon I made up an example and it can resolve better than anything that I have to measure with. It would be good to know if others have any experience with them.

How do I find the wiki referred to for OEM codes?

Thanks all.

Dennis
Title: Re: How to recover from power interuption?
Post by: Hood on September 15, 2010, 12:39:26 PM
How do I find the wiki referred to for OEM codes?

Thanks all.

Dennis
Support tab at the top of the page.
Hood
Title: Re: How to recover from power interuption?
Post by: stirling on September 16, 2010, 05:15:45 AM
How do you think using "Feedhold" will help?
Well that was the point of my question really. I think there's quite a bit more to it than JUST doing a feedhold when power outs. "How to recover from power interruption" in my view is the second part of your problem. "What to do when power is first interrupted" is the first part.

a question: How long can your UPS keep the system running i.e. making chips.

I think this is crucial and will determine to some extent your options down the line.

Ian
Title: Re: How to recover from power interuption?
Post by: Bivouac on September 16, 2010, 11:16:13 AM
Hi Ian

As the UPS is at the moment it should run for about half an hour using the internal battery pack. That should be enough to park every thing. More battery is possible, but, I think it is necessary to maintain holding torque on the motors until power is restored. We have had no power for 26 hours on one occasion; most are for around 8 to 9 hours. The short interuptions; maybe when a baboon has tripped a breaker last only 5 to 10 minutes. For these short interuption I need the UPS to carry the load until power is restored. So, I would not start the park and shutdown routine until the interuption had been in effect for 15 minutes.

Dennis
Title: Re: How to recover from power interuption?
Post by: BR549 on September 16, 2010, 11:34:26 AM
Looking at your accuracy requirements the ONLY way to do this is to run a UPS   "AND " a very large battery bank. That way there is NO interuption of cut.

With your resolution requirement you cannot even "stop" the program without effecting the finish cut. SO the machine must remain running thru the  power outage.

It would be very hard to create a macro to be to retract the cutting bit in a method that would not cause harm to a finish cut. COULD be done but very complicated.

(;-) TP
Title: Re: How to recover from power interuption?
Post by: Bivouac on September 16, 2010, 11:42:51 AM
Thanks for that BR549

It may come to that. Starting to look at using a generator as a back-up for the back-up.

Dennis
Title: Re: How to recover from power interuption?
Post by: stirling on September 16, 2010, 01:54:32 PM
Looking at your accuracy requirements the ONLY way to do this is to run a UPS "AND " a very large battery bank. That way there is NO interuption of cut.

With your resolution requirement you cannot even "stop" the program without effecting the finish cut. SO the machine must remain running thru the  power outage.

It would be very hard to create a macro to be to retract the cutting bit in a method that would not cause harm to a finish cut. COULD be done but very complicated.

(;-) TP

I think you're being a bit "absolutist" here Terry. ONE other way - which kinda kills your ONLY way - is to do what Bivouac has said and incorporate a generator with the UPS.

But I would go further and say that with a bit of thought it wouldn't be be that hard to "park" the spindle, shut down and resume without losing position. The advantage of this of course is that you don't have to then expend on a generator.

I suggested a basic scheme earlier on. I'd be interested in why you think that wouldn't be a reasonable starting point.

Title: Re: How to recover from power interuption?
Post by: BR549 on September 16, 2010, 06:49:13 PM
OK Lets look at the resolution and expected accuracy. This tells me that he is working on extreme detailed parts. AND the time to run tells me it is an expensive part.

I have never seen a machine cutting a finish cut at that resolution that IF you did a feed hold you would not mar, ding, scratch, gouge a finish cut.

Also With certain Material you cannot interupt a cut and have the bit rub the same spot it creates a hard spot which will never finish cut correctly

NOw as the outage events are random we have to assume the worst case senario, it is in a finish cut mode. Experiance tell us IF you plan on the worst case senario the rest will take care of itself(;-)

Try it and you will see what I mean.

 The only way out would be to RUN continuously or wait FOR a point in the program that the bit is NOT cutting material. That could be hours into a long program. The only way to be absolutly sure is to STOP in a tool change senario. OR use built in hold routines throughout the program AND the programs may not  HAVE either.

SO where do you stop????      IF you are just cutting cheap plywood on a router please disregard the above

The generator is just a replacement for a large battery bank same thing only different name. Still a stored energy source(;-) He mentioned a UPS so they need a battery and it is EASY to add more capacity, add more batteries. LONG outages yep he has the answer UPS and a backup generator

Now from past Power company Power Quality Tech experiance you need to run the generator for at least 30 minute AFTER the outage event occurs. AS they bring the system back on line there could be cascade failures that will trip the system back off again. So give the system plenty of time to stabilize before you transfer back to grid power.

As to the stop restart part that would very simple to do ONCE you have the machine stopped. We do that all the time in plasma to stop and check the consumables in long cuts. There is a routine to start restart on this forum somewhere that we use to do it.

That is just my experience in outage recovery technics, Your mileage may vary (;-)
Title: Re: How to recover from power interuption?
Post by: stirling on September 17, 2010, 04:02:31 AM
OK Lets look at the resolution and expected accuracy. This tells me that he is working on extreme detailed parts. AND the time to run tells me it is an expensive part.

I have never seen a machine cutting a finish cut at that resolution that IF you did a feed hold you would not mar, ding, scratch, gouge a finish cut.

Also With certain Material you cannot interupt a cut and have the bit rub the same spot it creates a hard spot which will never finish cut correctly

NOw as the outage events are random we have to assume the worst case senario, it is in a finish cut mode. Experiance tell us IF you plan on the worst case senario the rest will take care of itself(;-)

Try it and you will see what I mean.

OK I'll ignore all of the above because these are the very reasons for my suggested approach. Did you read it?

The only way out would be to RUN continuously or wait FOR a point in the program that the bit is NOT cutting material.
More or less what I've proposed. Did you read it?

That could be hours into a long program. The only way to be absolutly sure is to STOP in a tool change senario. OR use built in hold routines throughout the program AND the programs may not  HAVE either.
could be? - may not? - try asking the OP before you right things off. I've always found that an analysis of the problem usually precedes the selection or otherwise of possible solutions - just me from years of software engineering  ::)

The only way out would be to RUN The generator is just a replacement for a large battery bank same thing only different name. Still a stored energy source(;-) He mentioned a UPS so they need a battery and it is EASY to add more capacity, add more batteries. LONG outages yep he has the answer UPS and a backup generator
You only know this because I asked - it was only a few posts ago you ASSUMED it was capacitor based and had less than a second of capacity. Like I said - ask some questions of the OP.

Now from past Power company Power Quality Tech experiance
Ah Terry - is there any job you havn't been an expert in?

As to the stop restart part that would very simple to do ONCE you have the machine stopped. We do that all the time in plasma to stop and check the consumables in long cuts. There is a routine to start restart on this forum somewhere that we use to do it.
One minute you're on about the need for extreme accuarcy and the next your quoting me PLASMA?

That is just my experience in outage recovery technics, Your mileage may vary (;-)
There's clearly no limit to your expertise. I'll get back in my box - Over to you Terry for finding the solution for the OP.
Title: Re: How to recover from power interuption?
Post by: BR549 on September 17, 2010, 04:18:10 PM
AH Stirling if you had only walked in my shoes for the last 40 years.(;-)

Seems to me the OP was asking general questions so he got general answers. Sorry they did not agree with yours.

Capacitor based??? Every CNC i have ever worked on is capacitor based including the computer. SO yes the answer was appropriate. The caps will keep the machine alive for a very short time including the drives. So if you have enought capacity you can RIDE through Blinks and never miss a beat.

BUT without a UPS running you will NEVER have time to capture the positional and program stop data before the caps drain and ALL is lost.

As far as capturing the stop/restart data that is a piece of cake AND I gave an example of what we do it with on a daily basis running a plasma cutter.

nOW is there a type machine I have not used/ ran/ worked on/ rebuilt  NOT MANY. I spent about 40 years in the trenches USING/fixing  those machines. Sorry you missed out on that experience.

BUT I tell you what, you seemed to be a smart fellow I will just sit on my experince and let you handle all the technical parts AS I am probably not qualified or experineced enought to handle MACH stuff after all it IS fairly complicated with all that Gcode stuff (;-)

BUt i would suggest spending about 5 years learning Mach inside and out before you sugar coat and try to convince people that Mach can do anything. It can't it has it limitations. YOU of all people should know that seeing the things you have tried and did not work as you thought it should. YOu need to push EVERY button try EVER code Try every possible combination of code and hardware. Then scratch your head a figure out WHY all teh things that SHOULD work DON'T

Yous guys are a HOOT, and some of the worlds best armchair quaterbacks ,  

Have a good one, (;-) TP
Title: Re: How to recover from power interuption?
Post by: BR549 on September 17, 2010, 10:58:37 PM
Stirling just make sure you explain what happens during an outage IF you get caught in the bad cycle where the Gen is spooling down after resyncing to the grid and a power outage reoccurs and the transfer attempts to transfer BACK to the Genset with it spoiling down. Especially IF you are below 10hzs on the genset.

(;-) TP
Title: Re: How to recover from power interuption?
Post by: stirling on September 18, 2010, 05:51:04 AM
I'm guessing I'm off your Birthday invite list then Terry.

Ian
Title: Re: How to recover from power interuption?
Post by: BR549 on September 18, 2010, 09:54:24 AM
Stirling Not Hardly, you are still invited to the party  I very much admire you for your programming skills. That is something I cannot do, don't have the logic gene it takes to do it.

(;-) TP
Title: Re: How to recover from power interuption?
Post by: BR549 on September 18, 2010, 12:43:57 PM
IAN , if you want to work on a mach PORS (power outage recovery system) It would be GREAT new Mach feature for the mach tool box.

You are the VB code geewiz,  (;-) TP
Title: Re: How to recover from power interuption?
Post by: BR549 on September 18, 2010, 01:12:08 PM
IAN many years back this is how we did it in mach. I dug up part of the discussion. It was a very simple approach back then. It does assume you had accurate home switches.

Re: Power outage macro –


We call it the ARF ( Auto Restart FUnction)

It is a piece of code that runs in the Macropump

Every () minutes open the Restart file and write the Program name AND current
line. Close file


If you need to restart press the ARF button which

REFHOME the machine, Retreives the LAST notes from the restart file, Loads the
program by name, Then update the RUN FROM HERE line # DRO and restarts the
program run by use of the "RUN FROM HERE" function.

The only thing the operator has to do is when the RFH screen pops up is verify
there is a clear path for the machine to return to the restart position and
press Cycle Start.


***********

http://www.machsupport.com/forum/index.php/topic,15042.0.html
THis is the link to the stop restart function with the plasma.   NOTE plasma does NOT require you to use the RFH feature so it may NOT apply to very situation. In plasma all you need to do is set next line and fire the torch then RUN.

Also note that teh RFH does not work worth a hoot with plasma when using the Zref routines for THC.


IF you have some more ideas throw the  bone on the porch and us old dawgs will chew on it for a while


Just a thought, (;-) TP

Title: Re: How to recover from power interuption?
Post by: stirling on September 19, 2010, 03:45:53 AM
I'll add it onto my list Terry  :)