{'fraction_non_alphanumeric': 0.025926077860278132, 'fraction_numerical': 0.01035128741573341, 'mean_word_length': 5.237802797679973, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Low Cost Photonic Sensor for in-Line Oil Quality Monitoring: Methodological Development Process towards Uncertainty Mitigation

Lubricant and hydraulic fluid ageing impacts the performance of the machines, gears, transmissions or automatisms where they are being used. This manuscript describes the work accomplished for bringing an innovative measurement concept for analysing the physical- chemical properties of these fluids, to a real industrial product ready to be integrated into different industrial equipment. The steps taken to deal with uncertainties and evolving requirements while progressing in the sensor development are described, covering the stages of theoretical formulation of the problem, optical and fluidic simulations, sensor prototype development and tests. The sensor working principle is based on a combination of transmittance and diffuse reflectance photonic inspection of the fluid sample that is collected in a micro-cavity through a standard hydraulic fitting. Photonics, electronics, micro-mechanics, fluidics, data processing and analysis has been merged with a deep knowledge in the lubricant degradation process to develop a sensor solution that is able to measure the Oil Degradation Index, Oil Oxidation, Acid Number, Ruler and Membrane Patch Colorimetry data from an in-service lubricating oil sample. The photonic micro sensor presented here offers a powerful tool that operates directly immersed in the fluid, at an economic cost and compacted size for in-line oil degradation monitoring.


Introduction
Oil degradation could be defined as the process by which the performance of the fluid decreases the impact on its ability to perform basic lubricant functions such as lubrication, cooling, cleaning, protection or sealing [1]. Processes such as oxidation, nitration, temperature rise, external contamination, shearing, corrosive ambient, additive depletion, etc. are the most important factors contributing to and accelerating the oil degradation process [2]. Therefore, lubricant and hydraulic fluid ageing impacts the performance of the machines, gears, transmissions or automatisms where they are being used [3,4], and often the degradation of the lubricant properties is the cause of downtimes and dramatic failures [5,6]. Consequently, the periodic change of these oils is a basic part of the maintenance program of the infrastructure operators [7], with an important impact on the O&M (Operation and Maintenance) cost, and different research and commercial efforts have been fostered trying to migrate to predictive maintenance approaches with the aim of minimizing oil change while assuring the safe operation of the infrastructure [8]. In this context, the number of in-line sensors installed in industrial equipment for monitoring the status of the fluids has been importantly increased [9][10][11].
Additionally, in the last couple of years, different trends of the predictive maintenance approach have merged with the Internet of Things (IoT) [12,13]. In this context, the smart sensors are considered a key factor in meeting the promise of unprecedented advancements in automation, efficiency and flexibility, together with an expected dramatic saving in manufacturing, operation and maintenance costs. Focusing on industrial scenarios, in the Industry 4.0 or the Industrial Internet of Things (IIoT) approaches, the smart sensors are considered as the real enablers for a true industrial digitalization, since these sensors become the unique data sources for all the services and big data applications [14,15]. In this context, large companies are not only focusing on the higher tiers of the digitalization of industry [16], but also, they are shifting to generate novel sensor technologies that meet the expectations of the IIoT in terms of integrability, connectivity, intelligence, flexibility, rugged and reliable operation and indeed, cost [17,18]. This eagerness for pervasive motorization within industrial environments represents a paramount opportunity for sensor manufacturers, with different applications pulling for the in-place and real time measurement solutions. Table 1 summarizes possible application scenarios where these kinds of sensors are required. Several types of machines classified by sector and some of its main lubrication technical characteristics are presented. In addition, the severity of lubrication failures and their possible consequences are indicated. Most of these sectors require large moving machinery in which sensors can be installed with a bypass connection. However, it is worth highlighting sectors such as automotive or manufacturing with small motors, robots, cranes, or small mechanical transmission systems, where making a bypass connection is not easy [19]. In addition, a bypass connection could complicate installation and require bulky settings and extra investment for sensor in-line operation, due to requirements for fluid conditioning, etc. This situation leads to the necessity of easily integrable and compact sensor solutions, like bolt stem or plug-in approaches (see Figure 1, pure in-line connection (b)). Moreover, scenarios like production plants with thousands of mechatronic lubricated systems to be monitored require economic solutions [20]. These use cases are clear examples demanding a trade-off solution between an immediate availability and reliability of information, and integrability, compactness and economic cost, which is the ideal scenario for solutions like the one presented in this paper. Drill press (1600 Tn) Extortion press (3600 Tn) Clamping presses (<600 L) High pressure pumps (200 L-400 L)  Figure 1. Diagram depicting the differences between the fluidic process analysis approaches [21].
However, meeting the already mentioned requirements in terms of sensor performance, compactness, unitary cost, reliability, etc., but also market and economic objectives poses a considerable technical and organizational challenge for any company. Management of uncertain and evolving specifications, continuous risk assessment, synchronizing of multidisciplinary working teams (e.g., micromechanics, optics, electronics, fluidics, etc.) are common challenges to be solved in the field of sensor development [21]. In addition, increasing importance of time to market (TTM) and project costs reduction in order to be competitive [22,23], and the complexity inherent to the technological bases of the sensor's scientific measurement principles need to be managed efficiently throughout the whole development process of the sensor product.
In this context, the work presented in this paper describes a pluggable photonic sensor for in-line monitoring lubricant quality, and methodological development process followed for bringing innovative sensor idea into a fully operative, reliable, compact and cost-effective sensor system.

Lubricant Quality Parameters and Sensors
First introduced in the late forties [24], the laboratory analysis of lubricating oil samples looking for evidence of ageing or degradation has been continuously evolving to offer a more accurate diagnosis about the remaining life time of the lubricants, or about any latent or imminent failure in the equipment or processes where they are being used. These laboratory analyses are nowadays standardized as a set of parameters describing the quality of an oil, which some of them are described below [25,26]: Acid Number (AN), is a measurement of oil acidity and it is considered a key indicator that may reflects oil quality deterioration due to chemical reactions, oxidation, incorrect oils, additive depletion and contamination. ASTM (American Society for Testing and Materials) D974 and ASTM D664 methods are the current industry standard methods for measuring the acid number [27][28][29].

2.
Remaining Useful Life Evaluation Routine (RULER) by Linear Sweep Voltammetry is a test method to determine the remaining useful life of oil by measuring remaining antioxidant additives. These additives are responsible for slowing down the oil degradation process, and therefore remaining additives level may indicate the oil degradation condition. ASTM D6971 and ASTM D6810 are approved test methods specified by ASTM [30,31].

3.
Fourier Transform Infrared Spectroscopy (FTIR) evaluates the oil's components at a molecular level. The spectrum is used as a fingerprint of various components and it is compared with fresh oil reference. High concentrations of degradation products, such as oxidation, nitration, and sulphation, and low concentrations of oxidation inhibitors indicate oil degradation. However, FTIR interpretation is complex and some additive components usually mask the critical antioxidant region. The ASTM E2412 test method is the approved standard practice for lubricants condition monitoring by FTIR spectrometry specified by ASTM [32].

4.
Viscosity. Lubricants need to have a specific viscosity to give correct operation in the equipment where they are being used. Viscosity change as the oil oxidizes, whereby this is an important parameter to measure when the oil condition is evaluated. ASTM D445 the standard test method for viscosity approved by ASTM [33]. 5.
ASTM Color Scale (ASTM D500), is a method that visually determines the colour of petroleum products such as lubricating oils, waxes, and diesel fuel oils. If the colour range of a specific oil is known, a variation outside this may indicate contamination. Colour can also be used as an indication of the degree of refinement of the material [34]. 6.
Membrane Patch Colorimetry (MPC) is a method for analysing the insoluble contaminants in lubricants with spectral analysis. With MPC, a direct correlation is made from the colour and intensity of the insoluble to lubricant oil degradation. The method identifies soft contaminants, which are directly associated with oil degradation. Larger hard contaminants unrelated to oil degradation do not influence the test results much. ASTM D7843 is the approved standard test methods specified by ASTM [35,36].
As mentioned earlier, huge efforts are being made to migrate these laboratory measurements right to the field. Several scientific references are found related to sensors for real-time oil quality monitoring. Those sensors use different measurement principles to provide the oil quality condition that can be related with previously listed parameters. As an example, Torres et al. [37] propose a low-cost sensor solution based on the measurement of the complex permittivity of the lubricant. Rauscher et al. [38] use a non-dispersive infrared spectroscopy measuring principle to monitor the oxidation, water content, and acid number of the lubricating oil in automotive and industrial gearboxes. Han et al. present a cylinder capacitive sensor to detect changes in the lubrication oil condition of an engine lubrication system [39]. Moreover, sensors based on other electrical properties measurements have been also studied, such as Chen et al. [40], Shinde et al. [41] and Riziotis et al. [42].
In the context of plug-in in-line oil condition sensors, diverse scientific references, patents and commercial sensor have also been found. Table 2 lists some of the current commercial sensors. Those sensors provide an easily integrable and compact solutions to avoid hydraulic bypass connection and comply with the integrability requirements presented before. The table also shows an estimation regarding integrability, price and size characteristics for each of the presented commercial sensors. Narrowing down to solutions based on the photonics, additional scientific references and patents are found. These solutions also provide an easily integrable hydraulic fitting compatible with the plug-in sensors to operate directly immersed in the fluid to be monitored. For example, Welling et al. [43] patented in-situ fluid analysis sensor bolt for fluids used in machinery such as engines, compressors or hydraulic devices. An infrared source of radiation is configured to direct the radiation through the flow path containing the fluid sample, and a detector detects the radiation passing through the path. The patent does not describe the correlation between obtained measure and the oil degradation condition. On the other hand, Miranda et al. [44] patent a compact colourimeter that can be submerged in liquids for monitoring the colour of liquid samples according to CIELAB standards. The device consists of a colour charge-coupled device (CCD) video camera, two lighting systems to measure by reflectance (opaque samples) or transmittance (translucent samples) and the necessary optics for capturing the light that interacts with the monitored sample. As in the previous patent, the system measures the colour of a fluid sample, but it does not correlate the measured colour to a fluid condition. Finally, Ossia et al. [45] present an optical sensor for synthetic hydraulic oils condition monitoring based on oil colour change compared to fresh oil sample. The device integrates a white light emitter that illuminates the oil sample, a colour sensor that receives the light that passes through the oil and a feedback photodiode to stabilize the optical power of the emitter. Based on measured oil colour a total contamination index is calculated in an external microcontroller.
However, described photonic measurement principles are based on light transmittance through the fluid sample, from the light emitter to the detector. This optical setting requires a high optomechanical accurateness to guarantee specified distances and alignment of the photonic and optical elements [46,47]. This fact adds complexity to sensors manufacturing process and consequently manufacturing and sensor cost increases. In addition, as most of the referenced approaches include protected intellectual property, their commercial use for new developments is, evidently, restricted. These limitations encourage us to research on new sensor concept approaches to face these technical and commercial challenges.

Transmittance and Diffuse Reflectance Measurement Principle
This paper describes the development of a photonic sensor to determine oil degradation level based on the colour variation of an oil sample compared to fresh oil. On one hand, there is an important previous work done on correlating the physical-chemical parameters of the lubricant oil with colour variations over ageing time (see Figure 2) [48][49][50][51][52]. Based on this scientific background, the proposed sensor will embed algorithms [52] to provide a general oil degradation index combining the previously defined laboratory parameters (AN, RULER, FTIR, etc.). On the other hand, there is also previous experience in photonic sensors development based on light matter interaction for accomplishing measurements about chemical and physical parameters in fluids, not only for industrial but also for food sectors [52][53][54][55][56][57][58][59][60]. Figure 3 describes the most important effects and phenomena (reflection, absorption, diffraction, scattering, etc.) happening when the light radiation enters a matter, due to sample chemical and physical properties [61][62][63]. The study of the modifications that happen to the emitted light is the base of the aforementioned photonic sensors. In the context of lubricant oils, the change in the colour over ageing time due to physical-chemical changes in the fluid is related to light-matter interactions. So, the collection and the subsequent analysis of light that comes out the matter provides relevant information about fluid characteristics. In this context, this paper presents an innovative sensor concept approach that combines previous experience and knowledge in both the photonic sensor development and the correlation of the physical-chemical variables of the lubricant oil with the change in colour over ageing time. The starting point of the sensor proposed in the article is the OilHealth ® sensor, previously developed for atten2 Advances Monitoring Technologies (Eibar, Spain). OilHealth ® is an industrial in-line photonic sensor for real-time oil quality monitoring, based on transmittance measurement principle (see Figure 4a) [8,52,53]. A white light beam goes through the oil inside the device sample cavity and an RGB colour sensor collects the light transmitted through the oil. The obtained RGB value is processed by embedded algorithms that compare it to the RGB measurement of the corresponding fresh oil sample. The algorithm result provides an oil degradation index (OD) that indicates the total degradation percentage of the oil sample. Those algorithms are based on previously established correlations between physical-chemical variables of the lubricant oil and sample colour change regarding fresh oil [52]. To manage the sample cavity filling and oil sample renewal, OilHealth ® requires a bypass hydraulic connection and integrates a sample conditioning hydraulic subsystem, which represents an important drawback for complying with the requirements in terms of integrability, compactness and unit cost, specified before. Therefore, the idea to develop an innovative photonic sensor based on transmittance and diffuse reflectance measurement principle is outlined. Thus, patent infringement is avoided, and the sensor set up is simplified. As it is shown in Figure 4b, in this photonic configuration, the light beam passes through the fluid sample, is reflected in an optical back element and passes back through the fluid sample, which is a clear innovation from the referenced systems. Then, the RGB colour sensor placed beside the light source collects the light that is not absorbed by the fluid and is transmitted and reflected. The optical back element acts like a virtual light emitter directing the light radiation again through the fluid sample to the optical receiver. Finally, as in OilHealth ® , the colour (RGB) change due to changes in the light absorbance is used to calculate the oil degradation index (OD). As shown in Figure 4, the main design difference between OilHealth ® and the new approach is that the optical transmitter and receiver are placed in the same mounting plane, which constitutes a simplification of the optomechanical and optoelectronic design. This optical element setting has the following advantages over OilHealth ® or similar sensors designs: • Required optomechanical accuracy for optical elements is minimum. • Fluidical-Mechanical subsystem redesign allows the sensor to operate directly immersed in the fluid, avoiding the necessity of a hydraulic conditioning subsystem required for a hydraulic bypass connection.
These advantages contribute to reduce manufacturing costs, allow the miniaturization of the system and facilitate its integration and installation in scenarios where OilHealth ® is not a suitable option. Therefore, this new sensor concept approach potentially meets previously identified requirements in terms of integrability, compactness and cost.
However, the proposed sensor concept involves three important uncertainties that impact reliable sensor operation and hinder sensor development.

•
Although both transmittance and reflectance approaches (see Figure 4) are conducted in the visible spectrum and the light that is not absorbed by the oil is collected by the detector, the light and fluid interaction process differ. This difference makes it impossible to determine at the beginning of the development the RGB absorbance measurement dynamic range that can be achieved with the proposed optical configuration. The RGB dynamic range is the key element of the development since it is directly related to the sensor's oil degradation measurement resolution and the compatibility with different oil types that could be measured.

•
The dependence between the temperature and some optical elements, such as, light emitters, receivers, etc., is known. For example, the white LEDs lose luminous intensity as temperature increases. Although the manufacturers of the optical elements provide this efficiency versus temperature dependency, the real impact of this effect in the RGB light absorbance measurement is uncertain. It is necessary to precisely analyse this dependency and guarantee light source stability since uncontrolled variations in the RGB light absorbance measurement can lead to an erroneous oil quality value.

•
As the sensor operates immersed in the fluid, the filling of the sample cavity and renewal of the oil sample cannot be guaranteed by means of hydraulic actuators. In this context, there is an uncertainty regarding the ability of the fluidical-mechanical sensor design that ensures sample cavity filling, air evacuation and fluid sample renewal considering the different conditions of the sensor installation in the field (e.g., viscosity, temperature and pressure of the fluid). This is also an especially relevant point, because the presence of bubbles in the sample cavity, non-renewal of the oil sample, etc., can lead to an erroneous oil quality value.
In addition, the development aims to increase the amount of information provided by the sensor, related to oil degradation condition. Besides the Oil Degradation (OD) value, it is of great interest to provide more specific information such as aforementioned Acid Number (AN), Ruler, etc. parameters. The calculation of those parameters from the RGB absorbance measurement entail reformulating previously established correlations between the physical-chemical variables of the lubricant oil and sample colour change. These algorithms will be also integrated in the proposed sensor concept.
Finally, the following sections describe the work accomplished for bringing the presented photonic principle into a fully operative, reliable, easily integrable, compact and cost-effective industrial sensor for in-line monitoring lubricant quality. Section 2 presents the methodological process followed to face and solve identified uncertainties. Section 3 describes in detail the activities carried out during this process, including theoretical approaches, simulations and prototypes development. Section 4 shows obtained results and Section 5 concludes this article.

Materials and Methods
This section presents the methodological procedure followed to support the development of the proposed sensor concept approach. The development of such systems entails technological, scientific and operational challenges [64,65] that derive from: (i) missing requirements, uncertainties and risks related to the generation of new products based on novel technologies and innovative ideas [66]; (ii) unforeseeable interactions among the system components intrinsic to system heterogeneity and complexity (e.g.,: software, hardware, chemistry, optic, mechanic, etc.) [67]; (iii) operation dependability and regulatory requirements imposed by critical domains such as industry or energy; and (iv) increasing importance of time to market and project costs reduction in order to be competitive [23].
To efficiently manage those challenges, a structured and iterative Design/Build/Measure development process has been followed. This process is based on a hybrid approach where ideas from New Product Development Processes as "Design for Six Sigma" [68], "Lean Startup" [69], "Open Innovation and Stage-Gate" [70,71] have been merged. Those approaches are mainly focused on shaping the system and identifying changes and deviations at relatively early development phases so the impact of required modifications, and consequently development cost and time, are minimized. The process is based on theoretical approaches, simulations and prototypes development as intermediate solutions to reach the final sensor system. These intermediate solutions favour exploring and testing, which is essential for uncertainties resolution and complete requirements (risks and limitations) specification.
First, based on customer and market requirements, functional, technical and design uncertainties involved in the proposed sensor solution, and mechanisms or activities to solve them are identified. The aim is to prioritize the resolution of uncertainties with a greater impact on the basic functionality of the system. Based on this information, a development activity plan is formulated to guide the development process. Every time an activity is completed, obtained results are evaluated and corresponding technical and design decisions are taken to successfully continue the development. This assessment should not only consider the activity results, but also customer feedback, new requirements, etc. In addition, if necessary, the activity plan is updated according to the conclusions of the assessment. Once all the activities are completed, a fully specified solution is obtained, without uncertainties and with identified limitations and risks. At this development point only the additional functionality of the system in terms of embedded algorithms, communications, etc. remains to be implemented.
As presented in the previous section, the main uncertainties jeopardizing the development of the proposed sensor concept approach are related to the optical and fluidic subsystems and the corresponding impact on reliable sensor operation. To provide a reliable performance in terms of oil degradation condition monitoring, the RGB measurement must be significant to cover the widest range of oil types and degradation levels, and stable in operation conditions. However, as mentioned, the achievement of this expected performance involves several technical and design uncertainties summarized in Table 3. Additionally, this table displays the mechanisms (theoretical approaches, simulations and prototypes development) to face, mitigate and finally solve those uncertainties. Next, those uncertainties and mechanisms are translated into the development activity plan presented in Figure 5. As explained before, the development process is structured in several activities to face and solve identified uncertainties, prioritizing the ones with greatest impact on sensor's basic functionality. Those activities are mainly focused on optical theoretical approaches, optical and computational fluidic dynamics (CFD) simulations, and prototypes development and tests. This is an updateable process that could be modified if the results of the activities are unsuccessful or if the design changes and new activities are required. Or, as in this case, the customer considers new requirements that impact system design, and the development of new optical simulations and a second prototype are required. The execution of those activities is described in detail in Section 3.

Uncertainty Driven Sensor Design
This section describes the main building blocks of proposed sensor solution and activities carried out to solve technical, functional and technological uncertainties presented in the previous section.

Sensor General Description and Prototypes
The proposed sensor concept approach integrates different building blocks, including mechanic, fluidic, optic, electronic, embedded software, etc. As it is shown in Figures 6 and 7, the fluidical-mechanical subsystem includes the fluidic sample cavity, the hydraulic connections or sensor attaching thread, and holds and positions the optics and electronics components. The optical subsystem integrates an RGB colour sensor (HAMAMATSU S11059-02T digital colour sensor, Hamamatsu Photonics, Hamamatsu City, Japan), a white LED lighting (CREE ® PLCC4 1 in 1 SMD LED CLA1A-WKW, CREE ® , Research Triangle Park, NC, USA), an ambient light sensor (MAXIM MAX44009, Maxim Integrated, San Jose, CA, USA) acting as secondary receiver, a glass window (BK7 high quality optical glass) and the optical back element (polished aluminium) to confine the fluid within the fluidic sample cavity. The use of polished aluminium is proposed as it has an almost flat reflectance of 90% for visible spectra (see Figure 8). In addition, to avoid the direct radiation from the emitter to the receiver, an anti-crosstalk shield is placed between the light source and the RGB colour sensor. Finally, the sensor includes custom embedded electronics for lighting control and the execution of the oil degradation algorithms. As mentioned before, these algorithms are the result of previous work done on correlating the physical-chemical parameters of the lubricant oil with the colour variations over the ageing time [48][49][50][51][52]. The algorithms are directly implemented in the embedded electronics.   Two prototypes have been developed to achieve desired final system. Alpha Prototype has a configurable sample cavity length to test different optical configurations and fluid pathlength, and determine the position that maximizes the RGB measurement dynamic range. Since theoretical approaches and simulations have not been determinant enough to define the optical configuration, this prototype has been developed. In addition, this prototype is used to verify the fluidical-mechanical subsystem and the compliance of the sample acquisition requirements. Then, a second prototype (Beta prototype) is developed, motivated by new customer requirement. This requirement specifies the necessity to reduce the hydraulic fitting size. This modification requires increasing the distance from the optical emitter and receiver to the sample cavity, so RGB measurement resolution could be affected. Beta prototype and corresponding optical simulation verify the feasibility of this innovative design. Figure 9 shows developed prototypes and remarks on their main differences. Finally, as mentioned before, the following subsections describe the activities carried out to solve previously identified uncertainties and develop the devised sensor systems. The development process is divided into the development of the optical and the fluidical-mechanical subsystems, and includes the activities listed in Table 4: Sections 3.2 and 3.3 describe the optical subsystem development. Those sections describe the activities 1, 2, 3, 5, 6, 8, 9, 10 and 11 defined in the activity plan, that are related to optical theoretical approaches, optical simulations, and tests with Alpha and Beta prototypes. In addition, Section 3.3 describes the development of the fluidical-mechanical subsystem. This part of the development is addresses by fluidic dynamic (CFD) simulations (activity 4 of the activity plan) and tests with Alpha prototype (activity 7).

RGB Measurement Dynamic Range
This subsection presents the activities carried out to solve the technical, functional and design uncertainties of the optical subsystem, regarding the definition of the RGB measurement dynamic range. First, a theoretical approach is made to approximately determine the position and characteristics of the optical elements of the Alpha Prototype. Next, the proposed design is verified via simulation, and finally the prototype is validated with real oil samples. In addition, a second iteration of simulation and tests is performed to evaluate modification related to Beta Prototype.

Theoretical Approach of the Alpha Prototype (Activity 1 of the Activity Plan)
This section describes the theoretical approximations made for describing the basic chemical and physical processes involved in the chosen measurement principle. First, the basic setup and components (see Figure 10) with their significant characteristics need to be defined, where optoelectronic components, materials and target fluid must be characterized as precisely as possible. • The RGB colour sensor shows a sensibility of 30, 76 and 94 a.u. count/lx and the peak sensibilities 460 nm, 530 nm, 615 nm for Red, Green and Blue channels respectively, and directivity of 120 • approximately.

•
The feedback photodiode shows a 0.045 a.u. count/lx sensibility with a directivity of 90 • .

•
The white LED used as sample illuminator is able to deliver 2800 mcd at 30 mA driving current with a 120 • 3 dB viewing angle. The emitter shows a relative luminous intensity of 90%, 65%, 80% at the peak sensibility wavelengths of the RGB photodetector.

•
The construction and optical materials include: anodized aluminium for sensor body parts, which could be considered fully absorbent in the visible range, and optical back element of polished aluminium with an almost flat reflectance of 90% for visible spectra and BK7 optical window, which displays a transmittance of 99% also in the visible range.

•
The light absorption at the oil sample will depend on its absorptivity (ε) and on the sample cavity length (L). Additionally, the total diffuse reflectance is also a parameter dependent on the chemical properties of the sample and on the sample length. Graphs displayed in Figure 11 show the transmittance and reflectance visible-NIR spectral values for different oil samples (see Figure 12) at different degradation status, measured with a laboratory equipment (LAMBDA 850 UV/Vis Spectrophotometer, Perkin Elmer, Waltham, MA, USA) using a 1 mm cuvette for the oil sample.
According to these graphs and applying the Absorbance to Transmittance conversion displayed in equation (1), the absorbance of each sample can be obtained for the central wavelengths of the RGB colour sensor (see Table 5).
(1)     Table 5), the selection of an optical back element of polished aluminium with an almost flat reflectance of 90% for visible spectra is a good option. It is observed that tested oils have a low reflectance capacity, so an optical back element with high and flat reflective capacity is required, such as the polished aluminum, that acts as a virtual light emitter (see Section 1.2) to increase the amount of light that could reach the RGB detector.
Then, the Light Power Budget is calculated to show the relation between the light emitted by the LED and the light received by the RGB colour sensor, after passing through the different system elements (BK7 glass, oil sample, etc). As it is shown in Figure 11, with the aim of understanding the orders of magnitude of the photonic system and due to the complexity of the calculations, only the effect of direct light rays is considered in this theoretical approach. More detailed calculations will be presented in the simulation tests. The transmitted light intensity through the system elements is calculated according to the Beer-Lambert law, displayed in equation (2), where, I 0 is the incident light intensity at wavelength λ, I is the transmitted intensity at same wavelength, ε is the molar absorption coefficient (L mol -1 cm -1 ) also called the molar extinction coefficient, c is the concentration (mol L -1 ) or Molar (M) and l is the light path along absorbing material (cm).
To facilitate the calculation of transmitted light intensity, the next assumptions are considered: • The absorbance coefficient of the air and BK7 glass is negligible.

