You are an expert at summarizing long articles. Proceed to summarize the following text:

You are an expert at summarizing long articles. Proceed to summarize the following text: 
CROSS REFERENCE TO RELATED APPLICATIONS 
     This is a continuation-in-part of U.S. patent application Ser. No. 08/752,810 filed Nov. 20, 1996, now U.S. Pat. No. 5,887,654. 
    
    
     BACKGROUND OF THE INVENTION 
     This invention relates generally to the field of performing downhole functions in a well, and is particularly applicable to downhole well completion tools. 
     In completing a product recovery well, such as in the oil and gas industry, several downhole tasks or functions must generally be performed with tools lowered through the well pipe or casing. These tools may include, depending on the required tasks to be performed, perforating guns that ballistically produce holes in the well pipe wall to enable access to a target formation, bridge plug tools that install sealing plugs at a desired depth within the pipe, packer-setting tools that create a temporary seal about the tool and valves that are opened or closed. 
     Sometimes these tools are electrically operated and are lowered on a wireline, configured as a string of tools. Alternatively, the tools are tubing-conveyed, e.g. lowered into the well bore on the end of multiple joints of tubing or a long metal tube or pipe from a coil, and activated by pressurizing the interior of the tubing. Sometimes the tools are lowered on cables and activated by pressurizing the interior of the well pipe or casing. Other systems have also been employed. 
     Typically, ballistic tools are not “armed” (i.e., not yet configured to fire upon receipt of a hydraulic or electric stimulus) until just before being placed in the well, in order to avoid accidental firings at surface. Once armed, very high safety standards must be maintained to avoid potentially deadly premature firings until the tool is safely below ground. Even after the armed tool has been lowered into the well, an accidental, premature firing can result in costly well damage. 
     SUMMARY OF THE INVENTION 
     In one aspect of the invention, a downhole device for performing a function in a well has a series of dedicated hydro-mechanical locks that prevent occurrence of the function until desired. The hydro-mechanical locks are each capable of being released directly by a respective elevated hydraulic activating pressure condition and are constructed and arranged for sequential operation such that a lock in the series cannot be released until after the hydraulic pressure conditions required to release any preceding locks in the series have occurred. 
     In one embodiment, the device is in the form of a self-contained downhole device for controlling the occurrence of the function. In this embodiment, the device includes a downhole housing and a port in the housing in hydraulic communication with a remote hydraulic pressure source via the well by pressure-transmitting structure such as casing or tubing in the well. 
     In some embodiments, the series of hydro-mechanical locks comprises a set of one or more displaceable elements associated with a common hydraulic actuator, the actuator constructed and arranged to displace the elements sequentially. In some cases the actuator is responsive to an increase in hydraulic pressure to advance to engage an element and to a subsequent decrease in hydraulic pressure to move the element from a locking to an unlocking position. 
     Some preferred embodiments contain one or more of the following features: the actuator has a piston; the actuator is biased to a first position by a spring, the activating pressure condition moving the actuator to a second, activated position; the elements each comprises a ring, which in some embodiments is resiliently radially compressed, in a locking, unreleased condition, within a first bore of a lock housing; the actuator has a ring gripper for moving the ring; the lock housing has a second, larger bore into which the ring is movable to an unlocking, released position; the ring has an engageable cam surface; the gripper has a finger with a cam surface for engaging the cam surface of the ring, and in some instances a lift formation for lifting any previously released rings to enable the disengagement of an engaged ring from the cam surface of the gripper. 
     In some embodiments of the invention, the spring comprises a compressible fluid which is compressed in a first chamber by said actuator. In a particularly useful arrangement, the device also has an orifice for restricting a flow of the compressible fluid from the first chamber to a second chamber, enabling the respective activating pressure condition to cause the actuator to compress the fluid in the first chamber. In some instances the device has a third chamber and a floating piston disposed between the second and third chambers, the floating piston containing a one-way check valve constructed to enable flow from the second chamber to the third chamber. In this arrangement the construction of the floating piston advantageously enables oil within the first and second chambers to expand at higher temperatures. 
     In another embodiment, the series of hydro-mechanical locks comprises one or more valves, each valve arranged to be openable to a released condition in response to an activating hydraulic pressure condition. In a current arrangement, each of the valves has an inlet to receive activating pressure, and an outlet blocked from the inlet until after a respective activating pressure condition has occurred. In some arrangements, the outlet of the valve is hydraulically connected to an inlet of a pressure-activated tool. 
     In a particularly useful configuration, the valve is constructed to delay opening for a predetermined amount of time after the occurrence of a respective activating pressure condition. This delay time enables the inlet pressure condition to the valve to be reduced before the valve opens. In this manner, the opening of an upper valve in a series of valves does not immediately open a lower valve, enabling a series of such valves to be independently, sequentially opened by a sequence of activating pressure conditions. 
     Some configurations may have one or more of the following features: the valve has a piston that forces a fluid through an orifice to expose a port to open the valve; and the delay time between the occurrence of the respective activating pressure condition and the opening of the valve is determined at least in part by the size of the orifice. 
     In another aspect of the invention, a string of tools for performing downhole functions in a well includes a number of functional sections arranged in a physical order within the string along a string axis. At least one of the sections has a downhole device with a series of dedicated hydro-mechanical locks that prevent occurrence of an associated function. The hydro-mechanical locks are each capable of being released directly by a respective elevated hydraulic activating pressure condition, and are constructed and arranged for sequential operation such that a lock in the series cannot be released until after the hydraulic pressure condition required to release any preceding lock in the series has occurred. 
     In a particularly advantageous configuration, at least three of the sections each have such a device, the string being arranged and configured to perform the functions in an order other than the physical order of the sections along the axis. 
     In a preferred embodiment, the sections are constructed to enable activating pressure conditions to be applied simultaneously to all of the functional sections having the devices. 
     In some useful configurations, a first device in the string has at least one fewer dedicated hydro-mechanical locks than a second device in the string, the actuating pressure conditions for releasing the locks of the first and second devices being correlated such that pairs of locks of the first and the second devices are simultaneously released, resulting in all locks being released in the first device while a lock remains unreleased in the second device. 
     In another aspect of the invention, a downhole device for performing a function in a well has an actuator arranged to move along an axis in response to an activating pressure condition, an operator engageable by the actuator and arranged to cause the function to be performed when moved, and at least one lock element engageable by the actuator and disposed axially, in a locking position, between the actuator and the operator. The actuator is constructed and arranged to, in response to a first activating pressure condition, engage and move the lock element to a non-locking position, and subsequently, in response to a second activating pressure condition, to engage and move the operator to cause the function to be performed. 
     In a preferred embodiment, there are more than one lock element arranged in series between the actuator and the operator. In a preferred configuration, the axial motion of the actuator is limited by the lock element. 
     In another aspect of the invention, a method of performing a sequence of downhole functions in a well comprises lowering a string of tools, the string having a functional section associated with each function. At least two of the sections each has a device with a series of dedicated hydro-mechanical locks that prevent occurrence of the function associated with the section. The hydro-mechanical locks are capable of being released directly by a respective elevated hydraulic activating pressure condition, and are constructed and arranged for sequential operation, such that a lock in the series cannot be released until after the hydraulic pressure conditions required to release any preceding locks in the series have occurred. 
     The method also comprises applying a sequence of activating hydraulic pressure conditions to the string, a given activating pressure condition releasing an associated lock in predetermined functional sections having unreleased locks. The functional sections having the devices each perform their associated functions in response to an activating pressure condition occurring after all locks of the section have been released. 
     In some embodiments, at least one of the functional sections perforates the well in response to an activating pressure condition occurring after all locks within the section have been released. 
     In a particularly useful embodiment, the method includes maintaining the axial position of the string within the well while applying the sequence of activating pressure conditions to set a bridge plug at a first axial well position, set a packer at a second axial well position, and subsequently perforate the well between the first and second axial well positions. 
     In another embodiment, the method of the invention further includes maintaining the axial position of the string within the well while sequentially performing functions associated with at least three sections of the string. The sections include an upper section, a lower section, and at least one middle section, according to positions along an axis of the string. The method further includes performing the associated functions in an order starting with the function associated with a middle section. 
     In another embodiment, at least three of the sections are operated by the sequence of activating hydraulic pressure conditions to perforate upper, lower and middle well zones, the middle zone being perforated first. 
     In yet another useful embodiment, the method further comprises applying an elevated downhole test pressure. The test pressure releases an associated lock in each functional section having unreleased locks without causing any functional section to perform its associated function. 
     According to another aspect of the invention, a string of tools for performing a downhole function in a well includes a locking tool and a ballistic tool connected to the locking tool. The locking tool has a series of dedicated hydro-mechanical locks arranged to prevent arming of the ballistic tool, the locks capable of being released directly by a respective elevated hydraulic activating pressure condition. The locks are constructed and arranged for sequential operation, such that a lock in the series is not released until after the hydraulic pressure conditions required to release any preceding locks in the series have occurred, with the last released lock arranged to arm the ballistic tool when released. 
     In one embodiment, the ballistic tool is constructed to, once armed, delay performing the downhole function for a predetermined amount of time (preferably, between about 1 and 20 minutes) after the occurrence of a subsequent activating hydraulic pressure condition. 
     Preferably, the last released lock is constructed to, upon release, expose the ballistic tool to hydraulic pressure for receiving subsequent activating hydraulic pressure conditions. 
     The ballistic tool includes, in some configurations, a displaceable ballistic member and a target ballistic member. The last released lock is constructed to, upon release, enable the displaceable ballistic member to be hydraulically displaced toward the target ballistic member to arm the ballistic tool. 
     According to yet another aspect of the invention, a ballistic downhole tool is constructed to be armed downhole. The tool includes first and second ballistic components for transferring an internal detonation to fire the tool, the ballistic components initially being separated by a sufficient distance to inhibit the detonation transfer. The first ballistic component includes a piston. The tool also includes a lock arranged to retain the first ballistic component in its initial position, and a hydraulically activatable actuator adapted to release the lock to enable the first ballistic component to be moved toward the second ballistic component by hydraulic pressure acting against the piston, to arm the tool. 
     In some embodiments, the first ballistic component includes a firing pin and a length of detonator cord, the second ballistic component having a trigger charge arranged to be ignited by the detonator cord of the first ballistic component with the tool in an armed condition. 
     In the presently preferred embodiment, the first ballistic component also includes a release piston arranged to be moved by hydraulic pressure to release the firing pin. 
     The tool may also include a seal arranged to isolate the release piston from hydraulic pressure with the tool in an unarmed condition, to provide an additional safeguard against accidental firing. 
     Although surface accidents can generally be avoided by proper care and safety procedures, the invention can provide an additional level of safety by enabling the tool to be initially lowered into the well unarmed and subsequently armed only just before firing. Costly premature firings in the well can also be avoided. By keeping the ballistics unarmed while traversing the well, accidental firings caused by faulty seals and unexpected hydraulic conditions can also be avoided. 
     The invention advantageously enables functional tools to be arranged in a single downhole string in any desired physical order, and activated in any preselected sequence. This flexibility can be very useful, e.g. for perforating multiple zones in a well starting with a middle zone, or for perforating between a preset bridge plug and preset packer. 
     The invention also enables various arrangements of downhole tasks to be performed with a single string of tools, requiring only one trip down the well, thereby saving substantial rig time. Used in a triggering mechanism to trigger a detonation to activate a tool, the invention also advantageously avoids potential failure modes of electrically-activated downhole equipment and associated safety risks, by employing only hydro-mechanical downhole equipment for triggering detonations. 
     In embodiments in which the device according to the invention is employed to activate a tool, the activation of any of the tools in the string advantageously does not depend upon the previous activation of any other tools in the string, such that the failure of one tool to properly perform does not inhibit the operation of the other tools in the string. 
     These and other advantageous features are realized in equipment that is simple, reliable and relatively inexpensive. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a diagrammatic illustration of a tool string in a well, according to the invention; 
     FIG. 2 illustrates a series of activating pressure cycles applied to a tool string; 
     FIGS. 3A through 3D schematically illustrate the sequential operation of four tools in a string, according to the invention; 
     FIG. 3E schematically illustrates a lock-releasing actuator, according to the invention; 
     FIG. 4 is a cross-sectional view of a hydraulically programmable firing head in a fill sub, according to a first embodiment; 
     FIG. 5 is an enlarged view of area  5  in FIG. 4; 
     FIGS. 6A through 6E diagrammatically illustrate the operation of part of the lock-releasing mechanism of FIG. 4; 
     FIG. 7 is a schematic illustration of a functional section of a string of tools, according to a second embodiment; and 
     FIG. 8 is a functional illustration of a pilot valve of the embodiment of FIG.  7 . 
     FIG. 9 shows a third embodiment, in which the lock-releasing actuator is configured to arm the tool. 
     FIG. 9A illustrates the embodiment of FIG. 9 in an armed condition. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     Referring to FIG. 1, a hydraulic programmable firing head  10  according to the invention is part of a string  12  of tools that can be arranged in various ways to selectively enable multiple operations to be performed in a well  20 , such as setting a bridge plug or packer, pressure testing the plug or packer, and perforating one or more zones, all in one trip in the well. The hydraulic programmable firing head  10  is adapted to initiate a downhole event when a preprogrammed number of activating pressure cycles have been received. As shown in FIG. 1, firing head  10  is capable of triggering a perforating gun  14 , a packer-setting tool  16 , a bridge plug tool  18 , or any other downhole tool configured to perform a task. Multiple hydraulically programmable firing heads  10  can be used in a string  12  of tools, as shown, to trigger any desired arrangement of tools along the axis  21  of the string in any preprogrammed order. 
     String  12  is lowered into well  20  on the end of tubing  22 , which is filled with hydraulic fluid. Hydraulic communication lines  26 , also filled with fluid, hydraulically connect each firing head  10  in parallel communication with a remote source  27  via tubing  22 , such that pressure applied at the top end of tubing  22  will be applied simultaneously to all firing heads  10  in the string. By provision of a suitably selected number of dedicated hydro-mechanical locks in the respective firing heads  10 , the firing heads are each capable of being mechanically configured to trigger an associated tool or event upon receipt of a preselected number of actuation cycles. The firing heads can be set up such that a series of pressure cycles received by string  12  through tubing  22  sequentially triggers each tool or event in a predetermined order, without dependence on the arrangement of tools along the string, as described below. 
     As indicated in FIG. 1, string  12  comprises a series of self-contained functional sections A, B and C, with each section comprising a firing head  10  and an associated tool, e.g. a perforating gun  14 , a packer-setting tool  16 , a bridge plug tool  18 , or other tool. The firing heads  10  are each connected to their associated tools with safety spacers  28  and sealed ballistic transfers  30 . Sections A, B and C are separated from each other by blank subs  32 . Each firing head  10  triggers its associated tool ballistically by initiating a detonation which is transferred to the associated tool through the sealed ballistic transfers  30  and safety spacer  28 . Ballistic transfers  30  and blank subs  32  are internally sealed to prevent fluid from flowing between firing heads  10 , safety spacers  16  and tools. FIG. 1 illustrates the relative placement of each component in string  12 , and does not represent their proportionate dimensions. String  12  may consist of any number of functional sections A, B, C, and so forth, each comprising a firing head and an associated tool as described above, each in parallel hydraulic communication with tubing  22 . Each associated tool may be configured to perform a downhole task, such as perforating the well, setting a packer or bridge plug, operating a valve, moving a sleeve, or otherwise causing a desired event to occur within the well. 
     Referring to FIG. 2, string  12  of FIG. 1 is activated from the surface of the well by a series of activating pressure cycles  40  applied to the fluid within tubing  22 . Each pressure cycle spans at least 3 or 4 minutes in the current configuration, and consists of a pressure increase  42  from hydrostatic pressure P H  to activation pressure (P A  which is sufficiently above the pressure required to activate each firing head  10 ), a pressure dwell period  44  at activation pressure P A , and a pressure decrease  46 . In the current configuration, as described below, pressure cycles  40  are separated by a length of time sufficient to return internal chamber pressures to hydrostatic pressure P H . 
     Referring also to FIGS. 3A through 3D, string  12  is diagrammatically illustrated as a series of four functional sections A, B, C and D, although it should be understood that the string may consist of more or fewer self-contained sections. The firing head in each section contains a series of dedicated, hydraulically-releasable hydro-mechanical locks, each unreleased lock illustrated as an X in the figures. As initially placed in the well (FIG.  3 A), the firing head of section A contains two such locks; section B, one lock; section C, four locks; and section D, three locks. Each pressure cycle  40  within tubing  22  releases one lock X from the firing head of each section. If a given section has no unreleased locks X, a next pressure cycle  40  causes the firing head in the given section to trigger its associated event or tool. After a first pressure cycle  40  (FIG.  3 B), section A contains only one unreleased lock X, section B has no more unreleased locks, and sections C and D have three and four unreleased locks X, respectively. After a second pressure cycle  40 , one additional lock X in each of sections A, C and D has been released, such that section A has no more unreleased locks and sections C and D have two and one, respectively (FIG.  3 C). Because section B had no unreleased locks upon receipt of the second pressure cycle, the firing head in section B triggers its associated tool or event due to the second pressure cycle  40 . A third pressure cycle  40  causes the firing head in section A to trigger and leaves only one unreleased lock X in section C, none in D (FIG.  3 D). Not shown, a fourth pressure cycle causes the firing head in section D to trigger, and a fifth pressure cycle causes the firing head in section C to trigger. 
     In certain preferred embodiments the hydro-mechanical locks are of the form of displaceable elements, and a common actuator is employed. Referring for example to FIG. 3E, a firing head or other downhole device includes a hydraulically actuated gripper  300  that is moved axially to engage an operator  302  by the application of an activating pressure. At least one lock element  304  is positioned between gripper  300  and operator  302 , such that cycles of application and release of activating pressure sequentially move lock elements  304  to a released position, exposing operator  302  for engagement upon the next application of activating pressure. As shown, a selected number of lock elements  304  are placed in series, such that successive pressure cycles release respective lock elements until the release of the last unreleased lock element in the series exposes operator  302  for engagement. Once engaged, operator  302  is subsequently moved by a reduction in pressure, causing an associated downhole function to be performed. 
     In particularly preferred embodiments, the displaceable lock elements are c-rings that are sequentially moved by a common downhole actuator in the form of a hydraulic piston and a device for engaging the rings, referred to herein as a ratchet grip. The details of this implementation will now be described. 
     Referring to FIG. 4, the hydraulic programmable firing head  10  is located within a fill sub  50 , which is attached to the rest of the string of downhole equipment by a fill sub connector  52  at the top end of the fill sub, and a lower adaptor  54  at the bottom end of the fill sub. Firing head  10  comprises the internal components housed within fill sub  50  and lower adaptor  54  below level A in the figure. Fill sub connector  52  has upper and lower threaded ports,  56  and  58 , respectively, for attaching hydraulic communication lines  26  (FIG.  1 ). To configure firing head  10  to be the upper firing head in the string, upper threaded port  56  is typically plugged and an upper tubing connector (not shown) provides a hydraulic connection, internal to the string, between annulus  60  within fill sub connector  52  and tubing  22 , while lower threaded port  58  provides a hydraulic connection, through an external communication line  26  (FIG.  1 ), to the upper threaded port  56  of a lower firing head fill sub connector  52 . To configure the firing head to be the lowest in the string of multiple firing heads, lower threaded port  58  is plugged, and upper threaded port  56  provides a hydraulic link to the upper firing heads and tubing  22 . In middle firing heads, both the upper and lower ports  56  and  58  are employed for communication (FIG.  1 ). 
     Annulus  62  within fill sub  50  is open to annulus  60  within fill sub connector  52 , and runs the length of the firing head, which is axially retained in the fill sub with threaded rod  64 , jam nut  66 , sleeve  67  and threaded collar  68 . Upper head  70 , piston guide  72 , oil chamber housing  74 , oil chamber extension  76 , stem guide  78 , piston housing  80 , housings connector  82 , ratchet housing  84 , release sleeve housing  86  and detonator adaptor  88  are stationary components of firing head  10 , all connected in succession by threaded joints. Within piston guide  72  is a movable piston  90  connected to the upper end of a long operating stem  92  that runs through the center of the firing head, the lower end of the operating stem being connected to a movable, ring-grasping ratchet grip  94 . Operating stem  92  is supported along its length by guide bearing surfaces  96  in oil chamber extension  76 , stem guide  78  and housings connector  82 , such that it is free to move axially with movable piston  90 . A compression spring  98  around stem  92  within oil chamber housing  74  biases piston  90  and ratchet grip  94  in an upward direction. Side ports  100  in housings connector  82  and release sleeve housing  86  permit hydraulic flow between fill sub annulus  62  and oil chambers  102  and  104 , respectively. Fluid can also flow from chamber  104  in release sleeve housing  86  to chamber  106  in ratchet housing  84 , through an open inner bore of release sleeve operator  108 , such that activation pressure is always applied, through fill sub annulus  62 , to the lower end of stem  92 , and acts, along with compression spring  98 , to bias piston  90  in an upward direction to an inactivated position against a stop shoulder  109  of piston guide  72 . Compression chamber  110 , which extends through oil chamber housing  74  and oil chamber extension  76 , is pre-filled, through a subsequently plugged side port  116  in piston guide  72 , with a highly compressible silicon oil, typically compressible to about 10% by volume. Middle chamber  112  is also pre-filled with compressible silicon oil through a subsequently plugged side port  118  in stem guide  78 , and is hydraulically connected to compression chamber  110  through flow-restricting orifices  114  in stem guide  78 . Two jets, i.e. Lee Visco brand jets with an effective flow resistance of 243,000 lohms, are employed as orifices  114 . One-way ball check valves  120  in a floating piston  122 , located in piston housing  80 , allow the silicon oil in chambers  110  and  112  to expand at higher well temperatures, without allowing upward flow from chamber  102  to chamber  112 . Because floating piston  122  is free to move axially within piston housing  80 , the pressure in chamber  112  is always substantially equal to the pressure in chamber  102 , which is the same as annulus  62  pressure, e.g. tubing pressure. Flow-restricting orifices  114  slowly allow the pressure in compression chamber  110  to equalize to tubing pressure, such that by the time the string is in place at the bottom of a well, chambers  104 ,  106 ,  102 ,  112  and  110  are all substantially at hydrostatic tubing pressure. 
     A rupture disk  124  in upper head  70  prevents the pressurization of upper piston chamber  126  until the pressure in annulus  62  exceeds a level required to rupture disk  124 , ideally higher than the maximum expected hydrostatic pressure (P H  in FIG.  2 ), and lower than activation pressure P A . Upon the application of a first activation pressure cycle  40  (FIG.  2 ), rupture disk  124  ruptures, and tubing pressure is applied to the top of piston  90 , moving piston  90 , stem  92  and ratchet grip  94  downward against compression spring  98 . Tubing pressure, which is substantially equal to the pressure in chamber  112 , must be increased rapidly so that the piston  90  can move downward and compress the silicon oil in compression chamber  110 . If the tubing pressure is increased too slowly, flow across orifices  114  will equalize the pressure between chambers  112  and  110 , bringing the silicon oil in chamber  110  up to tubing pressure, in which case tubing pressure will be effectively applied to both sides of piston  90 , and no activating motion of the piston and ratchet grip  94  will occur. Tubing pressure is typically increased to a level P A  of about 3500 psi above hydrostatic pressure P 4  in about 30 seconds, moving piston  90  and ratchet grip  94  downward, and held at that level for a dwell time of two to three minutes before being released. When the tubing pressure is released back to hydrostatic level P H , piston  90  and ratchet grip  94  are returned to their initial dispositions by the pressure of the compressed silicon oil in compression chamber  110  and compressed spring  98 . Between successive pressure cycles, chambers  104 ,  106 ,  102 ,  112  and  110  all return substantially to hydrostatic pressure. 
     Referring to FIG. 5, ratchet grip  94  has resilient fingers  140  with outwardly facing cam surfaces  142  at their distal ends. Attached to and moving with ratchet grip  94  is a ratchet grip guide  144  with an outwardly-facing lip about its lower end with an upper surface  145 . C-ring locks  146 , preferably made of spring metal, such as beryllium copper, each has a vertical slit  148  and an inwardly-facing engageable cam surface  150 . The C-rings are disposed, in a locked position, in a small bore  152  of ratchet housing  84 , the small bore having a smaller diameter than the free outer diameter of the c-ring so that the c-rings are in a radially compressed state. Friction between the facing surfaces of c-ring  146  and bore  152  retain the c-ring locks in their locked position. 
     To release the top c-ring lock  146  in a series of locks, the top c-ring lock  146  is moved to a released or unlocked position in a large bore  154  of ratchet housing  84  by an axial motion cycle of ratchet grip  94 . In response to the application of an elevated activating pressure condition in a pressure cycle, as described above, ratchet grip  94  and ratchet grip guide  144  are forced downward until a lower surface  156  of ratchet grip guide  144  contacts an upper stop surface  158  of the top c-ring lock  146 , and cam surfaces  142  of resiliently bendable fingers  140  snap outwardly underneath cam surface  150  of the upper c-ring in an engaging, ring-grasping motion. When tubing pressure is released and ratchet grip  140  moves upward to its initial position, work is performed as the grasped c-ring  146  is pulled upward, against resistance to its movement, into large bore  154 . Once within the large bore, spring force in the compressed c-ring opens the ring to a relatively relaxed state, disengaging c-ring  146  from ratchet grip fingers  140  and releasing the c-ring to be supported by lower bore shoulder  160  of ratchet housing  84 . 
     Further lock-releasing actions of this embodiment are illustrated diagrammatically in FIGS. 6A through 6E. In FIG. 6A, the top c-ring lock  146   a  has been released as described above. Upon the application of a second elevated pressure condition, lip surface  145  of ratchet grip guide  144  resiliently expands the released c-ring  146   a  as the ratchet grip guide passes downward into small bore  152  with ratchet grip  94 , where lower grip guide surface  156  contacts the upper stop surface  158  of the next unreleased c-ring  146   b , with cam surfaces  142  of fingers  140  engaging cam surface  150  of ring  146   b  (FIG.  6 B). When the activating pressure is reduced a second time, engaged c-ring  146   b  is raised into large bore  154  by ratchet grip  94 , and released c-ring  146   a  is raised from shoulder  160  by ratchet grip guide  144 , making room for engaged ring  146   b  to be released into large bore  154  (FIG.  6 C). This lock-releasing process is continued with further pressure cycles until all c-ring locks  146  are released. In a presently preferred configuration, the actuator and bores are sized in length to receive up to five preset c-rings in small bore  152 . 
     Referring also to FIG. 4, below the lowest c-ring lock  146 , e.g. the last in the series, is the release sleeve operator  108  which has a stem section  162  connected to a release sleeve  164  disposed about a firing pin housing  166  enclosing a firing pin  168 . Release sleeve operator  108  also has an upper section  170  with an inwardly-facing, engageable cam surface  172 , similar to cam surface  150  of split c-rings  146 . After all installed c-rings  146  have been released, a next pressure cycle forces ratchet grip  94  downward to engage release sleeve operator  108  (FIG.  6 D). Upon a subsequent reduction of tubing pressure, engaged release sleeve operator  108  is pulled upward by ratchet grip  94 , thereby raising release sleeve  164  (FIG.  6 E). An o-ring  175  within ratchet housing  84  provides some frictional resistance to the motion of release sleeve operator  108 . 
     Until release sleeve  164  is raised from its initial position, firing pin  168  is retained axially by four balls  174  within holes in firing pin housing  166  (FIG.  4 ), which is connected to detonator adapter  88 . The balls extend inwardly into a circumferential groove  176  in the firing pin, retaining the firing pin against axial motion. O-rings  178  around firing pin  168  keep tubing pressure, to which the upper end of the firing pin is subjected, from detonator cavity  180 . When the release sleeve is pulled upward, the downward force of tubing pressure on firing pin  168  accelerates the firing pin downward, forcing balls  174  out of groove  176 . The firing pin strikes a detonator  182  at the lower end of detonator cavity  180 , which ignites a length of detonator cord  184  (primacord), which in turn ignites a trigger charge  186  at the lower end of the hydraulically programmable firing head  10 . 
     Although the configuration shown is sized to contain up to five c-ring locks  146 , the effective number of locks in the section may be increased by appropriate dimensional adjustments and the addition of more c-rings to ratchet housing  84 , or by adding a lock extension kit to the bottom of the firing head that contains additional locks and a lock-releasing actuator that is blocked from receiving activating elevated pressure conditions until release sleeve  164  is raised. 
     Referring to FIG. 7, a second embodiment of the invention employs pilot valves  200  as locks within a functional string section  202 . A series of time-delay pilot valves  200  is located, in some cases, immediately above a pressure-activated firing head  204  of an associated tool  205  as shown. In other cases, the lowest valve  200  in the series is constructed to directly release a firing pin to activate tool  205 . 
     Referring also to FIG. 8, each pilot valve  200  functions as a time-delay lock that is activated when the pressure at an inlet  206  of the respective valve reaches an activation level, e.g. P A  in FIG.  2 . Once activated, the valve is arranged to open, after a given time delay, hydraulic communication between inlet  206  and outlet  210  by moving a piston  208  to expose a port  212  to inlet pressure. Until the pressure at inlet  206  reaches an activating level, piston  208  is held in a port-blocking position by shear pins  214 . A cavity  216  above piston  208  is filled with a viscous fluid, and is connected to an initially unpressurized cavity  218  through an orifice  220 . Valve  200  is configured such that inlet  206  may be exposed to hydrostatic pressure, e.g. a pressure level of P H  in FIG. 2, without shearing pin  214 . Once the shear pin has been severed by an application of an activating pressure condition, e.g. a pressure of level P A , inlet pressure will move piston  208  upward, forcing the fluid in cavity  216  through orifice  218  at a predeterminable rate. Consequently, port  212  will be exposed when an o-ring seal  222  on piston stem  224  has moved upward an appropriate distance, the timing of the exposure of port  212  being a function of the predeterminable rate of motion of piston  208 . During the relatively slow motion of piston  208 , which is preferably configured to expose port  212  after about five minutes from the application of the respective activating pressure condition, the inlet pressure, e.g. tubing pressure in the present embodiment, is lowered to a hydrostatic level low enough that successive valves connected to outlet  210  will not be immediately activated by the exposure of port  212 , but high enough to continue to force piston  208  upward. The rate of motion of piston  208  under a given pressure condition can be adjusted by changing the size of orifice  220  or the viscosity of the fluid in cavity  216 . A rupture disk may be used in series with orifice  220  in lieu of shear pins  214 . In some embodiments, piston stem  224  of the lowest lock valve  200  in a series of lock valves is directly attached to a release sleeve operator, such as release sleeve operator  108  in FIG. 4, to release a firing pin when moved. 
     As connected in series in FIG. 7, the outlet  210  of each pilot valve  200  is in hydraulic communication with the inlet  206  of the next-lowest valve, with the outlet  210  of the lowest valve being in communication with firing head  204 . In this embodiment, the tubing pressure is increased to activate the upper unreleased pilot valve lock  200  in the string section  202 , and, according to the predetermined pressure cycle parameters as described above, is returned to a hydrostatic level before the activated pilot valve opens, such that by the time the activated valve opens to permit tubing pressure to be applied to the next lowest valve  200 , tubing pressure has been reduced to a non-activating level. Upon the next application of activating pressure, the next lowest unreleased valve  200  will be activated, and so forth, until firing head  204  is in hydraulic communication with tubing pressure. At this point, another application of a pressure cycle activates the firing head, initiating the detonation of a trigger charge within the firing head. 
     In either embodiment heretofore described, the detonation of a trigger charge in the firing head ( 10  and  204  in FIGS. 1 and 7, respectively) ignites subsequent detonations through sealed ballistic transfers  30  and safety spacer  28 , igniting a detonation within a tool associated with the firing head to perform a desired downhole function. As previously described, it should also be realized that the lock-releasing mechanisms described above can be employed to perform many other downhole tasks than the detonation of a trigger charge within a firing head. The release sleeve operator  108  of the first embodiment may, for instance, open a valve or move a functional sleeve instead of releasing a firing pin. 
     Hydraulic lines  26 , shown in FIGS. 1 and 7, are preferably positioned external to the functional tools  14 ,  16 ,  18  and  212  of the string. This positioning is particularly advantageous when the tools include perforating guns  14 , to reduce the possibility of the lines being damaged by the firing of the charges of the gun and opening an undesirable path between the activation fluid in tubing  22  and the annulus of the well. Lines  26  are positioned next to guns  14  such that the detonation of the gun will not damage the lines. 
     In other embodiments, as when tubing  22  of FIG. 1 is replaced with a cable, the firing heads are activated by cyclically pressurizing the well annulus around the tool string. If the well will also be pressurized for other purposes with the tool string downhole, e.g. for bridge plug or flow testing, extra locks, e.g. c-rings  146  in FIG. 4 or pilot valves  200  in FIG. 7, can be added to appropriate sections of the tool string for release by the test pressure cycles. Thus activation of the tool string by the test pressure, or advancement from the desired function sequence, can readily be avoided. 
     Although, as in the present embodiments, the locks of the invention are preferred to be constructed to be released at about the same activation pressure level P A  (FIG.  2 ), various locks within the string of tool sections may be built to release at different pressure levels, further increasing the in-field flexibility of the invention to perform various downhole function sequences. 
     Referring to FIG. 9, the lock releasing mechanism discussed above with respect to FIGS. 6A-6E is employed to arm firing head  300  in response to a series of pressure cycles received from the surface of the well through coiled tubing  22  (FIG.  1 ). Instead of releasing a firing pin when pulled upward by ratchet grip  94   a , release sleeve  302  releases a piston assembly  304  which contains a firing pin  306  and a length of detonator cord  308 . Until piston assembly  304  is released, it is retained within piston guide  310  with the lower end of its detonator cord separated from a trigger charge  312  by a safe distance, G, of about 8 inches, to prohibit a premature detonation of detonator cord  308  from igniting the trigger charge. In other words, the tool is not armed until the piston assembly is released. When released, piston assembly  304  is released and is forced downward, under hydraulic pressure, to arm the tool (i.e., to place detonator cord  308  close enough to trigger charge  312  to transfer a subsequent detonation). 
     Piston assembly  304  includes a piston  314  which extends upward through piston guide  310  and carries two o-ring seals  316 . A groove  318  at the distal end of piston  314  and corresponding holes in guide  310  retain four balls such as those illustrated retaining firing pin  168  in FIGS. 6A-6E. At its lower end, piston  314  is attached to an upper tube  320  through an upper bulkhead  322 . The upper tube is connected to a lower tube  324  through a detonator housing  326  which retains detonator cord  308  and a detonator  182   a . Firing pin  306  is arranged to strike detonator  182   a  when release sleeve  164   a  has been pulled upward by a release piston  328  which is sealed against the bore of upper tube  320  by twin o-rings  330 . A cavity  332  above release piston  328  initially contains a viscous fluid, and is connected to an initially empty cavity  334  through an orifice  220   a . As hydraulic pressure is applied against the lower surface of release piston  328  through a hole  336  in the wall of upper tube  320 , a pin  338  is sheared and the release piston slowly forces the viscous fluid from cavity  332  through orifice  220   a . As was discussed above with respect to the time delay lock of FIG. 8, the rate of the upward motion of the release piston is predetermined by selecting the fluid viscosity, orifice size, and activation pressure. If no delay is desired, the viscous fluid may be left out of cavity  332 . When the release piston has moved upward a sufficient distance, firing pin  306  is released and strikes detonator  182   a , igniting detonator cord  308 . 
     Except for the upper portion of piston  314 , all of piston assembly  304  is disposed in a sealed chamber  340  within an isolation spacer  342  which initially isolates the piston assembly from hydraulic pressure. At its lower end, isolation spacer  342  is connected to a lower bulkhead  344 , from which a cord tube  346  extends upward into lower tube  324  to support trigger charge  312 . A pair of o-ring seals  348  provide a sliding seal between cord tube  346  and lower tube  324 . A crushable element  350  (e.g., a coil of stainless steel tubing) at the upper end of lower bulkhead  344  helps to cushion the impact of the lower tube when the piston assembly is released. FIG. 9A shows the position of the piston assembly after it has been released and forced downward to arm the tool. 
     In operation, a predetermined number of hydraulic activation cycles are applied to sequentially release all of the locking rings  146 . Upon the next application of sufficient pressure, ratchet grip  94   a  moves downward to engage release sleeve  302 . When the pressure has been reduced, the ratchet grip pulls the release sleeve upward to release the balls in groove  318  and force piston assembly  304  downward. As soon as seals  316  have cleared the inner bore of piston guide  310 , chamber  340  in isolation spacer  342  is charged to tubing pressure. At this point, the piston assembly has moved down far enough to arm the tool. If pin  338  has been sized to be sheared by hydrostatic pressure levels, release piston  328  will immediately begin moving upward to release firing pin  306  to initiate the ballistic operation of the tool. Alternatively, pin  338  may be sized to require a subsequent application of activation pressure to be sheared. 
     Firing head  300  may be placed in series with other tools in a string, as tool A in FIG. 3A, for example, and operated in a predetermined sequence with the other tools, as predetermined by the number of releasable locks in each tool. Two firing heads in series may be configured with an equal number of locks and ballistically linked to the same tool to provide a redundant firing mechanism for a particularly critical downhole operation. The upper firing head may be configured to fire last, and to detonate an automatic release mechanism that drops the expended tools into the rat hole. 
     Other embodiments and advantages will be evident to those skilled in the art, and are within the scope of the following claims.

Summary:
A downhole device and method for performing a function in a well. The device has a series of dedicated hydro-mechanical locks that prevent occurrence of an associated function. The hydro-mechanical locks are capable of being released directly by a respective elevated hydraulic activating pressure condition, and are constructed and arranged for sequential operation, such that a successive lock in the series cannot be released until after the hydraulic pressure condition required to release the preceding lock in the series has occurred. In a preferred embodiment, an actuator sequentially releases each lock in a series of locks, subsequently moving an operator to perform a function. A preferred implementation employs a series of resilient rings movable, sequentially, from a locking to an unlocking position, and a common actuator that effects these movements. Multiple devices of this construction are advantageously arranged in a string of tools to perform functions in any preprogrammed order by pre-selecting the number of locks in each device. In one embodiment, movement of the operator arms an associated ballistic tool downhole. Methods of performing sequences of downhole well functions are also disclosed.