A framework to model and optimize the operation of lithium-ion energy storage in electricity markets, and an assessment of lithium-ion energy storage in Texas