•
The refractive index of the BK7 glass and the fluid sample is negligible.

•
The refractive index of the polished aluminium is 90%.

•
The absorbances of the target oil for the defined cavity lengths (0.5, 1, 1.5, 2 mm) are calculated by applying the equation (2) to the values listed in Table 5. KluberSynth fresh oil and degraded samples are used, as they cover a complete degradation range.
In this context, Table 6 shows the percentage of: (i) transmitted light intensity through the oil sample, (ii) reflected light intensity in the back element, and (iii) transmitted light intensity through the oil sample and received by the RGB colour sensor. Approximately measurement dynamic ranges of 60% and 80% are obtained with cavity lengths of 2 mm and 0.5 mm, respectively. The estimated luminous intensity that reaches the detector is considered enough to determine the feasibility proposed measurement principle setup. Many detailed calculations, considering directivity and sensibility peaks of the white LED and RGB colour sensor, will be performed in simulation tests in the next subsection. The objective of this simulation is to perform a more detailed analysis of the optical subsystem presented in the previous subsection. Different configurations of sample cavity length and fluid mediums are simulated to verify and optimize the position and characteristics of the proposed optical design components. In order to achieve reliable simulation results, all the optical subsystem components, including fluid sample, must be represented as real as possible. To obtain simulation results comparable to the experimental values, the different fluids of interest should be characterized across the entire visible spectrum in terms of absorbance, reflectance and transmittance. This characterization entails complex work that is not the objective of this study and could be carried out later if needed. Therefore, as it will be explained later in this subsection, standard materials will be used to simulate the fluid sample. As will be explained later, standard materials will be used to simulate the fluid sample. In this context, the simulation results do not provide a real value about the measurement dynamic range, but the best configuration and the feasibility of the presented optical design are analysed. The tool used to perform these simulations is ZEMAX OpticStudio ® (Zemax, Kirkland, WA, USA).
First, the designed optical subsystem is represented. The white LED, the RGB colour sensor and the photodiode are represented following their commercial characteristics in terms of luminosity angle and expected spectral response. As described in the theoretical approach, the optical back element is simulated as a reflective (mirror) material. The 3 mm length anti-crosstalk shield and the material of the inner surface of the mechanical housing are considered absorbent components that collect all the light beams that impact on them. Finally, the BK7 glass optical window is included in the simulation model. Those elements are selected as ideal coatings/materials from the ZEMAX coating catalogue.
Second, regarding the fluid sample simulation and taking into consideration the previously mentioned complexity of the fluid characterization, only the most extreme cases of 100% degraded and 0% degraded (fresh oil) fluid samples are simulated, as ideal absorbent and Lambertian scattering mediums, respectively. Thus, the absorbent medium is characterized as ideal absorbent material from the ZEMAX coating/material catalogue. The scattering of the light going through the fluid sample, is defined with a Lambertian scattering with a 0.55 ratio of scattered rays versus non-scattered rays. Most diffuse surfaces or volumes are nearly Lambertian, so it is a quite accurate model for our sample simulation. In the Lambertian scattering model, the scattered intensity is proportional to the cosine of the angle between the normal vector and the scattered ray angle. Lambertian scattering is independent of the ray incident angle.
The simulation results are presented below. First, Figure 13 shows the path of light beam from emitter (white LED) to detector (RGB colour sensor) and to the photodiode (secondary receiver). The light rays are drawn up in different colours when they pass through the optical elements of subsystem (optical window, oil sample, etc.). Table 7 contains the lumens values in RGB colour sensor and photodiode for different sample cavity length and oil sample settings. To facilitate the interpretation of simulation results, it has been assumed that the emitter emits 1 Lumen/1.00 × 10 6 rays.  As expected, taking into consideration the directivity of the main optical components (the white led, the RGB colour sensor, and the photodiode), and the absorbance and reflectance of the rest of the components, the RGB colour sensor receives less luminous intensity than that calculated in the theoretical approach (Section 3.2.1). However, the relation between the measurement of the absorbent and scattering samples verifies the feasibility of the proposed design. As mentioned before, although real fluid samples are not characterized, these simulation results suggest an approximately measurement dynamic range of 50%. It is considered that simulated ideal absorbent and Lambertian scattering media cover desired oil degradation states. In this context, a prototype with a configurable sample cavity length is developed to validate simulated optical subsystem's functionality with real oil samples and to determine the real RGB measurement dynamic range.
Finally, as the luminous intensity emitted by the white LED remains the same in all the simulations, the photodiode measurement is almost the same in all the cases. This result verifies that the position and characteristics of the photodiode are correctly selected.

