ContinuousObserver.java
/*
* $Id: ContinuousObserver.java,v 1.6 2008/07/16 04:58:04 koga Exp $
*
* Copyright (C) 2004 Koga Laboratory. All rights reserved.
*
*/
package org.mklab.tool.control.system.controller;
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.LinearSystem;
import org.mklab.tool.control.system.LinearSystemOperator;
import org.mklab.tool.control.system.continuous.ContinuousLinearDynamicSystem;
import org.mklab.tool.control.system.parameter.Parameter;
import org.mklab.tool.control.system.parameter.ParameterUpdator;
/**
* 連続時間オブザーバを表すクラスです。
*
* @author koga
* @version $Revision: 1.6 $, 2004/06/04
* @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 ContinuousObserver<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 ContinuousLinearDynamicSystem<RS,RM,CS,CM> implements ParameterUpdator {
/** オブザーバーの極 */
@Parameter(name = "observerPoles", description = "オブザーバーの極", update = true)
private CM observerPoles;
/** 連続時間オブザーバーの設計器 */
private ObserverDesigner<RS,RM,CS,CM> designer;
/**
* コンストラクター
*
* @param linearModel 状態推定の対象(線形システム)
* @param sunit unit of scalar
*/
public ContinuousObserver(final LinearSystemOperator<RS,RM,CS,CM> linearModel, RS sunit) {
super(sunit);
RS[] rp = sunit.createArray(1);
RS[] ip = sunit.createArray(1);
rp[0] = sunit.create(-1);
ip[0] = sunit.create(0);
RM rr = sunit.createGrid(rp);
RM ii = sunit.createGrid(ip);
this.observerPoles = rr.createComplex(rr, ii);
this.designer = new ObserverDesigner<>(linearModel);
}
/**
* @see org.mklab.tool.control.system.parameter.ParameterUpdator#updateWith(String)
*/
public boolean updateWith(final String parameter) {
if (parameter.equals("observerPoles")) { //$NON-NLS-1$
setObserverPoles(this.observerPoles);
return true;
}
return false;
}
/**
* オブザーバーの極を設定します。
*
* @param observerPoles オブザーバーの極
*/
public void setObserverPoles(final CM observerPoles) {
this.observerPoles = observerPoles.createClone();
this.designer.setObserverPoles(observerPoles);
final LinearSystem<RS,RM,CS,CM> linearSystem = this.designer.getObserver().getLinearSystem();
setLinearSystem(linearSystem);
setInputSize(linearSystem.getInputSize());
setOutputSize(linearSystem.getOutputSize());
setStateSize(linearSystem.getStateSize());
setInitialState(this.sunit.createZeroGrid(linearSystem.getStateSize(), 1));
setState(this.sunit.createZeroGrid(linearSystem.getStateSize(), 1));
}
}