Juan Pablo Timpanaro
email: juanpablo.timpanaro@inria.fr

Thibault Cholez
email: thibault.cholez@inria.fr

Isabelle Chrisment
email: isabelle.chrisment@loria.fr

Olivier Festor
email: olivier.festor@inria.fr

BitTorrent's Mainline DHT Security Assessment

Keywords: BitTorrent, Distributed Tracker, Mainline DHT, Security Assessment, Protection Mechanisms

BitTorrent is a widely deployed P2P file sharing protocol, extensively used to distribute digital content and software updates, among others. Recent actions against torrent and tracker repositories have fostered the move towards a fully distributed solution based on a distributed hash table to support both torrent search and tracker implementation. In this paper we present a security study of the main decentralized tracker in BitTorrent, commonly known as the Mainline DHT. We show that the lack of security in Mainline DHT allows very efficient attacks that can easily impact the operation of the whole network. We also provide a peer-ID distribution analysis of the network, so as to adapt previous protection schemes to the Mainline DHT. The mechanisms are assessed through large scale experiments on the real DHT-based BitTorrent tracker.

I. INTRODUCTION

BitTorrent [START_REF] Cohen | Incentives build robustness in bittorrent[END_REF] is a peer-to-peer protocol developed by Bram Cohen. A recent study [START_REF]Ipoque. Internet study[END_REF] shows that between 43% and 70% of all Internet traffic is generated from BitTorrent clients, which makes it the most popular peer-to-peer protocol. However, there have been several legal issues and complaints from music and movie companies, putting in jeopardy the continuity of its success. Moreover, in some countries, there have already been legal actions to successfully shut-down major trackers site, such as The Pirate Bay or Mininova. Without a central server to retrieve the peers participating in the download of a given torrent, there is no possibility to join the network. However, an alternative tracking approach has already been implemented, the decentralized tracking. Every peer in the network acts as a small tracker, allowing a fully-decentralized architecture, in which there is no central component to attack. Notwithstanding, decentralized tracking in BitTorrent has major security problems. In BitTorrent, there are two implementations of decentralized tracking, both based on the Kademlia DHT [START_REF] Maymounkov | Kademlia: A peer-to-peer information system based on the xor metric[END_REF]. The Azureus DHT came first, and it is only used for this client. In second place, the Mainline client introduced its DHT after around a month later and it was adopted by several clients.

Being today the largest decentralized tracker in BitTorrent, we restrict the focus in this study to the Mainline DHT.

In this work, we make the following contributions as a way to protect the alternative tracking in BitTorrent, the Mainline decentralized tracking network:

• We show the major security problems in the Mainline DHT Network.

• We propose a distributed architecture used to launch a series of evaluation on the real network.

• We adapt and analyse a set of protections mechanisms proposed for the KAD DHT network [START_REF] Cholez | Evaluation of Sybil Attacks Protection Schemes in KAD[END_REF], in order to fulfill the security problems.

• Along with the work done by Wolchok et al. [START_REF] Wolchok | Crawling bittorrent dhts for fun and profit[END_REF], we complete the security view of BitTorrent's decentralized trackers. Even though these evaluations could have been done from a single computer, very basic rules to limit the number of peers per IP could easily mitigate a one-computer attack. Therefore, we chose a distributed approach.

The document is organized as follows. Section II presents a set of works in the area, regarding the BitTorrent protocol and a set of attacks, including monitoring. Section III details the distributed architecture proposed as well as the targeting component of BitTorrent, its decentralized tracker. Section IV introduces how we exploit some vulnerabilities in this alternative tracker and section V presents some mechanisms to avoid these attacks. Section VI concludes the paper.

II. RELATED WORKS

Regarding decentralized tracking, Crosby et al. [START_REF] Crosby | An analysis of bittorrents two kademlia-based dht's[END_REF] present a complete study about the two decentralized trackers in BitTorrent. They examine a variety of aspects, such as latency, and detect problems mainly in the routing algorithms, and proposed a better maintenance of the routing table to avoid dead nodes. However they do not address any security problems.

Monitoring the BitTorrent network has been investigated in several ways. [START_REF] Stevens Le-Blond | Spying the world from your laptopidentifying and profiling content providers and big downloaders in bittorrent[END_REF] proposes a simple, but yet effective way of spying BitTorrent users, through exploiting the tracker's infrastructure. Piatek et al. [START_REF] Piatek | Challenges and directions for monitoring p2p file sharing networks-or: why my printer received a dmca takedown notice[END_REF] show how exploiting this infrastructure properly, can lead to implicate arbitrary network endpoints in illegal content sharing. Saganos et al. [START_REF] Siganos | Monitoring the bittorrent monitors: A bird's eye view[END_REF] analyse a set of top torrents in order to blacklist BitTorrent's monitors.

Both BitTorrent components, the tracker and the swarm itself, have been the core study in many research works. This is not the case for the decentralized tracking. Jetter et al. [START_REF] Jetter | Quantitative analysis of the sybil attack and effective sybil resistance in peer-to-peer systems[END_REF] propose a self-registration mechanism, as a way to avoid a Sybil attack in the BitTorrent DHT. They limit the number of peers per IP, so as to avoid an attacker to launch several peers from a single machine. However, their solution does not maintain backward compatibility, and using a distributed architecture will bypass this protection. On the other hand, Wolchok et al. [START_REF] Wolchok | Crawling bittorrent dhts for fun and profit[END_REF] conduct a monitoring study on the Azureus DHT. They clearly show how the Azureus DHT can be crawled thanks to a Sybil attack, so as to rebuild from scratch a BitTorrent search engine as well as to monitor pirate's behaviour. To our knowledge, we present the first security study in the Mainline DHT.

This paper completes the work of Wolchok et al. by analysing Mainline DHT and its security characteristics. We extend our previous analysis in [START_REF] Cholez | Evaluation of Sybil Attacks Protection Schemes in KAD[END_REF] to the Mainline DHT network in order to determinate if the security mechanisms can be applied.

III. BITTORRENT ARCHITECTURE

A. Overview of BitTorrent Architecture

Considering BitTorrent and its architecture, the following components can be described:

• Tracker: Entity responsible for helping peers to find each other by using a central tracker or a DHT service.

• Peers: Depending on if they have the entire file or only a part of it, can be respectively called "Seeders" or "Leechers".

• Swarm: The group of peers sharing the file. It is composed of Seeders and Leechers.

• Torrent File: Contains Metadata describing the file to share. The torrent file contains mainly two parts. The first one is normally a list of trackers, which will have indexed the torrent file. The second part, the info part, describes the file to be shared and it contains a list of parts composing the file, along with a piece-hash for later verification.

There are two steps when trying to download a file.

In the first, a user wants to download a given file, which has a torrent file associated. Once this user retrieves the torrent file, normally from a website that distributes them, it loads it into a BitTorrent client. Secondly, the BitTorrent client will contact the trackers or the distributed tracker, and retrieve a list of peers already sharing the file. Finally, the client will start contacting every peer to join the swarm. Contacting the tracker will make the peer to be added to the list of peers sharing the torrent.

The second step is slightly more complex. Every peer in the swarm can download from whoever it can. However, in order to decide which peers to upload, a rewarding mechanism is used. This mechanism is based on a Tit-for-Tat scheme [START_REF] Cohen | Incentives build robustness in bittorrent[END_REF], and it allows fair trading inside the swarm. For example, peer A will select peer B to upload data, if peer B has shared with peer A. This selection is made locally by a peer and it is based on the upload rate of every peer to the local peer.

B. BitTorrent DHT's

The BitTorrent protocol has acquired some new features over time. Many of them are still under consideration before being added officially to the protocol. Among these protocol extensions, we can find: We will focus on one extension, the Distributed Tracker. This extension aims to replace the way a peer retrieves the list of peers sharing a file. Instead of using a central tracker, a peer can use a decentralized service, where every peer is responsible to index a group of torrents.

• Distributed Tracker • Magnet Links
There are two protocols to operate a distributed tracker in BitTorrent. The distributed tracker of Azureus, which is only used by the Azureus client, now called Vuze, and the one of the Mainline client. Both are based on the Kademlia Protocol, but are incompatible between them. As we mentioned in section I we will focus our attention on the distributed tracker of the Mainline client, commonly known as Mainline DHT.

In decentralized tracking, every peer is in charge of indexing a group of torrents, mainly, those torrents that are close to the peer. The concept of closeness, as stated in Kademlia, is based on the XOR distance between a peer ID and the torrent ID. While the peer ID is chosen randomly, the torrent ID is obtained by hashing the info part of the torrent file.

In Figure 1 we can observe the basic procedure to announce a torrent and then retrieve the list of peers sharing it.

Let's assume Peer 9 is sharing the Nirvana file. It announces the torrent through an Announce message, specifying that it is sharing the torrent. In this case Peer 52 is responsible to index this torrent and save the entry, because its ID is the closest. Then, Peer 75 wants to download the Nirvana file, so it sends a GetPeer message. Again, Peer 52 receives this message and answers with a list of the peers already sharing that torrent, which in this case contains Peer 9. The GetPeer message will also add Peer 75 to the list of peers sharing in the torrent.

This procedure is similar when contacting a central tracker, but it allows to distribute the load among all the peers in the DHT, since a central tracker receives a request for every torrent it indexes, whilst a peer only indexes a small group of torrents.

IV. EXPLOITING DHT VULNERABILITIES

We present in this section an architecture together with a set of experiments made to demonstrate the feasibility of large scale attacks against the Mainline DHT.

A. Distributed Architecture

In order to deploy a variety of experimental attacks in the decentralized tracker of BitTorrent, the distributed architecture Fig. 2: Attack Architecture depicted in Figure 2 is proposed. This architecture extends our previous work in the KAD network [START_REF] Cholez | Evaluation of Sybil Attacks Protection Schemes in KAD[END_REF].

We used a group of PlanetLab nodes, along with a Postgres database server located in the LHS(High Security Lab located at INRIA Nancy). This server contains all the architecture configuration and maintains the data retrieved during the experimental evaluations.

We developed a modified version of a plug-in for the Vuze client, which allow us to connect to the Mainline DHT. This modified plug-in has the property to load the configuration from the database server and upload any data it gets.

