  We consider an HJM model setting for Markov-chain modulated forward rates.
The underlying Markov chain is assumed to induce regime switches on the forward
curve dynamics. Our primary focus is on the interest rate and energy futures
markets. After deriving HJM-drift conditions for the two markets, we prove
under the assumption of affine structure for the term structure that the
forward curves are solutions to specific systems of ODEs that can be solved
explicitly in many cases. This allows for a tractable model setting, and we
present an algorithm for obtaining consistent forward curve models within our
framework. We conclude by presenting some simple numerical examples.
