When the gasoline or diesel engine is running, it generates power for the electric motor.
(the gasoline or diesel engine; is running; ) (it; generates; power for the electric motor; T:When the gasoline or diesel engine is running)
the gasoline or diesel engine it
is running generates
power for the electric motor T:When the gasoline or diesel engine is running