RGB Measurement Tests with Alpha Prototype (Activity 5 of the Activity Plan)
Based on the simulation result, a first prototype is developed to perform oil degradation validation tests with real samples (see Figure 14a). These tests determine the effectiveness of the system to measure the RGB absorbance of the oil sample and the RGB measurement dynamic range. This RGB measurement is used to calculate the oil degradation condition by applying embedded algorithms based on previously identified correlations between the physical-chemical variables of the lubricant oil and sample colour change [48].
To accomplish the tests, the prototype is introduced in the test bench shown in Figure 14b in order to prevent that external light from reaching the detector and to facilitate oil management. First, a measurement with the measurement cavity empty (no oil sample) is made to check prototype's calibration and to ensure that the relationship between the light emitted by the white LED and the light received by the RGB colour sensor is correct. Based on the knowledge acquired in previous developments [53], it has been established that a correct calibration value corresponds to a measurement of 80% in the G channel.
Next, measurements are made with samples of new and degraded oil of type Agip OTE 32. Figure 14c shows the oil samples used for these tests. These are samples of fresh oil (0% degraded) and 50% and 100% degraded oil (artificially degrades in a reactor). These samples were measured with different laboratory techniques including ASTM D664, D6971, E2412, D445, D1500 and D7843 and expertly diagnosed to obtain the real degradation value. Finally, these measurements are repeated for sample cavity lengths between 0.5 mm and 2 mm, adjusting the prototype's reflective back element position. Obtained results are presented in Table 8.  Tests results show that the difference between 100% and 0% degraded oil samples values for cavity lengths of 2 mm, 1.5 mm, 1 mm and 0.5 mm is 48%, 56%, 53% and 26%, respectively. These results determine that 2 mm, 1.5 mm and 1 mm lengths provide adequate measurement dynamic ranges. However, to analyse in detail the RGB measurement dynamic range for each sample cavity, the relationship between the oil sample measurements and the empty measurement is calculated. These results are illustrated in Figure 15. The graphs show that the widest and most linear measurement dynamic range is obtained with 1 mm sample cavity length. Consequently, it is assumed that it provides the best resolution to distinguish fresh and degraded oils. Besides, the 0.5 mm length provides a narrow and luminous measurement range, optimum for dark oil samples. On the other hand, 1.5 mm and 2 mm cavity lengths provides a narrow and dark measurement range, optimum for light oil samples. Consequently, the best configuration to cover the widest range of degradations and oil types is 1 mm length. Those results agree with the obtained simulations results, that determined a suitable sample cavity length of 1-2 mm. Those tests results support the design decision of setting a 1 mm sample cavity length.

