An approach based on a hierarchical representation of heterogeneous systems and their decomposition into separate homogeneous subsystems is considered. Two-level model is constructed with continuous homogeneous processes at the lower level and discrete control of their switching at the upper level. Such model allows one to describe systematically the changing not only the structure, but also the order and even the nature of homogeneous subsystems. For this system the optimal control problem is stated and general and specific sufficient optimality conditions of Krotov type are obtained.