This study deals with the comprehensive modelling, analysis, and control of a DC microgrid (MG) in islanded mode. The proposed DC MG comprises a wind turbine, a photovoltaic (PV) source, battery storage, DC/DC source, and load side converters with DC loads. To this aim, a circuit-oriented modelling of the whole system is developed. The PV source is modelled with a single-diode electrical circuit. Afterward, a mathematical model of the system with state-space representation was derived. A detailed analysis of PV system design is performed because the parameters of PV are appearing in the dynamic model of DC MG. For the purpose of controller development, the dynamic model of the DC MG, which is modelled by a non-linear-non-affine eight-order system, is linearized around an equilibrium point using the Jacobian matrix framework, while stability using eigenvalue is carried out showing that the stability is guaranteed under operating condition. Finally, for the first time, the state-dependent Riccati equation (SDRE) technique is proposed to find the optimal regulation problem for the DC MG with non-linear-non-affine dynamics. The numerical simulation studies first confirm the validity of the performed mathematical, then the effectiveness of the proposed non-linear controller is evaluated under illumination and load change.