Galaxy formation, evolution - II. Energy balance, star formation, feedback