An energy-management system that manages energy within a predominantly closed power system, comprising: a storage device coupled to a processor and a memory, wherein the storage device is configured to store instructions able to be executed by the processor to cause the processor to perform a method; a component driver (108, 110) configured to issue commands specific to a component (112, 114) in order to control the power consumption or production of the component, wherein the component driver comprises a receiving mechanism configured to receive current status information for the component (112, 114), such as a load or a supply, associated with the component driver (108, 110); an optimization and control module (104, 106) configured to manage or control the energy consumption or production of a component via the component driver (108, 110); characterized in that the component driver further comprises: a model-construction mechanism configured to construct a performance model for the component, wherein in constructing the performance model, the processor is configured to compute, a power function of the consumption or generation rate, a cost function and a deficit function, wherein the power function, cost function and the deficit function are associated with an operating state of the component; and a transmitting mechanism configured to transmit the performance model, which includes the power function, cost function and the deficit function, to the optimization and control module (104, 106) to facilitate optimization based on the power function, cost function and the deficit function, wherein to perform the method, the processor is configured to operate the receiving mechanism, the model-construction mechanism and the transmitting mechanism. a storage device coupled to a processor and a memory, wherein the storage device is configured to store instructions able to be executed by the processor to cause the processor to perform a method; a component driver (108, 110) configured to issue commands specific to a component (112, 114) in order to control the power consumption or production of the component, wherein the component driver comprises a receiving mechanism configured to receive current status information for the component (112, 114), such as a load or a supply, associated with the component driver (108, 110); an optimization and control module (104, 106) configured to manage or control the energy consumption or production of a component via the component driver (108, 110); characterized in that the component driver further comprises: a model-construction mechanism configured to construct a performance model for the component, wherein in constructing the performance model, the processor is configured to compute, a power function of the consumption or generation rate, a cost function and a deficit function, wherein the power function, cost function and the deficit function are associated with an operating state of the component; and a transmitting mechanism configured to transmit the performance model, which includes the power function, cost function and the deficit function, to the optimization and control module (104, 106) to facilitate optimization based on the power function, cost function and the deficit function, wherein to perform the method, the processor is configured to operate the receiving mechanism, the model-construction mechanism and the transmitting mechanism. a model-construction mechanism configured to construct a performance model for the component, wherein in constructing the performance model, the processor is configured to compute, a power function of the consumption or generation rate, a cost function and a deficit function, wherein the power function, cost function and the deficit function are associated with an operating state of the component; and a transmitting mechanism configured to transmit the performance model, which includes the power function, cost function and the deficit function, to the optimization and control module (104, 106) to facilitate optimization based on the power function, cost function and the deficit function, wherein to perform the method, the processor is configured to operate the receiving mechanism, the model-construction mechanism and the transmitting mechanism.