DoubleDerivativeSystem.java
package org.mklab.tool.control.system.continuous;
import org.mklab.nfc.matrix.DoubleMatrix;
import org.mklab.tool.control.DoubleLinearSystemFactory;
/**
* 微分器を表すクラスです
*
* @author esumi
*
*/
public class DoubleDerivativeSystem extends DoubleContinuousLinearDynamicSystem {
/**
* 新しく生成された<code>TDerivativeSystem</code>オブジェクトを初期化します。
*/
public DoubleDerivativeSystem() {
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());
}
}