Optical Simulation of Beta Prototype (Activity 8 of the Activity Plan)
The objective of this simulation is to evaluate the impact that the increase in the distance between the transmitter and receiver and the fluid sample has on the other optical components and consequently on the RGB measurement. As mentioned before, this modification is motivated by a new customer mechanical specification that requires the reduction of the diameter of the hydraulic fitting (from BSP GAS 1 ⁄2 to BSP GAS 1 ⁄4). In order to minimize the impact of this modification at to keep the investment in prototypes low, it is decided to move backwards the position of the sample cavity and keep the rest of the components as in Alpha Prototype. Figure 16 shows the main differences between Alpha and Beta prototypes. This simulation is based on the previous simulation model and is performed as described in Section 3.2.2. First, according to previous test results, 1 mm sample cavity length is configured. Next, according to the new optical design, the sample cavity is set to a distance of 25.9 mm from the plane of light emitter and receiver. Finally, the characteristics of the anti-crosstalk shield and the inner surface of the mechanical housing are updated. To favour the number of light rays arriving at the detector, it is decided to simulate different configurations of anti-crosstalk shield lengths and inner surface of the mechanical housing. First, a configuration similar to the one used in the Alpha Prototype is selected. The anti-crosstalk shield is 3 mm length and of absorbent material. Next, this length is updated to 24 mm to cover almost all the distance between the emitter/receiver and the sample, to avoid the direct lighting between emitter and receiver. This shield configuration is simulated with absorbent and mirror materials. Finally, those three configurations are simulated with absorbent and reflective (mirror) materials for the inner surface of the mechanical housing. The mechanical housing of the Alpha Prototype was developed with an absorbent material (anodized aluminium), but it is expected that in this case a reflective (brass) configuration provides better results. As the sample is distanced from the light emitter and receiver, a reflective housing will favour the number of light rays arriving at the detector.
In this context, Figure 17 shows the path of the light beam from the emitter to the detector simulating presented configurations. Moreover, Table 9 collects the lumen values in the RGB colour sensor and the photodiode for the defined simulation configurations. As in the previous simulation, to facilitate the interpretation of the simulation results, it has been assumed that the emitter emits 1 Lumen/1.00 × 10 6 rays.  The analysis of the simulation results (see Table 9 and Figure 17) determines that the configuration that optimized the optical design is the one corresponding to a reflective mechanical housing inner surface and a 24 mm reflective anti-crosstalk shield. Considering the rest of the configurations, the configuration with absorbent mechanical housing is discarded as the RGB detector barely receives luminous intensity. On the other hand, although a 3 mm anti-crosstalk shield maximizes the luminous intensity received by the RGB colour sensor receives, it is due to direct radiation from the emitter to the receiver, so this configuration is not suitable to provide a significant RGB measurement dynamic range. Finally, taking into consideration the simulation results of the 24 mm shield, the largest amount of luminous intensity is received with the reflective anti-crosstalk shield. Consequently, this is the optical subsystem design selected for the Beta Prototype. This design favours the propagation of the light rays due to the reflectivity of the inner surface of the mechanical housing and the anti-crosstalk shield and minimizes the incidence of direct light from the emitter to the RGB detector due to the anti-crosstalk shield length. As mentioned in the previous simulation, obtained results are not valuable to determine RGB measurement dynamic range as the real fluid samples are not characterized and ideal absorbent and Lambertian scattering mediums are simulated. In this context, a second prototype is developed to validate selected optical subsystem design with real oil samples and determine the real RGB measurement dynamic range.
Finally, regarding the photodiode configuration, the simulation results are similar to the ones obtained in the Alpha Prototype simulation as this part of the design has not changed.