The modified client does not have the capability to download any file, to share pieces of it or even to join any swarm. The client will respond to every message in the DHT level, but it will not reply to any request for handshake and, as a result, any upload request.

We take advantage of one well-known flaw in DHT's [START_REF] Urdaneta | A survey of DHT security techniques[END_REF]: the free choice of ID's. Letting a DHT user to freely choose its ID leads the user to place itself in a determined space in the DHT. In our case, each modified client will carefully choose its ID so as to position itself close enough to a given torrent, which will allow us to receive most of the DHT protocol messages. Such configuration resembles the well-known Sybil attack, already perform in KAD by [START_REF] Steiner | Exploiting kad: Possible uses and misuses[END_REF]. In our case the fake peers, so called the Sybils, are the modified Vuze clients on PlanetLab nodes.

B. Experiment in the Real Network

We configure the architecture with a set of Sybils, which will share between 110 and 140 bits in common with the ID of the targeted torrent. 110 bits in common is more than enough to be in the tolerance zone of any target in the DHT. The tolerance zone represents the torrents that a peer might index, which are those torrents whose IDs have at least 8 bits in common with the peer ID [START_REF] Crosby | An analysis of bittorrents two kademlia-based dht's[END_REF]. To improve the efficiency of our architecture, each Sybil knows and advertises the others, instead of discovering them through the regular DHT protocol. With this basic set-up, we successfully performed the following attacks:

1) Spy Attack: By logging all the requests each Sybil receives along with their information, like client IPs 1 and client ports we can estimate the amount of users downloading a given torrent with the DHT as a tracking option. Since this alternative tracking is activated in most of the clients, spying becomes more critical. Moreover, we can determinate, 1 IP addresses are anonymized upon reception for instance, when a client changes its IP address. This measurement can be done in a passive way, in opposition to, for example, a crawler.

We are also able to retrieve valuable data regarding the users behaviour, as well as the traffic in the DHT for a given torrent.

As an example, we deployed our architecture using 18 Sybils for almost 20 hours. As a target, we chose a popular TV series, Fringe (S03E01), which at that moment was the last available and highly popular episode. The purpose of the experiment was to observed all the GetPeer requests, as to monitor which peers search for this given torrent.

During the experiment, we received over 1 million of request for this torrent, in which over 91000 different IPs and over 61000 different ports were retrieved. Curiously, from all the requests, 9.2% were outside the tolerance zone of the Sybils and around a 34% of these requests were generated from the same group of IPs. This behaviour might indicate modified clients running particular experiments in the DHT.

Figure 3 shows the number of requests received per hour. During this particular period of time, there are well distributed over the duration of the experiment, probably due to the popularity of the torrent. This experiment shows how easy it is to monitor a given torrent, and retrieve those peers downloading it.

2) Pollution and Eclipse: During the experiments, we chose a popular film (Iron Man 2) and we deployed the same architecture configuration as defined before varying the number of Sybils. Figure 4 shows the amount of responses from Sybils that a normal client receives when searching for the given torrent. With 20 Sybils, a normal client will receive over 90% of Sybils. Increasing the number of Sybils allow us to increase the percentage of pollution.

Polluting a torrent means that when a normal client searches for that torrent, it will receive our Sybils clients instead. From this point, a wide set of attacks can be carried on in the Swarm. Attacking BitTorrent swarms from the DHT will require a longer analysis and it exceeds the scope of this work.

On the other hand, we can achieve an Eclipse attack. Each Sybil, when receiving a GetPeer message, does not respond instead of sending a valid answer. A normal client will not be able to retrieve any peers, as long as all the Sybils have the same behaviour.

During our evaluation, we were able to fully pollute a given torrent, but intermittently. The main reason is that, despite the Sybils are over 100 bits close to the target, the routing algorithm is not always capable of finding the closest peers, and regularly, normal peers are returned in the search response. Considering, as one example, that different copyright laws can apply for different countries, we can use this Localized Isolation to eclipse a given content for a particular country. As an alternative, instead of denying the content, we can simply spy a particular group of users, and retrieve statistical data. Clearly there are many situations in which this attack might become useful.

V. PROTECTION MECHANISMS

A. Considering the KAD Protection Mechanisms

As it has been stated before, the Mainline DHT is based on the Kademlia Protocol. The KAD network is also based on this protocol and it is one of the most deployed P2P networks currently active. However, KAD contains a number of security mechanisms that makes the network resilient to most wellknown attacks. In our previous work [START_REF] Cholez | Evaluation of Sybil Attacks Protection Schemes in KAD[END_REF] we conducted an evaluation of protection schemes in KAD, concluding that these protections are highly effective against attacks from a single machine, but can be bypassed if the attacker has a group of public IPs from different sub-networks, which already made the attack harder. Later on in [START_REF] Cholez | Efficient DHT attack mitigation through peers' ID distribution[END_REF] we proposed a distribution analysis scheme so as to detect distributed attacks.

Based on our previous work on the KAD network, we will conduct a measurement in the Mainline DHT network, and study its distribution of Ids. This study will show if a distribution analysis will be adequate to develop an Ids distribution protection.

B. IDs Distribution in BitTorrent Mainline DHT

An analysis distribution is applicable if safe lookups (when the peers involved in a search are not malicious, then a lookup is consider safe) in the network follow a theoretical distribution so as we can discriminate attacks.

Firstly, it is necessary to determinate what is a normal distribution of IDs in the Mainline DHT network. The theoretical distribution can be simply obtained by considering that if the ID of a peer is really randomly chosen, the distance between two different IDs, in term of number of common bits, also called prefix length, is based only on the number of peers in Fig. 5: DHT Size Estimation Fig. 6: Average Prefix Size for the best 8 peers found the network. Equation ( 1) describes the mean number of peers sharing a given prefix x, considering a network with N peers.

F (x) = N 2 x (1)
Aware of the difficulty to accurately compute the number of peers in the network [START_REF] Crosby | An analysis of bittorrents two kademlia-based dht's[END_REF], we used the population estimator of the Mainline DHT plug-in for Vuze to get a rough estimate. Figure 5 shows the oscillation of the population during a oneday experiment, in which we are able to compute 4.2 million users in average.

The theoretical distribution can give us a precise idea of how the peers'ID are distributed among the DHT space, however a measurement in the real network is still needed, since the real distribution of prefixes among neighbours surrounding a target and found during a search might not follow the theoretical distribution, due to the efficiency of the routing algorithm of the Mainline DHT or dead nodes. Therefore, we conducted a measurement experiment aiming to assess this real distribution.

C. Distribution Experiment Setup

We conducted a 24-hours experiment in the network, in which we searched for random IDs and kept the 8 best contacts found during this search by the Mainline DHT plug-in for Vuze. This procedure was repeated every hour, starting at 18:00Hs (CEST), and searching for 35 different random keys each time. Using random keys allow us to avoid attacks on well-known keys, such as popular movies or TV series.

During this period of time, 861 keys were searched. Figure 6 shows the average prefix size of the 8 best contacts found during the experiment. The fact that IDs are randomly chosen give us the following relationship: if the number of peers in the network is divided by two, the average prefix size between two neighbors decreases in one bit. As it can be observed, the variation of population in the Mainline DHT network, seen in figure 5 impacts directly in the average prefix size, seen in figure 6. The network size varies from 3.2 millions to 6.4 millions whilst the average prefix size varies from 20.5 After considering all the best contacts found and their distances to the target, we can compute the mean number of peers found for a given prefix. Figure 7 puts together both the theoretical with N = 4.2 million and the measured distribution of IDs. As it can be noticed, after the 20 bit prefix, the measured distribution follows perfectly the theoretical distribution, which indicates that the routing algorithm, in this case, is precise enough on average to find the closest peers possible. Figure 7 shows an example of an attack distribution which could be measured if an attacker introduces a group of Sybils close to a key (sharing 26-27-28 bits prefixes).

D. Protection against attacks through Distribution Analysis

In order to avoid those peers which are dangerously close to the key we are searching for, we need to take into account the distribution of peers' IDs and compare it with the theoretical distribution. If the distance between the two distributions is higher than a threshold, we should consider that the peers retrieved might be attackers. However, before computing the distance to detect stealth attacks, we can already avoid peers sharing more than 30 bits in common with the given key, since peers with these prefixes are highly unlikely to be found as being honest. The detection threshold is obtained from computing the distance between safe distributions and attack distributions. The attack distributions needs to contain a wide set of examples, from naive attacks (all peers sharing 30 bits with the target) to more smart distributions (barely above the normal distribution).

When a set of peers is considered as suspicious, we cannot precisely identified the bad nodes, so we remove all peers that increase the most the divergence, and replace them with new peers further from the target. Therefore, each attackers will not receive requests from the participants.

We prove the applicability of a distribution analysis in the Mainline DHT network, based on our previous work on the KAD network. However, a fixed theoretical distribution might not be accurate enough, since the network size varies considerably, contrary to the KAD network. A periodically calculation of the DHT's size and a re-computation of the theoretical distribution is a good approach to avoid a high false positive rate.

VI. CONCLUSION

In this paper we showed that the move towards a DHTbased tracking service in BitTorrent is not alone sufficient to provide bulletproof security to the service and privacy to the users. We have demonstrated through real deployment that efficient attacks can be performed on the Mainline DHT using the distributed architecture presented in the paper. In its current form with no build-in security mechanism, the DHTbased approach is even open to more vulnerabilities than the centralized tracker approach initially built into BitTorrent. We have shown that with few nodes, one can highly pollute or even eclipse a given content on the Mainline DHT.

While raising awareness is one of the main outcome of this paper, we are convinced that the solution is clearly to integrate new security mechanisms in the DHT. Firstly by implementing the set of protections already included in KAD which limit the number of peers per IP. Secondly by computing the distribution of IDs to identify malicious nodes in the network while keeping backward compatibility regarding random ID assignment. Future work will focus on extending the measurements and defining new metrics to identify malicious behaviour. These measurements and metrics will be compared to other DHTs that already implement a subset of the proposed security measures.

