01 /*
02 * $Id: Motor.java,v 1.17 2008/06/26 10:10:34 koga Exp $
03 *
04 * Copyright (C) 2004 Koga Laboratory. All rights reserved.
05 *
06 */
07 package matxbook.chap21;
08
09 import org.mklab.nfc.matrix.DoubleMatrix;
10 import org.mklab.nfc.matrix.Matrix;
11 import org.mklab.tool.control.system.continuous.BaseContinuousDynamicSystem;
12
13
14 /**
15 * モータ(角度と角速度が測定可能)を表すクラスです。
16 *
17 * @author koga
18 * @version $Revision: 1.17 $, 2004/04/23
19 */
20 public class Motor extends BaseContinuousDynamicSystem {
21 /** 電圧トルク変換係数 */
22 double a = 1;
23 /** 摩擦係数 */
24 double c = 1;
25 /** 慣性モーメント */
26 double J = 1;
27 /** システム行列 */
28 Matrix A;
29 /** 入力行列 */
30 Matrix B;
31 /** 出力行列 */
32 Matrix C;
33
34 /**
35 * コンストラクター
36 */
37 public Motor() {
38 super(1, 2, 2);
39 setForcedSystem(true);
40 setHasDirectFeedthrough(false);
41
42 this.A = new DoubleMatrix(new double[][] { {0, 1}, {0, -this.c / this.J}});
43 this.B = new DoubleMatrix(new double[] {0, this.a / this.J}).transpose();
44 this.C = DoubleMatrix.unit(2);
45 }
46
47 /**
48 * @see org.mklab.tool.control.system.continuous.ContinuousDynamicSystem#stateEquation(double, org.mklab.nfc.matrix.Matrix, org.mklab.nfc.matrix.Matrix)
49 */
50 @SuppressWarnings("unused")
51 public Matrix stateEquation(double t, Matrix x, Matrix u) {
52 Matrix dx = this.A.multiply(x).add(this.B.multiply(u));
53 return dx;
54 }
55
56 /**
57 * @see org.mklab.tool.control.system.continuous.BaseContinuousDynamicSystem#outputEquation(double, org.mklab.nfc.matrix.Matrix)
58 */
59 @Override
60 @SuppressWarnings("unused")
61 public Matrix outputEquation(double t, Matrix x) {
62 Matrix y = this.C.multiply(x);
63 return y;
64 }
65 }
|