RGB Measurement Tests with Beta Prototype (Activity 10 of the Activity Plan)
Considering the success of the simulation results, the second prototype is developed. Again, this prototype is used to perform oil degradation measurement validation tests with real samples. As in Alpha Prototype, the test results determine the capacity of the new optical design to measure the RGB absorbance of the oil sample. The procedure used in these tests is the same than the one described in Section 3.2.3. First, to check optical calibration, a measurement with the measurement cavity empty (no oil sample) is performed. The G channel measurement must be around 80% to indicate a correct calibration. Next, measurements with different oil samples of Agip OTE 32 type are taken. In order to extend the coverage of the tests, degraded samples are selected at 0% (fresh oil), 33%, 66% and 100% in this case (see Figure 18). On the other hand, different configurations of the anti-crosstalk shield (absorbent and mirror) are used to check simulation results. In addition, these results are compared with measurements made with the Alpha Prototype and 1 mm sample cavity length. Table 10 collects obtained results. Beta Prototype tests results show that the difference between 100% and 0% degraded oil samples values for 24 mm absorbent and reflective anti-crosstalk shield is 22% and 44%, respectively. As determined in simulation, the best optical configuration, and measurement dynamic range, is obtained with a reflective anti-crosstalk shield. On the other hand, taking into consideration Alpha Prototype (1 mm sample cavity length) measurements, the relationship between 100% and 0% degraded oil samples is 53%. In this context, comparable results are obtained with both prototypes. However, to analyse in detail the RGB measurement dynamic range, the relationship between the oil sample measurements and the empty measurement is also calculated. These results are illustrated in Figure 19. First, it is observed that the Beta Prototype R, G and B channel measurements (see Figure 19a,b) present a loss of linearity compared to the Alpha Prototype RGB measurements (see Figure 19c), over the entire oil degradation range. This is probably due to the change in the material of the mechanical housing. The Beta Prototype housing is made of brass, while Alpha Prototype housing is made of anodized aluminium. This modification was motivated by economic reasons, but it will be changed to polished aluminium in the final design due to the chromatic impact of the brass in the RGB measurement. Apart from that, the overall RGB measurement dynamic range of both the Alpha Prototype and the Beta Prototype with reflective anti-crosstalk shield is approximately 0.6. Those results support design decisions for the Beta Prototype and prove its feasibility. Figure 19. Graphical representation of the relationship between the measurements with oil sample and the empty measurement for: (a) Beta Prototype with absorbent anti-crosstalk shield; (b) Beta Prototype with reflective anti-crosstalk shield; (c) Alpha Prototype with 1mm sample cavity length and reflective back element.

