UnitDelaySystem.java
/*
* Created on 2006/02/03
* Copyright (C) 2006 Koga Laboratory. All rights reserved.
*
*/
package org.mklab.tool.control.system.discrete;
import org.mklab.nfc.matrix.ComplexNumericalMatrix;
import org.mklab.nfc.matrix.RealNumericalMatrix;
import org.mklab.nfc.scalar.ComplexNumericalScalar;
import org.mklab.nfc.scalar.RealNumericalScalar;
import org.mklab.tool.control.LinearSystemFactory;
/**
* 1サンプル遅れを表わすクラスです。
*
* @author yusuke
* @version $Revision$, 2006/02/03
* @param <RS> type of real scalar
* @param <RM> type of real matrix
* @param <CS> type of complex scalar
* @param <CM> type of complex matrix
*/
public class UnitDelaySystem<RS extends RealNumericalScalar<RS,RM,CS,CM>, RM extends RealNumericalMatrix<RS,RM,CS,CM>, CS extends ComplexNumericalScalar<RS,RM,CS,CM>, CM extends ComplexNumericalMatrix<RS,RM,CS,CM>> extends DiscreteLinearDynamicSystem<RS,RM,CS,CM> {
/**
* 新しく生成された<code>UnitDelaySystem</code>オブジェクトを初期化します。
*
* @param size 入出力の数
* @param sunit unit of scalar
*/
public UnitDelaySystem(final int size, RS sunit) {
super(LinearSystemFactory.createLinearSystem(sunit.createZeroGrid(size, size), sunit.createUnitGrid(size, size), sunit.createUnitGrid(size, size), sunit.createZeroGrid(size, size)), sunit);
}
/**
* 新しく生成された<code>UnitDelaySystem</code>オブジェクトを初期化します。
* @param sunit unit of scalar
*/
public UnitDelaySystem(RS sunit) {
super(sunit);
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(this.sunit.createZeroGrid(size, 1));
setLinearSystem(LinearSystemFactory.createLinearSystem(this.sunit.createZeroGrid(size, size), this.sunit.createUnitGrid(size, size), this.sunit.createUnitGrid(size, size), this.sunit.createZeroGrid(size, size)));
}
}
/**
* @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(this.sunit.createZeroGrid(size, 1));
setLinearSystem(LinearSystemFactory.createLinearSystem(this.sunit.createZeroGrid(size, size), this.sunit.createUnitGrid(size, size), this.sunit.createUnitGrid(size, size), this.sunit.createZeroGrid(size, size)));
}
}
/**
* {@inheritDoc}
*/
@Override
public void setInitialState(RM initialState) {
super.setInitialState(initialState);
final int size = initialState.length();
if (getStateSize() != size) {
setStateSize(size);
setLinearSystem(LinearSystemFactory.createLinearSystem(this.sunit.createZeroGrid(size, size), this.sunit.createUnitGrid(size, size), this.sunit.createUnitGrid(size, size), this.sunit.createZeroGrid(size, size)));
}
setInputSize(initialState.length());
setOutputSize(initialState.length());
}
}