DiscreteObserver.java

/*
 * $Id: DiscreteObserver.java,v 1.14 2008/06/26 10:10:35 koga Exp $
 *
 * Copyright (C) 2004 Koga Laboratory. All rights reserved.
 *
 */
package org.mklab.tool.control.model.matxbook;

import org.mklab.nfc.matrix.DoubleMatrix;
import org.mklab.tool.control.system.discrete.DoubleBaseDiscreteDynamicSystem;


/**
 * 離散時間オブザーバーを表すクラスです。
 * 
 * @author koga
 * @version $Revision: 1.14 $, 2004/04/23
 */
public class DiscreteObserver extends DoubleBaseDiscreteDynamicSystem {

  /** オブザーバーの係数行列 */
  DoubleMatrix Ahd = new DoubleMatrix(new double[] {0.223});
  /** オブザーバーの係数行列 */
  DoubleMatrix Bhd = new DoubleMatrix(new double[] {-1.554});
  /** オブザーバーの係数行列 */
  DoubleMatrix Jhd = new DoubleMatrix(new double[] {0.259});
  /** オブザーバーの係数行列 */
  DoubleMatrix Chd = new DoubleMatrix(new double[][] { {0}, {1}});
  /** オブザーバーの係数行列 */
  DoubleMatrix Dhd = new DoubleMatrix(new double[][] { {1}, {2}});

  /**
   * コンストラクター
   */
  public DiscreteObserver() {
    super(2, 2, 1);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleMatrix stateEquation(int k, DoubleMatrix z, DoubleMatrix uy) {
    DoubleMatrix u = uy.getSubVector(1, 1);
    DoubleMatrix y = uy.getSubVector(2, 2);
    DoubleMatrix nz = this.Ahd.multiply(z).add(this.Bhd.multiply(y)).add(this.Jhd.multiply(u));
    return nz;
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public DoubleMatrix outputEquation(int k, DoubleMatrix z, DoubleMatrix uy) {
    DoubleMatrix y = uy.getSubVector(2, 2);
    DoubleMatrix xh = this.Chd.multiply(z).add(this.Dhd.multiply(y));
    return xh;
  }
}