Coordinated control of multi-functional battery energy storage system in an unbalanced network