RGB Measurement Stability versus Temperature
This section describes the activities carried out to determine the dependence of the RGB measurement versus temperature (Alpha Prototype) and verify implemented lighting control (Beta Prototype) to compensate this effect and provide a stable measurement.

Theoretical Approach of Alpha Prototype versus Temperature (Activity 2 of the Activity Plan)
This section describes the theoretical approximations made to determine the dependency of the main optical elements (white LED emitter and RGB colour) versus the temperature, and to establish a solution to compensate this effect.

•
The dependency between the white LED and the temperature is tested making several measures with the LED in a climatic chamber over a temperature range of 0 • C to 80 • C. To measure the luminous intensity emitted by the LED, it is connected with an optical fiber to a VIS-NIR spectrophotometer (HR-2000+, Ocean Optics, Dunedin, FL, USA) placed outside the climatic chamber (see Figure 20a). Figure 20b shows measured luminous intensity at the wavelengths of the blue, green and red colours. A variation of approximately 20%, 13% and 15% is observed at wavelengths of the colour blue, green and red, respectively, over the tested temperature range.

•
The dependency between the RGB colour sensor and the temperature is also tested making several measures with the RGB sensor in a climatic chamber over a temperature range of 0 • C to 80 • C. The RGB photodetector is illuminated with a 12 W broadband tungsten-halogen light source (HL-2000, Ocean Optics, Dunedin, FL, USA) placed outside the climatic chamber and connected to the colour sensor with an optical fiber (see Figure 21a). Figure 21 shows the measured luminous intensity at blue, green and red wavelengths. The variation of RGB measurement over the tested temperature range is negligible compared to the results obtained with the white LED.  Taking into consideration the white LED dependency versus temperature, it is necessary to implement lighting control to ensure light source stability over sensor's operating temperature range. After a literature revision, the following lighting control approaches are identified: • "Temperature Coefficient of Voltage Approach" measures the flow-through voltage of the white LED, which combined with the parameter Temperature Coefficient of Voltage allows sensing precisely the junction temperature of the LED, and based on this and the Temperature Coefficient of Efficiency, the referenced system implement an open loop control for maintaining the luminous intensity of the white LED constant [72]. • "Feedback Photodiode Approach" measures the luminous intensity emitted by the white LED with a secondary receiver, such as a photodiode, and based on this value an open control loop is implemented for maintaining the luminous intensity of the white LED constant [73].
The first option is discarded as it has a greater complexity of implementation and a custom calibration is required for each white LED to establish the relationship between desired luminous intensity and the flow-through voltage. The second approach does not require any calibration, as the luminous intensity emitted by the white LED is auto-calibrated and compensated with the photodiode measurement. However, it must be taken into consideration that the measurement of the selected photodiode has a variability of approximately 5% over the desired operation temperate range [73]. This variation is assumed versus the variation observed in the LED and considering the required RGB and OD measurements precision for the prototypes development.
3.3.2. Temperature-Dependent RGB Measurement Stability Tests with Alpha Prototype (Activity 6 of the Activity Plan) First, Alpha Prototype is used to perform RGB measurement stability tests in a climatic chamber. Measurements are made with no oil sample and 1 mm sample cavity length. Only this length is tested because the RGB absorbance measurement test results (see Section 3.2.3) determined the optimum measurement resolution at this length. The implemented temperature cycle is 0 • C-80 • C-0 • C in 6 h, making 1 measurement per minute. Tests results determine RGB measurement dependency versus temperature. As shown in Figure 22, RGB colour sensor measurement varies over the entire temperature range, approximately 20% in the G channel, 15% in the R channel and 10% in the B channel. Those results agree with the values determined in the theoretical approach, taking into consideration that, as described in the previous theoretical approach, relative luminous intensity peaks of the white LED do not match with the RGB colour relative sensitivity peak. However, observed RGB measurement variability is unacceptable, as it could lead to an erroneous interpretation of the oil degradation level provided by the sensor prototype. As mentioned in a previous subsection, the observed variability is mainly caused by the loss of efficiency of the white LED with. In this context, it is decided to implement a lighting control based on the photodiode measurement, to compensate this situation and provide a stable lighting, and consequently a stable RGB measurement.  Figure 23 shows designed lighting control to compensate temperature effect in the white LED efficiency, and consequently the RGB measurement. The objective of the implemented control is to maintain an optimum luminance value (luma setpoint ) over the entire working temperature range. White LED current is controlled by a pulse train, and the luminance value obtained for each pulse train configuration is measured by the photodiode (secondary receiver).
Designed lighting control is a purely proportional control, in which the luminance error (the difference between luma setpoint and luma measurement ) is multiplied by an adjustable gain. The result is added to the LED train pulse value to obtain a new LED train pulse value to compensate the temperature effect. The lighting control is simulated and implemented using the MATLAB (Natick, MA, USA) computing environment. For the simulation, a model of the white LED is generated from experimental measurements. Those experimental values are linearly interpolated to obtain the white LED response for any LED pulse value. To emulate the white LED degradation or power loss versus temperature, an exponential decay over time is considered. Figure 24 shows the implemented white LED model. Furthermore, regarding lighting control implementation, instead of a single luminance setpoint an acceptable luminance range (luma min , luma max ) is defined. The implemented algorithm automatically finds a unique luminance setpoint, which is the midpoint between the accepted minimum and maximum luminance values.
Finally, Figure 25 shows simulation results for different gain value configurations. It is observed that from a certain gain value, the systems start to oscillate, and therefore the luminance value is not properly controlled (see Figure 25a). On the other hand, if an appropriate gain is selected, the system does not oscillate, and the control is correctly performed. However, in this case, Figure 25b shows that although the control gain is correct, the luminance is still outside the desired range. This is mainly due to the lack of resolution of the control hardware components, which does not allow to regulate the pulse value with greater precision. In this context, the minimum possible pulse variation will imply a luminance variation greater than needed. The only possible solution to this limitation is the redesign of the custom embedded electronic. At this point, it is decided that the current resolution may be valid so RGB measurement stability tests are performed with current custom embedded electronic design. However, the conclusions drawn from this simulation will be taken into consideration for future redesigns and sensor prototype updates. Similar to previous temperature tests, the lighting control implemented in Beta Prototype is tested in the climatic chamber. The programmed temperature cycle is 0 • C-80 • C-0 • C in 6 h, making 1 measurement per minute. Figure 26 shows RGB colour sensor measurements. Those results determine that the total RGB measurement variability has decreased by around 50% compared to the results obtained with the Alpha prototype. Figure 26 shows that the RGB measurement variability of the Beta Prototype and the implemented lighting is around 10% for the G channel, 8 % for the R channel and 7% for the B channel.

