1. A method for controlling a system having local loads, different from a utility grid, and local power sources connected to the utility grid through a point of common connection, the method comprising: detecting an islanding condition wherein the local power sources are islanded from the utility grid; evaluating, responsive to detecting the islanding condition, a power available from each of the local power sources; adaptively controlling, while the islanding condition is occurring, a power supplied to each of the local loads based on the power available from the local power sources wherein adaptively controlling the power supplied comprises implementing an algorithm in response to operator determined inputs and externally determined inputs, wherein implementing the algorithm comprises: determining the current energy flow between the system elements; determining the cost of energy transfer between the system elements; and determining the optimum states of the local loads; and operating the local loads and one or more local power sources as an islanded system while the utility grid is disconnected from the point of common connection.