Abstract:To save energy and compensate voltage,the control of energy storage system is becoming increasingly rigid for urban mass transit.To design a reliable control algorithm rapidly and efficiently,a model of supercapacitor based energy storage system has been presented via Simulink/Stateflow.Furthermore,the features and optimization suggestions of Stateflow are provided.The function of the algorithm model is described briefly and verified via simulation,then the embedded C code suitable for the LF2407A digital signal processor(DSP) platform is automatically generated.It also generalizes the rapid implementation flow based on DSP and provides suggestions to the rapid implementation iteration process by studying the generated C code,and the rapid transition of bidirectional DC/DC converter is also discussed.Finally an experiment is conducted to verify the validity of this approach.This methodology is suitable for other power electronics control system for the urban mass transit,and it can facilitate the project development and shorten the development cycle.