Fluidic Sample Acquisition: Sample Cavity Filling, Air Evacuation and Sample Renewal
This subsection presents the activities carried out to solve the technical, functional and design uncertainties of the fluidical-mechanical subsystem related to the fluidic sample acquisition (filling of the fluidic sample cavity, air evacuation and the renewal of the sample). As mentioned before, the presence of bubbles in the sample cavity, non-renewal of the oil sample, etc., can lead to an erroneous oil quality value. Performed activities to solve those uncertainties include several simulations to verify the proposed fluidical-mechanical design. These simulations will determine the pressure conditions of the hydraulic circuit in which the sensor will be installed to guarantee both the filling and the renewal of the fluidic sample. Then, fluidic tests are performed with Alpha Prototype to validate this design in almost real conditions.
The proposed fluidical-mechanical design is mainly conditioned by the requirements of the optical design (Section 3.2), and the integrability ease of installation in the hydraulic circuits without fluid recirculation.

CFD Simulation of Alpha Prototype (Activity 4 of the Activity Plan)
The objective of the simulations described in this subsection is to determine the minimum flow rate that will pass through the sensor under a given pressure drop. To this end, simulations will verify sample cavity geometry and length, and the pressure conditions of the hydraulic lubricating circuit in which the sensor will be installed. This configuration will guarantee the fluid flow though the sensor, and consequently the filling of the sample cavity and oil sample renewal.
The simulation tool used to perform the next simulations is ANSYS Fluent CFD software (ANSYS, Canonsburg, PA, USA). In addition, the simulations are performed on the most extreme positions of estimated sensor sample cavity length: minimum position of 0.5 mm and maximum position of 2 mm.
As a first step, the geometry of the fluidical-mechanical part of the sensor is simulated to verify the inlet/outlet dimensions of the fluid sample cavity. Figure 27 shows the geometry of the fluidical-mechanical part of the sensor and the simulated hydraulic system flow. The simulation results show that the fluid in the sensor inlet section is organized and there are no whirlpools that could generate reverse flow. Thus, designed sensor's fluid sample cavity geometry provides adequate fluid inlet and outlet. Then, the steps taken to simulate the fluid flow through the sensor are described. This simulation provides the flow rate and pressure difference generated between the sensor inlet and outlet for a given sensor sample cavity length and pressure drop in the hydraulic installation circuit.
First, using the ANSYS DesignModeler toolbox (ANSYS, Canonsburg, PA, USA) of the simulation tool, liquid volume on which the simulations will be performed is defined. Figure 28 shows the defined liquid volume, considering sample cavity lengths of 2 mm and 0.5 mm. The difference in the shape of the defined liquid volume, corresponding to the inlet and outlet sensor sections, is due to the circularity of the optical back element and that it must be adjusted to reduce the sample cavity length thus modifying the boundary conditions. In addition, this figure shows the points at which the sensor and the hydraulic system input and output data will be taken for each of the simulations carried out below. Second, to simulate the characteristics of the fluid, a meshing process has been performed with the ANSYS Meshing toolbox (ANSYS, Canonsburg, PA, USA). The Multizone method has been used and a limit layer has been imposed through Inflation. Regarding the mesh metric spectrum, Orthogonal Quality and Skewness has been selected.
Third, the pressure drop in the fluid has been calculated. To carry out this calculation, a Realizable K-epsilon Viscous Model with Enhanced Wall Treatment has been selected. In addition, the fluid that will pass through sensor has been created. Selected density and viscosity properties of fluid correspond to Mobilgear-shc-xmp-320 lubricating oil (Density = 860 kg/m 3 and Viscosity = 0.335 kg/m s).
Next, a simulation is performed to determine compliance with the mass balance and to calculate the mass flow generated through the sensor. As a boundary condition, a pressure loss ranging from 100 Pa (1 mbar) to 10000 Pa (0.1 bar) is imposed. Table 11 shows the results obtained in this simulation. It is observed that in all cases the mass balance is fulfilled, that a mass flow is generated, and that a mass flow corresponding to a laminar flow is generated.
Finally, a post-processing of the results obtained in the previous simulation is performed. This post-processing determines the volumetric flow rate, the fluid speed along the sensor and the pressure difference between the sensor inlet and outlet. Figure 29 shows an example of these post-processing. The graphs show the flow velocity through the sensor and the pressure at the sensor and the hydraulic system inlet and outlet sections for the hydraulic system pressure difference of 100 Pa and a sample cavity length of 2 mm. Lastly, Table 11 shows all the information generated in this post-processing, regarding the different configurations of the sample cavity length and system pressure drop.  In conclusion, although the system pressure difference is low (100 Pa), simulation results confirm that the mass and volumetric flow through the sensor is guaranteed for any of the proposed fluidical-mechanical design configurations (0.5 mm to 2 mm) and given fluid properties. Consequently, a pressure difference is generated in the sensor that will guarantee the filling of the measurement cavity, air evacuation and the renewal of the sample. These results confirm the viability of the proposed design provided that the hydraulic system in which the sensor is installed ensures at least this pressure drop and, therefore, the feasibility to continue with the development. However, although in oil storage tanks this pressure drop could not be guaranteed, diffusion principles will ensure sample renovation [74,75].

