Motor.java
/*
* $Id: Motor2.java,v 1.11 2008/02/02 03:06:25 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.continuous.DoubleBaseContinuousExplicitDynamicSystem;
/**
* モータ(角度のみ測定可能、角速度は測定できない)を表すクラスです。
*
* @author koga
* @version $Revision: 1.11 $, 2004/04/23
*/
public class Motor extends DoubleBaseContinuousExplicitDynamicSystem {
/** 慣性モーメント */
double J = 1;
/** 摩擦係数 */
double c = 1;
/** 電圧トルク変換係数 */
double a = 1;
/**
* 新しく生成された<code>Motor2</code>オブジェクトを初期化します。
*/
public Motor() {
super(1, 1, 2);
setHasDirectFeedthrough(false);
}
/**
* {@inheritDoc}
*/
public DoubleMatrix stateEquation(double t, DoubleMatrix x, DoubleMatrix u) {
DoubleMatrix A = new DoubleMatrix(new double[][] { {0, 1}, {0, -this.c / this.J}});
DoubleMatrix B = new DoubleMatrix(new double[][] { {0}, {this.a / this.J}});
DoubleMatrix dx = A.multiply(x).add(B.multiply(u));
return dx;
}
/**
* {@inheritDoc}
*/
@Override
public DoubleMatrix outputEquation(double t, DoubleMatrix x) {
DoubleMatrix C = new DoubleMatrix(new double[] {1, 0});
DoubleMatrix y = C.multiply(x);
return y;
}
}