Fig. 1 :

 1 Fig. 1: BitTorrent DHT • Connection ObfuscationWe will focus on one extension, the Distributed Tracker. This extension aims to replace the way a peer retrieves the list of peers sharing a file. Instead of using a central tracker, a peer can use a decentralized service, where every peer is responsible to index a group of torrents.There are two protocols to operate a distributed tracker in BitTorrent. The distributed tracker of Azureus, which is only used by the Azureus client, now called Vuze, and the one of the Mainline client. Both are based on the Kademlia Protocol, but are incompatible between them. As we mentioned in section I we will focus our attention on the distributed tracker of the Mainline client, commonly known as Mainline DHT.In decentralized tracking, every peer is in charge of indexing a group of torrents, mainly, those torrents that are close to the peer. The concept of closeness, as stated in Kademlia, is based on the XOR distance between a peer ID and the torrent ID. While the peer ID is chosen randomly, the torrent ID is obtained by hashing the info part of the torrent file.In Figure1we can observe the basic procedure to announce a torrent and then retrieve the list of peers sharing it.Let's assume Peer 9 is sharing the Nirvana file. It announces the torrent through an Announce message, specifying that it is sharing the torrent. In this case Peer 52 is responsible to index this torrent and save the entry, because its ID is the closest. Then, Peer 75 wants to download the Nirvana file, so it sends a GetPeer message. Again, Peer 52 receives this message and answers with a list of the peers already sharing that torrent, which in this case contains Peer 9. The GetPeer message will also add Peer 75 to the list of peers sharing in the torrent.This procedure is similar when contacting a central tracker, but it allows to distribute the load among all the peers in the DHT, since a central tracker receives a request for every torrent it indexes, whilst a peer only indexes a small group of torrents.

Fig. 3 :

 3 Fig. 3: Number of GetPeer requests per hour

Fig. 4 :

 4 Fig. 4: Pollution over an Iron Man torrent 3) Geo-Localized Isolation: A simpler rule when answering a GetPeer request can lead to what we call a "Geo-Localized Isolation Attack". This attack aims to Eclipse a given torrent, but only to those peers in a given geographical region. With an external tool that gives us the geographical location of an IP, we can decide in real-time which requests to answer and which not.Considering, as one example, that different copyright laws can apply for different countries, we can use this Localized Isolation to eclipse a given content for a particular country. As an alternative, instead of denying the content, we can simply spy a particular group of users, and retrieve statistical data. Clearly there are many situations in which this attack might become useful.

Fig. 7 :

 7 Fig. 7: Theoretical Distribution Vs. Measured Distribution bits to 21.5 bits. This behaviour can be seen around 06:30Hs, where the population is 3.3 millions and the average prefix size decreases to 20.5.After considering all the best contacts found and their distances to the target, we can compute the mean number of peers found for a given prefix. Figure7puts together both the theoretical with N = 4.2 million and the measured distribution of IDs. As it can be noticed, after the 20 bit prefix, the measured distribution follows perfectly the theoretical distribution, which indicates that the routing algorithm, in this case, is precise enough on average to find the closest peers possible. Figure7shows an example of an attack distribution which could be measured if an attacker introduces a group of Sybils close to a key (sharing 26-27-28 bits prefixes).


Boaz Ophir

Michael Elad

Nancy Bertin

Mark D Plumbley

SEQUENTIAL MINIMAL EIGENVALUES -AN APPROACH TO ANALYSIS DICTIONARY LEARNING

Over the past decade there has been a great interest in a synthesis-based model for signals, based on sparse and redundant representations. Such a model assumes that the signal of interest can be decomposed as a linear combination of few columns from a given matrix (the dictionary). An alternative, analysis-based, model can be envisioned, where an analysis operator multiplies the signal, leading to a sparse outcome. In this paper we propose a simple but effective analysis operator learning algorithm, where analysis "atoms" are learned sequentially by identifying directions that are orthogonal to a subset of the training data. We demonstrate the effectiveness of the algorithm in three experiments, treating synthetic data and real images, showing a successful and meaningful recovery of the analysis operator.

INTRODUCTION

In a wide range of fields, from signal processing to machine learning, sparse representations and their computation has become a well-known topic. Most of the time, the term "sparse representations" refers to a generative model where the signals of interest are described as a linear combination of a few atoms chosen from a redundant and predefined set. More specifically, the signal x ∈ R d is assumed to be composed as x = Dz, where D ∈ R d×n is a redundant dictionary with d ≤ n, and z ∈ R n is a sparse vector, serving as the representation of the signal. The number of non-zeros in z, denoted ∥z∥ 0 , is assumed to be much smaller than d. This signal model is typically referred to as the synthesis model.

Why do we need such a model? In typical situations, the signal of interest x is only observed through a set of linear measurements y ∈ R m which are noisy and (if m ≤ d) possibly incomplete, y = Mx + e where ∥e∥ 2 ≤ ε.

(

) 1
The recovery of x from y in such a case becomes a much more stable process by invoking the sparsity assumption on the desired signal. Indeed, there is a wide family of methods, termed pursuit algorithms, that are designed to solve this problem [START_REF] Bruckstein | From sparse solutions of systems of equations to sparse modeling of signals and images[END_REF].

A key problem with the model described above is the choice of D. Naturally, when working on a specific signal source, we would like to have a dictionary that enables sparse representations for the signals in question. In recent years there has been a growing interest in learning an appropriate dictionary from a set of example signals (training set). Two well-known options are the MOD and the K-SVD algorithms [START_REF] Engan | Method of optimal directions for frame design[END_REF][START_REF] Aharon | An algorithm for designing overcomplete dictionaries for sparse representation[END_REF][START_REF] Rubinstein | Dictionaries for sparse representation modeling[END_REF].

The synthesis model has been intensively studied in the past decade, and it is now a well established field of research. However, there is another viewpoint to sparse representations -an analysis one. The analysis model relies on a linear operator Ω : R d → R p such that the coefficient vector Ωx ∈ R p is expected to be sparse for the signals in mind [START_REF] Elad | Analysis versus synthesis in signal priors[END_REF]. While it sounds similar to the above synthesis counterpart, it is in fact very different [START_REF] Nam | Cosaprse analysis modeling -uniqueness and algorithms[END_REF]. Interestingly, relatively little is known about the analysis model. Though this model has been used for a while in some applications [START_REF] Rudin | Nonlinear total variation based noise removal algorithms[END_REF][START_REF] Schultz | A Bayesian approach to image expansion for improved definition[END_REF][START_REF] Portilla | Image restoration through l0 analysis-based sparse optimization in tight frames[END_REF][START_REF] Selesnick | Signal restoration with overcomplete wavelet transforms: Comparison of analysis and synthesis priors[END_REF], the analysis model in itself has been given much less attention in recent literature, compared to the synthesis.

In this paper we focus on the analysis model, and in particular, the development of an algorithm that would learn the analysis operator Ω from a set of examples X = [x 1 , x 2 , . . . , x N ], so that the analysis coefficients ΩX are sparse. The paper is organized as follows. In Section 2, we give a precise definition of the sparse analysis model. We describe the proposed learning algorithm in Section 3, and demonstrate it in Section 4. A discussion on the limits of this method, and a perspective for future work is provided in Section 5.

THE ANALYSIS MODEL

As described above, the analysis model for the signal x ∈ R d uses the possibly redundant analysis operator Ω : R d → R p (redundancy here implies p ≥ d). This model assumes that the vector Ωx should be sparse. Unless stated otherwise, we shall assume hereafter that the rows in Ω are in general position, implying that every subset of d or less rows are necessarily linearly independent. This is equivalent to the assumption that the spark of Ω T is full [START_REF] Bruckstein | From sparse solutions of systems of equations to sparse modeling of signals and images[END_REF].

In the synthesis model the representation z can be arbitrarily sparse, ∥z∥ 0 = k ≪ d. Also, the signal is characterized by the k non-zero indices in the representation vector z, as those describe the atoms constructing it, which in turn define the subspace this signal belongs to. In contrast, the analysis model leads necessarily to a mild sparsity, ∥Ωx∥ 0 ≥ pd, as otherwise there would be d or more rows that are orthogonal to x, which is possible only for x = 0. Thus, for a highly redundant analysis operator, the cardinality of Ωx is expected to be quite high. But this is not necessarily bad news, as we shall see.

In the analysis model we put emphasis on the zeros of the vector Ωx, and define the cosparsity ℓ of the analysis model to be the number of zeros in the vector Ωx,

