Abstract:
Drug delivery system comprising a housing and expelling means with a first rotational member adapted to rotate relative to the housing corresponding to a set and/or expelled dose and comprising a first force transmitting surface, a second rotational member adapted to rotate relative to the housing corresponding to a set and/or expelled dose and comprising a second force transmit ting surface. At least portions of the first and second force transmitting surfaces are adapted to engage each other during setting and/or expelling of a dose, and the first rotational member including the force transmitting surface is formed from a polymeric material containing magnetic particles, wherein the polymeric material having been magnetized to provide a magnet producing a magnetic spatial field. Hereby a spatial magnetic field is generated which varies corresponding to the rotational movement of the first rotation al member.

Description:
[0001]    The present invention relates to devices and methods allowing detection of movements of a moveable element. In a specific aspect, the invention addresses the issue of detecting movement of a member indicative of the operation of a drug delivery expelling mechanism. 
       BACKGROUND OF THE INVENTION 
       [0002]    In the disclosure of the present invention reference is mostly made to drug delivery devices comprising a threaded piston rod driven by a rotating drive member, such devices being used e.g. in the treatment of diabetes by delivery of insulin, however, this is only an exemplary use of the present invention. 
         [0003]    Drug Injection devices have greatly improved the lives of patients who must self-administer drugs and biological agents. Drug Injection devices may take many forms, including simple disposable devices that are little more than an ampoule with an injection means or they may be durable devices adapted to be used with pre-filled cartridges. Regardless of their form and type, they have proven to be great aids in assisting patients to self-administer injectable drugs and biological agents. They also greatly assist care givers in administering injectable medicines to those incapable of performing self-injections. 
         [0004]    Performing the necessary insulin injection at the right time and in the right size is essential for managing diabetes, i.e. compliance with the specified insulin regimen is important. In order to make it possible for medical personnel to determine the effectiveness of a prescribed dosage pattern, diabetes patients are encouraged to keep a log of the size and time of each injection. However, such logs are normally kept in handwritten notebooks, from the logged information may not be easily uploaded to a computer for data processing. Furthermore, as only events, which are noted by the patient, are logged, the note book system requires that the patient remembers to log each injection, if the logged information is to have any value in the treatment of the patient&#39;s disease. A missing or erroneous record in the log results in a misleading picture of the injection history and thus a misleading basis for the medical personnel&#39;s decision making with respect to future medication. Accordingly, it may be desirable to automate the logging of ejection information from medication delivery systems. 
         [0005]    Though some injection devices integrate this monitoring/acquisition mechanism into the device itself, e.g. as disclosed in US 2009/0318865, WO 2010/052275 and WO 2010/112575, most devices of today are without it. The most widely used devices are purely mechanical devices either durable or prefilled. The latter devices are to be discarded after being emptied and so inexpensive that it is not cost-effective to build-in electronic data acquisition functionality in the device it-self. Addressing this problem a number of solutions have been proposed which would help a user to generate, collect and distribute data indicative of the use of a given medical device. 
         [0006]    For example, WO 2007/107564 describes an electronic “add-on” module adapted to be attached to and measure signals generated by a standard mechanical pen device, the module relying on e.g. the sounds inherently produced by such a device during operation. 
         [0007]    Alternatively, in order to provide pre-filled drug delivery devices which more reliably allow detection of an out-dosed amount of drug, it has been proposed to modify such pre-filled drug delivery devices to provide them with structures making them more suitable for cooperation with external detection means, thereby providing more reliable and accurate determination of out-dosed drug amounts. For example, PCT/EP2012/069729 discloses a drug delivery device in which a rotating piston rod is provided with a magnet allowing an add-on logging module to detect the axial position of the magnet by means of 3D magnetometers. 
         [0008]    Having regard to the above, it is an object of the present invention to provide components, devices and methods allowing reliable and cost-effective detection of movements generated by a drug delivery expelling mechanism in order to determine amounts of expelled drug. 
       DISCLOSURE OF THE INVENTION 
       [0009]    In the disclosure of the present invention, embodiments and aspects will be described which will address one or more of the above objects or which will address objects apparent from the below disclosure as well as from the description of exemplary embodiments. 
         [0010]    Thus, in a first aspect of the invention a drug delivery system is provided, comprising a housing, a drug-filled cartridge or means for receiving a drug-filled cartridge, the cartridge comprising an axially displaceable piston and a distal outlet portion, and drug expelling means. The drug expelling means comprises dose setting means allowing a user to set a dose of drug to be expelled, an axially displaceable piston rod adapted to move the piston of a cartridge in a distal direction to thereby expel drug from the cartridge, a first rotational member adapted to rotate relative to the housing corresponding to a set and/or expelled dose and comprising a first force transmitting surface, and a second rotational member adapted to rotate relative to the housing corresponding to a set and/or expelled dose and comprising a second force transmitting surface. At least portions of the first and second force transmitting surfaces are adapted to engage each other during setting and/or expelling of a dose, the first rotational member comprising a magnet producing a magnetic spatial field which varies corresponding to the rotational movement of the first rotational member, wherein the first rotational member is fully formed from a polymeric material containing magnetic particles, the polymeric material having been magnetized to provide a magnet producing the magnetic spatial field. By this arrangement an existing element in a drug delivery device can be manufactured in a magnetisable polymer compound allowing a sufficiently powerful yet in-expensive magnet to be provided without additional modifications. 
         [0011]    Alternatively, the first rotational member formed from a polymeric material containing magnetic particles has not been magnetized to provide a magnet producing a magnetic spatial field, this corresponding to the below-described system comprising first and second per se identical drug delivery devices, not all the devices comprising an active magnet. 
         [0012]    The first force transmitting surface may be adapted to transmit a torque during setting of a dose or expelling of drug from a cartridge. 
         [0013]    In an exemplary embodiment the first rotational member rotates during dose expelling. Alternatively, the first rotational member may be adapted to rotate bi-directionally during dose setting and resetting, i.e. corresponding to a dose size being set and subsequently adjusted by the user. By the latter arrangement the detected movement of the first rotational member could be used to control an electronic display showing the dose being set. 
         [0014]    The drug delivery system of the invention may comprise a sensor assembly comprising one or more sensors each adapted and arranged to measure the generated magnetic field corresponding to at least two axes, and processor means configured to determine on the basis of measured values a rotational position of the indicator element. The processor means may be configured to determine on the basis of measured values a property related to the amount of drug expelled from a reservoir by the expelling means. The sensors and the processor means may be provided in the form of a logging module releasably attachable to a drug delivery device comprising the cartridge or being adapted to receive a cartridge. 
         [0015]    In a further aspect a drug delivery system is provided comprising a first and a second drug delivery device, each drug delivery device comprising a housing, a drug-filled cartridge or means for receiving a drug-filled cartridge, the cartridge comprising an axially displaceable piston and a distal outlet portion, and drug expelling means. The drug expelling means comprises dose setting means allowing a user to set a dose of drug to be expelled, an axially displaceable piston rod adapted to move the piston of a cartridge in a distal direction to thereby expel drug from the cartridge, a first rotational member adapted to rotate relative to the housing corresponding to a set and/or expelled dose and comprising a first force transmitting surface, and a second rotational member adapted to rotate relative to the housing corresponding to a set and/or expelled dose and comprising a second force transmitting surface. At least portions of the first and second force transmitting surfaces are adapted to engage each other during setting and/or expelling of a dose. The first rotational member including the force transmitting surface is formed at least in part of a polymeric material containing magnetic particles. In the system the first drug delivery device comprises a first rotational member which has not been magnetized to provide a magnet producing a magnetic spatial field, and the second drug delivery device comprises a first rotational member in which the polymeric material has been magnetized to provide a magnet producing a magnetic spatial field, whereby a spatial magnetic field is generated which varies corresponding to the rotational movement of the first rotational member. 
         [0016]    By providing a drug delivery device comprising a rotating member manufactured in a material containing magnetic particles, it can be decided at the assembly state whether or not the member should be magnetized, this allowing two different versions of a given drug delivery device to be manufactured using identical parts, merely the assembly steps being different, i.e. performing or leaving out the magnetizing step. 
         [0017]    As used herein, the term “insulin” is meant to encompass any drug-containing flowable medicine capable of being passed through a delivery means such as a cannula or hollow needle in a controlled manner, such as a liquid, solution, gel or fine suspension, and which has a blood glucose controlling effect, e.g. human insulin and analogues thereof as well as non-insulins such as GLP-1 and analogues thereof. In the description of exemplary embodiments reference will be made to the use of insulin. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0018]    In the following the invention will be further described with reference to the drawings, wherein 
           [0019]      FIG. 1A  shows a system comprising a logging module mounted on a pen device, 
           [0020]      FIG. 1B  shows the system of  FIG. 1A  with the pen cap removed, 
           [0021]      FIG. 2  shows in an exploded view the components of the pen device of  FIG. 1A , 
           [0022]      FIGS. 3A and 3B  show in sectional views an expelling mechanism in two states, 
           [0023]      FIGS. 4A-4C  show components of the pen device of  FIG. 2 , 
           [0024]      FIG. 5  shows a component of the pen device of  FIG. 2 , 
           [0025]      FIG. 6  shows components of a first embodiment of a logging module, 
           [0026]      FIG. 7  shows components of a second embodiment of a logging module, 
           [0027]      FIG. 8  shows a component of a third embodiment of a logging module mounted on a pen, 
           [0028]      FIG. 9  shows a component of a fourth embodiment of a logging module, and 
           [0029]      FIG. 10  shows an exterior view of the fourth embodiment of a logging module. 
       
    
    
       [0030]    In the figures like structures are mainly identified by like reference numerals. 
       DESCRIPTION OF EXEMPLARY EMBODIMENTS 
       [0031]    When in the following terms such as “upper” and “lower”, “right” and “left”, “horizontal” and “vertical” or similar relative expressions are used, these only refer to the appended figures and not necessarily to an actual situation of use. The shown figures are schematic representations for which reason the configuration of the different structures as well as their relative dimensions are intended to serve illustrative purposes only. When the term member or element is used for a given component it generally indicates that in the described embodiment the component is a unitary component, however, the same member or element may alternatively comprise a number of sub-components just as two or more of the described components could be provided as unitary components, e.g. manufactured as a single injection moulded part. When it is defined that members are mounted axially free to each other it generally indicates that they can be moved relative to each other, typically between defined stop positions whereas when it is defined that members are mounted rotationally free to each other it generally indicates that they can be rotated relative to each other either freely or between defined stop positions. The terms “assembly” and “subassembly” do not imply that the described components necessary can be assembled to provide a unitary or functional assembly or subassembly during a given assembly procedure but is merely used to describe components grouped together as being functionally more closely related. 
         [0032]      FIGS. 1A and 1B  show a drug delivery assembly  1  with a pen-formed drug delivery device  200  on which an electronic logging module  100  is mounted. In the present context the device represents a “generic” drug delivery device providing a specific example of a device in combination with which embodiments of the present invention is intended to be used or which can form a basis for aspects of the present invention. 
         [0033]    More specifically, the logging module  100  comprises a body portion  110  and a ring-formed portion  120  allowing the module to be mounted on a generally cylindrical pen device. The body portion comprises electronic circuitry and sensor means allowing a property to be detected representing an amount of drug being expelled from the cartridge, as well as a display  130  for displaying data to a user. The ring portion comprises coupling means allowing the module to be securely and correctly mounted on the pen body. The electronic circuitry and the sensor means may in part be arranged in the ring portion. Exemplary embodiments of a logging module will be described with reference to  FIGS. 6-10  below. 
         [0034]    The pen device  200  comprises a cap part  207  and a main part having a proximal body or drive assembly portion with a housing  201  in which a drug expelling mechanism is arranged or integrated, and a distal cartridge holder portion in which a drug-filled transparent cartridge  213  with a distal needle-penetrable septum is arranged and retained in place by a non-removable cartridge holder attached to the proximal portion, the cartridge holder having openings allowing a portion of the cartridge to be inspected as well as distal coupling means  215  allowing a needle assembly to be releasably mounted. The cartridge is provided with a piston driven by a piston rod forming part of the expelling mechanism and may for example contain an insulin, GLP-1 or growth hormone formulation. A proximal-most rotatable dose member  280  serves to manually set and reset (i.e. adjust) a desired dose of drug shown in display window  202  and which can then be expelled when the button  290  is actuated. Depending on the type of expelling mechanism embodied in the drug delivery device, the expelling mechanism may comprise a spring as in the shown embodiment which is strained during dose setting and then released to drive the piston rod when the release button is actuated. Alternatively the expelling mechanism may be fully manual in which case the dose member and the actuation button moves proximally during dose setting corresponding to the set dose size, and then is moved distally by the user to expel the set dose. 
         [0035]    As appears,  FIG. 1  shows a drug delivery device of the pre-filled type, i.e. it is supplied with a pre-mounted cartridge and is to be discarded when the cartridge has been emptied. In alternative embodiments the drug delivery device may be designed to allow a loaded cartridge to be replaced, e.g. in the form of a “rear-loaded” drug delivery device in which the cartridge holder is adapted to be removed from the device main portion, or alternatively in the form of a “front-loaded” device in which a cartridge is inserted through a distal opening in the cartridge holder which is non-removable attached to the main part of the device. 
         [0036]    As the invention relates to a module adapted to be secured to and interact with a drug delivery device, as well as a drug delivery device allowing such an interaction, an exemplary embodiment of such a device will be described for better understanding of the invention. 
         [0037]      FIG. 2  shows an exploded view of the pen-formed drug delivery device  200  shown in  FIG. 1 . More specifically, the pen comprises a tubular housing  201  with a window opening  202  and onto which a cartridge holder  210  is fixedly mounted, a drug-filled cartridge  213  being arranged in the cartridge holder. The cartridge holder is provided with distal coupling means  215  allowing a needle assembly  216  to be releasably mounted, proximal coupling means in the form of two opposed protrusions  211  allowing a cap  207  to be releasably mounted covering the cartridge holder and a mounted needle assembly, as well as a protrusion  212  preventing the pen from rolling on e.g. a table top. In the housing distal end a nut element  225  is fixedly mounted, the nut element comprising a central threaded bore  226 , and in the housing proximal end a spring base member  208  with a central opening is fixedly mounted. A drive system comprises a threaded piston rod  220  having two opposed longitudinal grooves and being received in the nut element threaded bore, a ring-formed piston rod drive element  230  rotationally arranged in the housing, and a ring-formed clutch element  240  which is in rotational engagement with the drive element (see below), the engagement allowing axial movement of the clutch element. The clutch element is provided with outer spline elements  241  adapted to engage corresponding splines  204  (see  FIG. 4B ) on the housing inner surface, this allowing the clutch element to be moved between a rotationally locked proximal position, in which the splines are in engagement, and a rotationally free distal position in which the splines are out of engagement. As just mentioned, in both positions the clutch element is rotationally locked to the drive element. The drive element comprises a central bore with two opposed protrusions  231  in engagement with the grooves on the piston rod whereby rotation of the drive element results in rotation and thereby distal axial movement of the piston rod due to the threaded engagement between the piston rod and the nut element. The drive element further comprises a pair of opposed circumferentially extending flexible ratchet arms  235  adapted to engage corresponding ratchet teeth  205  arranged on the housing inner surface. The drive element and the clutch element comprise cooperating coupling structures rotationally locking them together but allowing the clutch element to be moved axially, this allowing the clutch element to be moved axially to its distal position in which it is allowed to rotate, thereby transmitting rotational movement from the dial system (see below) to the drive system. The interaction between the clutch element, the drive element and the housing will be shown and described in greater detail with reference to  FIGS. 4A and 4B . 
         [0038]    On the piston rod an end-of-content (EOC) member  228  is threadedly mounted and on the distal end a washer  227  is rotationally mounted. The EOC member comprises a pair of opposed radial projections  229  for engagement with the reset tube (see below). 
         [0039]    The dial system (or dose setting system) comprises a ratchet tube  250 , a reset tube  260 , a scale drum  270  with an outer helically arranged row of dose numerals, a user-operated dial member  280  for setting a dose of drug to be expelled, a release button  290  and a torque spring  255  (see  FIG. 3 ). The reset tube is mounted axially locked inside the ratchet tube but is allowed to rotate a few degrees (see below). The reset tube comprises on its inner surface two opposed longitudinal grooves  269  adapted to engage the radial projections  229  of the EOC member, whereby the EOC can be rotated by the reset tube but is allowed to move axially. The clutch element is mounted axially locked on the outer distal end portion of the ratchet tube  250 , this providing that the ratchet tube can be moved axially in and out of rotational engagement with the housing via the clutch element. The dial member  280  is mounted axially locked but rotationally free on the housing proximal end, the dial ring being under normal operation rotationally locked to the reset tube (see below), whereby rotation of dial ring results in a corresponding rotation of the reset tube and thereby the ratchet tube. The release button  290  is axially locked to the reset tube but is free to rotate. A return spring  295  provides a proximally directed force on the button and the thereto mounted reset tube. The scale drum  270  is arranged in the circumferential space between the ratchet tube and the housing, the drum being rotationally locked to the ratchet tube via cooperating longitudinal splines  251 ,  271  and being in rotational threaded engagement with the inner surface of the housing via cooperating thread structures  203 ,  273 , whereby the row of numerals passes the window opening  203  in the housing when the drum is rotated relative to the housing by the ratchet tube. The torque spring is arranged in the circumferential space between the ratchet tube and the reset tube and is at its proximal end secured to the spring base member  208  and at its distal end to the ratchet tube, whereby the spring is strained when the ratchet tube is rotated relative to the housing by rotation of the dial member. A ratchet mechanism with a flexible ratchet arm  252  is provided between the ratchet tube and the clutch element, the latter being provided with an inner circumferential teeth structures  242 , each tooth providing a ratchet stop such that the ratchet tube is held in the position to which it is rotated by a user via the reset tube when a dose is set. In order to allow a set dose to be reduced a ratchet release mechanism  262  is provided on the reset tube and acting on the ratchet tube, this allowing a set dose to be reduced by one or more ratchet increments by turning the dial member in the opposite direction, the release mechanism being actuated when the reset tube is rotated the above-described few degrees relative to the ratchet tube. 
         [0040]    Having described the different components of the expelling mechanism and their functional relationship, operation of the mechanism will be described next with reference mainly to  FIGS. 3A and 3B . 
         [0041]    The pen mechanism can be considered as two interacting systems, a dose system and a dial system, this as described above. During dose setting the dial mechanism rotates and the torsion spring is loaded. The dose mechanism is locked to the housing and cannot move. When the push button is pushed down, the dose mechanism is released from the housing and due to the engagement to the dial system, the torsion spring will now rotate back the dial system to the starting point and rotate the dose system along with it. 
         [0042]    The central part of the dose mechanism is the piston rod  220 , the actual displacement of the plunger being performed by the piston rod. During dose delivery, the piston rod is rotated by the drive element  230  and due to the threaded interaction with the nut element  225  which is fixed to the housing, the piston rod moves forward in the distal direction. Between the rubber piston and the piston rod, the piston washer  227  is placed which serves as an axial bearing for the rotating piston rod and evens out the pressure on the rubber piston. As the piston rod has a non-circular cross section where the piston rod drive element engages with the piston rod, the drive element is locked rotationally to the piston rod, but free to move along the piston rod axis. Consequently, rotation of the drive element results in a linear forwards movement of the piston. The drive element is provided with small ratchet arms  234  which prevent the drive element from rotating clockwise (seen from the push button end). Due to the engagement with the drive element, the piston rod can thus only move forwards. During dose delivery, the drive element rotates anti-clockwise and the ratchet arms  235  provide the user with small clicks due to the engagement with the ratchet teeth  205 , e.g. one click per unit of insulin expelled. 
         [0043]    Turning to the dial system, the dose is set and reset (i.e. adjusted) by turning the dial member  280 . When turning the dial, the reset tube  260 , the EOC member  228 , the ratchet tube  250  and the scale drum  270  all turn with it. As the ratchet tube is connected to the distal end of the torque spring  255 , the spring is loaded. During dose setting, the arm  252  of the ratchet performs a dial click for each unit dialed due to the interaction with the inner teeth structure  242  of the clutch element. In the shown embodiment the clutch element is provided with 24 ratchet stops providing 24 clicks (increments) for a full 360 degrees rotation relative to the housing. The spring is preloaded during assembly which enables the mechanism to deliver both small and large doses within an acceptable speed interval. As the scale drum is rotationally engaged with the ratchet tube, but movable in the axial direction and the scale drum is in threaded engagement with the housing, the scale drum will move in a helical pattern when the dial system is turned, the number corresponding to the set dose being shown in the housing window  202 . 
         [0044]    The ratchet  252 ,  242  between the ratchet tube and the clutch element  240  prevents the spring from turning back the parts. During resetting, the reset tube moves the ratchet arm  252 , thereby releasing the ratchet click by click, one click corresponding to one unit IU of insulin in the described embodiment. More specifically, when the dial member is turned clockwise, the reset tube simply rotates the ratchet tube allowing the arm of the ratchet to freely interact with the teeth structures  242  in the clutch element. When the dial member is turned counter-clockwise to adjust the currently set dose, the reset tube interacts directly with the ratchet click arm forcing the click arm towards the centre of the pen away from the teeth in the clutch, thus allowing the click arm on the ratchet to move “one click” backwards due to torque caused by the loaded spring. 
         [0045]    To deliver a set dose, the push button  290  is pushed in the distal direction by the user as shown in  FIG. 3B . The reset tube  260  decouples from the dial member and subsequently the clutch element  240  disengages the housing splines  204 . Now the dial mechanism returns to “zero” together with the drive element  230 , this leading to a dose of drug being expelled. It is possible to stop and start a dose at any time by releasing or pushing the push button at any time during drug delivery. A dose of less than 5 IU normally cannot be paused, since the rubber piston is compressed very quickly leading to a compression of the rubber piston and subsequently delivery of insulin when the piston returns to the original dimensions. 
         [0046]    The EOC feature prevents the user from setting a larger dose than left in the cartridge. The EOC member  228  is rotationally locked to the reset tube, which makes the EOC member rotate during dose setting, resetting and dose delivery, during which it can be moved axially back and forth following the thread of the piston rod. When it reaches the proximal end of the piston rod a stop is provided, this preventing all the connected parts, including the dial member, from being rotated further in the dose setting direction, i.e. the now set dose corresponds to the remaining drug content in the cartridge. 
         [0047]    The scale drum  270  is provided with a distal stop surface adapted to engage a corresponding stop surface on the housing inner surface, this providing a maximum dose stop for the scale drum preventing all the connected parts, including the dial member, from being rotated further in the dose setting direction. In the shown embodiment the maximum dose is set to 80 IU. Correspondingly, the scale drum is provided with a proximal stop surface adapted to engage a corresponding stop surface on the spring base member, this preventing all the connected parts, including the dial member, from being rotated further in the dose expelling direction, thereby providing a “zero” stop for the entire expelling mechanism. 
         [0048]    To prevent accidental over-dosage in case something should fail in the dialing mechanism allowing the scale drum to move beyond its zero-position, the EOC member serves to provide a security system. More specifically, in an initial state with a full cartridge the EOC member is positioned in a distal-most axial position in contact with the drive element. After a given dose has been expelled the EOC member will again be positioned in contact with the drive element. Correspondingly, the EOC member will lock against the drive element in case the mechanism tries to deliver a dose beyond the zero-position. Due to tolerances and flexibility of the different parts of the mechanism the EOC will travel a short distance allowing a small “over dose” of drug to be expelled, e.g. 3-5 IU of insulin. 
         [0049]    The expelling mechanism further comprises an end-of-dose (EOD) click feature providing a distinct feedback at the end of an expelled dose informing the user that the full amount of drug has been expelled. More specifically, the EOD function is made by the interaction between the spring base and the scale drum. When the scale drum returns to zero, a small click arm  206  on the spring base is forced backwards by the progressing scale drum. Just before “zero” the arm is released and the arm hits a countersunk surface on the scale drum. 
         [0050]    The shown mechanism is further provided with a torque limiter in order to protect the mechanism from overload applied by the user via the dial member. This feature is provided by the interface between the dial member and the reset tube which as described above are rotationally locked to each other. More specifically, the dial member is provided with a circumferential inner teeth structure  281  engaging a number of corresponding teeth arranged on a flexible carrier portion  261  of the reset tube. The reset tube teeth are designed to transmit a torque of a given specified maximum size, e.g. 150-300 Nmm, above which the flexible carrier portion and the teeth will bend inwards and make the dial member turn without rotating the rest of the dial mechanism. Thus, the mechanism inside the pen cannot be stressed at a higher load than the torque limiter transmits through the teeth. 
         [0051]    In  FIG. 4A  the clutch element, the drive element and the housing (in partial) are shown in the dose setting state, and in  FIG. 4B  the same components are shown in the expelling state. As appears, the piston rod on which the drive element is arranged and the ratchet tube on which the clutch element is mounted are not shown. To better show the structures provided on the inner surface of the housing  FIG. 4C  shows a partial clutch element  240  arranged in the housing  201 . 
         [0052]    The inner surface of the housing  201  comprises a circumferential ring-formed array of axially oriented spline elements  204  protruding into the interior, each having a pointed distal end  209 , as well as a circumferential ring-formed array of one-way ratchet teeth  205 . The inner surface further comprises a male helical thread  203  adapted to engage the female helical thread  273  on the scale drum  270 . A distal circumferential groove is formed to engage and mount the nut element  225 . The clutch element  240  comprises an inner circumferential ring-formed array of ratchet teeth  242  adapted to engage the ratchet arm  252  on the ratchet tube  250 , and an outer circumferential ring-formed array of axially oriented spline elements  241  adapted to engage the spline elements  204  of the housing as well as the coupling slots in the drive element (see below), each spline having a pointed proximal end  243 . The drive element  230  comprises a pair of opposed coupling portions each comprising two proximally extending skirt portions  232  between which an axially extending coupling slot  233  is formed, the slot being adapted to engage a portion of the clutch element spline elements. In this way the engaging surfaces serve to transmit a rotational force and thereby torque from the clutch element to the drive element in the expelling state. The drive element further comprises a pair of opposed circumferentially extending flexible ratchet arms adapted to engage the ring-formed array of one-way ratchet teeth  205 . During dose delivery, the drive element rotates anti-clockwise and the ratchet arms  235  also provide the user with small clicks due to the engagement with the ratchet teeth  205 , e.g. one click per unit of insulin expelled. In the shown embodiment 24 ratchet teeth are provided corresponding to 15 degrees rotation per unit of insulin. The central bore of the drive element comprises two opposed protrusions  231  adapted to engage with the axially oriented grooves on the piston rod. 
         [0053]    In the dose setting state shown in  FIG. 4A  the spline elements  241  of the clutch element are in engagement with the spline elements  204  of the housing thereby rotationally locking the clutch element relative to the housing. As can be seen from  FIG. 4A  a group of clutch spline elements are received in the corresponding coupling slot with a slight rotational play. In the expelling state shown in  FIG. 4B  the spline elements  241  of the clutch element are moved distally out of engagement with the spline elements  204  of the housing thereby allowing rotation of the clutch element relative to the housing. As can be seen from  FIG. 4B  the group of clutch spline elements are now received in the corresponding coupling slot without rotational play. 
         [0054]      FIG. 5  shows a detail view of the clutch element  240  showing the above-described inner circumferential ring-formed array of ratchet teeth  242  and the outer circumferential ring-formed array of axially oriented spline elements  241 . As appears, the spline elements are not arranged equidistantly on the ring but in groups, the groups comprising two opposed coupling groups  245  serving as the coupling means engaging the coupling slots  233 . Whereas thus only some of the spline elements serve as coupling means between the clutch element and the drive element they all serve as coupling means between the clutch element and the housing splines  204 . In the shown embodiment the entire clutch element is manufactured in magnetic material, preferably moulded using a magnetic polymeric compound containing grinded magnetic particles, as this technique can produce intricate shapes. A large magnetic volume is subsequently obtained by magnetizing the whole part, thereby cost-effectively obtaining a larger external magnetic field with a larger magnetic moment than what would be possible with just a region of the part being magnetic, or by mounting a number of separate magnets to a rotational member as disclosed in WO 2010/112575. 
         [0055]    In the shown example a magnetic dipole oriented in the A-A direction is created. As will be described in greater detail below, the magnetic field can be detected by an electronic sensing component and the information be used to determine the rotational and/or axial position of the clutch element in relation to the sensor means. 
         [0056]    Turning to  FIG. 6  an exemplary embodiment of a logging module  300  is shown in which the exterior housing has been removed to reveal the interior design and components. The module comprises a main body  310  having a generally cylindrical ring-formed portion  320  and a body portion  330  on which the majority of the electronic circuitry is mounted. The main body is formed from a LDS polymer whereby integrated wiring can be achieved by using LDS (Laser Direct Structuring) technology, the polymer having elastic properties allowing a flexible hinged latch to be formed integrally. More specifically, the ring portion comprises an inner generally cylindrical surface adapted to be mounted on a drug delivery pen body as well as a pair of opposed integrally formed coupling structures  321  adapted to engage corresponding coupling structures on the pen device to assure that the module is securely mounted. The distal part of the ring portion has a larger diameter with a distally facing circumferential stop surface  329  adapted to receive and engage a cap when the module is mounted on a pen, see below. 
         [0057]    The inner ring surface and the outer pen body surface may be in either form-fitting or slight frictional engagement. Each coupling structure on the module is in the form of a latch  322  having a proximal portion  323 , a distal portion  324  and a central portion, the latter being pivotally connected to the ring portion by integrally formed flexible hinges  325  allowing the latch to pivot a few degrees corresponding to a circumferential axis. By this arrangement the distal latch portion moves inwards when the proximal portion is moved outwards and vice versa. The proximal latch portions each comprises an inner protrusion  326  adapted to engage a corresponding coupling structure on the pen device and the distal latch portions each comprises a protrusion  327  adapted to engage the cap when a cap is mounted on the pen body. 
         [0058]    To assure correct rotational mounting of the module on the pen the shown module is provided with a funnel-shaped slot  528  (see  FIG. 8 ) adapted to axially engage a corresponding protrusion on the pen. In the shown embodiment of  FIG. 1A  the protrusion  212  is provided on the pen cartridge holder  210  and arranged opposite the pen display window  202 , the electronic display  130  thereby being arranged next to the pen display window when the module is mounted on a pen. The interactions between the logging module, the pen body and the cap will be described in greater detail below. On the body portion  330  the majority of the electronic components  340  including processors means, a display  341 , a flexible cap switch  342  and a battery  343  are mounted. In the shown embodiment the logging module comprises two opposed sensors in the form of magnetometers  345  mounted directly on the ring portion  320 , the sensors as well as the majority of the electronic components being connected using LDS. Further sensors may be provided allowing e.g. the type of the device to be recognized. The logging module may be provided with user input means in the form of e.g. one or more buttons (not shown) allowing the user to control the module. The logging module may further be provided with transmission means allowing data to be transmitted to or from the module, e.g. log data may be transmitted to a user&#39;s smartphone by NFC or other wireless means.  FIG. 7  shows an alternative embodiment 400 in which the electronics including the sensors are mounted on a flexible PCB  440  which then is mounted on the main body  410  using metal clips  446 . 
         [0059]      FIG. 8  shows an alternative embodiment of a module main body  510  comprising a generally cylindrical ring-formed portion  520  and a body portion  530 , the main body being formed from a LDS polymer. Corresponding to the  FIG. 6  embodiment the ring portion  520  is provided with a pair of opposed coupling latches  522  having proximal and distal coupling protrusions  526 ,  527  as well as a coupling slot  528 . 
         [0060]      FIG. 9  shows a further alternative embodiment of a module main body  610  comprising a generally cylindrical ring-formed portion  620 , however, in contrast to the above-described embodiments comprising integrally formed latches, the latch structures are here provided as separate metal latch members  621  attached to the ring portion. Corresponding to the integrally formed latches, each latch member comprises a proximal portion  623  with an inner protrusion  626  adapted to engage a corresponding coupling structure on the pen device, as well as a distal portion  624  with an inner protrusion  327  adapted to engage the cap when a cap is mounted on the pen body. In the shown embodiment the metal latch members each comprises a pair of proximal legs attached to the ring portion by rivets. The shown embodiment of a metal latch does not comprise a specific hinge structure, however, when mounted on a pen the latch member will provide the same “dual-purpose” functionality as the integrally formed latch, see below.  FIG. 10  shows the main body  610  incorporated in a logging module  600  comprising a circumferential stop surface  629  and being provided with metal latch members  622 . 
         [0061]    With reference to  FIGS. 2 and 8  mounting and operation of a logging module of the type shown in  FIGS. 1A and 1B  will be described. To mount the module on the pen body the cap is removed allowing the module to be slid over the cartridge holder  210 . During mounting the user orients the module display  130  in line with the pen display  202  whereby the funnel-shaped slot  528  will catch the protrusion  212  which then will orient the module rotationally correct, this ensuring that the proximal latch protrusions  526  will snap into engagement with the cartridge protrusions  211 , the module now being in its operational position, this allowing information to be transferred between the drug delivery device and the logging module (see below). As appears from  FIG. 1B , in the mounted position a ring-formed gap  214  is formed between the cartridge holder and the distal portion of the module, this allowing the cap to be inserted into the gap as shown in  FIGS. 1B and 8 . For normal use without a mounted logging module the cap comprises inner coupling means adapted to engage the cartridge protrusions  211 , however, with a mounted logging module the cartridge protrusions are “occupied”. Correspondingly, the module is provided with the above-described distal latch protrusions  527  which in the shown embodiment frictionally engage the outer cap surface to securely hold it in place. In addition, also the flexible cap switch  342  contributes to hold the cap in place. Alternatively, the cap may be provided with coupling means, e.g. a circumferential groove, which would allow the cap to engage the module by snap action. 
         [0062]    The coupling between the pen main part and the module is designed to provide both ease of attachment and a firm and secure grip during normal use, however, this should also be the case for the cap when attached to the pen in cooperation with the module. Correspondingly, when the cap is removed from the pen a distally directed force is transmitted to the coupling between the module and the pen via the coupling between the module and the cap which under given circumstances may result in the module being unintentionally pulled off the pen. To reduce the risk of this happening the module coupling latches  522  are provided with a “snap booster” feature. More specifically, each latch has a hinged design as described with reference to  FIG. 6 , this providing that the distal latch portion moves (further) inwards into the circumferential gap when the proximal latch portions are moved outwards as the module is mounted on the pen. As the proximal latch portions cannot be moved further inwards when the module is mounted, the outwards movement of the distal latch portions due to insertion of the cap into the gap  214  will result in an inwardly directed force being applied on the proximal latch portions via the latch central portion, this ensuring an enhanced grip between the module and the pen when the cap is mounted, this reducing the risk that the module is unintentionally pulled off the pen when the cap is removed. A proximal stop for the cap is provided by a circumferential stop surface of the module. 
         [0063]    Having described the different components of the system, next a typical situation of use will be described with reference to  FIGS. 1A and 1B . When the user desires to dispense a dose of drug, e.g. performing an intravenous injection of an amount of an insulin formulation, the cap  207  is removed and a needle assembly, if not already in place, is mounted on the cartridge holder coupling means  215 . When the cap is removed the logging module is turned on from its sleeping state by activation of the module cap switch to its “on” position, e.g. the electronic circuitry with the sensor system is powered up and the display is turned on showing e.g. the last logged dose and the time since then. The user will then turn the rotatable dose member  280  to manually set a desired dose of drug shown in display window  202  and which can then be expelled when the button  290  is actuated. Depending on the design of the logging module a given dose may be registered corresponding to a set dose, an expelled dose or both. In the shown embodiment in which movement of the clutch element is detected it follows that only an expelled dose can be registered. Correspondingly, the module display will not show information in respect of the dose being set. When the dose has been set, the user releases the spring-driven expelling mechanism whereby the clutch element is released and starts to rotate in a fixed relationship to the expelled amount, this allowing the expelled amount to be determined by the logging module. As the module has not acquired information in respect of the set dose and as the expelling of a set dose can be paused by releasing the pressure on the release button, a given dose, e.g. a large dose, may be split into two or more amounts, which would result in the logging of two or more expelled doses. Correspondingly, to treat such split doses as a single dose the shown logging module is designed to combine and log individual doses as a single dose under given circumstances, typically within a given window of time, e.g. 5 minutes, after which the “combine feature” would time out. Such a feature would also allow the module to be moved to a new pen should a given desired dose be larger than the amount of drug remaining in the cartridge of a used pen. If it for any reason is desired to have split doses logged individually the “combine window” can be closed by mounting the cap on the pen to thereby bring the cap switch in its “off” position terminating a logging event. Correspondingly, during normal operation in which a given dose is expelled as a single amount of drug the combine window is closed when the cap is mounted, this resulting in the determined dose (single or combined) being logged in the memory together with a time value as well as displayed in the electronic display for a given amount of time, e.g. 30 seconds, before the electronics power down and the display is turned off. 
         [0064]    Turning to the sensor system of the logging module, the shown embodiment may be designed to detect one or more movements of one or more magnetic members. For example, a “simple” design may be implemented in which the number of incremental rotational movements of the clutch element is counted, i.e. the number of 15 degrees increments, each increment corresponding to 1 unit (IU) of insulin. The system would be designed to scan the pen at a frequency sufficiently high to securely detect that the clutch element has moved into a new of 24 pre-determined sectors each corresponding to 15 degrees rotation and thus 1 IU. Using the same basic sensor design and sensor positions a magnetic drive element could be used as an alternative magnetic element. As a further alternative using the same general sensor design a component which is moved in accordance with both the set and the expelled dose could be used as a magnetic element, e.g. the ratchet tube. As the ratchet tube extends axially outside the part of the pen enclosed by the module ring only a portion of the ratchet tube may have magnetic properties, e.g. provided by a separate element. 
         [0065]    As a yet further alternative the sensor system may be designed to determine the absolute rotational position of a given element, however, as most pens using a rotating expelling mechanism are designed to expel a dose size requiring more than one full rotation of a given element, it would be necessary to count the number of full revolution. This could be accomplished using the same magnetic element to both count incremental movement (here: number of rotations) and an absolute position. The same or different sensor systems may be provided to detect the two type of information. Determination of an absolute position would prevent errors due to missed counts. Alternatively the sensor system may be designed to use an additional “secondary” element which is moved axially as a dose is expelled to indicate full rotations of the “primary” rotating element, e.g. a magnetic EOC member, however, as the movement of such an element primarily takes place outside the part of the pen enclosed by the module ring it may be necessary to provide further sensors. 
         [0066]    In the following a magnetometer-based detection system will be described which basically can accurately detect the position of a magnet moving in a predefined way, e.g. rotating relative to an axis. The system is therefore applicable in many technical areas in which accurate non-contact position sensing is relevant. In the following a system will be described which has been set up for application in a drug delivery system comprising a magnetic member which is configured to perform a rotational movement, see e.g.  FIG. 4A , and which will determine the absolute rotational position of a magnetic member. 
         [0067]    In  FIG. 6  an exemplary embodiment of a sensor assembly is configured as comprising 3 3D magnetic sensors  345  equidistantly around the pre-determined axis for the above-described ring-formed clutch element rotating inside the distal portion of a pen-formed drug delivery. 
         [0068]    In the following an exemplary algorithm for estimating a current orientation of a magnet will be described. The algorithm is general to any movement of a magnet, but in the present application, it is applied to a system with rotational movement of a magnet. 
         [0069]    The algorithm is adapted for a system having deviations from nominal movement of the magnet. Therefore, it requires a pre-determined model of the magnet movement from which one can derive derivatives. Let B nom   k (n) denote the field having nominal geometry of the system, where n is the position of the axial displacement and k is the sensor measuring the field. 
         [0070]    If the magnet has a given geometry and if the relative distance between sensors and magnet is assumed to be in the magnetic far-field for all positions, the pre-determined model can be estimated using a dipole field model. Thus, we can estimate B nom   k (n) to all positions by the following: 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       B 
                       nom 
                       k 
                     
                      
                     
                       ( 
                       n 
                       ) 
                     
                   
                   = 
                   
                     
                       1 
                       
                         4 
                          
                         π 
                       
                     
                      
                     
                       [ 
                       
                         
                           
                             3 
                              
                             
                               ( 
                               
                                 m 
                                 · 
                                 r 
                               
                               ) 
                             
                           
                           
                             r 
                             5 
                           
                         
                         - 
                         
                           m 
                           
                             r 
                             3 
                           
                         
                       
                       ] 
                     
                   
                 
               
               
                 
                   [ 
                   1 
                   ] 
                 
               
             
           
         
       
     
         [0071]    Where m is the dipole moment vector of that given position n, r is the distance vector between the magnet and the sensor k and r is the distance between the magnet and sensor k. 
         [0072]    If the sensors are positioned in the magnetic near-field, then B nom (n) can be estimated using Finite Element analysis of the magnet geometry. 
         [0073]    The concept is to have a model that both estimates the non-nominal behaviour and compensates the pre-determined nominal model, if non-nominal behaviour is found to be acceptable. In order to do so, a linearized model of the pre-determined model is defined: [ 2 ] 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       
                         B 
                         ^ 
                       
                       
                         k 
                         , 
                         n 
                       
                     
                      
                     
                       ( 
                       
                         
                           B 
                           ext 
                         
                         , 
                         
                           Δ 
                            
                           
                               
                           
                            
                           x 
                         
                         , 
                         
                           Δ 
                            
                           
                               
                           
                            
                           y 
                         
                         , 
                         
                           Δ 
                            
                           
                               
                           
                            
                           z 
                         
                         , 
                         
                           Δ 
                            
                           
                               
                           
                            
                           m 
                         
                         , 
                         
                           Δ 
                            
                           
                               
                           
                            
                           ϕ 
                         
                         , 
                         
                           Δ 
                            
                           
                               
                           
                            
                           ψ 
                         
                       
                       ) 
                     
                   
                   = 
                   
                     
                       
                         B 
                         nom 
                         k 
                       
                        
                       
                         ( 
                         n 
                         ) 
                       
                     
                     + 
                     
                       B 
                       ext 
                     
                     + 
                     
                       
                         
                           [ 
                           
                             
                               ∂ 
                               B 
                             
                             
                               ∂ 
                               x 
                             
                           
                           ] 
                         
                         
                           k 
                           , 
                           n 
                         
                         nom 
                       
                        
                       Δ 
                        
                       
                           
                       
                        
                       x 
                     
                     + 
                     
                       
                         
                           [ 
                           
                             
                               ∂ 
                               B 
                             
                             
                               ∂ 
                               y 
                             
                           
                           ] 
                         
                         
                           k 
                           , 
                           n 
                         
                         nom 
                       
                        
                       Δ 
                        
                       
                           
                       
                        
                       y 
                     
                     + 
                     … 
                     + 
                     
                       
                         
                           [ 
                           
                             
                               ∂ 
                               B 
                             
                             
                               ∂ 
                               ψ 
                             
                           
                           ] 
                         
                         
                           k 
                           , 
                           n 
                         
                         nom 
                       
                        
                       Δ 
                        
                       
                           
                       
                        
                       ψ 
                     
                   
                 
               
               
                 
                   [ 
                   2 
                   ] 
                 
               
             
           
         
       
     
         [0074]    Where we have included the following Deviation parameters in the linearized model: 
         [0075]    B ext  Uniform background field 
         [0076]    Δx, Δy Radial offsets of magnet position relative to nominal model 
         [0077]    Δz Axial offset of magnet position relative to nominal model 
         [0078]    Δm Deviation from nominal magnet strength 
         [0079]    Δφ Rotational offset 
         [0080]    Δψ Tilt offset 
         [0081]    Stacking the Deviation parameters in a column vector E: 
         [0000]    
       
         
           
             
               
                 
                   E 
                   = 
                   
                     [ 
                     
                       
                         
                           
                             
                               B 
                               x 
                               ext 
                             
                             _ 
                           
                         
                       
                       
                         
                           
                             
                               B 
                               y 
                               ext 
                             
                             _ 
                           
                         
                       
                       
                         
                           
                             B 
                             z 
                             ext 
                           
                         
                       
                       
                         
                           
                             Δ 
                              
                             
                                 
                             
                              
                             x 
                           
                         
                       
                       
                         
                           
                             Δ 
                              
                             
                                 
                             
                              
                             y 
                           
                         
                       
                       
                         
                           
                             Δ 
                              
                             
                                 
                             
                              
                             z 
                           
                         
                       
                       
                         
                           
                             Δ 
                              
                             
                                 
                             
                              
                             m 
                           
                         
                       
                       
                         
                           
                             Δ 
                              
                             
                                 
                             
                              
                             ϕ 
                           
                         
                       
                       
                         
                           
                             Δ 
                              
                             
                                 
                             
                              
                             ψ 
                           
                         
                       
                     
                     ] 
                   
                 
               
               
                 
                   [ 
                   3 
                   ] 
                 
               
             
           
         
       
     
         [0082]    We can write a linearized model as: 
         [0000]        {circumflex over (b)}   n ( E )= b   n   nom   +J   n   E   [4]
 
         [0083]    Where J n =∂b n   nom /∂E is the Jacobian matrix. Then we determine E to minimize the difference between the measured field and the linearized model. I.e.: 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       ∂ 
                       
                          
                         
                           
                             b 
                             meas 
                           
                           - 
                           
                             
                               
                                 b 
                                 ^ 
                               
                               n 
                             
                              
                             
                               ( 
                               E 
                               ) 
                             
                           
                         
                          
                       
                     
                     
                       ∂ 
                       E 
                     
                   
                   = 
                   
                     
                       2 
                        
                       
                         J 
                         n 
                         T 
                       
                        
                       
                         
                           G 
                           n 
                         
                          
                         
                           ( 
                           
                             
                               b 
                               n 
                               nom 
                             
                             + 
                             
                               
                                 J 
                                 n 
                               
                                
                               E 
                             
                             - 
                             
                               b 
                               meas 
                             
                           
                           ) 
                         
                       
                     
                     = 
                     0 
                   
                 
               
               
                 
                   [ 
                   5 
                   ] 
                 
               
             
           
         
       
     
         [0084]    Where G n  denotes a diagonal matrix with weights for each sensor k and position n. Thus, E is given by: 
         [0000]        E   n   min   =[J   n   T   G   n   J   n ] −1   [J   n   T   G   n ( b   meas   −b   n   nom )]  [6]
 
         [0085]    The above expression can be simplified to the following: 
         [0000]        E   n   min   =M   n ( b   meas   −b   n   nom )  [7]
 
         [0000]      Where: 
         [0000]        M   n   =[J   n   T   G   n   J   n ] −1   [J   n   T   G   n ]  [8]
 
         [0086]    This matrix is constant. Thus, it can be stored on the processor to save computational power. 
         [0087]    The parameter offset vector, E n   min , is then inserted into the linearized model: 
         [0000]        {circumflex over (b)}   n ( E   n   min )= b   n   nom   +J   n   E   n   min   [9]
 
         [0088]    This provides an updated version of the nominal model accounting for the difference between the measured field and the nominal model. The estimated position is found to be the position with the smallest difference, i.e. minimizing the residual: 
         [0000]        r   n   =∥b   meas   −b   n ( E   n   min )∥  [10]
 
         [0089]    The advantages of the above algorithm are: 
         [0090]    The algorithm makes use of constant tables that can be stored on the processor, i.e. it consists of b n   nom , J n  and M n . The algorithm provides measures that can be used as fail-safe measure, i.e. the quality of the fit can be estimated from E n   min  and the size of the residuals, r n . The shown column vector E is merely an example of selected deviation parameters. 
         [0091]    If the risk of external magnetic fields other than earth&#39;s magnetic field and disturbances in the internal magnetic field by the presence of iron nearby can be positively excluded, the most likely candidate of actual position found in the table can be relayed or displayed as actual position. However, in most applications the risk of disturbances in the magnetic field must be considered likely from a variety of sources and in some applications the consequences of a wrong determination of position could have serious and unacceptable consequences. In such applications a number of fail-safe measures can be taken, for example:
       (1) Taking a number of readings and use mean axis value from each axis from each sensor only when variations between readings are less than a predefined level. This could prevent wrong readings from the sensors caused by a fluctuating disturbance in the magnetic field.   (2) Subtracting readings from diametrically opposite sensors to eliminate the magnet field contribution and the homogenous external field contribution and hence calculate the gradient of an inhomogeneous external field. Comparison against threshold values may be used as criteria for using the readings.   (3) Using readings to calculate the external field. Comparison against threshold values may be used as criteria for using the readings.   (4) Using readings from an over-determined sensor configuration to calculate deviations from pre-determined nominal mechanical geometry and magnet characteristics. Comparison against threshold values may be used as criteria for using the readings.   (5) Comparing the deviance of the most likely position and the deviances of rejected positions (e.g. the second most likely position) to determine the credibility of the most likely position. Comparison against threshold values may be used as criteria for using the readings.   (6) Comparing the most likely position and rejected positions, e.g. the top 10 next most likely positions, to determine the distribution of the positions. The distribution, e.g. span between minimum and maximum position, may be used as criteria for using the readings.   (7) Using the most likely position to calculate the field contribution from the magnet and subtracting the contribution from the readings to obtain an estimated external field. The estimated external field may be used as input for calculating a most likely position which should be rejected by one or more of the fail-safe measures since the field contribution from the magnet has been eliminated. The field contribution from a position different from the most likely positions may be calculated and added to the estimated external field. The resulting field may be used as input for calculating a most likely position. Correspondence between the selected position and calculated position may be used as criteria for using the readings.   (8) Using calculated positions to determine the mechanical movement, e.g. direction, speed and position stability. Comparison against threshold values may be used as criteria for using the readings.   (9) Only appoint a most likely candidate of actual position if the minimum sum of deviance is less than a predefined value, to ensure a certain level of coherence between measured values and (expected) table values. This predefined value may be dependent on where in the range of operation the most likely candidate is, since the distances between neighboring candidates vary with distance from sensor. This should prevent a constant disturbance above a certain magnitude from causing the wrong position to be appointed most likely candidate and can also prevent a most likely candidate from being appointed if one of the sensors axis&#39; have gone into saturated mode. If sensors are exposed to a magnetic field of a strength exceeding their limit of operation, they will go into saturation mode and give a readout of (a known predefined) maximum value.       
 
         [0101]    The above mentioned fail-safe measures will only be able to help prevent read-out of dose data based on false positions by giving no read-out at all. The system can then (if change of position is either prevented or monitored not to occur) repeat measurements until the system is clear of the external disturbance of the internal magnetic field. 
         [0102]    As a given pre-filled drug delivery device may be part of a system it may be provided to the users with different types of drugs, e.g. drugs for the treatment of different conditions such as diabetes and growth disorders, different classes of drugs for the treatment of a given condition such as insulins and GLP-1 for treatment of diabetes, different types of drugs from a given class such as long-acting and fast-acting insulin formulations, or different concentrations for a given specific drug such as 100 IU or 200 IU of insulin per ml of formulation. Although the above-described logging module normally would be designed to be mounted on only one type of drug delivery device it could in theory be mounted on devises containing a variety of different drugs. 
         [0103]    To prevent that a given logging module would be used in a way resulting in incorrect determination of dose data, it should be ensured that a given logging module in a given state is used in combination with the corresponding drug. 
         [0104]    For example, a given logging module may be adapted to be used with only one type of drug, e.g. a given insulin formulation having a given concentration, this being indicated on the logging module e.g. text, colour or other visual markings. Indeed, this would still allow a given logging module to be used in combination with the wrong delivery device. To prevent this from taking place the logging module and the different delivery devices of a given system may be coded allowing mating of only modules and devices corresponding to each other, e.g. mechanically or electronically. 
         [0105]    For example, when a given pen type is used for different types of drugs it will be marked accordingly, e.g. by text, colour and/or codes. By providing such visual markings on the pen body on the part of the surface which would be covered by a mounted logging module, the logging module could be provided with optical sensor means adapted to detect such markings. For example, a given pen device may be fully or partly manufactured from a material having a given colour or it may be provided with a label having a given colour. 
         [0106]    If a given logging module is adapted to be used only for one type of drug it would require that the corresponding colour is positively identified, otherwise the logging module would indicate an error condition. Alternatively, the logging module may be adapted to be used in combination with a variety of drugs, such that the positive identification of a given pre-specified colour would set up the logging module accordingly. For example, when mounted on a pen device with insulin of a given concentration it would register and display the correct number of IU, whereas when mounted on a pen device with GLP-1 of a given concentration it would register and display the correct number of mg. The type or brand name of the drug may be displayed e.g. a short time each time the display is turned on. 
         [0107]    A mechanical coding between cartridge holder and add-on device could be provided by e.g. a simple knob-slot coding preventing non-corresponding units to be connected. 
         [0108]    In the above description of exemplary embodiments, the different structures and means providing the described functionality for the different components have been described to a degree to which the concept of the present invention will be apparent to the skilled reader. The detailed construction and specification for the different components are considered the object of a normal design procedure performed by the skilled person along the lines set out in the present specification.