Fluidic (Sample Acquisition) Test with Alpha Prototype (Activity 7 of the Activity Plan)
Based on the fluidic design proposed in the previous simulations, a prototype has been developed to validate the filling of the measurement cavity and the sample renewal under laboratory conditions. Considering that the validation of the optical design (Section 3.2) has determined that the best RGB absorbance measurement resolution is obtained with a sample cavity length of 1mm, the fluidic validation is only performed at this sample cavity length.
To perform this test, the prototype was immersed in 150 mL of new Agip OTE 32 oil, and 5 mL of 100% degraded oil (artificially degraded in a reactor) was added at intervals of 5 min for 10 steps. To ensure oil mixing and sample renewal in the sensor, a magnetic stirrer with minimum stirring (1 rpm) was used. The sensor was then left to measure for another half hour to observe the evolution of the measurement. The test bench used to perform this test is shown in Figure 30. On the other hand, Figure 31 shows the results obtained in the test. The graph shows the RGB absorbance value measured in different time periods (min.), compared to the volume of degraded oil added to the mixture. It is observed that as the degradation level of the mixture increases, the RGB measurement decreases. In addition, it is noticeable that there is a tendency to the stability in the RGB measurement during the final stabilization period of the mixture. This behaviour demonstrates that both the filling of sample cavity and the renewal of fluid sample are being carried out successfully.

Results and Discussion
Obtained conclusions from the development process are used to the develop a sensor product that meets all the requirements specified in terms of feasible measurement and operation, integrability, compact size and economic cost. Next, the compliance with those requirements is described in detail.
First, Table 12 present identified uncertainties at the beginning of the developments versus obtained results. Those results show that the expected performance related to oil degradation condition measurement resolution and feasibility, and sensor's ease of installation and integrability are achieved. In addition, the additional requirements regarding compact size, economic cost and providing extra information about oil degradation condition are also met. On the one hand, the sensor size is Ø32 × 65 mm which is approximately the same as other similar commercial sensors (see Table 2). On the other hand, the sensor price is expected to be lower than the price range of the current commercial sensors (see Table 2). In this context, Table 13 shows expected manufacturing costs for the proposed sensor. Finally, Table 14 shows the results of the additional oil degradation condition information versus laboratory results. This information is obtained by applying implemented embedded algorithms to the RGB measurements of the Beta Prototype tests (Section 3.2.5). The difference between laboratory and sensor results fall within the range of ±5% for the oil degradation total index (OD) and ±10% for the rest of the parameters, which is an acceptable precision for in-line oil conditioning commercial sensors.

Conclusions
In this manuscript, a detailed description of the development process of an in-line oil condition sensor is presented. The sensor is based on an innovative setting form implementing a traditional measurement principle that determines the oil degradation condition from the change in colour of the sample over ageing time. The colour is measured using different light-matter interaction processes, such as transmittance and diffuse reflectance. In addition, the sensor aims to operate immersed in fluid to avoid oil sample conditioning hydraulic subsystems and consequently reduce sensor cost and size. This fact facilitates the integration and installation of the sensor in systems and machinery not specifically prepared and with reduced space for sensing. Finally, its low cost makes this sensor perfect for scenarios such as manufacturing plants where thousands of cranes and robotics arms should be monitored.
The development of the proposed sensor concept approach entails functional, technical and design uncertainties focused on the optical and fluidical-mechanical subsystems. On the one hand, the optical design must guarantee a significant and stable RGB measurement dynamic range to precisely measure required oil degradation conditions (colour changes). On the other hand, the fluidical-mechanical design must guarantee an adequate oil sample acquisition, including sample cavity filling, air evacuation and oil renewal. A failure at any of these points can lead to an erroneous oil degradation condition measurement and unreliable operation mode.
To successfully face and solve those uncertainties, a methodological development process based on NPD (New Product Development) approaches is followed. The process is based on theoretical approaches, simulations and prototypes development as intermediate solutions to efficiently reach a completely defined final sensor system. This process has led us to achieve a sensor of Ø32 × 65 mm and approximately cost of 100€/1000units (see Table 13), which is lower than the size and prize of similar commercial sensors. The sensor operates directly immersed in fluid if there is at least a 100 Pa pressure drop or, in scenarios such as oil storage tanks, Fick's law of diffusion is met. In addition, the oil degradation condition information provided by the sensor includes a total oil degradation index (OD) and RULER, AN, FTIR (Oxi) and MPC (CLIELAB) parameters. Finally, the precision/variability of the measurement is ±5% for the OD and ±10% for the rest of the parameters over operation conditions, which is acceptable by the sensor client.
However, several improvements are identified. On the one hand, the emergence of new multifunctional sensor solutions, such as the HAMAMATSU Color/Proximity Sensor (Hamamatsu Photonics, Hamamatsu City, Japan) [76], could further reduce sensor size and improve measurement resolution/precision. Those multifunctional sensors incorporate into a single package an LED and a color sensor and improve emitted/received light ratio (photosensitivity) compared to the current design. On the other hand, migrating the lighting control to a "Temperature Coefficient of Voltage Approach" (see Section 3.3.1) or selecting a photodiode with a better temperature response could also improve measurement resolution/precision by reducing measurement variability over operating temperature conditions. The consideration of those new approaches in future work will improve the sensor performance quality.