A solenoid operated unit for detecting and removing with diagnostic metering an undesired fluid from a desired fluid of lower specific gravity than that of the undesired fluid, the solenoid operated unit comprising: a unified solenoid operated pump and valve unit further comprising, a combination housing having a first housing and a second housing, a solenoid coil circuit having an electromagnetic circuit integrated with a fluid circuit, and a pump-valve assembly further comprising a unified chamber having a first liner and a second liner, a plunger, a receiver, an air reliever and a sealing seat; a drainage path between a holding chamber and a drainage chamber further comprising, an inlet non-return valve disposed at a first mounting provision in the first housing, and an outlet non-return valve disposed at a second mounting provision of the first housing; an electrical detection system; a mecha-electro-magnetic detection system; and a junction box interacting with an electronic control unit comprising a pulse width modulated wave generator, the first housing having a provision to dispose thereon a modular float chamber having a floating device comprising a "First Fluid" spherical end and a "Second Fluid" spherical end, the first housing mounted on the second housing on a mating surface of the second housing such that a first junction chamber of the first housing orients with a second junction chamber of the second housing and forms the junction box and a common axis of the first housing and the second housing becomes co-axial, consequently a first cylindrical chamber of the first housing and a second cylindrical chamber of the second housing forms the unified chamber, the first housing comprising the drainage path of the undesired fluid, the electrical detection system, the mecha-electro-magnetic detection system, the second housing comprising the electromagnetic circuit, the pump-valve assembly accommodated partially in the first housing and partially in the second housing, the solenoid operated unit mounted at the bottom of a vessel, wherein the plunger moves from up to down, a sweeping volume with a cycle of a PWM electricity wave, while moving down the plunger creates a negative pressure in the sweeping volume and while moving up a positive pressure gets created in the sweeping volume, the air reliever is provided for breathing, the solenoid operated unit senses a real-time position of the floating device, has a calibrated number of cycles N of the PWM electricity wave for the diagnostic metering, an error list decodes a variation of an actual number of cycles Na with reference to the calibrated number of cycles N of the PWM electricity wave. a unified solenoid operated pump and valve unit further comprising, a combination housing having a first housing and a second housing, a solenoid coil circuit having an electromagnetic circuit integrated with a fluid circuit, and a pump-valve assembly further comprising a unified chamber having a first liner and a second liner, a plunger, a receiver, an air reliever and a sealing seat; a combination housing having a first housing and a second housing, a solenoid coil circuit having an electromagnetic circuit integrated with a fluid circuit, and a pump-valve assembly further comprising a unified chamber having a first liner and a second liner, a plunger, a receiver, an air reliever and a sealing seat; a drainage path between a holding chamber and a drainage chamber further comprising, an inlet non-return valve disposed at a first mounting provision in the first housing, and an outlet non-return valve disposed at a second mounting provision of the first housing; an inlet non-return valve disposed at a first mounting provision in the first housing, and an outlet non-return valve disposed at a second mounting provision of the first housing; an electrical detection system; a mecha-electro-magnetic detection system; and a junction box interacting with an electronic control unit comprising a pulse width modulated wave generator,