∥Ωx∥ 0 = p -ℓ.
(

Naturally, 0 ≤ ℓ ≤ d.

In the analysis model the signal x is characterized by the cosparsity -the zeros of the vector Ωx -as the indices of these zeros define the subspace the signal belongs to. This explanation may become clearer as we turn to describe another interpretation of these two models as special instances of union-of-subspaces (UoS). Indeed, both the synthesis and the analysis models form unions of subspaces in which their signals reside [START_REF] Lu | A Theory for Sampling Signals From a Union of Subspaces[END_REF].

In a general UoS model it is assumed that there is a collection of subspaces S γ , γ ∈ Γ, such that a signal of interest x coincides with an element from the union ∪ γ∈Γ S γ . The synthesis model with sparsity k implies that every signal is created as a linear combination of k columns from D. Thus, each of the

( n k )
possible choices of supports leads to a subspace, and those together describe the geometrical location of the signals in this model in R d .

The analysis model is similarly associated to a UoS model as follows. The signal that satisfies the model assumption ∥Ωx∥ 0 = p-ℓ is orthogonal to ℓ rows from Ω. Thus, it is simply in the orthogonal complement to the linear combination of these rows. This way, the analysis model corresponds to a union of all the possible ( p ℓ ) complement subspaces for ℓ chosen rows from Ω. Note that in general, the synthesis and the analysis unions of subspaces are very different -for example, if p = n = 2d and k = d -ℓ ≪ d, then the subspaces united by the two models are of the same dimension (k), but their number is entirely different, with many more subspaces included in the analysis model.

ANALYSIS OPERATOR LEARNING

For the analysis model to be effective, we should choose Ω such that the cosparsity ℓ is maximized for the signals we aim to operate on. This is comparable to the quest for a dictionary D in the synthesis model that leads to maximal sparsity (minimal k). In the same way as for the synthesis model, we have two options -either choose a pre-specified operator that seems to be in agreement with the data (e.g., Gabor filters, wavelet, etc.), or construct Ω by learning it from signal examples [START_REF] Rubinstein | Dictionaries for sparse representation modeling[END_REF]. In this paper we target the second option, and propose a learning algorithm for Ω using a training set

X = [x 1 , x 2 , . . . , x N ].

Basic Step -Minimal Eigenvalue

The inner process of the proposed algorithm attempts to learn a single analysis vector ω, which will correspond to a single row in the analysis operator Ω. Such a vector is known to be orthogonal (or nearly so in practice) to a non-negligible subset of the training signals. By "non-negligible" we mean that if the rows of Ω are used uniformly in constructing the analysis signals, then we expect that Nℓ/p of the signals would be orthogonal to each row on average.

Finding a candidate row ω is done by singling out an eigenvector of the Gram matrix X Λ X T Λ of the data, where X Λ contains a subset of the training examples, by removing columns of irrelevant examples. This problem is complex since we need to find both the group of examples to use, Λ, and the eigenvector that corresponds to it. Naturally, if Λ is known, we can target the eigenvector associated with the smallest eigenvalue (rather like [START_REF] Jaillet | An l1 criterion for dictionary learning by subspace identification[END_REF]). The essence of the process is iteratively prune the training data, keeping only training vectors that have low correlation with the current estimate of the analysis vector. The analysis vector is then updated and the operation is repeated iteratively until convergence (or a predetermined stopping rule) is reached. At the final stage, the learned analysis vector is orthogonal or nearly-so to the subset of training vectors x that were kept all along the process, which justifies its choice as a row of Ω. Algorithm 1 describes this process, and it output is one analysis vector ω. The inner loop in the above algorithm shows convergence (which should be proven), but the final threshold found would not necessarily be small enough. The outer loop adds a random flavor to this process by choosing a different initialization, thereby enabling the overall process to find a suitable row ω that is nearly orthogonal to the set X Λ .

From a Basic Step to the Complete Algorithm

So far we have concentrated on finding a single row from Ω. Now we would like to extend this method to find all the rows. The approach we take is sequential, which means that we apply Algorithm 1 p or more times, each time producing a new candidate row to Ω. In our work we consider two ways to construct such an overall algorithm: a deterministic approach and a randomized one. The deterministic algorithm repeats Algorithm 1 to find one row at a time, while pruning away training examples that are orthogonal to the analysis vectors already found. This practically guarantees that we will learn one distinct new analysis vector with each iteration. This algorithm is presented in Algorithm 2.

Note that the two pruning options described in Algorithm 2 have different roles. The first, corresponding to i < ℓ guarantees that the newly found row will be different from previous ones, as it relies on different training examples. The second pruning option for i ≥ ℓ simply removes examples in the training set that are already well-treated by the rows found so far, thus enabling the "less-represented" examples to get a better treatment. The added step of returning to the complete training set after iteration ℓ-1 is necessary because all those examples that were removed should be returned before entering iteration i = ℓ.

This algorithm exhibits an obvious weakness: the pruned training set tends to shrink in size very rapidly after iteration i = ℓ, leading to situations where the very last rows of Ω Algorithm 2 : Overall Deterministic Algorithm.

Given: Training data X ∈ R d×N . Desired: An analysis operator Ω with p rows, leading to cosparsity ℓ. Initialization: Set X 1 = X to contain all the training examples, and set Ω to be an empty matrix. Loop: Repeat for i = 1 to p: • Basic Step: run Algorithm 1 on X i and find ω.

• Accumulate: Add the found ω as a new row to Ω.

• Prune Training Set:

-For i < ℓ remove from X i all examples that are orthogonal to all the accumulated rows in Ω thus far. -For i ≥ ℓ remove from X i all examples that are orthogonal to at least ℓ rows from Ω.

-If i = ℓ -1, set X i = X.
cannot be found reliably. One possible solution might be to begin the learning process with huge amounts of data, but this solution is not practical in most cases.

An alternative solution is a randomized algorithm. Instead of the pruning used in Alg. 2, at each epoch a random subset of the whole training data X is chosen, and used as input for the basic step. This way, we ensure that, at each iteration, we will have sufficient data to carry out a meaningful learning. Since we start each learning epoch with a different subset of the input data, we can expect to learn different atoms. However, we cannot guarantee that there will be no repetitions, so to avoid this, we compare each new atom to the previously learned ones, and accept the new atom only if it is sufficiently different.

Another situation that may take place is a detection of a row ω that is a linear combination of a pair (or a triplet) of original rows from Ω. The probability for this is small but not negligible, and in the proposed algorithm we have chosen not to prune such rows away. Note that for applications using the learned Ω, these additional rows do not pose a problem, as long as they are found in addition to the p true rows. Because of the above-described two problems, the number of iterations needed to learn the original p atoms is often larger than p. This algorithm is described in Algorithm 3.

• Basic

Step: run Algorithm 1 on X t and find ω.

• Admittance Criterion: verify that ω is different from all accumulated rows in Ω, and otherwise remove it. • Accumulate: Add the found ω as a new row to Ω.

Alg. 3 is expected to work well when the analysis atoms are of equal importance, i.e. all are orthogonal to about the same number of training examples. if this is not the case, we may not be able to learn the rarer atoms. One way to over-come this would be to keep track of which data samples are used when learning different analysis atoms. We may then remove from the data set, or in some way re-weight, those data samples that have already contributed in the learning of many atoms. In essence we are saying that we have already learned all we can from these samples, so we may ignore them completely in the following learning cycles. The exact formulation of this mechanism is part of our future work.

EXPERIMENTS

In this section we introduce three experiments that demonstrate the operation of Alg. 3. We start with purely synthetic data set that follows the analysis model, as described in Section 2. We show that Alg. 3 recovers the original Ω very accurately and with high-probability even when the data is noisy. In the second experiment we turn to a synthetic piecewise constant image, and show that the found Ω is related to finite differences, as expected. Finally, we test the learning algorithm on a true image, and suggest that the resulting rows in Ω make natural sense.

Synthetic Data

In the synthetic experiment, Ω is randomly generated with iid Gaussian entries. We have also tested a known analysis operator such as the overcomplete DCT and the results are the same. Analysis-modeled signals are synthetically created by first choosing ℓ rows from Ω uniformly at random, and then projecting a random vector onto the complement space formed by these rows. The resulting signals are then normalized. This way we guarantee that the data is exactly ℓ cosparse with respect to Ω.

We tested our algorithm on signals of dimension d = 10 with an analysis matrix with p = 20 rows, and we set the cosparsity to ℓ = 8. We generated 10,000 input signals with the above procedure. We ran tests with and without additive Gaussian white noise, σ = 0.1/ √ d. Each iteration (in the randomized algorithm) used ρ = 0.1. The stopping rule for the inner-loop was set to be when the threshold θ became lower than 1.5σ , and the constant c was set to 1.

Each learned analysis vector ω has to fulfill an admittance criterion related to its similarity with the previously learned atoms. In this experiment, we accepted vectors whose maximal inner product with the rows of Ω was θ s = 1 -δ , for different values of δ . Setting δ = 0.02, all the vectors learned were true rows from Ω. When setting it to a more strict admittance criterion (δ = 0.01), some learned vectors were linear combination of rows from Ω.

Results: in the noiseless experiments, all of the analysis vectors were recovered with a mean-squared-error of ≈ 10 -8 per coefficient. The basic step was run 100 times on average until all p = 20 analysis vectors were found, meaning that each vector was found 5 times on average. The number of vectors found and rejected was low, even with the stricter admittance criterion.

Adding noise to the experiments affected the results mainly in two ways. Again, all of the analysis vectors were recovered, but with a mean-squared-error of ≈ 10 -4 per coefficient, and the basic step needed to be run on average 300 times until all p = 20 analysis vectors were found. The number of vectors found and rejected was not affected by the noise.

Synthetic Image Data

In this experiment the randomized algorithm was run on artificially created piecewise constant images. This image was created by accumulating rotated rectangles of random size and random locations to the image. Such an image was chosen for our demonstration since we can hypothesize on the expected shape of the analysis vectors we expect to learn. For a piecewise constant data, we expect these vectors to take some form of oriented derivatives.

Our training data is composed of 8 × 8 patches extracted from a piecewise constant image, as in Figure 1. Thus d = 64. We chose to learn a 4 times redundant analysis operator, so p = 4d = 256. Each iteration used ρ = 0.1 of the data. The stopping rule for the inner loop was set to be when the threshold θ becomes lower than 10 (gray-values), and the data threshold constant c was set to 1.3. A major difference between this experiment and the previous one is that the analysis operator Ω we expect to learn is not necessarily of maximal spark. This implies that there could be linear dependencies between the rows. Thus, it may well be that the cosparsity in such cases exceeds the signal dimension, i.e., ℓ > d. As a consequence, in this experiment we can try to learn a redundant analysis operator that will give us cosparsity ℓ that is much greater than d = 64. Indeed, the results shown in Figure 2 show sample atoms obtained for ℓ = 64, ℓ = 128, and ℓ = 192. As can be seen, the atoms tend to be more localized when ℓ is larger. The atoms shown in Figure 2 represent various (first, second, third) derivatives in different locations and with different orientations, as expected.

True Image Data

The last experiment in this paper is very similar to the previous one, but applied on a natural image -"peppers" shown in Figure 3. A sample set from the analysis rows obtained for cosparsity ℓ = 3d = 192 is given in Figure 4. As can be In order to illustrate the effectiveness of the found analysis operator, Ω, Figure 5 presents the projection values ΩX for 1000 randomly chosen image patches from the training set. The projection values are sorted per each column in a descending order of their absolute value. Ideally, we should get that the last 3d rows are exact zeros, but as we work on true data and allow for small inner products instead of exact zeros, the behavior is little-bit different. As can be seen, the projection values tend to decrease very fast towards zero (zero is white color in order to save toner). For reference, a similar projection matrix is shown for a randomly chosen Ω (with zero mean rows), and it is clear that it is much less effective in terms of the cosparsity it leads to.

ℓ = d ℓ = 2d ℓ = 3d

CONCLUSIONS

Learning the analysis operator that gives sparse analysis coefficients is a new field of activity. In this paper we presented a simple but effective algorithm for learning a sparsifying analysis operator. We have shown that our algorithm is able to recover the analysis operator with high precision in synthetic experiments and is able to learn derivative like operators for analysis of piecewise constant images. Future work includes studying the effects of the various parameters and understanding how they affect the learning process and the learned dictionary, handling linear dependencies within the analysis operator, proving converges for the basic set of the algorithm, and developing more elaborate analysis learning schemes.

Algorithm 3 :

 3 Overall Random Algorithm. Given: Training data X ∈ R d×N . Desired: An analysis operator Ω with p rows, leading to cosparsity ℓ. Initialization: Set Ω to be an empty matrix. Loop: Repeat until we have p distinct rows in Ω: • Choose Examples: Set X t to contain a randomly chosen subset of the training examples with ρN examples, (ρ ≪ 1).

Figure 1 :

 1 Figure 1: A sample piecewise constant image.

Figure 2 :

 2 Figure 2: Sample analysis atoms found for the synthetic piecewise constant image using different ℓ values.

Figure 3 :

 3 Figure 3: The "peppers" image.

Figure 5 :

 5 Figure 5: The projection values (after sorting their absolute values). The top refers to the learned Ω, while the bottom refers to a random matrix with Gaussian iid entries (and normalized rows).

Figure 4 :

 4 Figure 4: Sample analysis atoms found for the image "peppers", obtained for ℓ = 3d.

  Algorithm 1 : Basic Algorithm -Finding one Row. Given: Training data X ∈ R d×N . Desired: A row from the analysis operator Ω that has p rows, leading to cosparsity ℓ. Initialization: Set an initial threshold value θ = ∞. Loop: Repeat until threshold θ ≤ θ 0 . Initial row: Set ω to an initial random value. Inner Loop: Repeat until convergence: • Inner Products: compute the inner products between ω and all the examples X. • Set Threshold: set a threshold θ such that cℓN/p of the inner products are below this threshold (c ≤ 1). • Set Indicator: set Λ to specify only inner products smaller than θ . • Prune: prune irrelevant examples and build X Λ . • Update ω: set ω to be the eigenvector associated with the smallest eigenvalue of X Λ X T Λ .

Acknowledgement

This work was supported by the European CommissionŠs FP7-FET program, SMALL project (grant agreement no. 225913).


Christophe Tournier

Cedric Castagnetti

Sylvain Lavernhe

François Avellan
email: françois.avellan@epfl.ch

Cedric Castagnetti

François Avellan Tool

Cédric Castagnetti

Tool path generation and post-processor issues in five-axis high speed machining of hydro turbine blades

Keywords: five-axis machining, high speed machining, inverse kinematical transformation, tool path computation

de niveau recherche, publiés ou non, émanant des établissements d'enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.

Introduction

The Laboratory for Hydraulic Machines (LMH) of the Ecole Polytechnique Fédérale de Lausanne (EPFL) carries out teaching, research and services in the field of hydrodynamics rotating machines such as hydraulic turbines, pumps, pump-turbines, ship propellers etc. Within the context of the European project Hydrodyna [START_REF] Hydrodyna | Eureka Project[END_REF], the LMH is involved in the realization of tests on 1/10 scaled models. The hydraulic machine of the Hydrodyna project is a pump-turbine made of three main parts: the spiral case or volute, the distribution and the wheel (figure 1). The turbine is composed of several parts with different types of copper blades: the fixed guide vanes, which support the mechanical strains due to both water pressure and flow in the stay ring; the wicket gates, which regulate the discharge in the runner by changing the opening angle; the runner blades, which convert the hydraulic energy in mechanical energy.

As LMH has just acquired a new 5-axis high speed milling center, the objective of the collaboration with the Laboratoire Universitaire de Recherche en Production Automatisée (LURPA) is to study the feasibility of blade manufacturing in 5-axis High Speed Milling (HSM). Indeed, these parts present complex geometries for which collisions, surface roughness and productivity issues arise.

The use of 5-axis HSM allows profits in productivity by optimizing tool trajectories and by minimizing the number of part setups. Nevertheless, 5-axis machining requires a better expertise than 3-axis machining since both tool path planning and tool path computation are especially important. Indeed, problems of tool collision as well as the kinematical behavior of the machine tool have a strong influence on the machining progress and on the quality of machined parts. This paper deals with the machining of the fixed guide vanes (figure 2). In the first section, problems involved by the Inverse Kinematical Transformation (IKT) are exposed. More particularly, a specific attention is done on the problem of IKT multiple solutions and on singularities, which generate collisions or incoherent movements disturbing machining. The second section is dedicated to the illustration of encountered problems in 5-axis machining using test parts, which prompt machine tool axes differently. Finally, some solutions to overcome inverse kinematical transformation problems are proposed. Tool path generation in 5-axis milling using CAM software leads to a trajectory expressed in the programming reference frame attached to the CAD model of the part. The trajectory is expressed as a set of cutter tool locations. Each cutter tool location is defined by (X p , Y p , Z p ), the coordinates of the driven point of the tool and (i, j, k), the projections of the tool axis direction onto each axis of the programming reference frame. In addition, a five dimension articular space linked to the three translation axes and the two rotation axes is associated to the 5-axis structure. Therefore, to be complete, the numerical chain must include a geometric transformation, which transforms cutter locations into displacement orders on each machine tool axis (X m , Y m , Z m , A/B or A/C or B/C). This transformation is called the Inverse Kinematical Transformation (IKT).

According to the Numerical Controller (NC) unit, several solutions are offered to the user to describe the tool trajectory, which is transmitted to the NC unit (figure 3). The first possibility is to directly send the tool trajectory expressed in the reference frame. In this case, the post-processor is used to translate the program generated by the CAM software into APT language (ISO3592) or into G code (ISO6983) language. The IKT is then carried out in real time by the NC unit. The main advantage of this approach is to keep the consistency within the numerical chain since the program would be the same whatever the machine tool structure used. Another solution is to use a dedicated post-processor the role of which is to compute the IKT. Hence, displacement orders on each axis are calculated in the articular space and are transmitted to the NC unit. This approach is more difficult to manage since we have to control the effective relative movements between the tool and the part and each axis velocity.

Figure 3: numerical chain in 5-axis milling

The machine tool of LMH is a 5-axis milling center Ferrari with a RTTTR structure with possible rotation on the C and B axes. The first one corresponds to the part rotation, and the second one is located on the spindle. Concerning the LURPA, the machine tool is a 5-axis milling center Mikron UCP710 with a RRTTT structure with rotation on the A and C axes on the part. As tests are carried out on both machine tools, we illustrate our remarks concerning the IKT problems using the Mikron machine tool. The same approach has been carried out with the Ferrari machine tool.

For the RRTTT structure, the IKT leads to solve the following equations, which have zero, one, two or an infinite number of solutions:

     = × - = × = ) cos( ) sin( ) cos( ) sin( ) sin( A k A C j A C i (1)
System (1) has two domains of solutions corresponding to A>0 or A<0, and solutions vary in function of the (i,j,k) values (table 1). -If k is included in the interval ]-1,ArcCos(|Amax|)], there is no solution; the programmed orientation is not practically reachable for it is out of the rotary axis range.

