Functional and diagnostic model of a hybrid power system using renewable energy sources