here is ltspice simulation of circuit grid tie inverter, ltspice is free.
You do not need to always sense the mains, you just have to know when is the zero crossing, then you shovel in your sinusoidal current in phase with it.
You need to have a dc supply of voltage higher than the mains peak, so that you can always shovel power into the mains via the inverter....so whatever gives you that HVDC supply, it needs to be isolated...ie, its input must be isolated from the mains.....as you know, its output is not isolated from the mains because it feeds current into the mains directly.