DoubleUnitLeadSystem.java
/*
* Created on 2012/05/17
* Copyright (C) 2012 Koga Laboratory. All rights reserved.
*
*/
package org.mklab.tool.control.system.discrete;
import org.mklab.nfc.matrix.DoubleMatrix;
import org.mklab.tool.control.DoubleLinearSystemFactory;
/**
*
* 1サンプル進みを表わすクラスです。
* @author esumi
* @version $Revision$, 2012/05/17
*/
public class DoubleUnitLeadSystem extends DoubleDiscreteLinearDynamicSystem {
/**
* 新しく生成された<code>UnitDelaySystem</code>オブジェクトを初期化します。
*/
public DoubleUnitLeadSystem() {
super();
setAutoSize(false);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setInputSize(int)
*/
@Override
public void setInputSize(final int size) {
if (size < 0) {
return;
}
super.setInputSize(size);
super.setOutputSize(size);
if (getStateSize() != size) {
setStateSize(size);
super.setInitialState(new DoubleMatrix(size, 1));
setLinearSystem(DoubleLinearSystemFactory.createLinearSystem(new DoubleMatrix(new double[][]{{0,1},{-1,0}}), new DoubleMatrix(new double[][]{{0},{1}}), new DoubleMatrix(new double[][]{{0,1}}), new DoubleMatrix(new double[][]{{0}}), new DoubleMatrix(new double[][]{{1,0},{0,0}})));
}
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setOutputSize(int)
*/
@Override
public void setOutputSize(final int size) {
if (size < 0) {
return;
}
super.setInputSize(size);
super.setOutputSize(size);
if (getStateSize() != size) {
setStateSize(size);
super.setInitialState(new DoubleMatrix(size, 1));
setLinearSystem(DoubleLinearSystemFactory.createLinearSystem(new DoubleMatrix(new double[][]{{0,1},{-1,0}}), new DoubleMatrix(new double[][]{{0},{1}}), new DoubleMatrix(new double[][]{{0,1}}), new DoubleMatrix(new double[][]{{0}}), new DoubleMatrix(new double[][]{{1,0},{0,0}})));
}
}
/**
* {@inheritDoc}
*/
@Override
public void setInitialState(DoubleMatrix initialState) {
super.setInitialState(initialState);
final int size = initialState.length();
if (getStateSize() != size) {
setStateSize(size);
setLinearSystem(DoubleLinearSystemFactory.createLinearSystem(new DoubleMatrix(new double[][]{{0,1},{-1,0}}), new DoubleMatrix(new double[][]{{0},{1}}), new DoubleMatrix(new double[][]{{0,1}}), new DoubleMatrix(new double[][]{{0}}), new DoubleMatrix(new double[][]{{1,0},{0,0}})));
}
setInputSize(initialState.length());
setOutputSize(initialState.length());
}
}