OdeBench.java

/*
 * $Id: OdeBench.java,v 1.5 2008/06/26 10:10:34 koga Exp $
 *
 * Copyright (C) 2004 Koga Laboratory. All rights reserved.
 *
 */
package org.mklab.tool.control.util;

import org.mklab.nfc.matrix.DoubleMatrix;
import org.mklab.tool.control.system.continuous.DoubleBaseContinuousExplicitDynamicSystem;


/**
 * シミュレーションのベンチマークを行うためのクラス
 * 
 * @author koga
 * @version $Revision: 1.5 $, 2004/06/10
 */
class OdeBench extends DoubleBaseContinuousExplicitDynamicSystem {

  /** 線形システムの係数行列 */
  private DoubleMatrix A;
  /** 線形システムの係数行列 */
  private DoubleMatrix B;
  /** 状態フィードバック行列 */
  private DoubleMatrix F;

  /**
   * コンストラクタ
   */
  public OdeBench() {
    super(1, 0, 3);
    this.A = new DoubleMatrix(new double[][] { {0, 1, 0}, {0, 0, 1}, {0, 0, 0}});
    this.B = new DoubleMatrix(new double[] {0, 0, 1}).transpose();
    this.F = new DoubleMatrix(new double[] {-1, -2, -3});
  }

  /**
   * {@inheritDoc}
   */
  public DoubleMatrix stateEquation( double t, DoubleMatrix x, DoubleMatrix u) {
    DoubleMatrix dx = this.A.multiply(x).add(this.B.multiply(u));
    return dx;
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public DoubleMatrix inputOutputEquation( double t, DoubleMatrix x) {
    DoubleMatrix u = this.F.multiply(x);
    return u;
  }
}