Sustainable development is a key principle in the European Union. As a moral leader and pioneer in energy-efficient buildings, the EU is carrying out the first legislative steps by implementing the Europe 2020 strategy in real life. Currently, the energy-efficient solutions for individual buildings are common knowledge; now the focus is shifting from single objects towards further, more complex systems such as urban fragments, city districts or even whole cities. By 2050, cities will accommodate about 70% of world's population yet even at present, they are responsible for 80% of CO2 emissions. With this in mind, it is necessary, but also convenient, to look for solutions to global environmental problems within cities. Urban layout varies with many factors, such as local climate, topology, or cultural background, all of which need to be reflected in the new concepts of 21st-century energy-efficient urban design. On this matter, we have the opportunity to learn from the past the streets of cities emerging under Spanish influence were often laid out for conditions of greater sunlight, known as the Spanish grid. The present contribution presents a strategy for making cities more energy efficient by preferring local renewable energy sources while maintaining their identity and cultural heritage. Today we can reliably look for solutions in silico, through computer simulations. It is possible to evaluate quickly many urban variations including diverse aspects while saving considerable effort and energy. This focus of this study is on software generation of urban structures according to the position of the sun to maximize active and passive solar energy utilisation. The given approach creates nearly zero- or even plus-energy urban volumes, which are able to supply the energy surplus to their surroundings in an energy cooperation process, including even existing developments. In addition, the energy cooperation potential between basic typologies of city fragments was analysed. Solar potential was studied with regard to the two basic principles of solar energy utilization active (photovoltaic and photothermic conversion) and passive (transmission through building openings). With regard to these principles, the unobstructed solar exposition of corresponding surfaces is crucial and deserves far more attention in urban planning processes. The generation of urban structures was conducted by an algorithm written in the Rhino script Grasshopper. It is based on similar principles as the Solar Envelope of Ralph Knowles and extends them. Urban volumes are created by the following limitations defined by borders of tangential plots, the pre-set period from 20th March to 22nd September (defined through partial research and possible energy gains) and the time interval from 9 a.m. to 3 p.m.. According to Juhani Pallasmaa, the process of creation is conducted through the connection between hand and mind. Therefore this process remains within the competence of architects and town planners the generating algorithm follows their intentions and afterwards optimises the areas to be built up. The final step is volumetric reduction from the southern direction, in order to create appropriate surfaces for solar appliances. The analysis of 3 resulting structures in comparison with "traditional" 4- and 8-storey urban typologies was performed on a reference plot of 4 ha. The boundary conditions of proposed buildings and structural elements correspond to the passive energy standard (15 kWh/m(2).a), average values of hot-water energy consumption (3.5 kWh/d.dw), and average household electricity consumption (6 kWh/d.dw). One dwelling was represented by 100 m2 gross floor area and was occupied by 2.5 persons. Transparent parts of buildings accounted for 30% on facades and 15% on roof surfaces. Two case studies were observed the first one was focused solely on the use of photovoltaic energy, while the second one included an equal surface shared by photovoltaic and photothermic sources. The results juxtapose the energy demands/ consumption of the analysed urban fragments and their solar energy potential. In case of PV-only structures, the energy gained can outbalance the needs at the level of nearly zero energy standards. The "traditional" urban typologies ranked better at the 4-storey level, but were surpassed by the second and third generated urban structures (Generated Structure 02 and 03). The other case which utilised energy from both photovoltaic and photothermic sources showed higher energy efficiency and better outcomes. All of the structures are rated at nearly zero energy standards or higher. The greatest energy surplus urban volume according to the summarization is Generated Structure 02, even though it does not display the highest solar energy gain potential. Generated Structure 03 can shelter the most inhabitants and enables the highest solar energy gains. Traditional low-rise urban types are not far behind and have quite good energy cooperation potential as well. Savings in household electricity consumption offer a certain space for further reduction of energy demands. Changes in user behaviour can have a great impact on overall energy needs. European studies have proven that a reduction to levels below 4 kWh/d.dw is definitely feasible. In addition to energy parameters, the volume characteristics and possible number of inhabitants need to be considered with regard to social factors, as the recommended population density is about 250 inhabitants/ha. Generation of solar urban structures, optimization of traditional urban typology or revitalisation of entire city districts all represent possible ways of creating a system of energysurplus urban fragments. Energy potential may be transformed into a synergy by means of an energy cooperation grid, in which historically valuable urban structures would receive needed energy from new urban developments. A persistent hurdle to renewable energy use is the financially demanding possibilities of energy storage. However, even in this field there are well-documented studies of diverse promising technologies. The concept of energy cooperation on the urban scale offers a solution for preservation of the identity and cultural heritage of cities and, at the same time, a balance and reliability of energy networks could be ensured. It is essential that energy from renewable sources is not only acquired but also is put to use within the neighbourhood or city. The implementation of the proposed concept needs to occur in the field of urban design. New energy indicators for town-planning have been defined. The cooperation indicator of the urban structure (or neighbourhood, district, city quarter) is meant to be a quantifier of the negative/positive energy balance of the urban structure's contribution to the synergy within an urban frame. It expresses either the structure's capability of offering its energy surplus or its energy demands with respect to adjoining structures or city quarters. Utilisation of the available renewable sources in real time is enabled by a local smart grid. Energy cooperation indicators reflect the potential of overproduction or the deficiency of a particular urban structure type in relation to a reference plot/area (e.g. 1 ha). The indicator varies from positive to negative values, and may be related to electrical (referred to as electric cooperation indicator ECI) or thermic (TOO energy (or any other applicable commodity). The solar index of an urban structure (or neighbourhood, district, city quarter) is defined as the ratio of the total amount of incident solar radiation on the surface of a specific urban structure during a period (of the year) to the total amount of irradiation of the corresponding plot attached to the urban structure. Using numbered values, the solar index indicates which part of the total solar radiation falling onto the given area is actually caught by the urban structure for its potential utilisation. The amount of harnessed energy depends on the observed period (specified according to he intended solar energy utilisation). Koen Steemers states that only the compact city can be energy-efficient. Compactness allows "material savings from extent", increasing infrastructure efficiency, lowering traffic demands or better use of soil. This paper presents ways to design denser urban areas while preserving healthy living through an optimally sunlit environment. Policies for appropriate passive and active solar energy utilisation and coordination of energy flows in urban areas must be specified and executed by municipal authorities. The chief difficulty within the given concept is, as always, user behaviour. Therefore, reduction of energy consumption relies on proper education and public demonstration of best-practice examples. These are the starting points for urban development in the 21st century.