i have a diesel driven 2 pole alternator (single pahse 230volt 50hz0running at 3000rpm it is bruhlesss and has a capacitor across the windings what is this cap for
It provides the excitation and sets the frequency.
The capacitor plus the inductance of the winding form a "tank circuit" - a resonant circuit that "rings" at a particular frequency.
What happens next depends on the type of rotor you have in the alternator. (I'll describe it as if it were a squirrel cage, then delta the description for a wound-coil-diode variant.)
The ringing coil/capacitor combination produces an alternating magnetic field. If the rotor is turning at roughly the frequency of the ringing, the magnetic field from the ringing current will try to magnetize the rotor with a pair of poles. If the motor is trying to push the rotor faster than the speed that would exactly match the ringing, the rotating magnetized rotor will push against the field (which will resist it) and pump energy into the rining (which will make it stronger).
Meanwhile, the slippage between the slightly-faster rotor and the field from the ringing coil "drags" the magnetization through the rotor. This induces a (large) current in the squirrel-cage conductors. This current maintains the field and resists its motion through the rotor.
Once started up (by a trace of residual magnetization in the rotor and its motion at or above the critical rate), the ringing and magnetization build up in an avalanche until they are limited by the "saturation" of the magnetic core material of the rotor and/or the stator. (This provides the voltage regulation.) After that point the rotation maintains the magnetization in the rotor and the ringing coil, pumping energy from the motor (by drag on the shaft) into the currents in the tank circuit and the squirrel cage to replace the energy lost to resistive heating.
With the rotor magnetized the correct amount and rotating at the correct speed, its magnetic field also generates a voltage in the output winding. Current can be pulled from there, and when it is the current resists the motion of the rotor - forcing the motor to provide the energy that drives the current into the load.
If the load pulls two much current, one of two things will happen: The rotor will slow down below the critical rotation rate to keep the tank pumped, and/or the load will start reducing the magnetic field of the rotor. Pull too much current and energy isn't pumped into the tank fast enough to replace what is lost to resistance. The ringing collapses, the rotor's magnetic field collapses, and the output voltage drops to almost zero. (This limits the output current.) Reduce the load sufficiently and the ringing will build up again.
Turning off the motor while the load is still attached MAY completely demagnitize the rotor as the generator slows down. Then you have nothing to get the process restarted again the next time you start up. You can restart things by "flashing" the rotor - driving a current through the output windings by connecting one wire to one side of a battery and striking the other wire against the other battery post. This may work if you do it when the genny is stopped (creating some residual magnetization in the rotor), and it WILL work if you do it while the motor is running (getting current going in the rotor and starting the ringing-pumping before it collapses). But use care if flashing when the motor is running, because the generator will go to full output in a fraction of a second, leaving you holding hot wires and/or with the hot wires stuck to the battery.
Squirrel cage rotors work. But they have problems. The big one is that they are lossier than they need to be (due to the slippage of the mag field through them). Another rotor type has a coil of wire to create a magnetic pole pair at a particular place in the rotor, with a diode across the end of the coil. The diode rectifies energy from harmonics and off-speed motion to get a pole started at a particular place. Then the shape of the pole pieces combined with the current keep it pinned there, without slippage, as the ringing builds its strength. Absent the slippage the excitation circuit only steals enough power to keep its coil ringing - you lose the losses that would otherwise drive the currents in the squirrel cage.