The noise is definitely electronic.  It starts the instant you flip either hot water switch, gas or electric.  Flow of water or temperature of water makes no difference.  If you open the exterior cover, and put your ear as close as possible, it sounds like its coming from the circuit board.  If you pull one of the brown wires off the thermostat, it stops.  That made me think it was the thermostat, and since I had an adjustable thermostat I was going to use on another RV, I plugged the two thermostat wires into the adjustable one while holding it-whining returned. The sound has nothing to do with water movement or gas movement.
CT51