1. A method for optimizing operational settings for a plurality of energy devices, comprising: representing each of the plurality of energy devices in terms of a set of decision variables and operational parameters; constraining the decision variables and operational parameters based on operational conditions and interrelationship between the plurality of energy devices; generating a two-tiered model of the plurality of energy devices wherein a top tier of the model represents interaction of various sub-models and a bottom tier of the model includes a set of the sub-models that form the top tier, each sub-model representing detailed operation of the plurality of energy devices; and optimizing the two-tiered model to provide either a schedule of operation for the plurality of energy devices or real-time control for the plurality of energy devices, wherein each of the above steps are performed within a computer system.