How do you determine the direction of AC current? (ex: whether your solar-powered house is drawing from the city power grid or adding to the grid)
This is considerably easier and safer if you interface to the existing meter that does this, but: your current measures will be signed. Positive or negative. Whether you're measuring through a shunt or magnetic methods. You need to compare to the sign of the voltage measured at the same time. Same sign means same phase opposite sign means out of phase. In phase should mean the grid is powering the house. Out of phase means the opposite.