Small, commercially available SAPS consisting of solar P V modules, batteries, and loads regularly needs to be controlled by a certain type of controller. The simplest controller has an input for electricity generated by PV modules, input/output connectors,for, batteries and connectors for the DC load The controller automalically directs electricity to the load and/or to the batteries or connects the batteries and a load when there is no electricity from the PV. If future SAPS use apart from batteries a hydrogen energy storage system consisting of an electrolyzer, pressurized hydrogen storage and a fuel cell, the appropriate controller should be developed and commercially produced. This paper presents a mathematical model of a veri; simple controller that directs and controls energy and mass flow between the PV modules, batteries, electrolyzer, hydrogen storage, fuel cell and electrical load. The proposed logical scheme of the controller has been mathematically modelled and simulated as well as the rest of the subsystems of the SAPS (batteries, elecirolyzer, hydrogen storage and load) using MATLAB-SIMULINK software. Input to the system model was supposed to be daily solar irradiation and load profiles aimed at proving whether controller logic can control the whole system in a practical and sale way. Mathematical equations, SIMULINK program and obtained results are presented and discussed The conclusion is that proposed controller logic works well and that a controller can be built using electronic components, commercially produced