Using Power Grid Schedules in Dynamic Optimization of Gas Pipelines