This paper presents the detailed modeling of various components of a grid connected hybrid energy system (HES) consisting of a photovoltaic (PV) system, a solid oxide fuel cell (SOFC), an electrolyzer and a hydrogen storage tank with a power flow controller. Also, a valve controlled by the proposed controller decides how much amount of fuel is consumed by fuel cell according to the load demand. In this paper fuel cell is used instead of battery bank because fuel cell is free from pollution. The control and power management strategies are also developed. When the PV power is sufficient then it can fulfill the load demand as well as feeds the extra power to the electrolyzer. By using the electrolyzer, the hydrogen is generated from the water and stored in storage tank and this hydrogen act as a fuel to SOFC. If the availability of the power from the PV system cannot fulfill the load demand, then the fuel cell fulfills the required load demand. The SOFC takes required amount of hydrogen as fuel, which is controlled by the PID controller through a valve. Effectiveness of this technology is verified by the help of computer simulations in MATLAB/SIMULINK environment under various loading conditions and promising results are obtained.