your inverter is connected to grid. so you need phase angle of the grid voltage. obtain it with any convenient method. suppose the angle of current is measured referenced to angle of voltage vector. decompose current vector in a frame in which voltage vector is x-axis, and an axis perpendicular to voltage vector . As you know in-phase current (id) generates active power and perpendicular current (iq) generates reactive power. control id and iq according to demanded active power and reactive power respectively. now obtain angle and amplitude of current by using id and iq. use hysteresis band modulation or any convenient method to generate this current at output of the inverter.
Good Luck