i < 0 i = 0 i > 0 A 1 = acos(k) C 1 = -atan(i/j) j < 0 A 2 = -acos(k) C 2 = -atan(i/j)+π A 1 = acos(k) C 1 = -π/2 A 1 = acos(k) C 1 = π/2 j = 0 A 2 = -acos(k) C 2 = π/2 A=0 C undefined A 2 = -acos(k) C 2 = -π/2 A 1 = acos(k) C 1 = -atan(i/j)+π j > 0 A 2 = -acos(k) C 2 = -atan(i/j)
-If k is included in the interval ]ArcCos(|Amax|), ArcCos(|Amin|)], there is only one solution. This configuration is a major source of collisions between the tool and the part. Indeed, when maximum rotation on A axis is reached in a given space of solution (A 1 ,C 1 ), switching from domain 1 (A 1 >0) to domain 2 (A 2 <0) makes the table C rotates by 180°. This rapid movement may cause rear gouging. Moreover, during this movement, the displacement of the cutter contact on the surface is small; the relative velocity tool-surface is quite zero. As cutting conditions are not satisfied, velocity drops may cause marks on the surface.

-If k is included in the interval [ArcCos(|Amin|),1[, two opposite articular solutions (A 1 ,C 1 )
and (A 2 ,C 2 ) exist. The choice of a solution among those possible is generally solution of an optimization problem [START_REF] Brient | Etude de l'influence du processus de fabrication sur les performances des propulseurs marins : approche multimétiers de l'usinage d'hélices[END_REF].

-Lastly, if k = 1, an infinity of solutions exists. In this case, as the tool axis is perpendicular to the table any configuration of the C axis is possible [START_REF] Bohez | Adaptive nonlinear tool path optimization for five-axis machining[END_REF]. Although this configuration only appears when the cosine directors (i, j, k) is precisely equal to (0,0,1), the resolution and the precision of the rotary axes actually define a conical volume that should not be crossed [START_REF] Affouard | Avoiding 5axis singularities using tool path deformation[END_REF]. The deformation of the tool center trajectory and the tool axis orientation is proposed in [START_REF] Affouard | Avoiding 5axis singularities using tool path deformation[END_REF] to avoid crossing this zone defined as the "cone of singularity".

values of k ]-1,ArcCos(|Amax|)] ]ArcCos(|Amax|), ArcCos(|Amin|)] [ArcCos(|Amin|),1[ 1 number of 0 1 2 ∞ solutions no solution (A 2 ,C 2 ) (A 1 ,C 1 ) or (A 2 ,C 2 )
A=0 and C=unspecified Table 2. Sets of solutions for the IKT.

The different solutions to the IKT problem or the absence of solution are a major source of problems in 5-axis milling as well as interference issues. This analysis of the inverse kinematical transformation will be useful to explain the difficulties which we encountered during the machining of the fixed guide vane in 5-axis milling on both the Ferrarri and the Mikron machines.

Machining strategy

Generally, manufacturers of small-scale hydraulic machine models wish to reach the best geometrical characteristics on lower and upper blade surfaces directly from the machining operation, and envisage a manual polishing operation to obtain the correct leading edge roughness. They can thus make the tool path overlap on the leading edges. The new challenge is now to directly machine the leading edge with the best quality possible in order to avoid manual polishing. However, this issue is seldom addressed. Most of the research works focus on finding the best machining strategies for lower and upper surfaces, with the objective to approach the expected roughness and/or to minimize vibrations [START_REF] Brient | Etude de l'influence du processus de fabrication sur les performances des propulseurs marins : approche multimétiers de l'usinage d'hélices[END_REF][5] [START_REF] Corduan | Investigation on thin walled piece stability during milling operations[END_REF].

Therefore, finding the best machining strategy for leading edge machining seems an interesting issue which can be useful not only for blade surfaces but also for any type of form presenting strong evolutionary curvature areas. Indeed, if we can make the assumption that on the lower and upper surfaces, the tool reaches the programmed feedrate it is not the case for the leading edges. Rotary axes have to rotate very quickly to make the tool turning all around the part, which generates strong accelerations. As illustrated through the example below, the rotary axis cannot ensure the programmed feedrate although this one is not very high. A programmed feedrate Vf = 2 m/min involves 65450°/min for the A or B rotary axis velocity. As the maximum velocity is 53280°/min for the Ferrari and 5400°/min for the Mikron, the programmed federate cannot be reached. Dedicated machining strategies can help to improve machining performances.

To analyze this problem, let us consider a filleted end mill, a generic tool in 5-axis milling which geometry can be modified as a ball end mill or flat end mill. We associate to each cutter contact point C C , the local coordinate frame defined by (C C , f, n, t), where f is the tool feed direction, n is the normal to the surface and t is the tangent vector to the surface defined so that t = f ^ n. Initially, the tool axis vector u, f and n are coplanar. To orient the tool axis, two rotations are considered [START_REF] Choi | Cutter location data optimization in 5-axis surface machining[END_REF]: the tilt rotation θ t around t and the yaw rotation θ n around n (Figure 4). Values of θ t and θ n can be modified to control the scallop height [START_REF] Tournier | Iso-scallop tool path generation in 5-axis milling[END_REF], to avoid collisions [START_REF] Lee | Admissible tool orientation control of gouging avoidance for 5-axis complex surface machining[END_REF] or to modify the rotary axis prompting [START_REF] Ho | Five-axis tool orientation smoothing using quaternion interpolation algorithm[END_REF]. For instance, they can be adapted to anticipate the evolution of the tool axis orientation on the leading edge in order to respect the tool feedrate (Figure 5). We propose to use this strategy based on anticipated orientations of the tool axis so that velocities and accelerations of the rotary axes are less important, with the aim of reaching the programmed feedrate. A test part is thus created in order to prompt the rotary axis A which is the slowest (Figure 6). The part presents an evolutionary curvature along the leading edge in order to test performances of the A axes. Tests are carried out on both 5-axis machining centers. Nevertheless, tests carried out on the MIKRON UCP710 are more detailed as the numerical controller Siemens 840D offers the possibility of monitoring axis characteristic during machining (position, velocity, etc.). We used four different machining strategies to carry out the finishing milling of the part based on a tool guiding according to iso-parametric curves of the surface. For each strategy the management of the tilt and yaw angles varies (Table 3). For the first three strategies and whatever the machine tool used, the "A axis" test part cannot entirely be machined without swaps from one space of solutions to the other one. Indeed, the calculated amplitude of the A axis rotation exceeds axis range limits for every strategy except for the fourth. In this case, the amplitude of A axis rotation is reduced by 50° due to the tool axis orientation management. Values of the A and C angles to be reached and computed by the post-processor of the MIKRON are reported in figure 8. We clearly see the discontinuity when the A axis reaches one of its limits A min : it swaps from A min to -A min , whereas the C axis makes a half turn (rotation of 180°).

Figure 8: rotary axes commands during machining

This discontinuity generates significant variations in the axis command. The resulting movement between the two successive positions, before and after the discontinuity, depends on the reference frame in which axis commands are computed. Generally, in the part reference frame (X p , Y p , Z p i, j, k), the machine must ensure the coordination of the 5 axes (figure 9). But in our case, the machine detects the end of the A axis range and does not find the opposite solution, stopping the machining. We then use the alternative mode for which movement instructions transmitted to the NC unit are (X p , Y p , Z p , A, C). Calculation of the A and C angles is previously carried out by the post-processor. If the program described the movement of the tool extremity, swapping from one solution to the opposite one generates a mark on the part. Hence, a collision appears between the tool and the part (figure 10). Indeed, the machine does nothing but controls the extremity of the tool without considering the part and tool volumes. The position of the tool extremity point is calculated by the CAM software to ensure a tangent contact to the part for a given orientation of the tool axis. The great displacement of the part thus generates a modification of the tool axis orientation relatively to the part that means a modification of the contact point. The collision is unavoidable, even if the tool remained fixed in the part reference frame.

Figure 9: movement between the tool and the part according to the programming frame

In the case of ball-end cutter tool milling, for a given position of the tool center point any orientation of the tool axis preserves the tangent contact between the tool and surface. Then the solution consists in programming the trajectory of the tool center in the CAM system and to decrease the declared tool length in the machine by the tool radius value. With this solution, the collision does not appear but nevertheless we can observe a mark left by the tool. This mark may come from an error of the declared tool length or the declared characteristic length of the machine.

Besides, when axis commands are described in the machine reference frame (X m , Y m , Z m , A, C), there is no coordination. For instance, when the table turns by 180°, the tool trajectory does not follow the movement of the table in order to maintain constant the relative position between the tool and the part (figure 9). The NC unit only manages axis synchronization in the articular space: axes must start and arrive at the same time. The task dedicated to the post-processor is the sampling of the movement in order to reduce the relative movement. In other words, the collision between the tool and the part is unavoidable. In the literature this behavior generates errors qualified as "kinematical errors" [START_REF] Munlin | Optimization of a 5-axis milling machine near stationary points[END_REF]. Since, errors are larger when programmed movements are longer, this phenomenon often appears during roughing, and is sometimes associated to jumps between rotary axis configurations.

A solution to the collision when swapping from one solution space to the other one could be the introduction of additional tangent movements before and after swapping. Therefore, the transition between the two positions would be done while the tool is located on a retract plane for instance. Nevertheless, this kind of solution is not optimal as it breaks the numerical chain. Indeed, rotary axis limit is linked to the considered machine tool, which is not known during CAM programming, especially in a decentralized world market with overseas production.

Figure 10: collisions and marks during jumps between IKT solutions

Incoherent movements

During the machining of the part with the strategy 2 (constant 5° tilt angle), we observed incoherent C axis movement when the tool is close to the singularity (figure 8). This movement appears very locally for each path but with different amplitudes, and strongly slows down the machining which generates marks on the part. By extracting lines from the ISO code corresponding to the tool path, we note a discontinuity in table evolution (see appendix).

After checking the program expressed in the part reference frame, we note that the location is not exactly at the singularity point. If strategies 1 (null tilt angle) and 2 (constant 5° tilt angle) are compared, we can notice that the singularity point is not approached in the same way. For strategy number 1, the passage at the neighborhood of the singularity and the inversion of the sign of j (from A>0 to A<0) are performed whereas i is almost null. In the case of the strategy, the inversion of the sign of j is done whereas i is not null (figure 11).

From this statement, we studied the evolution of the function C = -Arctan(i/j) all tool path long for the four strategies. The iso-value lines of the Arctan function (in blue) and the coordinates i and j of the tool axis orientation for each point of the considered tool path are plotted in figure 11. Strategies 1 and 2 present a similar behavior but are shifted by a value of j corresponding to the 5° tilt angle. Strategies 3 and 4 present a linear behavior due to the constant i/j ratio. The offset between the two curves when i = 0 is due to the 5° tilt angle difference on the leading edge.

The graph proposed in figure 11 allows the calculation of the gradient associated to the rotation of the C axis. For example, considering strategy 4, C axis quickly varies from values close to 135° to 0°. By zooming near the singularity point (i=0, j=0), we can observe for strategy 2 a point of the trajectory for which the value of the C angle is approximately 52°. As the iso-value lines are very tightened in this zone, any point will generate a rapid movement during machining.

Figure 11: C axis values according to i and j

Nevertheless, if we can emphasize the amplitude of the incoherent movements, thanks to figure 11, the movement itself results once again from the existence of two IKT solutions. Indeed, the passage from j negative to j positive corresponds to the solution space swapping. That means that swapping from A 1 = acos(k) ; C 1 = -atan(i/j) to the solution A 2 = -acos(k) ; C 2 = -atan(i/j) involves a main discontinuity (figure 12). When the ratio i/j is a of a high negative value, C 1 is close to 90°, whereas when i/j is of a high positive value, C 2 is close to -90°. This generates a 180° discontinuity when passing through j = 0 when i is not null. Nevertheless, since linear movements of the tool are small during finishing, generated kinematical errors are not significant, particularly when using a ball-end cutter tool.

Figure 12: C axis values according to i/j ratio and to the space of solution

Although this phenomenon is not comparable with the problem of singularity cone, the resolution of the problem can be carried out with methods identical to those developed in [START_REF] Affouard | Avoiding 5axis singularities using tool path deformation[END_REF], i.e. by deformation of the 3D trajectory or by modification of the 2D curve in the ij plane (figure13). Indeed, the only suppression of the "wrong" point in the program could generate a too significant chordal deviation. Moreover, a deformation-based method preserves continuity in the movement of the rotary axes. The deformation leads to the tool orientation modification by modifying the tilt and yaw angles to pass as closer as possible to the singularity point, as for strategy 1 (null tilt angle) which does not present this difficulty (figure 11). However, if this modification is influence-free on surface roughness when using a ball-end cutter tool, it is not the case with a filleted-end tool [START_REF] Choi | Cutter location data optimization in 5-axis surface machining[END_REF]. In such a case, the solution cannot come from the post processing of the trajectory considering that to preserve the specified scallop height (thus the required quality), it is necessary to modify the angles of the tool axis orientation in the local reference frame (C C , f, n, t) relatively to the tangent plane to the surface at the considered C C point.

In order to maintain the behavior of A axis during the tool path modification (A=acos(k)), we could impose a deformation in the ij plane respecting the following constraint: i² + j² = 1 -k². Hence, the modified point on the ij plane must be part of a sqrt(1 -k²) radius circle centered on the origin (Figure 13). We applied this deformation on a set of cutter location points at the neighborhood of the incoherent movement and computed the resulting direct axis command C (Figure 13). The transition between IKT solutions is smoother. The NC unit is able to interpolate theses new direct axis commands without difficulty, removing the incoherent movement. However, we point out that the new program communicated to the NC unit in term of (i, j, k) could generate a more localized incoherent movement due to the tool path interpolation through the change of IKT solution.

To summarize, strategies which not lead to incoherent movements of the rotary axes are of great interest (as strategy 4 for instance). Anyway, due to the complexity of the inverse kinematical transformation, it remains difficult to anticipate the machine tool kinematical behavior during tool path programming. The choice of the programming strategy is still an iterative procedure dedicated to a given machine tool. The production modification from 3-axis machining at conventional cutting speeds to 5-axis high speed machining on the fixed guide vanes presented some difficulties. These difficulties come mainly from the structure of the used machines, the limitations of the axes range and the kinematical performances of the rotary axes, always slowest on this type of machine. The limits of the rotary axes range generates jumps between IKT solutions, which create collisions if the CAM software is not able to propose additional retract movements to safety planes. We used machining strategies with tool axis orientation optimization in order to maximize the tool feedrate while minimizing rotary axes prompting. On the other hand, the machining of the leading edge in configurations where we are close to the singularity does not allow obtaining the awaited profits because of disturbed movements of the part. It is thus necessary to detect these behaviors during simulations of machining in order to modify the trajectory. We proposed an analysis of the tool path in the (i,j) plane and a method to modify the orientation of the tool to remove or soften the incoherent movements. In the case of the ball end mill, a modification can be carried out directly in the program trough a post-processing of the tool path. As drawback, the numerical chain is broken, as we cannot keep track of this modification. The most satisfactory solution is to modify the CAD model by modifying the machining strategy, but we are then confronted to the lack of integrate tools into commercial CAM software to carry out this operation easily. Finally, the tests carried out on the two milling center allow to confirm the choice of 5-axis high speed machining to produce copper blades. This will help to reduce the polishing phase of the leading edges.

Figure 1 :

 1 Figure 1: hydraulic pump-turbine Figure 2: fixed guide vane

Figure 4 :

 4 Figure 4: tool axis orientation Figure 5: tool axis orientation anticipation on the leading edge.

Figure 6 :

 6 Figure 6: A axis test part Figure 7: "interpolation" strategy

  ball end mill; Machining tolerance = 0.01 mm ; Scallop height = 0.01 mm ; Max sampling step = 0.1 mm ; Max sampling angle = 1°.

Figure 13 :

 13 Figure 13: tool path modification in (i,j) plane

Table 1 .

 1 Domains of solutions (A 1 ,C 1 ) and (A 2 ,C 2 ).

	Due to physical limitations, all solutions for A are not practically possible. Different possible cases
	arise according to k values:

Table 3 :

 3

machining strategies 4.1 Test part machining 4.1.1 Collisions when swapping from one solution range to the other


Castillo

L Merino

P O Darnerud

U Edberg

P Åman

Mdp Castillo

Levels of nitrate in Swedish lettuce and spinach over the past ten years

Monitoring of nitrate in Swedish-produced lettuce and spinach over the past ten years (1996)(1997)(1998)(1999)(2000)(2001)(2002)(2003)(2004)(2005) showed that more than 95 % of the samples were below the maximum levels established by the European Commission in 1997. The good agricultural practices used by Swedish farmers may partly explain these results. Analytical results of organic farming production of lettuce from year 2000 showed low nitrate levels compared to conventional production. The ten years of Swedish experience has shown good compliance with the EU maximum levels, but even lower nitrate levels may be achieved by organic farming methods, at least regarding fresh lettuce grown under cover.

Introduction

Our intake of nitrate is from three main sources: vegetables, drinking water and food additives.

Among them vegetables are generally the major source (75%-91%), yet in some areas drinking water can account for the major contribution (European Commission Scientific Committee for Food 1997). Nitrate is a natural component of vegetables originating from the uptake of nitrate ions in excess of its reduction and subsequent assimilation. The concentration of nitrate in vegetables depends on genetic factors, environmental variables and agricultural practice [START_REF] Maynard | Nitrate accumulation in vegetables[END_REF]).

When vegetables are classified according to their capacity of nitrate accumulation, genetic factors are most pronounced and commonly mask the effects of the other factors. In 1995 the National Food Administration (NFA), based on a survey of nitrate levels in vegetables from the Swedish retails market, made the following categorization: high levels (>1000 mg/kg) -fresh lettuce, spinach, intermediate levels (350-1000 mg/kg)-Chinese cabbage, iceberg lettuce, leek, beetroot, white cabbage, and low levels (<350 mg/kg) -broccoli, cucumbers, carrot, cauliflower, potato, tomato [START_REF] Merino | Låga nitrathalter i svenska grönsaker[END_REF]). Thus, lettuce and spinach are those with relatively high nitrate accumulation capacity.

