added switching observation and control segments, added gain to state output