implemented the function value for MtlOptEnergy, test passed.