Solenoid valve comprising: - a housing having an axial bore which is in flow connection with at least an inlet port and an outlet port (4, 5); - a valve element which is moveable to and fro in the axial direction of the bore; - an electrical coil for generating a magnetic field for moving the valve element between a first end position, in which it lies sealing against a seat (9', 10') in order to disconnect said inlet and outlet port (3; 4, 5) from each other, and a second end position, in which it lies at a distance from said seat (9', 10') in order to create a flow opening for connecting said inlet and outlet port (3; 4, 5) with each other; - a position sensor for detecting axial positions of the valve element in the axial direction of the bore; and - a control unit for determining stroke, velocities and/or accelerations of the valve element in the axial direction of the bore as a function of the detected axial positions during movements of the valve element between its first and second end positions, characterized in that the control unit comprises a memory with a set of reference values which are indicative for a proper functioning of the valve, and wherein the control unit is designed for comparing said determined stroke, velocities and/or accelerations as a function of the detected axial positions with the set of reference values, wherein the set of reference values stored in the memory comprises ranges for the stroke, velocities and/or accelerations, which ranges are indicative for a future malfunctioning of the valve, and wherein means (SIGNAL) are provided for sending out a feedback signal about failure modus and health status towards an operator that the valve needs maintenance, in particular that an element of the valve is likely to get damaged soon and needs to be replaced, in the case that said determined stroke, velocities and/or accelerations as a function of the detected axial positions are outside said ranges for the stroke, velocities and/or accelerations of the set of reference values. - a housing having an axial bore which is in flow connection with at least an inlet port and an outlet port (4, 5); - a valve element which is moveable to and fro in the axial direction of the bore; - an electrical coil for generating a magnetic field for moving the valve element between a first end position, in which it lies sealing against a seat (9', 10') in order to disconnect said inlet and outlet port (3; 4, 5) from each other, and a second end position, in which it lies at a distance from said seat (9', 10') in order to create a flow opening for connecting said inlet and outlet port (3; 4, 5) with each other; - a position sensor for detecting axial positions of the valve element in the axial direction of the bore; and - a control unit for determining stroke, velocities and/or accelerations of the valve element in the axial direction of the bore as a function of the detected axial positions during movements of the valve element between its first and second end positions, characterized in that the control unit comprises a memory with a set of reference values which are indicative for a proper functioning of the valve, and wherein the control unit is designed for comparing said determined stroke, velocities and/or accelerations as a function of the detected axial positions with the set of reference values, wherein