BaseContinuousStaticSystem.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.ComplexNumericalMatrix;
import org.mklab.nfc.matrix.RealNumericalMatrix;
import org.mklab.nfc.ode.SolverStopException;
import org.mklab.nfc.scalar.ComplexNumericalScalar;
import org.mklab.nfc.scalar.RealNumericalScalar;
import org.mklab.tool.control.system.SystemOperator;


/**
 * 代数方程式で表現される連続時間静的システムを表すクラスです。
 * 
 * @author Koga Laboratory
 * @version $Revision: 1.12 $, 2004/11/09
 * @param <RS> type of real scalar
 * @param <RM> type of real matrix
 * @param <CS> type of complex scalar
 * @param <CM> type of complex matrix
 */
public abstract class BaseContinuousStaticSystem<RS extends RealNumericalScalar<RS,RM,CS,CM>, RM extends RealNumericalMatrix<RS,RM,CS,CM>, CS extends ComplexNumericalScalar<RS,RM,CS,CM>, CM extends ComplexNumericalMatrix<RS,RM,CS,CM>> extends SystemOperator<RS,RM,CS,CM> implements ContinuousStaticSystem<RS,RM,CS,CM> {

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

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

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

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

  /**
   * {@inheritDoc}
   */
  final public RM inputOutputEquation(final RS t) throws SolverStopException {
    if (hasDirectFeedthrough()) {
      throw new RuntimeException(Messages.getString("BaseContinuousStaticSystem.2")); //$NON-NLS-1$
    }
    
    final RM u = t.createZeroGrid(getInputSize(), 1);
    final RM y = outputEquation(t);
    return u.appendDown(y);
  }
}