The environmental factors affecting nitrate levels in vegetables are light, temperature, humidity, CO 2 -atmosphere, water supply, etc. It is well documented that low light intensity is often associated with increased nitrate concentration in plants [START_REF] Cantliffe | Nitrate accumulation in vegetables crops as affected by photoperiod and light duration[END_REF]. Hence, nitrate levels tend to be higher in samples from northern Europe than those from Mediterranean countries. The nitrate content in vegetables grown under cover is usually considerable higher than in those grown in the open air in the same seasons (European Commission SCF 1997) [START_REF] Maynard | Nitrate accumulation in vegetables[END_REF].

With the use of Good Agricultural Practices (GAP) it may be easier to control the levels of nitrate in vegetables and much work is focussed on this topic. Light, plant density, watering, fertilizing, sprinkling, etc. are some of the variables considered in GAP (EC DG VI/4857/97, EC DG VI/8108/97, EC DG VI/8421/97, EC DG VI/8437/97).

The scientific discussion about the potential risk with the usage of nitrate in the agricultural and food sector is focussed on two major topics, namely environmental and health aspects. In the 1970s there was an intense nitrate debate due to the potential relationship between the use of nitrates and nitrites as additives and the formation of carcinogenic nitrosamines. Nitrate -and its derivate nitrite -is also associated to a disease affecting the oxygen transport in blood (methaemoglobinaemia), of which babies are most susceptible [START_REF] Walker | Nitrates and N-nitroso compounds: a review of the occurrence in food and diet and the toxicological implications[END_REF]). Hence, the Scientific Committee for Food (SCF) based on toxicological studies of the increase in circulating methaemoglobin (using a safety factor of 500) established an Acceptable Daily Intake (ADI) for nitrate of 3.7 mg/kg body weight (European Commission SCF 1997).

