Summary This thesis are analyzed several aspects in order to optimize and improve the electrical distribution networks. This analysis take account the present state of the networks and the challenges that they have to confront. There are several factor that affect to the new networks. The most important factors are the power quality (PQ) and the distributed generation (DG). These elements are setting the significant changes both in the wave in the way we understand the electricity business as the technical requirements to be met by the existing distribution network. So this thesis is focus in the study of the evaluation of PQ when the DG is introduced in a convectional network and how the parameters of the system change. This analysis shows the limits of the distribution networks in order to grow and integrate the DG. The operation setpoint of the present networks are also established. This methodology of analysis allows to set design criteria for future networks and to identify the drawbacks and advantages of those new networks. The concern about the global warming is introducing great changes in the electricity business. The general objectives chive are low cots, good PQ and energy efficiency. This strategy has became a reference in the business as a consequence several countries are building demonstrative projects in order to achieve these goals. The microgrid concept is archiving great popularity. The study cases proposed in this thesis reflets most of the ideas proposed by the microgrid concept, although the main objectives are not the island operation, the energy storage or the optimization of the control of DG units. The microgrid can be considered break with the current concept. In this thesis, It is changed the present infrastructure of the network to evaluate by means of an objective analysis if the integration of the DG has more advantages in loads and networks than the problems that it causes. The introduction of small and medium size renewable energies causes changes in the distribution networks, because the characteristics of this type of generation don't allows to be connected to the transport networks. So far, the introduction of the DG units has been done without a precise knowledge of the impact that DG has in the network. In order to obtain more information about this impact in the thesis is studied the operation aspects of the DG in stationary sinusoidal state. It is studied the influence of the position, the size and the type of DG in the currents and voltage of the current networks. It has been calculated the limits of integration as a function of the currents and voltage in the network. Other effect is motivated by the changes in the fault currents that the protection system shows and its caused by de presence of DG. Some of the problems that the DG causes are uncoordinated of the protection system, increase of the number of voltage dips to the network and the islanding operation. In the thesis are identified and described these problems in the networks and makes an assessment of the severity of themselves. As a consequence of the elaboration of these models, It has been extracted conclusions in several issues, as transient analysis, the efficiency and the operation of the network. It also has been carried out several stochastic simulations using the Monte Carlo method in a typical present network and one with DG integrated. It has been possible to evaluate the PQ accurately. This aspect facilitates the design of new networks, showing the influence in the change of equipments or control variables in the PQ, since if It is tried to collect this information in a physic system, most cases would be unfeasible because the cost or imposible because the monitoring time required.