DoubleBaseContinuousStaticSystem.java

/*
 * $Id: BaseContinuousStaticSystem.java,v 1.12 2008/06/26 10:10:34 koga Exp $
 *
 * Copyright (C) 2004 Koga Laboratory. All rights reserved.
 *
 */

package org.mklab.tool.control.system.continuous;

import org.mklab.nfc.matrix.DoubleMatrix;
import org.mklab.nfc.ode.SolverStopException;
import org.mklab.tool.control.system.DoubleSystemOperator;


/**
 * 代数方程式で表現される連続時間静的システムを表すクラスです。
 * 
 * @author Koga Laboratory
 * @version $Revision: 1.12 $, 2004/11/09
 */
public abstract class DoubleBaseContinuousStaticSystem extends DoubleSystemOperator implements DoubleContinuousStaticSystem {

  /**
   * 新しく生成された<code>BaseContinuousStaticSystem</code>オブジェクトを初期化します。
   * 
   * @param inputSize 入力の数
   * @param outputSize 出力の数
   */
  public DoubleBaseContinuousStaticSystem(final int inputSize, final int outputSize) {
    super();
    setInputSize(inputSize);
    setOutputSize(outputSize);
    setDynamic(false);
  }

  /**
   * @see org.mklab.tool.control.system.SystemOperator#initialize()
   */
  @Override
  public void initialize() {
    // nothing to do
  }

  /**
   * {@inheritDoc}
   */
  public DoubleMatrix outputEquation( final double t,  final DoubleMatrix u) throws SolverStopException {
    throw new SolverStopException(Messages.getString("BaseContinuousStaticSystem.0")); //$NON-NLS-1$
  }

  /**
   * {@inheritDoc}
   */
  public DoubleMatrix outputEquation( final double t) throws SolverStopException {
    throw new SolverStopException(Messages.getString("BaseContinuousStaticSystem.1")); //$NON-NLS-1$
  }

  /**
   * {@inheritDoc}
   */
  final public DoubleMatrix inputOutputEquation(final double t) throws SolverStopException {
    if (hasDirectFeedthrough()) {
      throw new RuntimeException(Messages.getString("BaseContinuousStaticSystem.2")); //$NON-NLS-1$
    }

    final DoubleMatrix u = new DoubleMatrix(getInputSize(), 1);
    final DoubleMatrix y = outputEquation(t);
    return u.appendDown(y);
  }
}