The intake of nitrate and nitrite from food are generally well within the ADIs. Thus, studies performed in the UK showed that taking into account nitrate intake from the rest of the diet, even the highest nitrate levels found in the UK Monitoring Programme are not likely to cause even high-level consumers of lettuce or of spinach to exceed the ADI (Food Surveillance Information sheet, 2003). An estimation of Swedish intake showed a mean intake of 18-21 mg/day and a 95% percentile intake of 63-72 mg/day [START_REF] Fernlöf | N-nitroso compounds and precursors in food-level, intake and health effect data and evaluation of risk[END_REF], to be compared with the ADI of 222 mg/day. However, there may be a considerable range in nitrate intake levels depending on other sources than vegetables, and the presence of nitrate-contaminated drinking water could drastically increase the total intake. We know that small children are especially sensitive to the effects of methaemoglobinemia, and that infant formula made with water with high nitrate levels could be a serious health risk. To eliminate potential risks, the Swedish NFA also recommends that small children should not be given juices made of nitrate-rich vegetables, such as beetroot.

To conclude, consumers seem in general to be sufficiently protected, as regards health effects, by the present regulation. High nitrate intake levels, which could be harmful especially in small children, may primarily be the result of factors other than nitrate in vegetables, e.g. contaminated drinking water. From a risk-benefit viewpoint, the beneficial health effects of vegetable consumption must also be taken into account. Moreover, a recently published study stresses evidence of the beneficial effects of some derivatives of nitrate e.g. nitric oxides to help regulate blood pressure and protect the stomach against harmful substances (gastric juice, strong spices, alcohol, bacteria, etc) [START_REF] Lundberg | Nitrate, bacteria and human health[END_REF]).

As indicated above, the concern for the environmental and health aspects of nitrate as a water pollutant is still of great interest. The EU monitoring networks indicate that over 20% of groundwater and between 30 and 40% of lakes and rivers show excessive nitrate concentration and agricultural sources account for between 50 and 80% of the nitrate entering Europe's water (European Commission 2005). Nutrients emissions from agriculture are the main reason for eutrophication. Rivers are now discharging several hundred thousands tonnes of nitrogen a year into the Baltic Sea. Swedish watercourses, however, account for only a minor proportion of this input. Instead the greater part comes from Eastern Europe, where population and agricultural acreage are considerably greater. In Sweden, about 100 000 people today are dependent on drinking water, which contains nitrate concentrations in excess of the limit (10 mg NO 3 -N/litre) The evaluation of the results of a Monitoring Programme for nitrate in lettuce and spinach, together with the adopted GAP codes and an updated scientific risk assessment will be used by the European Commission to establish a longer-term strategy for managing the risk from nitrate in vegetables. This includes the review of the maximum levels lay down in 1997 (European Commission 2001).

In 1995 the Swedish NFA evaluated the content of nitrates in vegetables [START_REF] Merino | Låga nitrathalter i svenska grönsaker[END_REF], and in 1996 started a monitoring programme for nitrate in lettuce and spinach cultivated in Sweden. The result of this study is presented in this paper.

