Working principle of hydraulic and pneumatic energy storage system