Materials and methods

Chemicals

All reagents must be of analytical grade and the water used of at least grade 1 as defined in the standard ISO 3696:1987

Equipment

Liquid chromatograph, isocratic system equipped with UV detector. Analytical separating column, anion exchanger, 4.6 mm x 150 mm, packing material (e.g. Waters IC Pak HC); polymethacrylate resin with a quaternary ammonium functional group, particle size of 10 µm.

Samples

The samples studied were fresh lettuce, iceberg lettuce, fresh and frozen spinach.

Sample collection

The samples collected during the Monitoring Programme followed the European Commission guidelines (European Commission DG VI/1655/97), i.e. one sample per two metric ton of production with a minimum of 12 samples per year for product. Fresh lettuces, iceberg lettuce together with fresh and frozen spinach representative of the seasonal growing and the geographical areas of the country were collected annually by the Swedish NFA. Each collected laboratory sample consisted of at least 10 individual vegetables. The samples were homogenised as a whole and frozen to -18 ºC until analysis.

In the summer of year 2000 a project was started by the NFA to compare organic, conventional and integration farming in relation to the quality of the food produced. The project considered the analysis of content of bacteria, vitamins, metals, pesticides, nitrate, etc. [START_REF] Staffas | Sallat & Vitaminer[END_REF]. From a total of 100 samples, 24% of the fresh and iceberg lettuces came from organic farming. These results are included for comparison and are not a part of the Monitoring Programme.

Sample preparation

Nitrate was extracted from the sample with hot water (50-60 ºC) and the test solution treated with acetonitrile to remove suspended material (NMKL No. 165 2000).

Analytical Method

The ion was determined by ion chromatography with ultraviolet detection at 205 nm (NMKL No.165 2000). The method accomplishes the criteria for analytical performance established by the European Commission (EC DG VI/4800/96-Rev-1). Our laboratory has previously evaluated this method.

Thus, extraction, clean-up and chromatographic conditions were some of the parameters studied.

Furthermore, an internal validation and two collaborative studies with the participation of 15 European laboratories were performed [START_REF] Merino | Liquid chromatographic determination of residual nitrite/nitrate in foods: NMKL collaborative study[END_REF]. The recovery calculated in the single validation was 103%. The recovery factor was not statistically significant; therefore it was not used to correct the results. The uncertainty calculated in a single validation study was lower than the uncertainty obtained from an interlaboratory study (Fig. 1). Because the confidence of the statistical parameters from interlaboratory studies is higher than the single validation (Codex Alimentarius Commission 2005), the former was used to interpret the results.

[Insert Fig 1 about here]

Throughout the Monitoring Programme, the Swedish NFA laboratory followed the recommended internal quality control procedure and participated annually in proficiency testing schemes with satisfactory performances.

Results and discussion

The yearly nitrate levels in lettuce and spinach are shown in Figures 2 and3, respectively. The summary of the nitrate content, expressed as median, is presented in Table I. No significant differences were observed between the median and mean values in any of the studied vegetable A total of 159 samples of fresh lettuce were analysed. These samples were cultivated under cover during winter and summer. The median value found was of 2684 mg NO 3 /kg, which is below the maximum limits established by the European Commission. However, four samples exceeded the regulatory limits, two were summer samples from 1996 and 1998 and two winter samples from year 2000 (Table I, Fig. 2). The producers were informed for corrective actions.

The median of the iceberg lettuce 931 mg NO 3 /kg was well below the regulatory limit (Table I, Fig. 3). However, in the year 1996 one high value was observed. All the Swedish production of iceberg lettuce is produced on uncovered fields during the summer season. [Table I about here] The results from organic farming showed that the median nitrate levels in fresh lettuce was 826 mg NO 3 /kg and that in iceberg lettuce 672 mg NO 3 /kg. Although only comparing nitrate data from one year (2000), the results indicate that organic farming, at least when compared to conventional farming of vegetables with fairly high nitrate levels (i.e. fresh lettuce), could lead to a substantial decrease in these levels. However, this is not the case with iceberg lettuce where it seems that the genetic factor is more important and masks the influence of the environmental factors and agricultural practices. In the study from 2000 fresh lettuce from organic production (826 mg NO 3 /kg; n=14) could be compared both with those from integrated production (1708 mg NO 3 /kg; n=28) and from conventional production (2484 mg NO 3 /kg; n=5) (Staffas 2000), which may give further evidence for the importance of the production manner for the nitrate levels. There are other studies showing that organic farming in average has the potential of reducing nitrate levels in vegetables products [START_REF] Brand | Organic agriculture: does it enhance or reduce the nutritional value of plant foods?[END_REF]. However, the literature also reports studies showing inconsistent or not significant difference in nitrate content in conventional and organically grown crops. (Lyons DJ, et.al, 1994;Woese K. et.al 1997) A total of 63 samples of fresh spinach were analysed with a median concentration of 1747 mg NO 3 /kg (Table I ,Fig 4). Twelve samples from year 1996 exceeded the maximum level specified in the regulation. All those samples came from the same producer who was using the vegetables for further processing as frozen spinach and not for direct consumption in the market.

The results of 70 frozen spinach samples with a median concentration of 551 mg NO 3 /kg (Table I ,Fig 5), confirm that, as it is well known, the nitrate content in processed vegetables is usually much less than in fresh vegetables due to the loss of nitrate during the blanching process [START_REF] Maynard | Nitrate accumulation in vegetables[END_REF]. [Insert Fig 4,5,about here] In theory the adverse climatic conditions in Sweden, with low light intensity, may promote high levels of nitrates in plants. However, concentrations below the maximum levels of nitrate were observed in 96 % of the samples analysed during 10 years of the Monitoring Programme. The good agriculture practices, which in Sweden could be performed as Integrated Production (IP) (Green Production 2005) or organic farming, controlled by KRAV or Demeter (http:/www.krav.se), allows the Swedish farmers to produce lettuce and spinach fulfilling the European regulations. The Swedish IP criteria are revised every two years and contain instructions that specifically address how to reduce nitrate levels in lettuce. Today, about half (lettuce under cover) or 75% (iceberg lettuce) of the production area for commercial lettuce production belongs to growers connected to the Swedish organisation for IP production. The adopted quality criteria for the analytical methods and sampling to be used by monitoring laboratories should minimise the adverse influence of these factors in the variability of the data.

Consequently, the comparison of the levels of nitrate between Member States will be easier. Also a better insight of the role of agricultural practice on the nitrate levels in vegetables is gained.

There is a potential public health risk with elevated nitrate levels in food because of possible nitrosamine formation, as well as methaemoglobin. On the other hand, in the light of increasing evidence that the reduction of nitrate to nitrite and the subsequent formation of biologically active nitrogen oxides could be beneficial, the previous view emphasising only the harmful effects of the intake of high nitrate may be reconsidered [START_REF] Lundberg | Nitrate, bacteria and human health[END_REF]). However, although, these new studies are discovering interesting aspects of the biological chemistry of the nitrogen cycle, they do not deny yet that the pollution of the environment with nitrate is a major public health problem (European Commission SCF 1997).

Conclusions

Former surveys made by the NFA in Sweden in 1985 and 1995 [START_REF] Lönberg | Nitrat i grönsaker[END_REF][START_REF] Merino | Låga nitrathalter i svenska grönsaker[END_REF]) and the results of the monitoring programme reported in this paper show a sustained low concentration of nitrate in lettuce and spinach cultivated in Sweden. During the last 5 years no samples with nitrate levels over the maximum limits established by the European Commission have been found. The specific instruction regarding nitrate reduction in lettuce production introduced by Swedish producer organisations may be an important factor in explaining these results.

  , 2005). Hence it is important to control the pollution caused by nitrates from agricultural sources, to which codes of GAP play a key role (Council Directive 91/676/EEC).

  a fairly normal distribution of the sample values. Some differences in levels were observed during the 10-year observation time, but no clear-cut time trend was obvious.

[

  Insert Fig 2, 3, about here]

  in organic farming were found in fresh lettuce but not in iceberg lettuce. This could indicate that the suitability of the agricultural practice as a regulator of the utilization of nitrogen could be limited by genetic factors. The monitoring programme is an effective tool to map out the nitrate levels in lettuce and spinach and its continuation would allow final conclusions about the role played by the GAP in the decrease of the nitrate content. The ten years of Swedish experience strengthen the opinion that there is no technical reason to increase the European maximum level established in 1997.

F

Figure 1 .

 1 Figures legends

Figure 2 .

 2 Figure 2. Nitrate content of fresh lettuce during years 1995-2005. Four samples exceeded the

Figure 3 .

 3 Figure 3. Nitrate content in iceberg lettuce during years 1995-2005. One value in the year 1996

Figure 4 .

 4 Figure 4. Nitrate content in open air fresh spinach during years 1996-2005. Twelve samples

Figure 5 .

 5 Figure 5. Nitrate content in frozen spinach during years 1996-2005. All samples were below the

  Fig.1

  . In general,

	environmental variables may exert a marked effect on nitrate accumulation, but they are difficult
	to handle
	F o
	r
	P
	e e r
	R e v i e w
	O n
	l y
	3

Table I .

 I Incidence of nitrate above maximum level (ML) detected through Monitoring Programme 1996-2005

	Type	No. samples	Median	Range	No. above
			(mg NO 3 /kg)	(mg NO 3 /kg)	ML
	Fresh lettuce	159	2684	58 -5406	4
	Iceberg lettuce	71	931	94 -2298	1
	Fresh spinach	63	1747	47 -5975	12
	Frozen spinach	70	551	213 -1862	0
	Fresh lettuce (organic farming)*	14	826	442 -2038	0
	o F o o F * Samples not included in the Monitoring Programme
	r r r
	P P P
	e e r e e r e e r
		R e v i e w R e v i e w R e v i e w
			O n O n O n
				l y l y l y
		1

http://mc.manuscriptcentral.com/tfac Email: fac@tandf.co.ukFood Additives and Contaminants

Acknowledgements

This project was supported by the Swedish National Food Administration.

Leonardo; Swedish National Food Administration, Research & Development Darnerud, Per Ola; Swedish National Food Administration, Research & Development Edberg, Ulla;