The following document contains the results of PMD's CPD 6.13.0.
| File | Line |
|---|---|
| org/mklab/tool/control/DoubleImproperLinearSystem.java | 199 |
| org/mklab/tool/control/ImproperLinearSystem.java | 197 |
final DoubleMatrix bd = this.getB().appendDown(this.getD());
ac.setElementFormat(this.getA().getElementFormat());
bd.setElementFormat(this.getB().getElementFormat());
final String[] acString = ac.getPrintingElementsString(Integer.MAX_VALUE).split("[\\r\\n]+"); //$NON-NLS-1$
final String[] bdString = bd.getPrintingElementsString(Integer.MAX_VALUE).split("[\\r\\n]+"); //$NON-NLS-1$
final String[] aString = new String[this.getStateSize() + 1];
if (this.getStateSize() != 0) {
System.arraycopy(acString, 0, aString, 0, this.getStateSize() + 1);
}
final String[] cString = new String[this.getOutputSize() + 1];
if (this.getStateSize() != 0) {
cString[0] = aString[0];
System.arraycopy(acString, this.getStateSize() + 1, cString, 1, this.getOutputSize());
resetRowNumber(cString);
}
final String[] bString = new String[this.getStateSize() + 1];
System.arraycopy(bdString, 0, bString, 0, this.getStateSize() + 1);
final String[] dString = new String[this.getOutputSize() + 1];
dString[0] = bString[0];
System.arraycopy(bdString, this.getStateSize() + 1, dString, 1, this.getOutputSize());
resetRowNumber(dString);
final PrintWriter pw = new PrintWriter(output);
if (this.getStateSize() == 0) {
for (int i = 0; i < this.getOutputSize() + 1; i++) {
pw.println(dString[i]);
}
return;
}
for (int i = 0; i < this.getStateSize() + 1; i++) {
pw.print(aString[i]);
pw.print("|"); //$NON-NLS-1$
pw.println(bString[i]);
}
for (int i = 0; i < aString[0].length(); i++) {
pw.print("-"); //$NON-NLS-1$
}
pw.print("+"); //$NON-NLS-1$
for (int i = 0; i < bString[0].length(); i++) {
pw.print("-"); //$NON-NLS-1$
}
pw.println(""); //$NON-NLS-1$
for (int i = 0; i < this.getOutputSize() + 1; i++) {
pw.print(cString[i]);
pw.print("|"); //$NON-NLS-1$
pw.println(dString[i]);
}
pw.println(""); //$NON-NLS-1$
pw.flush();
}
/**
* @see org.mklab.tool.control.LinearSystem#getSymbolicStateSpaceRepresentation(boolean)
*/
public String getSymbolicStateSpaceRepresentation(final boolean withInputOutput) {
final StringBuffer string = new StringBuffer();
if (0 < getStateSize()) {
final int[] columnLengthes = getColumnLengthesOfABCD();
final String[] symbolicState = getSymbolicState();
string.append(getSymbolicStateEquation(withInputOutput));
int eLength = getSymbolicELength();
for (int i = 0; i < eLength; i++) {
string.append(" "); //$NON-NLS-1$
}
if (withInputOutput) {
if (isContinuous()) {
if (getSubSystemSize() == 1) {
string.append(" "); //$NON-NLS-1$
} else {
string.append(" "); //$NON-NLS-1$
}
}
if (isDiscrete()) {
string.append(" "); //$NON-NLS-1$
}
final String format = "%" + (symbolicState[0].length() + 1 + 1 + 1) + "s"; //$NON-NLS-1$ //$NON-NLS-2$
string.append(String.format(format, "")); //$NON-NLS-1$
}
string.append("["); //$NON-NLS-1$
drawHorizontalLine(string, columnLengthes);
string.append("]" + System.getProperty("line.separator")); //$NON-NLS-1$ //$NON-NLS-2$
}
string.append(getSymbolicOutputEquation(withInputOutput));
return string.toString();
}
/**
* E行列のシンボルの長さを返します。
*
* @return E行列のシンボルの長さ
*/
private int getSymbolicELength() {
int eLength = 0;
for (int i : getELength()) {
eLength += i;
}
eLength += 2;
if (getELength().length != 1) {
eLength += (getSubSystemSize() - 1) * 2;
}
return eLength;
}
/**
* @see org.mklab.tool.control.LinearSystem#getSymbolicOutputEquation(boolean)
*/
public String getSymbolicOutputEquation(final boolean withInputOutput) {
final StringBuffer string = new StringBuffer();
final String[] symbolicInput = getSymbolicInput();
final String[] symbolicOutput = getSymbolicOutput();
final int[] columnLengthes = getColumnLengthesOfABCD();
final String lineSeparator = System.getProperty("line.separator"); //$NON-NLS-1$
for (int row = 0; row < getOutputPortSize(); row++) {
for (int i = 0; i < getSymbolicELength(); i++) {
string.append(" "); //$NON-NLS-1$
}
if (withInputOutput) {
if (isContinuous()) {
if (getSubSystemSize() == 1) {
string.append(" "); //$NON-NLS-1$
} else {
string.append(" "); //$NON-NLS-1$
}
}
string.append("[" + symbolicOutput[row] + "]"); //$NON-NLS-1$ //$NON-NLS-2$
if (row == getOutputPortSize() / 2) {
if (isContinuous()) {
string.append("(t)="); //$NON-NLS-1$
} else {
string.append("(k) ="); //$NON-NLS-1$
}
} else {
if (isContinuous()) {
string.append(" "); //$NON-NLS-1$
} else {
string.append(" "); //$NON-NLS-1$
}
}
}
string.append("["); //$NON-NLS-1$
for (int column = 0; column < getSubSystemSize(); column++) {
final String format = "%" + columnLengthes[column] + "s"; //$NON-NLS-1$ //$NON-NLS-2$
string.append(String.format(format, this.getSymbolicCMatrix()[row][column]));
if (column != getSubSystemSize() - 1) {
string.append(" "); //$NON-NLS-1$
}
}
if (0 < getStateSize()) {
string.append("|"); //$NON-NLS-1$
}
for (int column = 0; column < getInputPortSize(); column++) {
final String format = "%" + columnLengthes[column + getSubSystemSize()] + "s"; //$NON-NLS-1$ //$NON-NLS-2$
string.append(String.format(format, this.getSymbolicDMatrix()[row][column]));
if (column != getInputPortSize() - 1) {
string.append(" "); //$NON-NLS-1$
}
}
string.append("]"); //$NON-NLS-1$
if (withInputOutput && row < symbolicInput.length) {
string.append("[" + symbolicInput[row] + "]"); //$NON-NLS-1$ //$NON-NLS-2$
if (row == getInputPortSize() / 2) {
if (isContinuous()) {
string.append("(t)"); //$NON-NLS-1$
} else {
string.append("(k)"); //$NON-NLS-1$
}
}
}
string.append(lineSeparator);
}
if (withInputOutput && symbolicOutput.length < symbolicInput.length) {
final int lengthTolastLineSeparator = string.lastIndexOf(lineSeparator, string.length() - lineSeparator.length() - 1) + lineSeparator.length();
final int widthOfInputVector = (1 + symbolicInput[0].length() + 1);
int spaceLength = (string.length() - lengthTolastLineSeparator) - 2 - widthOfInputVector;
if (getOutputPortSize() - 1 == getInputPortSize() / 2) {
spaceLength -= 3;
}
final String format = "%" + spaceLength + "s"; //$NON-NLS-1$ //$NON-NLS-2$
for (int i = 0; i < symbolicInput.length - symbolicOutput.length; i++) {
string.append(String.format(format, "")); //$NON-NLS-1$
final int row = symbolicOutput.length + i;
string.append("[" + symbolicInput[row] + "]"); //$NON-NLS-1$ //$NON-NLS-2$
if (row == getInputPortSize() / 2) {
if (isContinuous()) {
string.append("(t)"); //$NON-NLS-1$
} else {
string.append("(k)"); //$NON-NLS-1$
}
}
string.append(lineSeparator);
}
}
return string.toString();
}
/**
* Eの長さを返します。
*
* @return Eの長さ
*/
private int[] getELength() {
int[] eLengthes = new int[getSubSystemSize()];
for (int column = 0; column < getSubSystemSize(); column++) {
eLengthes[column] = getMaxLengthColumnWise(this.getSymbolicEMatrix(), column);
}
return eLengthes;
}
/**
* @see org.mklab.tool.control.LinearSystem#getSymbolicStateEquation(boolean)
*/
public String getSymbolicStateEquation(final boolean withInputOutput) {
final StringBuffer string = new StringBuffer();
final String[] symbolicState = getSymbolicState();
final int[] columnLengthes = getColumnLengthesOfABCD();
final String lineSeparator = System.getProperty("line.separator"); //$NON-NLS-1$
for (int row = 0; row < getSubSystemSize(); row++) {
string.append("["); //$NON-NLS-1$
for (int column = 0; column < getSubSystemSize(); column++) {
final String format = "%" + getELength()[column] + "s"; //$NON-NLS-1$ //$NON-NLS-2$
string.append(String.format(format, this.getSymbolicEMatrix()[row][column]));
if (column != getSubSystemSize() - 1) {
string.append(" "); //$NON-NLS-1$
}
}
string.append("]"); //$NON-NLS-1$
if (withInputOutput) {
if (isContinuous()) {
if (getSubSystemSize() == 1) {
string.append("d/dt"); //$NON-NLS-1$
} else if (getSubSystemSize() == 2) {
if (row == 0) {
string.append("d/"); //$NON-NLS-1$
} else {
string.append("dt"); //$NON-NLS-1$
}
} else {
if (row == getSubSystemSize() / 2 - 1) {
string.append("d "); //$NON-NLS-1$
} else if (row == getSubSystemSize() / 2) {
string.append("--"); //$NON-NLS-1$
} else if (row == getSubSystemSize() / 2 + 1) {
string.append("dt"); //$NON-NLS-1$
} else {
string.append(" "); //$NON-NLS-1$
}
}
}
string.append("[" + symbolicState[row] + "]"); //$NON-NLS-1$ //$NON-NLS-2$
if (row == getSubSystemSize() / 2) {
if (isContinuous()) {
string.append("(t)="); //$NON-NLS-1$
} else {
string.append("(k+1)="); //$NON-NLS-1$
}
} else {
if (isContinuous()) {
string.append(" "); //$NON-NLS-1$
} else {
string.append(" "); //$NON-NLS-1$
}
}
}
string.append("["); //$NON-NLS-1$
for (int column = 0; column < getSubSystemSize(); column++) {
final String format = "%" + columnLengthes[column] + "s"; //$NON-NLS-1$ //$NON-NLS-2$
string.append(String.format(format, this.getSymbolicAMatrix()[row][column]));
if (column != getSubSystemSize() - 1) {
string.append(" "); //$NON-NLS-1$
}
}
string.append("|"); //$NON-NLS-1$
for (int column = 0; column < getInputPortSize(); column++) {
final String format = "%" + columnLengthes[column + getSubSystemSize()] + "s"; //$NON-NLS-1$ //$NON-NLS-2$
string.append(String.format(format, this.getSymbolicBMatrix()[row][column]));
if (column != getInputPortSize() - 1) {
string.append(" "); //$NON-NLS-1$
}
}
string.append("]"); //$NON-NLS-1$
if (withInputOutput) {
string.append("[" + symbolicState[row] + "]"); //$NON-NLS-1$ //$NON-NLS-2$
if (row == getSubSystemSize() / 2) {
if (isContinuous()) {
string.append("(t)"); //$NON-NLS-1$
} else {
string.append("(k)"); //$NON-NLS-1$
}
}
}
string.append(lineSeparator);
}
return string.toString();
}
/**
* 三対(入力数, 出力数, 状態数)の文字列に変換します。
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "NonProperLinearSystem(" + this.inputSize + " inputs, " + this.outputSize + " outputs, " + this.stateSize + " states)"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 1959 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 1951 |
exchangeRowAndColumn(matrix, column, inputNodeSize + i);
}
return ans;
}
/**
* 入力ノードの番号が該当すれば、入力ノードの番号を交換します。
*
* @param node1 ノード番号1
* @param node2 ノード番号2
*/
@SuppressWarnings("boxing")
private void exchangeInputNode(final int node1, final int node2) {
final int size = this.inputNodes.size();
for (int i = 0; i < size; i++) {
if (this.inputNodes.get(i) == node1 + 1) {
final int inputNode = this.inputNodes.get(i);
final String tag = this.inputPortTags.get(inputNode);
this.inputNodes.set(i, node2 + 1);
this.inputPortTags.remove(inputNode);
this.inputPortTags.put(node2 + 1, tag);
continue;
}
if (this.inputNodes.get(i) == node2 + 1) {
final int inputNode = this.inputNodes.get(i);
final String tag = this.inputPortTags.get(inputNode);
this.inputNodes.set(i, node1 + 1);
this.inputPortTags.remove(inputNode);
this.inputPortTags.put(node1 + 1, tag);
}
}
}
/**
* 出力ノードの番号が該当すれば、出力ノードの番号を交換します。
*
* @param node1 ノード番号1
* @param node2 ノード番号2
*/
@SuppressWarnings("boxing")
private void exchangeOutputNode(final int node1, final int node2) {
final int size = this.outputNodes.size();
for (int i = 0; i < size; i++) {
if (this.outputNodes.get(i) == node1 + 1) {
final int outputNode = this.outputNodes.get(i);
final String tag = this.outputPortTags.get(outputNode);
this.outputNodes.set(i, node2 + 1);
this.outputPortTags.remove(outputNode);
this.outputPortTags.put(node2 + 1, tag);
continue;
}
if (this.outputNodes.get(i) == node2 + 1) {
final int outputNode = this.outputNodes.get(i);
final String tag = this.outputPortTags.get(outputNode);
this.outputNodes.set(i, node1 + 1);
this.outputPortTags.remove(outputNode);
this.outputPortTags.put(node1 + 1, tag);
}
}
}
/**
* 挿入するノードの分だけ、入力ポートが接続されているノードの番号をシフトします。
*
* @param insertingNodes 挿入するノードの番号(0から始まります)
*/
@SuppressWarnings("boxing")
private void shiftInputNodeByInserting(final int[] insertingNodes) {
// 挿入するノードの番号を昇順にソート
final int[] sortedInsertingNodes = new int[insertingNodes.length];
System.arraycopy(insertingNodes, 0, sortedInsertingNodes, 0, insertingNodes.length);
Arrays.sort(sortedInsertingNodes);
final Map<Integer, String> originalInputPortTags = new TreeMap<>();
for (final Integer key : this.inputPortTags.keySet()) {
originalInputPortTags.put(key, this.inputPortTags.get(key));
}
final Map<Integer, String> newInputPortTags = new TreeMap<>();
for (int i = 0; i < this.inputNodes.size(); i++) {
final int inputNode = this.inputNodes.get(i);
int shiftSize = 0;
for (int j = 0; j < sortedInsertingNodes.length; j++) {
final int node = sortedInsertingNodes[j];
if (node + 1 <= inputNode) {
shiftSize = sortedInsertingNodes.length - j;
break;
}
}
this.inputNodes.set(i, inputNode + shiftSize);
final String tag = originalInputPortTags.get(inputNode);
this.inputPortTags.remove(inputNode);
newInputPortTags.put(inputNode + shiftSize, tag);
}
this.inputPortTags.putAll(newInputPortTags);
}
/**
* 挿入するノードの分だけ、Sourceが接続されているノードの番号をシフトします。
*
* @param insertingNodes 挿入するノードの番号(0から始まります)
*/
@SuppressWarnings("boxing")
private void shiftSourceNodeByInserting(final int[] insertingNodes) {
// 挿入するノードの番号を昇順にソート
final int[] sortedInsertingNodes = new int[insertingNodes.length];
System.arraycopy(insertingNodes, 0, sortedInsertingNodes, 0, insertingNodes.length);
Arrays.sort(sortedInsertingNodes);
for (int i = 0; i < this.sourceNodes.size(); i++) {
final int sourceNode = this.sourceNodes.get(i);
int shiftSize = 0;
for (int j = 0; j < sortedInsertingNodes.length; j++) {
final int node = sortedInsertingNodes[j];
if (node + 1 <= sourceNode) {
shiftSize = sortedInsertingNodes.length - j;
break;
}
}
this.sourceNodes.set(i, sourceNode + shiftSize);
}
}
/**
* 挿入するノードの分だけ、出力ポートが接続されているノードの番号をシフトします。
*
* @param insertingNodes 挿入するノードの番号(0から始まります)
*/
@SuppressWarnings("boxing")
private void shiftOutputNodeByInserting(final int[] insertingNodes) {
// 挿入するノードの番号を昇順にソート
final int[] sortedInsertingNodes = new int[insertingNodes.length];
System.arraycopy(insertingNodes, 0, sortedInsertingNodes, 0, insertingNodes.length);
Arrays.sort(sortedInsertingNodes);
final Map<Integer, String> originalOutputPortTags = new TreeMap<>();
for (final Integer key : this.outputPortTags.keySet()) {
originalOutputPortTags.put(key, this.outputPortTags.get(key));
}
final Map<Integer, String> newOutputPortTags = new TreeMap<>();
for (int i = 0; i < this.outputNodes.size(); i++) {
final int outputNode = this.outputNodes.get(i);
int shiftSize = 0;
for (int j = 0; j < sortedInsertingNodes.length; j++) {
final int node = sortedInsertingNodes[j];
if (node + 1 <= outputNode) {
shiftSize = sortedInsertingNodes.length - j;
break;
}
}
this.outputNodes.set(i, outputNode + shiftSize);
final String tag = originalOutputPortTags.get(outputNode);
this.outputPortTags.remove(outputNode);
newOutputPortTags.put(outputNode + shiftSize, tag);
}
this.outputPortTags.putAll(newOutputPortTags);
}
/**
* 挿入するノードの分だけ、Sinkが接続されているノードの番号をシフトします。
*
* @param insertingNodes 挿入するノードの番号(0から始まります)
*/
@SuppressWarnings("boxing")
private void shiftSinkNodeByInserting(final int[] insertingNodes) {
// 挿入するノードの番号を昇順にソート
final int[] sortedInsertingNodes = new int[insertingNodes.length];
System.arraycopy(insertingNodes, 0, sortedInsertingNodes, 0, insertingNodes.length);
Arrays.sort(sortedInsertingNodes);
for (int i = 0; i < this.sinkNodes.size(); i++) {
final int sinkNode = this.sinkNodes.get(i);
int shiftSize = 0;
for (int j = 0; j < sortedInsertingNodes.length; j++) {
final int node = sortedInsertingNodes[j];
if (node + 1 <= sinkNode) {
shiftSize = sortedInsertingNodes.length - j;
break;
}
}
this.sinkNodes.set(i, sinkNode + shiftSize);
}
}
/**
* 削除するノードの分だけ、入力ポートが接続されているノードの番号をシフトします。
*
* @param removingNodes 削除するノードの番号(0から始まります)
*/
@SuppressWarnings("boxing")
private void shiftInputNodeByRemoving(final int[] removingNodes) {
// 削除するノードの番号を昇順にソート
final int[] sortedRemovingNodes = new int[removingNodes.length];
System.arraycopy(removingNodes, 0, sortedRemovingNodes, 0, removingNodes.length);
Arrays.sort(sortedRemovingNodes);
final Map<Integer, String> originalInputPortTags = new TreeMap<>();
for (final Integer key : this.inputPortTags.keySet()) {
originalInputPortTags.put(key, this.inputPortTags.get(key));
}
final Map<Integer, String> newInputPortTags = new TreeMap<>();
for (int i = 0; i < this.inputNodes.size(); i++) {
final int inputNode = this.inputNodes.get(i);
int shiftSize = 0;
for (int j = 0; j < sortedRemovingNodes.length; j++) {
final int node = sortedRemovingNodes[j];
if (node + 1 <= inputNode) {
shiftSize++;
}
}
this.inputNodes.set(i, inputNode - shiftSize);
final String tag = originalInputPortTags.get(inputNode);
if (tag != null) {
this.inputPortTags.remove(inputNode);
newInputPortTags.put(inputNode - shiftSize, tag);
}
}
this.inputPortTags.putAll(newInputPortTags);
}
/**
* 削除するノードの分だけ、Sourceが接続されているノードの番号をシフトします。
*
* @param removingNodes 削除するノードの番号(0から始まります)
*/
@SuppressWarnings("boxing")
private void shiftSourceNodeByRemoving(final int[] removingNodes) {
// 削除するノードの番号を昇順にソート
final int[] sortedRemovingNodes = new int[removingNodes.length];
System.arraycopy(removingNodes, 0, sortedRemovingNodes, 0, removingNodes.length);
Arrays.sort(sortedRemovingNodes);
for (int i = 0; i < this.sourceNodes.size(); i++) {
final int sourceNode = this.sourceNodes.get(i);
int shiftSize = 0;
for (int j = 0; j < sortedRemovingNodes.length; j++) {
final int node = sortedRemovingNodes[j];
if (node + 1 <= sourceNode) {
shiftSize++;
}
}
this.sourceNodes.set(i, sourceNode - shiftSize);
}
}
/**
* 削除するノードの分だけ、出力ポートが接続されているノードの番号をシフトします。
*
* @param removingNodes 削除するノードの番号(0から始まります)
*/
@SuppressWarnings("boxing")
private void shiftOutputNodeByRemoving(final int[] removingNodes) {
// 削除するノードの番号を昇順にソート
final int[] sortedRemovingNodes = new int[removingNodes.length];
System.arraycopy(removingNodes, 0, sortedRemovingNodes, 0, removingNodes.length);
Arrays.sort(sortedRemovingNodes);
final Map<Integer, String> originalOutputPortTags = new TreeMap<>();
for (final Integer key : this.outputPortTags.keySet()) {
originalOutputPortTags.put(key, this.outputPortTags.get(key));
}
final Map<Integer, String> newOutputPortTags = new TreeMap<>();
for (int i = 0; i < this.outputNodes.size(); i++) {
final int outputNode = this.outputNodes.get(i);
int shiftSize = 0;
for (int j = 0; j < sortedRemovingNodes.length; j++) {
final int node = sortedRemovingNodes[j];
if (node + 1 <= outputNode) {
shiftSize++;
}
}
this.outputNodes.set(i, outputNode - shiftSize);
final String tag = originalOutputPortTags.get(outputNode);
if (tag != null) {
this.outputPortTags.remove(outputNode);
newOutputPortTags.put(outputNode - shiftSize, tag);
}
}
this.outputPortTags.putAll(newOutputPortTags);
}
/**
* 削除するノードの分だけ、Sinkが接続されているノードの番号をシフトします。
*
* @param removingNodes 削除するノードの番号(0から始まります)
*/
@SuppressWarnings("boxing")
private void shiftSinkNodeByRemoving(final int[] removingNodes) {
// 削除するノードの番号を昇順にソート
final int[] sortedRemovingNodes = new int[removingNodes.length];
System.arraycopy(removingNodes, 0, sortedRemovingNodes, 0, removingNodes.length);
Arrays.sort(sortedRemovingNodes);
for (int i = 0; i < this.sinkNodes.size(); i++) {
final int sinkNode = this.sinkNodes.get(i);
int shiftSize = 0;
for (int j = 0; j < sortedRemovingNodes.length; j++) {
final int node = sortedRemovingNodes[j];
if (node + 1 <= sinkNode) {
shiftSize++;
}
}
this.sinkNodes.set(i, sinkNode - shiftSize);
}
}
/**
* 隣接行列に含まれる積分器(または1サンプル遅れ器)の数を返します。
*
* @return 隣接行列に含まれる積分器(または1サンプル遅れ器)の数
*/
private int getIntegratorOrUnitDelaySystemSize() {
int count = 0;
for (int row = 0; row < getRowSize(); row++) {
for (int column = 0; column < getColumnSize(); column++) {
if (this.elements[row][column] instanceof IntegratorSystem) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/parameter/DoubleParameterContainer.java | 48 |
| org/mklab/tool/control/system/parameter/ParameterContainer.java | 55 |
public DoubleParameterContainer(DoubleSystemOperator system, final Field value, final Parameter anotation, final String name) {
this.system = system;
this.value = value;
this.anotation = anotation;
this.name = name;
}
/**
* パラメータのアノテーションを返します。
*
* @return パラメータのアノテーション
*/
public Parameter getAnotation() {
return this.anotation;
}
/**
* パラメータの値を返します。
*
* @return パラメータの値
* @throws ParameterAccessException パラメータにアクセスする権利が無い場合
*/
public Object getValue() throws ParameterAccessException {
try {
this.value.setAccessible(true);
final Class<?> type = this.value.getType();
if (type.isArray() && this.name.contains("[")) { //$NON-NLS-1$
return Array.get(this.value.get(this.system), getIndexOfArray(this.name));
}
return this.value.get(this.system);
} catch (IllegalArgumentException e) {
throw new ParameterAccessException(e);
} catch (IllegalAccessException e) {
throw new ParameterAccessException(e);
}
}
/**
* パラメータに値を設定します。
*
* @param value 設定する値
*
* @throws ParameterAccessException パラメータにアクセスする権利が無い場合
*/
public void setValue(Object value) throws ParameterAccessException {
try {
this.value.setAccessible(true);
if (this.value.getType().isArray() && value.getClass().isArray() == false) {
Array.set(this.value.get(this.system), getIndexOfArray(this.name), value);
} else {
this.value.set(this.system, value);
}
updateWithParameter();
} catch (IllegalArgumentException e) {
throw new ParameterAccessException(e);
} catch (IllegalAccessException e) {
throw new ParameterAccessException(e);
}
}
/**
* パラメータの定義式を設定します。
*
* @param expression パラメータの定義式
*/
public void setExpression(final String expression) {
this.expression = expression;
}
/**
* パラメータの値を返します。
*
* @return パラメータの値
* @throws ParameterAccessException パラメータにアクセスする権利が無い場合
*/
public boolean getBoolean() throws ParameterAccessException {
try {
this.value.setAccessible(true);
if (this.value.getType().isArray()) {
return Array.getBoolean(this.value.get(this.system), getIndexOfArray(this.name));
}
return this.value.getBoolean(this.system);
} catch (IllegalArgumentException e) {
throw new ParameterAccessException(e);
} catch (IllegalAccessException e) {
throw new ParameterAccessException(e);
}
}
/**
* パラメータの値を設定します。
*
* @param value パラメータの値
* @throws ParameterAccessException パラメータにアクセスする権利が無い場合
*/
public void setBoolean(final boolean value) throws ParameterAccessException {
try {
this.value.setAccessible(true);
if (this.value.getType().isArray()) {
Array.setBoolean(this.value.get(this.system), getIndexOfArray(this.name), value);
} else {
this.value.setBoolean(this.system, value);
}
updateWithParameter();
} catch (IllegalArgumentException e) {
throw new ParameterAccessException(e);
} catch (IllegalAccessException e) {
throw new ParameterAccessException(e);
}
}
/**
* パラメータの値を返します。
*
* @return パラメータの値
* @throws ParameterAccessException パラメータにアクセスする権利が無い場合
*/
public byte getByte() throws ParameterAccessException {
try {
this.value.setAccessible(true);
if (this.value.getType().isArray()) {
return Array.getByte(this.value.get(this.system), getIndexOfArray(this.name));
}
return this.value.getByte(this.system);
} catch (IllegalArgumentException e) {
throw new ParameterAccessException(e);
} catch (IllegalAccessException e) {
throw new ParameterAccessException(e);
}
}
/**
* パラメータの値を設定します。
*
* @param value パレメータの値
* @throws ParameterAccessException パラメータにアクセスする権利が無い場合
*/
public void setByte(final byte value) throws ParameterAccessException {
try {
this.value.setAccessible(true);
if (this.value.getType().isArray()) {
Array.setByte(this.value.get(this.system), getIndexOfArray(this.name), value);
} else {
this.value.setByte(this.system, value);
}
updateWithParameter();
} catch (IllegalArgumentException e) {
throw new ParameterAccessException(e);
} catch (IllegalAccessException e) {
throw new ParameterAccessException(e);
}
}
/**
* パラメータの値を返します。
*
* @return パラメータの値
* @throws ParameterAccessException パラメータにアクセスする権利が無い場合
*/
public char getChar() throws ParameterAccessException {
try {
this.value.setAccessible(true);
if (this.value.getType().isArray()) {
return Array.getChar(this.value.get(this.system), getIndexOfArray(this.name));
}
return this.value.getChar(this.system);
} catch (IllegalArgumentException e) {
throw new ParameterAccessException(e);
} catch (IllegalAccessException e) {
throw new ParameterAccessException(e);
}
}
/**
* パラメータの値を設定します。
*
* @param value パレメータの値
* @throws ParameterAccessException パラメータにアクセスする権利が無い場合
*/
public void setChar(final char value) throws ParameterAccessException {
try {
this.value.setAccessible(true);
if (this.value.getType().isArray()) {
Array.setChar(this.value.get(this.system), getIndexOfArray(this.name), value);
} else {
this.value.setChar(this.system, value);
}
updateWithParameter();
} catch (IllegalArgumentException e) {
throw new ParameterAccessException(e);
} catch (IllegalAccessException e) {
throw new ParameterAccessException(e);
}
}
/**
* パラメータの値を返します。
*
* @return パラメータの値
* @throws ParameterAccessException パラメータにアクセスする権利が無い場合
*/
public double getDouble() throws ParameterAccessException {
try {
this.value.setAccessible(true);
if (this.value.getType().isArray()) {
return Array.getDouble(this.value.get(this.system), getIndexOfArray(this.name));
}
return this.value.getDouble(this.system);
} catch (IllegalArgumentException e) {
throw new ParameterAccessException(e);
} catch (IllegalAccessException e) {
throw new ParameterAccessException(e);
}
}
/**
* パラメータの値を設定します。
*
* @param value パレメータの値
* @throws ParameterAccessException パラメータにアクセスする権利が無い場合
*/
public void setDouble(final double value) throws ParameterAccessException {
try {
this.value.setAccessible(true);
if (this.value.getType().isArray()) {
Array.setDouble(this.value.get(this.system), getIndexOfArray(this.name), value);
} else {
this.value.setDouble(this.system, value);
}
updateWithParameter();
} catch (IllegalArgumentException e) {
throw new ParameterAccessException(e);
} catch (IllegalAccessException e) {
throw new ParameterAccessException(e);
}
}
/**
* パラメータの値を返します。
*
* @return パラメータの値
* @throws ParameterAccessException パラメータにアクセスする権利が無い場合
*/
public float getFloat() throws ParameterAccessException {
try {
this.value.setAccessible(true);
if (this.value.getType().isArray()) {
return Array.getFloat(this.value.get(this.system), getIndexOfArray(this.name));
}
return this.value.getFloat(this.system);
} catch (IllegalArgumentException e) {
throw new ParameterAccessException(e);
} catch (IllegalAccessException e) {
throw new ParameterAccessException(e);
}
}
/**
* パラメータの値を設定します。
*
* @param value パレメータの値
* @throws ParameterAccessException パラメータにアクセスする権利が無い場合
*/
public void setFloat(final float value) throws ParameterAccessException {
try {
this.value.setAccessible(true);
if (this.value.getType().isArray()) {
Array.setFloat(this.value.get(this.system), getIndexOfArray(this.name), value);
} else {
this.value.setFloat(this.system, value);
}
updateWithParameter();
} catch (IllegalArgumentException e) {
throw new ParameterAccessException(e);
} catch (IllegalAccessException e) {
throw new ParameterAccessException(e);
}
}
/**
* パラメータの値を返します。
*
* @return パラメータの値
* @throws ParameterAccessException パラメータにアクセスする権利が無い場合
*/
public int getInt() throws ParameterAccessException {
try {
this.value.setAccessible(true);
if (this.value.getType().isArray()) {
return Array.getInt(this.value.get(this.system), getIndexOfArray(this.name));
}
return this.value.getInt(this.system);
} catch (IllegalArgumentException e) {
throw new ParameterAccessException(e);
} catch (IllegalAccessException e) {
throw new ParameterAccessException(e);
}
}
/**
* パラメータの値を設定します。
*
* @param value パレメータの値
* @throws ParameterAccessException パラメータにアクセスする権利が無い場合
*/
public void setInt(final int value) throws ParameterAccessException {
try {
this.value.setAccessible(true);
if (this.value.getType().isArray()) {
Array.setInt(this.value.get(this.system), getIndexOfArray(this.name), value);
} else {
this.value.setInt(this.system, value);
}
updateWithParameter();
} catch (IllegalArgumentException e) {
throw new ParameterAccessException(e);
} catch (IllegalAccessException e) {
throw new ParameterAccessException(e);
}
}
/**
* パラメータの値を返します。
*
* @return パラメータの値
* @throws ParameterAccessException パラメータにアクセスする権利が無い場合
*/
public long getLong() throws ParameterAccessException {
try {
this.value.setAccessible(true);
if (this.value.getType().isArray()) {
return Array.getLong(this.value.get(this.system), getIndexOfArray(this.name));
}
return this.value.getLong(this.system);
} catch (IllegalArgumentException e) {
throw new ParameterAccessException(e);
} catch (IllegalAccessException e) {
throw new ParameterAccessException(e);
}
}
/**
* パラメータの値を設定します。
*
* @param value パレメータの値
* @throws ParameterAccessException パラメータにアクセスする権利が無い場合
*/
public void setLong(final long value) throws ParameterAccessException {
try {
this.value.setAccessible(true);
if (this.value.getType().isArray()) {
Array.setLong(this.value.get(this.system), getIndexOfArray(this.name), value);
} else {
this.value.setLong(this.system, value);
}
updateWithParameter();
} catch (IllegalArgumentException e) {
throw new ParameterAccessException(e);
} catch (IllegalAccessException e) {
throw new ParameterAccessException(e);
}
}
/**
* パラメータの値を返します。
*
* @return パラメータの値
* @throws ParameterAccessException パラメータにアクセスする権利が無い場合
*/
public short getShort() throws ParameterAccessException {
try {
this.value.setAccessible(true);
if (this.value.getType().isArray()) {
return Array.getShort(this.value.get(this.system), getIndexOfArray(this.name));
}
return this.value.getShort(this.system);
} catch (IllegalArgumentException e) {
throw new ParameterAccessException(e);
} catch (IllegalAccessException e) {
throw new ParameterAccessException(e);
}
}
/**
* パラメータの値を設定します。
*
* @param value パレメータの値
* @throws ParameterAccessException パラメータにアクセスする権利が無い場合
*/
public void setShort(final short value) throws ParameterAccessException {
try {
this.value.setAccessible(true);
if (this.value.getType().isArray()) {
Array.setShort(this.value.get(this.system), getIndexOfArray(this.name), value);
} else {
this.value.setShort(this.system, value);
}
updateWithParameter();
} catch (IllegalArgumentException e) {
throw new ParameterAccessException(e);
} catch (IllegalAccessException e) {
throw new ParameterAccessException(e);
}
}
/**
* <code>opponent</code>と比較した結果を返します。
*
* <p> <code>opponent</code>より順序が前のとき正、 <code>opponent</code>より順序が後のとき負、 等しいとき0を返します。
*
* @param opponent 比較対象
* @return <code>opponent</code>と比較した結果
*/
public int compareTo(final DoubleParameterContainer opponent) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/AbstractLinearSystem.java | 122 |
| org/mklab/tool/control/DoubleAbstractLinearSystem.java | 115 |
final AnyRealRationalPolynomialMatrix<RS,RM,CS,CM> g2 = ((ProperLinearSystem<RS,RM,CS,CM>)opponent).getTransferFunctionMatrix();
return g1.equals(g2, tolerance);
}
/**
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + (int)(+serialVersionUID ^ (serialVersionUID >>> 32));
hashCode = 31 * hashCode + (this.proper ? 1231 : 1237);
hashCode = 31 * hashCode + (this.strictlyProper ? 1231 : 1237);
hashCode = 31 * hashCode + (this.G == null ? 0 : this.G.hashCode());
hashCode = 31 * hashCode + this.inputSize;
hashCode = 31 * hashCode + this.stateSize;
hashCode = 31 * hashCode + this.outputSize;
hashCode = 31 * hashCode + (this.a == null ? 0 : this.a.hashCode());
hashCode = 31 * hashCode + (this.b == null ? 0 : this.b.hashCode());
hashCode = 31 * hashCode + (this.c == null ? 0 : this.c.hashCode());
hashCode = 31 * hashCode + (this.d == null ? 0 : this.d.hashCode());
hashCode = 31 * hashCode + (this.inputPortTags == null ? 0 : this.inputPortTags.hashCode());
hashCode = 31 * hashCode + (this.outputPortTags == null ? 0 : this.outputPortTags.hashCode());
return hashCode;
}
/**
* 行番号を1からに設定します。
*
* @param matrix 行列の文字列
*/
protected void resetRowNumber(final String[] matrix) {
for (int i = 1; i < matrix.length; i++) {
matrix[i] = matrix[i].replaceFirst("\\(\\s*\\d+\\)", String.format("(% 3d)", Integer.valueOf(i))); //$NON-NLS-1$//$NON-NLS-2$
}
}
/**
* フォーマットされた状態のタグを返します。
*
* @return フォーマットされた状態のタグ
*/
protected String[] getSymbolicState() {
final int stateLength = getSymbolicStateLength();
final int outputLength = getSymbolicOutputLength();
final int length = Math.max(stateLength, outputLength);
final String[] symbolicStates = new String[getSubSystemSize()];
for (int i = 0; i < getSubSystemSize(); i++) {
final String stateTag = this.stateTags.get(i);
final String format = "%" + length + "s"; //$NON-NLS-1$ //$NON-NLS-2$
symbolicStates[i] = String.format(format, stateTag);
}
return symbolicStates;
}
/**
* フォーマットされた出力のタグを返します。
*
* @return フォーマットされた出力のタグ
*/
protected String[] getSymbolicOutput() {
final int stateLength = getSymbolicStateLength();
final int outputLength = getSymbolicOutputLength();
final int length = Math.max(stateLength, outputLength);
final String[] symbolicOutputs = new String[this.outputPortTags.size()];
for (int i = 0; i < this.outputPortTags.size(); i++) {
final String outputPortaTag = this.outputPortTags.get(i);
final String format = "%" + length + "s"; //$NON-NLS-1$ //$NON-NLS-2$
symbolicOutputs[i] = String.format(format, outputPortaTag);
}
return symbolicOutputs;
}
/**
* フォーマットされた入力のタグを返します。
*
* @return フォーマットされた入力のタグ
*/
protected String[] getSymbolicInput() {
final int stateLength = getSymbolicStateLength();
final int inputLength = getSymbolicInputLength();
final int length = Math.max(stateLength, inputLength);
final String[] symbolicInputs = new String[this.inputPortTags.size()];
for (int i = 0; i < this.inputPortTags.size(); i++) {
final String inputPortaTag = this.inputPortTags.get(i);
final String format = "%" + length + "s"; //$NON-NLS-1$ //$NON-NLS-2$
symbolicInputs[i] = String.format(format, inputPortaTag);
}
return symbolicInputs;
}
/**
* 状態のタグの最大長を返します。
*
* @return 状態のタグの最大長
*/
private int getSymbolicStateLength() {
int stateLength = 0;
for (final String stateTag : this.stateTags) {
if (stateLength < stateTag.length()) {
stateLength = stateTag.length();
}
}
return stateLength;
}
/**
* 入力ポートのタグの最大長を返します。
*
* @return 入力ポートのタグの最大長
*/
private int getSymbolicInputLength() {
int inputLength = 0;
for (final String inputPortTag : this.inputPortTags) {
if (inputLength < inputPortTag.length()) {
inputLength = inputPortTag.length();
}
}
return inputLength;
}
/**
* 出力ポートのタグの最大長を返します。
*
* @return 出力ポートのタグの最大長
*/
private int getSymbolicOutputLength() {
int outputLength = 0;
for (final String outputPortTag : this.outputPortTags) {
if (outputLength < outputPortTag.length()) {
outputLength = outputPortTag.length();
}
}
return outputLength;
}
/**
* Aの数式を返します。
*
* @return Aの数式
*/
public String getSymbolicA() {
final StringBuffer string = new StringBuffer();
final int[] columnLengthes = getColumnLengthesOfABCD();
for (int row = 0; row < getSubSystemSize(); row++) {
for (int column = 0; column < getSubSystemSize(); column++) {
final String format = "%" + columnLengthes[column] + "s"; //$NON-NLS-1$ //$NON-NLS-2$
string.append(String.format(format, this.aSymbol[row][column]));
if (column != getSubSystemSize() - 1) {
string.append(" "); //$NON-NLS-1$
}
}
string.append(System.getProperty("line.separator")); //$NON-NLS-1$
}
return string.toString();
}
/**
* Bの数式を返します。
*
* @return Bの数式
*/
public String getSymbolicB() {
final StringBuffer string = new StringBuffer();
final int[] columnLengthes = getColumnLengthesOfABCD();
for (int row = 0; row < getSubSystemSize(); row++) {
for (int column = 0; column < getInputPortSize(); column++) {
final String format = "%" + columnLengthes[column + getSubSystemSize()] + "s"; //$NON-NLS-1$ //$NON-NLS-2$
string.append(String.format(format, this.bSymbol[row][column]));
if (column != getInputSize() - 1) {
string.append(" "); //$NON-NLS-1$
}
}
string.append(System.getProperty("line.separator")); //$NON-NLS-1$
}
return string.toString();
}
/**
* Cの数式を返します。
*
* @return Cの数式
*/
public String getSymbolicC() {
final StringBuffer string = new StringBuffer();
final int[] columnLengthes = getColumnLengthesOfABCD();
for (int row = 0; row < getOutputPortSize(); row++) {
for (int column = 0; column < getSubSystemSize(); column++) {
final String format = "%" + columnLengthes[column] + "s"; //$NON-NLS-1$ //$NON-NLS-2$
string.append(String.format(format, this.cSymbol[row][column]));
if (column != getSubSystemSize() - 1) {
string.append(" "); //$NON-NLS-1$
}
}
string.append(System.getProperty("line.separator")); //$NON-NLS-1$
}
return string.toString();
}
/**
* Dの数式を返します。
*
* @return Dの数式
*/
public String getSymbolicD() {
final StringBuffer string = new StringBuffer();
final int[] columnLengthes = getColumnLengthesOfABCD();
for (int row = 0; row < getOutputPortSize(); row++) {
for (int column = 0; column < getInputPortSize(); column++) {
final String format = "%" + columnLengthes[column + getSubSystemSize()] + "s"; //$NON-NLS-1$ //$NON-NLS-2$
string.append(String.format(format, this.dSymbol[row][column]));
if (column != getInputPortSize() - 1) {
string.append(" "); //$NON-NLS-1$
}
}
string.append(System.getProperty("line.separator")); //$NON-NLS-1$
}
return string.toString();
}
/**
* Eの数式を返します。
*
* @return Eの数式
*/
public String getSymbolicE() {
final StringBuffer string = new StringBuffer();
final int[] columnLengthes = getColumnLengthesOfABCD();
for (int row = 0; row < getSubSystemSize(); row++) {
for (int column = 0; column < getSubSystemSize(); column++) {
final String format = "%" + columnLengthes[column] + "s"; //$NON-NLS-1$ //$NON-NLS-2$
string.append(String.format(format, this.eSymbol[row][column]));
if (column != getSubSystemSize() - 1) {
string.append(" "); //$NON-NLS-1$
}
}
string.append(System.getProperty("line.separator")); //$NON-NLS-1$
}
return string.toString();
}
/**
* 上部と下部を分割する水平線を描きます。
*
* @param string 生成する文字列
* @param columnLengthes 各列の文字列の長さ
*/
protected void drawHorizontalLine(final StringBuffer string, final int[] columnLengthes) {
int firstLength = 0;
for (int i = 0; i < getSubSystemSize(); i++) {
firstLength += columnLengthes[i];
if (i != getSubSystemSize() - 1) {
firstLength += 2;
}
}
int secondLength = 0;
for (int i = 0; i < getInputPortSize(); i++) {
secondLength += columnLengthes[i + getSubSystemSize()];
if (i != getInputPortSize() - 1) {
secondLength += 2;
}
}
for (int i = 0; i < firstLength; i++) {
string.append("-"); //$NON-NLS-1$
}
string.append("+"); //$NON-NLS-1$
for (int i = 0; i < secondLength; i++) {
string.append("-"); //$NON-NLS-1$
}
}
/**
* 列毎の成分の長さの最大値を返します。
*
* @return 列毎の成分の長さの最大値
*/
protected int[] getColumnLengthesOfABCD() {
final int[] columnLengthes = new int[getSubSystemSize() + getInputPortSize()];
for (int column = 0; column < getSubSystemSize(); column++) {
final int aLength = getMaxLengthColumnWise(this.aSymbol, column);
final int cLength = getMaxLengthColumnWise(this.cSymbol, column);
columnLengthes[column] = aLength > cLength ? aLength : cLength;
}
for (int column = 0; column < getInputPortSize(); column++) {
final int bLength = getMaxLengthColumnWise(this.bSymbol, column);
final int dLength = getMaxLengthColumnWise(this.dSymbol, column);
columnLengthes[column + getSubSystemSize()] = bLength > dLength ? bLength : dLength;
}
return columnLengthes;
}
/**
* 指定された列の成分の最大の長さを返します。
*
* @param matrix 対象となる行列
* @param column 指定列
* @return 指定された列の成分の最大の長さ
*/
protected int getMaxLengthColumnWise(final String[][] matrix, final int column) {
int length = 0;
for (int row = 0; row < matrix.length; row++) {
if (matrix[row] != null && matrix[row][column] != null && matrix[row][column].length() > length) {
length = matrix[row][column].length();
}
}
return length;
}
/**
* プロパーであるか判定します。
*
* @return プロパーならばtrue、そうでなければfalse
*/
public boolean isProper() {
return this.proper;
}
/**
* 厳密にプロパーであるか判定します。
*
* @return 厳密にプロパーならばtrue、そうでなければfalse
*/
public boolean isStrictlyProper() {
return this.strictlyProper;
}
/**
* 1入力1出力(SISO)であるか判定します。
*
* @return SISO(1入力1出力)システムならばtrue、そうでなければfalse
*/
public boolean isSISO() {
return getInputSize() == 1 && getOutputSize() == 1;
}
/**
* A行列(システム行列)を返します。
*
* @return A行列(システム行列)
*/
public RM getA() { | |
| File | Line |
|---|---|
| org/mklab/tool/control/DoubleProperLinearSystem.java | 280 |
| org/mklab/tool/control/ProperLinearSystem.java | 286 |
inst.G = this.G == null ? null : (DoubleRationalPolynomialMatrix)this.G.clone();
return inst;
}
/**
* @see org.mklab.tool.control.LinearSystem#getSymbolicStateSpaceRepresentation(boolean)
*/
public String getSymbolicStateSpaceRepresentation(final boolean withInputOutput) {
final StringBuffer string = new StringBuffer();
if (0 < getStateSize()) {
final int[] columnLengthes = getColumnLengthesOfABCD();
final String[] symbolicState = getSymbolicState();
string.append(getSymbolicStateEquation(withInputOutput));
if (withInputOutput) {
if (isContinuous()) {
if (getSubSystemSize() == 1) {
string.append(" "); //$NON-NLS-1$
} else {
string.append(" "); //$NON-NLS-1$
}
}
if (isDiscrete()) {
string.append(" "); //$NON-NLS-1$
}
final String format = "%" + (symbolicState[0].length() + 1 + 1 + 1) + "s"; //$NON-NLS-1$ //$NON-NLS-2$
string.append(String.format(format, "")); //$NON-NLS-1$
}
string.append("["); //$NON-NLS-1$
drawHorizontalLine(string, columnLengthes);
string.append("]" + System.getProperty("line.separator")); //$NON-NLS-1$ //$NON-NLS-2$
}
string.append(getSymbolicOutputEquation(withInputOutput));
return string.toString();
}
/**
* @see org.mklab.tool.control.LinearSystem#getSymbolicStateEquation(boolean)
*/
public String getSymbolicStateEquation(final boolean withInputOutput) {
final StringBuffer string = new StringBuffer();
final String[] symbolicState = getSymbolicState();
final int[] columnLengthes = getColumnLengthesOfABCD();
final String lineSeparator = System.getProperty("line.separator"); //$NON-NLS-1$
for (int row = 0; row < getSubSystemSize(); row++) {
if (withInputOutput) {
if (isContinuous()) {
if (getSubSystemSize() == 1) {
string.append("d/dt"); //$NON-NLS-1$
} else if (getSubSystemSize() == 2) {
if (row == 0) {
string.append("d/"); //$NON-NLS-1$
} else {
string.append("dt"); //$NON-NLS-1$
}
} else {
if (row == getSubSystemSize() / 2 - 1) {
string.append("d "); //$NON-NLS-1$
} else if (row == getSubSystemSize() / 2) {
string.append("--"); //$NON-NLS-1$
} else if (row == getSubSystemSize() / 2 + 1) {
string.append("dt"); //$NON-NLS-1$
} else {
string.append(" "); //$NON-NLS-1$
}
}
}
string.append("[" + symbolicState[row] + "]"); //$NON-NLS-1$ //$NON-NLS-2$
if (row == getSubSystemSize() / 2) {
if (isContinuous()) {
string.append("(t)="); //$NON-NLS-1$
} else {
string.append("(k+1)="); //$NON-NLS-1$
}
} else {
if (isContinuous()) {
string.append(" "); //$NON-NLS-1$
} else {
string.append(" "); //$NON-NLS-1$
}
}
}
string.append("["); //$NON-NLS-1$
for (int column = 0; column < getSubSystemSize(); column++) {
final String format = "%" + columnLengthes[column] + "s"; //$NON-NLS-1$ //$NON-NLS-2$
string.append(String.format(format, this.getSymbolicAMatrix()[row][column]));
if (column != getSubSystemSize() - 1) {
string.append(" "); //$NON-NLS-1$
}
}
string.append("|"); //$NON-NLS-1$
for (int column = 0; column < getInputPortSize(); column++) {
final String format = "%" + columnLengthes[column + getSubSystemSize()] + "s"; //$NON-NLS-1$ //$NON-NLS-2$
string.append(String.format(format, this.getSymbolicBMatrix()[row][column]));
if (column != getInputPortSize() - 1) {
string.append(" "); //$NON-NLS-1$
}
}
string.append("]"); //$NON-NLS-1$
if (withInputOutput) {
string.append("[" + symbolicState[row] + "]"); //$NON-NLS-1$ //$NON-NLS-2$
if (row == getSubSystemSize() / 2) {
if (isContinuous()) {
string.append("(t)"); //$NON-NLS-1$
} else {
string.append("(k)"); //$NON-NLS-1$
}
}
}
string.append(lineSeparator);
}
return string.toString();
}
/**
* @see org.mklab.tool.control.LinearSystem#getSymbolicOutputEquation(boolean)
*/
public String getSymbolicOutputEquation(final boolean withInputOutput) {
final StringBuffer string = new StringBuffer();
final String[] symbolicInput = getSymbolicInput();
final String[] symbolicOutput = getSymbolicOutput();
final int[] columnLengthes = getColumnLengthesOfABCD();
final String lineSeparator = System.getProperty("line.separator"); //$NON-NLS-1$
for (int row = 0; row < getOutputPortSize(); row++) {
if (withInputOutput) {
if (isContinuous()) {
if (getSubSystemSize() == 1) {
string.append(" "); //$NON-NLS-1$
} else {
string.append(" "); //$NON-NLS-1$
}
}
string.append("[" + symbolicOutput[row] + "]"); //$NON-NLS-1$ //$NON-NLS-2$
if (row == getOutputPortSize() / 2) {
if (isContinuous()) {
string.append("(t)="); //$NON-NLS-1$
} else {
string.append("(k) ="); //$NON-NLS-1$
}
} else {
if (isContinuous()) {
string.append(" "); //$NON-NLS-1$
} else {
string.append(" "); //$NON-NLS-1$
}
}
}
string.append("["); //$NON-NLS-1$
for (int column = 0; column < getSubSystemSize(); column++) {
final String format = "%" + columnLengthes[column] + "s"; //$NON-NLS-1$ //$NON-NLS-2$
string.append(String.format(format, this.getSymbolicCMatrix()[row][column]));
if (column != getSubSystemSize() - 1) {
string.append(" "); //$NON-NLS-1$
}
}
if (0 < getStateSize()) {
string.append("|"); //$NON-NLS-1$
}
for (int column = 0; column < getInputPortSize(); column++) {
final String format = "%" + columnLengthes[column + getSubSystemSize()] + "s"; //$NON-NLS-1$ //$NON-NLS-2$
string.append(String.format(format, this.getSymbolicDMatrix()[row][column]));
if (column != getInputPortSize() - 1) {
string.append(" "); //$NON-NLS-1$
}
}
string.append("]"); //$NON-NLS-1$
if (withInputOutput && row < symbolicInput.length) {
string.append("[" + symbolicInput[row] + "]"); //$NON-NLS-1$ //$NON-NLS-2$
if (row == getInputPortSize() / 2) {
if (isContinuous()) {
string.append("(t)"); //$NON-NLS-1$
} else {
string.append("(k)"); //$NON-NLS-1$
}
}
}
string.append(lineSeparator);
}
if (withInputOutput && symbolicOutput.length < symbolicInput.length) {
final int lengthTolastLineSeparator = string.lastIndexOf(lineSeparator, string.length() - lineSeparator.length() - 1) + lineSeparator.length();
final int widthOfInputVector = (1 + symbolicInput[0].length() + 1);
int spaceLength = (string.length() - lengthTolastLineSeparator) - 2 - widthOfInputVector;
if (getOutputPortSize() - 1 == getInputPortSize() / 2) {
spaceLength -= 3;
}
final String format = "%" + spaceLength + "s"; //$NON-NLS-1$ //$NON-NLS-2$
for (int i = 0; i < symbolicInput.length - symbolicOutput.length; i++) {
string.append(String.format(format, "")); //$NON-NLS-1$
final int row = symbolicOutput.length + i;
string.append("[" + symbolicInput[row] + "]"); //$NON-NLS-1$ //$NON-NLS-2$
if (row == getInputPortSize() / 2) {
if (isContinuous()) {
string.append("(t)"); //$NON-NLS-1$
} else {
string.append("(k)"); //$NON-NLS-1$
}
}
string.append(lineSeparator);
}
}
return string.toString();
}
/**
* {@inheritDoc}
*/
public DoubleRationalPolynomialMatrix getTransferFunctionMatrix(final boolean simplify, double tolerance) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleSystemOperator.java | 96 |
| org/mklab/tool/control/system/SystemOperator.java | 109 |
DoubleSystemOperator castedObj = (DoubleSystemOperator)opponent;
if (((this.stateSize != castedObj.stateSize) || (this.inputSize != castedObj.inputSize) || (this.outputSize != castedObj.outputSize)
|| (this.hasDirectFeedthrough != castedObj.hasDirectFeedthrough) || (this.forcedSystem != castedObj.forcedSystem) || (this.dynamic != castedObj.dynamic) || (this.linear != castedObj.linear)
|| (this.inlet != castedObj.inlet) || (this.outlet != castedObj.outlet) || (this.autoSize != castedObj.autoSize) || (this.id.equals(castedObj.id) == false))) {
return false;
}
if (this.parameters == null && castedObj.parameters == null) {
return true;
}
if (this.parameters != null && castedObj.parameters == null) {
return false;
}
if (this.parameters == null && castedObj.parameters != null) {
return false;
}
if (this.parameters.size() != castedObj.parameters.size()) {
return false;
}
for (final String key : this.parameters.keySet()) {
if (castedObj.parameters.containsKey(key) == false) {
return false;
}
if (this.parameters.get(key).equals(castedObj.parameters.get(key)) == false) {
return false;
}
}
return true;
}
/**
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + this.stateSize;
hashCode = 31 * hashCode + this.inputSize;
hashCode = 31 * hashCode + this.outputSize;
hashCode = 31 * hashCode + (this.hasDirectFeedthrough ? 1231 : 1237);
hashCode = 31 * hashCode + (this.forcedSystem ? 1231 : 1237);
hashCode = 31 * hashCode + (this.dynamic ? 1231 : 1237);
hashCode = 31 * hashCode + (this.linear ? 1231 : 1237);
hashCode = 31 * hashCode + (this.inlet ? 1231 : 1237);
hashCode = 31 * hashCode + (this.outlet ? 1231 : 1237);
hashCode = 31 * hashCode + (this.parameters == null ? 0 : getParameterHashCode());
hashCode = 31 * hashCode + (this.autoSize ? 1231 : 1237);
hashCode = 31 * hashCode + (this.id == null ? 0 : this.id.hashCode());
return hashCode;
}
/**
* タグ文字列を使用しないハッシュコードを返します。
*
* @return タグ文字列を使用しないハッシュコード
*/
private int localHashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + this.stateSize;
hashCode = 31 * hashCode + this.inputSize;
hashCode = 31 * hashCode + this.outputSize;
hashCode = 31 * hashCode + (this.hasDirectFeedthrough ? 1231 : 1237);
hashCode = 31 * hashCode + (this.forcedSystem ? 1231 : 1237);
hashCode = 31 * hashCode + (this.dynamic ? 1231 : 1237);
hashCode = 31 * hashCode + (this.linear ? 1231 : 1237);
hashCode = 31 * hashCode + (this.inlet ? 1231 : 1237);
hashCode = 31 * hashCode + (this.outlet ? 1231 : 1237);
hashCode = 31 * hashCode + (this.parameters == null ? 0 : getParameterHashCode());
hashCode = 31 * hashCode + (this.autoSize ? 1231 : 1237);
return hashCode;
}
/**
* パラメータのハッシュコードを返します。
*
* @return パラメータのハッシュコード
*/
private int getParameterHashCode() {
if (this.parameters == null) {
return 0;
}
int hashCode = 1;
for (final String key : this.parameters.keySet()) {
hashCode = 31 * hashCode + this.parameters.get(key).hashCode();
}
return hashCode;
}
/**
* (ハッシュコードに使用される)ID文字列を設定します。
*
* @param id (ハッシュコード使用される)ID文字列
*/
void setID(final String id) {
this.id = id;
}
/**
* (ハッシュコードに使用される)ID文字列を返します。
*
* @return (ハッシュコードに使用される)ID文字列
*/
String getID() {
return this.id;
}
/**
* 次数(状態の数)を返します。
*
* @return 状態の数
*/
public int getStateSize() {
return this.stateSize;
}
/**
* 次数(状態の数)を設定します。
*
* @param stateSize 状態の数
*/
public void setStateSize(final int stateSize) {
this.stateSize = stateSize;
}
/**
* 入力の数を返します。
*
* @return 入力の数
*/
public int getInputSize() {
return this.inputSize;
}
/**
* 入力の数を設定します。
*
* @param inputSize 入力の数
*/
public void setInputSize(final int inputSize) {
this.inputSize = inputSize;
}
/**
* 出力の数を返します。
*
* @return 出力の数
*/
final public int getOutputSize() {
return this.outputSize;
}
/**
* 出力の数を設定します。
*
* @param outputSize 出力の数
*/
public void setOutputSize(final int outputSize) {
this.outputSize = outputSize;
}
/**
* 直達項があるか(出力が入力に直接依存するか)判定します。
*
* @return 直達項があれば(出力が入力に直接依存すれば)true、そうでなければfalse
*/
final public boolean hasDirectFeedthrough() {
return this.hasDirectFeedthrough;
}
/**
* 直達項があるか(出力が入力に直接依存するか)設定します。
*
* @param hasDirectFeedthrough 直達項があれば(出力が入力に直接依存すれば)true、そうでなければfalse
*/
final protected void setHasDirectFeedthrough(final boolean hasDirectFeedthrough) {
this.hasDirectFeedthrough = hasDirectFeedthrough;
if (hasDirectFeedthrough) {
this.forcedSystem = true;
}
}
/**
* 入力が入力端であるかを設定します。
*
* @param inlet 入力が入力端ならばtrue、そうでなければfalse
*/
public void setInlet(final boolean inlet) {
this.inlet = inlet;
}
/**
* 入力が入力端であるか判定します。
*
* @return 入力が入力端ならばtrue、そうでなければfalse
*/
public boolean isInlet() {
return this.inlet;
}
/**
* 出力が出力端であるかを設定します。
*
* @param outlet 出力が出力端ならばtrue、そうでなければfalse
*/
public void setOutlet(final boolean outlet) {
this.outlet = outlet;
}
/**
* 出力が出力端であるか判定します。
*
* @return 出力が出力端ならばtrue、そうでなければfalse
*/
public boolean isOutlet() {
return this.outlet;
}
/**
* 状態が入力に依存するか判定します。
*
* @return 状態が入力に依存すればtrue、そうでなければfalse
*/
final public boolean isForecdSystem() {
return this.forcedSystem;
}
/**
* 状態が入力に依存するか設定します。
*
* @param forcedSystem 状態が入力に依存すればtrue、そうでなければfalse
*/
final protected void setForcedSystem(final boolean forcedSystem) {
this.forcedSystem = forcedSystem;
}
/**
* 動的システムであるか判定します。
*
* @return 動的システムならばtrue、そうでなければfalse
*/
final public boolean isDynamic() {
return this.dynamic;
}
/**
* 静的システムであるか判定します。
*
* @return 静的システムならばtrue、そうでなければfalse
*/
final public boolean isStatic() {
return !this.dynamic;
}
/**
* 動的システムであるか設定します。
*
* @param dynamic 動的システムならばtrue、そうでなければfalse
*/
final protected void setDynamic(final boolean dynamic) {
this.dynamic = dynamic;
}
/**
* 線形システムであるか設定します。
*
* @param linear 線形システムならばtrue、そうでなければfalse
*/
final public void setLinear(final boolean linear) {
this.linear = linear;
}
/**
* 線形システムであるか判定します。
*
* @return 線形システムならばtrue、そうでなければfalse
*/
final public boolean isLinear() {
return this.linear;
}
/**
* 線形システムの場合、線形システムの式を返します。
*
* @return 線形システムの式
*/
public DoubleLinearSystem getLinearSystem() { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyStringMatrix.java | 127 |
| org/mklab/tool/control/system/DoubleAdjacencyStringMatrix.java | 119 |
public void addMIMO(final List<Integer> inputNodes, final List<Integer> outputNodes, final SystemBuilder<RS,RM,CS,CM> system) {
for (final Integer inputNode : inputNodes) {
if (inputNode == null) {
continue;
}
for (final Integer outputNode : outputNodes) {
if (outputNode == null) {
continue;
}
if (hasEdge(inputNode, outputNode)) {
return;
}
system.resetAutoSize();
addEdge(inputNode, outputNode, "S" + this.systemId); //$NON-NLS-1$
setControlSystem("S" + this.systemId, system); //$NON-NLS-1$
}
}
this.systemId++;
}
/**
* 指定したノードとノードの間にエッジがあるか判定します。
*
* @param inputNode 入力ノード
* @param outputNode 出力ノード
* @return 指定したノードとノードの間にエッジがあればtrue、そうでなければfalse
*/
public boolean hasEdge(final int inputNode, final int outputNode) {
return this.elements.hasElement(inputNode, outputNode);
}
/**
* <code>inputNode</code>ノードから<code>outputNode</code>ノードに単位エッジ(重み=Iまたは-I)を追加します。
*
* @param inputNode 入力ノード
* @param outputNode 出力ノード
* @param positive 正入力かどうか(trueであれば正入力)
*/
public void addUnitEdge(final int inputNode, final int outputNode, final boolean positive) {
if (positive) {
addEdge(inputNode, outputNode, "P"); //$NON-NLS-1$
} else {
addEdge(inputNode, outputNode, "N"); //$NON-NLS-1$
}
if (this.nodeDegrees[inputNode - 1] == -1 && this.nodeDegrees[outputNode - 1] != -1) {
this.nodeDegrees[inputNode - 1] = this.nodeDegrees[outputNode - 1];
}
if (this.nodeDegrees[outputNode - 1] == -1 && this.nodeDegrees[inputNode - 1] != -1) {
this.nodeDegrees[outputNode - 1] = this.nodeDegrees[inputNode - 1];
}
setupNodeDegree();
}
/**
* <code>inputNodes</code>の各ノードから<code>outputNode</code>ノードへの多重器を追加します。
*
* @param inputNodes 入力ノードのリスト
* @param outputNode 出力ノード
*/
@SuppressWarnings("boxing")
public void addMultiplexer(final List<Integer> inputNodes, final int outputNode) {
this.muxMap.put(outputNode, inputNodes);
for (int i = 1; i <= inputNodes.size(); i++) {
final Integer node = inputNodes.get(i - 1);
if (node == null) {
continue;
}
addEdge(node, outputNode, "M" + i + "/" + inputNodes.size()); //$NON-NLS-1$ //$NON-NLS-2$
}
int outputSize = 0;
for (final Integer node : inputNodes) {
if (node == null) {
continue;
}
final int inputNode = node;
if (this.nodeDegrees[inputNode - 1] == -1) {
return;
}
outputSize += this.nodeDegrees[inputNode - 1];
}
this.nodeDegrees[outputNode - 1] = outputSize;
setupNodeDegree();
}
/**
* <code>inputNodes</code>の各ノードから<code>outputNode</code>ノードへの加算器を追加します。
*
* @param inputNodes 入力ノードのリスト
* @param outputNode 出力ノード
* @param positives 正入力かどうか(正入力ならばtrue)
*/
@SuppressWarnings("boxing")
public void addSum(final List<Integer> inputNodes, final int outputNode, final List<Boolean> positives) {
if (inputNodes.size() != positives.size()) {
throw new IllegalArgumentException(Messages.getString("AdjacencyStringMatrix.8")); //$NON-NLS-1$
}
for (int i = 0; i < inputNodes.size(); i++) {
final Integer node = inputNodes.get(i);
if (node == null) {
continue;
}
addUnitEdge(node, outputNode, positives.get(i));
}
}
/**
* 多重器の出力ノードの次数を設定します。
*
* @return 新たに多重器の出力ノードの次数を設定したならばtrue、そうでなければfalse
*/
@SuppressWarnings("boxing")
private boolean setupMultiplexerNodeDegree() {
boolean changed = false;
outer:for (Integer node : this.muxMap.keySet()) {
int outputNode = node;
if (this.nodeDegrees[outputNode - 1] != -1) {
continue;
}
final List<Integer> inputNodes = this.muxMap.get(outputNode);
int outputSize = 0;
for (final Integer inputNode : inputNodes) {
if (inputNode == null) {
continue;
}
if (this.nodeDegrees[inputNode - 1] == -1) {
continue outer;
}
outputSize += this.nodeDegrees[inputNode - 1];
}
this.nodeDegrees[outputNode - 1] = outputSize;
changed = true;
}
return changed;
}
/**
* <code>inputNode</code>ノードから<code>outputNodes</code>の各ノードへの分離器を追加します。
*
* @param inputNode 入力ノード
* @param outputNodes 出力ノードのリスト
*/
@SuppressWarnings("boxing")
public void addDeMultiplexer(final int inputNode, final List<Integer> outputNodes) {
this.demuxMap.put(inputNode, outputNodes);
for (int i = 1; i <= outputNodes.size(); i++) {
final Integer node = outputNodes.get(i - 1);
if (node == null) {
continue;
}
addEdge(inputNode, node, "D" + i + "/" + outputNodes.size()); //$NON-NLS-1$ //$NON-NLS-2$
}
int inputSize = 0;
for (final Integer node : outputNodes) {
if (node == null) {
continue;
}
final int outputNode = node;
if (this.nodeDegrees[outputNode - 1] == -1) {
return;
}
inputSize += this.nodeDegrees[outputNode - 1];
}
this.nodeDegrees[inputNode - 1] = inputSize;
setupNodeDegree();
}
/**
* 分離器の入力ノードの次数を設定します。
*
* @return 新たに分離器の入力ノードの次数を設定したならばtrue、そうでなければfalse
*/
@SuppressWarnings("boxing")
private boolean setupDeMultiplexerNodeDegree() {
boolean changed = false;
outer:for (final Integer node : this.demuxMap.keySet()) {
if (node == null) {
continue;
}
int inputNode = node;
if (this.nodeDegrees[inputNode - 1] != -1) {
continue;
}
final List<Integer> outputNodes = this.demuxMap.get(inputNode);
int inputSize = 0;
for (final Integer outputNode : outputNodes) {
if (outputNode == null) {
continue;
}
if (this.nodeDegrees[outputNode - 1] == -1) {
continue outer;
}
inputSize += this.nodeDegrees[outputNode - 1];
}
this.nodeDegrees[inputNode - 1] = inputSize;
changed = true;
}
return changed;
}
/**
* sourceシステムを追加します。
*
* @param inputNode sourceシステムを接続するノードの番号
* @param controlSystem sourceシステム
* @param sourceNumber sourceシステムの番号
*/
@SuppressWarnings("boxing")
public void addSource(final int inputNode, final SystemBuilder<RS,RM,CS,CM> controlSystem, final int sourceNumber) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/source/DoubleUserDefinedContinuousSource.java | 76 |
| org/mklab/tool/control/system/source/UserDefinedContinuousSource.java | 85 |
return (DoubleMatrix)this.outputFunction.invoke(this.obj, Double.valueOf(t));
} catch (IllegalArgumentException e) {
throw new SolverStopException(e);
} catch (IllegalAccessException e) {
throw new SolverStopException(e);
} catch (InvocationTargetException e) {
throw new SolverStopException(e.getTargetException());
}
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* システムのクローズ処理を記述したメソッドを設定します。
*
* @param closeFunction システムのクローズ処理を記述したメソッド
*/
public void setCloseFunction(Method closeFunction) {
this.closeFunction = closeFunction;
this.closeFunction.setAccessible(true);
}
/**
* システムのオープン処理を記述したメソッドを設定します。
*
* @param openFunction システムのクローズ処理を記述したメソッド
*/
public void setOpenFunction(Method openFunction) {
this.openFunction = openFunction;
this.openFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try {
this.updateFunction.invoke(this.obj);
} catch (IllegalArgumentException e) {
throw new ParameterException(e);
} catch (IllegalAccessException e) {
throw new ParameterException(e);
} catch (InvocationTargetException e) {
throw new ParameterException(e.getTargetException());
} catch (Exception e) {
throw new ParameterException(e);
}
}
/**
* @see org.mklab.tool.control.system.discrete.BaseDiscreteStaticSystem#initialize()
*/
@Override
public void initialize() {
super.initialize();
try {
if (this.initializeFunction != null) {
this.initializeFunction.invoke(this.obj);
}
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e.getTargetException());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* @see org.mklab.tool.control.system.source.Importer#open()
* @throws IOException 入出力例外がクローズ中に発生した場合
* @throws RuntimeException その他の例外の場合
*/
@Override
public void open() throws IOException {
this.active = true;
try {
if (this.openFunction != null) {
this.openFunction.invoke(this.obj);
}
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
if (e.getTargetException() instanceof IOException) {
throw (IOException)e.getTargetException();
}
throw new RuntimeException(e.getTargetException());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* @see org.mklab.tool.control.system.source.Importer#close()
* @throws IOException 入出力例外がクローズ中に発生した場合
* @throws RuntimeException その他の例外の場合
*/
@Override
public void close() throws IOException {
this.active = false;
try {
if (this.closeFunction != null) {
this.closeFunction.invoke(this.obj);
}
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
if (e.getTargetException() instanceof IOException) {
throw (IOException)e.getTargetException();
}
throw new RuntimeException(e.getTargetException());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* @see org.mklab.tool.control.system.source.Importer#importData()
*/
@Override
public void importData() {
// do nothing
}
/**
* @see org.mklab.tool.control.system.source.Importer#isActive()
*/
@Override
public boolean isActive() {
return this.active;
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 4910 |
| org/mklab/tool/control/system/AdjacencyMatrix.java | 4990 |
} else if (system.getLinearSystem().isProper() == false) {
// A取得
matrix[1][2] = new ConstantSystem<>(linearSystem.getA());
if (linearSystem.hasVariableA()) {
// ((ConstantSystem)matrix[1][2]).setExpression("A_" + linearSystem.getTag());
// //$NON-NLS-1$
((ConstantSystem<RS, RM, CS, CM>)matrix[1][2]).setExpression(linearSystem.getTag() + "_A"); //$NON-NLS-1$
} else {
final RM value = linearSystem.getA();
((ConstantSystem<RS, RM, CS, CM>)matrix[1][2]).setExpression(toMmString(value, format));
}
((ConstantSystem<RS, RM, CS, CM>)matrix[1][2]).setTag(linearSystem.getTag());
((ConstantSystem<RS, RM, CS, CM>)matrix[1][2]).setVariable(linearSystem.hasVariableA());
// B取得
matrix[0][2] = new ConstantSystem<>(linearSystem.getB());
if (linearSystem.hasVariableB()) {
// ((ConstantSystem)matrix[0][2]).setExpression("B_" + linearSystem.getTag());
// //$NON-NLS-1$
((ConstantSystem<RS, RM, CS, CM>)matrix[0][2]).setExpression(linearSystem.getTag() + "_B"); //$NON-NLS-1$
} else {
final RM value = linearSystem.getB();
((ConstantSystem<RS, RM, CS, CM>)matrix[0][2]).setExpression(toMmString(value, format));
}
((ConstantSystem<RS, RM, CS, CM>)matrix[0][2]).setTag(linearSystem.getTag());
((ConstantSystem<RS, RM, CS, CM>)matrix[0][2]).setVariable(linearSystem.hasVariableB());
// C取得
matrix[1][3] = new ConstantSystem<>(linearSystem.getC());
if (linearSystem.hasVariableC()) {
// ((ConstantSystem)matrix[1][3]).setExpression("C_" + linearSystem.getTag());
// //$NON-NLS-1$
((ConstantSystem<RS, RM, CS, CM>)matrix[1][3]).setExpression(linearSystem.getTag() + "_C"); //$NON-NLS-1$
} else {
final RM value = linearSystem.getC();
((ConstantSystem<RS, RM, CS, CM>)matrix[1][3]).setExpression(toMmString(value, format));
}
((ConstantSystem<RS, RM, CS, CM>)matrix[1][3]).setTag(linearSystem.getTag());
((ConstantSystem<RS, RM, CS, CM>)matrix[1][3]).setVariable(linearSystem.hasVariableC());
// D取得
final RM value = linearSystem.getD();
if (value.isZero()) {
matrix[0][3] = ZeroSystem.getInstance(this.sunit);
} else {
matrix[0][3] = new ConstantSystem<>(linearSystem.getD());
if (linearSystem.hasVariableD()) {
// ((ConstantSystem)matrix[0][3]).setExpression("D_" + linearSystem.getTag());
// //$NON-NLS-1$
((ConstantSystem<RS, RM, CS, CM>)matrix[0][3]).setExpression(linearSystem.getTag() + "_D"); //$NON-NLS-1$
} else { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/parameter/DoubleParameterContainer.java | 555 |
| org/mklab/tool/control/system/parameter/ParameterContainer.java | 562 |
final DoubleParameterContainer castedObj = (DoubleParameterContainer)o;
return ((this.system == null ? castedObj.system == null : this.system.equals(castedObj.system)) && (this.value == null ? castedObj.value == null : this.value.equals(castedObj.value))
&& (this.anotation == null ? castedObj.anotation == null : this.anotation.equals(castedObj.anotation)) && (this.name == null ? castedObj.name == null : this.name.equals(castedObj.name)) && (this.expression == null
? castedObj.expression == null : this.expression.equals(castedObj.expression)));
}
/**
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
int hashCode = 1;
// hashCode = 31 * hashCode + (this.system == null ? 0 :
// this.system.hashCode());// これを入れるとループ
hashCode = 31 * hashCode + (this.value == null ? 0 : this.value.hashCode());
hashCode = 31 * hashCode + (this.anotation == null ? 0 : this.anotation.hashCode());
hashCode = 31 * hashCode + (this.name == null ? 0 : this.name.hashCode());
hashCode = 31 * hashCode + (this.expression == null ? 0 : this.expression.hashCode());
return hashCode;
}
/**
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
Object object = ""; //$NON-NLS-1$
try {
this.value.setAccessible(true);
object = this.value.get(this.system);
} catch (@SuppressWarnings("unused") IllegalArgumentException e) {
// nothing
} catch (@SuppressWarnings("unused") IllegalAccessException e) {
// nothing
}
String unitString = ""; //$NON-NLS-1$
if (getUnit()[0] != SIunit.undefined) {
unitString = " [" + SIunit.toString(getUnit()) + "]"; //$NON-NLS-1$ //$NON-NLS-2$
}
String descriptionString = ""; //$NON-NLS-1$
if (getDescription().length() != 0) {
descriptionString = " (" + getDescription() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
}
return getName() + " = " + object + unitString + descriptionString; //$NON-NLS-1$
}
/**
* 説明を返します。
*
* @return 説明
*/
public String getDescription() {
if (this.anotation.description().equals("") == false) { //$NON-NLS-1$
return this.anotation.description();
}
if (this.anotation.quantity() != QuantityType.UNDEFINED) {
return this.anotation.quantity().getName();
}
return ""; //$NON-NLS-1$
}
/**
* 単位を返します。
*
* @return 単位
*/
public SIunit[] getUnit() {
if (this.anotation.unit()[0] != SIunit.undefined) {
return this.anotation.unit();
}
if (this.anotation.quantity() != QuantityType.UNDEFINED) {
return this.anotation.quantity().getUnitAsArray();
}
return new SIunit[] {SIunit.undefined};
}
/**
* パラメータ変更に伴う更新を行います。
*
* @throws ParameterAccessException パラメータ変更に伴う更新ができない場合
*/
private void updateWithParameter() throws ParameterAccessException {
if (this.anotation.update() == false) {
return;
}
if ((this.system instanceof ParameterUpdator) == false) {
return;
}
final boolean success = ((ParameterUpdator)this.system).updateWith(getName());
if (success) {
return;
}
updateWithSuperParameter(this.system.getClass());
}
/**
* パラメータ変更に伴う更新をスーパークラスに対して行います。
*
* @param klass 対象となるクラス
* @throws ParameterAccessException パラメータ変更に伴う更新ができない場合
*/
private void updateWithSuperParameter(final Class<? extends DoubleSystemOperator> klass) throws ParameterAccessException { | |
| File | Line |
|---|---|
| org/mklab/tool/control/AbstractLinearSystem.java | 1245 |
| org/mklab/tool/control/DoubleAbstractLinearSystem.java | 1239 |
}
/**
* 時間領域でのシステムの種類を設定します。
*
* @param type 時間領域でのシステムの種類
*/
public void setTimeDomainType(final TimeDomainType type) {
this.timeDomainType = type;
}
/**
* 時間領域でのシステムの種類を返します。
*
* @return 時間領域でのシステムの種類
*/
public TimeDomainType getTimeDomainType() {
return this.timeDomainType;
}
/**
* 連続時間システムであるか判定します。
*
* @return 連続時間システムならばtrue、そうでなければfalse
*/
public boolean isContinuous() {
return this.timeDomainType == TimeDomainType.CONTINUOUS;
}
/**
* 離散時間システムであるか判定します。
*
* @return 離散時間システムならばtrue、そうでなければfalse
*/
public boolean isDiscrete() {
return this.timeDomainType == TimeDomainType.DISCRETE;
}
/**
* サンプル値システムであるか判定します。
*
* @return サンプル値システムならばtrue、そうでなければfalse
*/
public boolean isSampled() {
return this.timeDomainType == TimeDomainType.SAMPLED;
}
/**
* 数値の出力フォーマットを設定します。
*
* @param format 数値の出力フォーマット
*/
public void setFormat(final String format) {
this.a.setElementFormat(format);
this.b.setElementFormat(format);
this.c.setElementFormat(format);
this.d.setElementFormat(format);
if (this.e != null) {
this.e.setElementFormat(format);
}
if (this.G != null) {
this.G.setElementFormat(format);
}
}
/**
* 数値の出力フォーマットを返します。
*
* @return 数値の出力フォーマット
*/
public String getFormat() {
return this.a.getElementFormat();
}
/**
* 状態空間実現の係数行列の数式を設定します。
*
* @param aSymbol A行列の数式
* @param bSymbol B行列の数式
* @param cSymbol C行列の数式
* @param dSymbol D行列の数式
* @param eSymbol E行列の数式
*/
public void setSymbolicString(final String[][] aSymbol, final String[][] bSymbol, final String[][] cSymbol, final String[][] dSymbol, final String[][] eSymbol) {
this.aSymbol = aSymbol;
this.bSymbol = bSymbol;
this.cSymbol = cSymbol;
this.dSymbol = dSymbol;
this.eSymbol = eSymbol;
}
/**
* サブシステムの数を返します。
*
* @return サブシステムの数
*/
protected int getSubSystemSize() {
return this.aSymbol.length;
}
/**
* 入力ポートの数を返します。
*
* @return 入力ポートの数
*/
protected int getInputPortSize() {
return this.bSymbol.length != 0 ? this.bSymbol[0].length : this.dSymbol[0].length;
}
/**
* 出力ポートの数を返します。
*
* @return 出力ポートの数
*/
protected int getOutputPortSize() {
return this.cSymbol.length;
}
/**
* 入力ポートのタグを返します。
*
* @return 入力ポートのタグ
*/
public List<String> getInputPortTags() {
return this.inputPortTags;
}
/**
* 入力ポートのタグを設定します。
*
* @param inputPortTags 入力ポートのタグ
*/
public void setInputPortTags(List<String> inputPortTags) {
this.inputPortTags = inputPortTags;
}
/**
* 出力ポートのタグを返します。
*
* @return 出力ポートのタグ
*/
public List<String> getOutputPortTags() {
return this.outputPortTags;
}
/**
* 出力ポートのタグを設定します。
*
* @param outputPortTags 出力ポートのタグ
*/
public void setOutputTags(List<String> outputPortTags) {
this.outputPortTags = outputPortTags;
}
/**
* 状態のタグを返します。
*
* @return 状態のタグ
*/
public List<String> getStateTags() {
return this.stateTags;
}
/**
* 状態のタグを設定します。
*
* @param stateTags 状態のタグ
*/
public void setStateTags(List<String> stateTags) {
this.stateTags = stateTags;
}
/**
* A行列の文字列をString[][]で返します。 (テストケースのための一時的なものです。)
*
* @return String[][](aSymbol)
*/
protected String[][] getSymbolicAMatrix() {
return this.aSymbol;
}
/**
* B行列の文字列をString[][]で返します。 (テストケースのための一時的なものです。)
*
* @return String[][](bSymbol)
*/
protected String[][] getSymbolicBMatrix() {
return this.bSymbol;
}
/**
* C行列の文字列をString[][]で返します。 (テストケースのための一時的なものです。)
*
* @return String[][](cSymbol)
*/
protected String[][] getSymbolicCMatrix() {
return this.cSymbol;
}
/**
* D行列の文字列をString[][]で返します。 (テストケースのための一時的なものです。)
*
* @return String[][](dSymbol)
*/
protected String[][] getSymbolicDMatrix() {
return this.dSymbol;
}
/**
* eSymbolを返します.(一時的実装)
*
* @return eSymbol
*/
protected String[][] getSymbolicEMatrix() {
return this.eSymbol;
}
/**
* @see org.mklab.nfc.matrix.GridElement#clone()
*/
@Override
abstract public Object clone();
/**
* 表示文字列を返します。
*
* @return 表示文字列
*/
public String getPrintingString() {
try (final CharArrayWriter output = new CharArrayWriter()) {
print(output);
final String printString = output.toString();
return printString;
}
}
/**
* 指数を返します。
* @return 指数
*/
public IntMatrix getIndex() {
return this.index;
}
/**
* 指数を設定します。
* @param index 指数
*/
public void setIndex(IntMatrix index) {
this.index = index;
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/graph/CycleMatrix.java | 92 |
| org/mklab/tool/control/system/graph/DoubleCycleMatrix.java | 85 |
if (adjacencyMatrix.getElement(row, column).isZero() == false) {
this.adjacencyConnectionMatrix.setElement(row, column, true);
}
}
}
}
/**
* 閉路が存在するか判定します。
*
* @return 閉路が存在するならばtrue、そうでなければfalse
*/
public boolean hasCycle() {
final int size = this.cycleMatrix.getRowSize();
for (int i = 1; i <= size; i++) {
// 同一行のtrueに対応するノードは同じループ内に存在する
IntMatrix nodes = this.cycleMatrix.getRowVector(i).find();
int nodeSize = nodes.length();
boolean hasOnlyConnectionSelfLoop = nodeSize == 1 && (this.adjacencyConnectionMatrix.getElement(i, i) == false);
if (nodes.isEmpty() || hasOnlyConnectionSelfLoop) {
continue;
}
return true;
}
return false;
}
/**
* 極大閉路を形成するノードのリストのリストを返します。
*
* @return 極大閉路を形成するノードのリストのリスト
*/
@SuppressWarnings("boxing")
public List<List<Integer>> getLocalMaximumCycles() {
List<List<Integer>> cycleList = new ArrayList<>();
final int size = this.cycleMatrix.getRowSize();
for (int i = 1; i <= size; i++) {
// 同一行のtrueに対応するノードは同じループ内に存在する
IntMatrix nodes = this.cycleMatrix.getRowVector(i).find();
int nodeSize = nodes.length();
boolean hasOnlyConnectionSelfLoop = nodeSize == 1 && (this.adjacencyConnectionMatrix.getElement(i, i) == false);
if (nodes.isEmpty() || hasOnlyConnectionSelfLoop) {
continue;
}
List<Integer> cycle = new ArrayList<>();
for (int j = 1; j <= nodeSize; j++) {
cycle.add(nodes.getIntElement(j));
}
cycleList.add(cycle);
// 同一ループ内のノードを検索対象から除外する
for (int j = 1; j <= nodeSize; j++) {
int node = nodes.getIntElement(j);
this.cycleMatrix.setRowVector(node, new BooleanMatrix(1, size));
this.cycleMatrix.setColumnVector(node, new BooleanMatrix(size, 1));
}
this.cycleMatrix.setRowVector(i, new BooleanMatrix(1, size));
this.cycleMatrix.setColumnVector(i, new BooleanMatrix(size, 1));
}
return cycleList;
}
/**
* 行列の次数を返します。
*
* @return 行列の次数
*/
public int getSize() {
return this.cycleMatrix.getRowSize();
}
/**
* 閉路情報を表わす行列を返します。
*
* @return 閉路情報を表わす行列
*/
public BooleanMatrix getBooleanMatrix() {
return this.cycleMatrix.createClone();
}
/**
* <code>row</code>行<code>column</code>列の成分を返します。
*
* @param row 行番号
* @param column 列番号
* @return row行column列の成分
*/
public boolean getElement(final int row, final int column) {
return this.cycleMatrix.getElement(row, column);
}
/**
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
result = PRIME * result + ((this.adjacencyConnectionMatrix == null) ? 0 : this.adjacencyConnectionMatrix.hashCode());
result = PRIME * result + ((this.cycleMatrix == null) ? 0 : this.cycleMatrix.hashCode());
return result;
}
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
final CycleMatrix<RS,RM,CS,CM> other = (CycleMatrix<RS,RM,CS,CM>)obj; | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleDerivativeSystem.java | 17 |
| org/mklab/tool/control/system/discrete/DoubleUnitLeadSystem.java | 23 |
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());
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/rpn/DoubleMaxima.java | 66 |
| org/mklab/tool/control/system/rpn/Maxima.java | 72 |
private static String getMatrixString(final DoubleMatrix matrix) {
final StringBuilder str = new StringBuilder();
str.append("matrix("); //$NON-NLS-1$
for (int i = 1; i < matrix.getRowSize() + 1; i++) {
str.append("["); //$NON-NLS-1$
for (int j = 1; j < matrix.getColumnSize() + 1; j++) {
// if (matrix instanceof IntMatrix) {
// str.append((((IntMatrix)matrix).getIntElement(i, j)));
// } else {
str.append((matrix.getElement(i, j)));
// }
if ((j >= matrix.getColumnSize()) == false) {
str.append(","); //$NON-NLS-1$
}
}
str.append("]"); //$NON-NLS-1$
if ((i >= matrix.getRowSize()) == false) {
str.append(","); //$NON-NLS-1$
}
}
str.append(");" + lineSeparator); //$NON-NLS-1$
return str.toString();
}
/**
* Maximaを起動し引数に渡されたコマンドを実行します。
*
* @throws IOException 出力できない場合
*/
public void open() throws IOException {
final String maximaHome = System.getenv("MAXIMA_HOME"); //$NON-NLS-1$
final String command = "\"" + maximaHome + "\\" + "maxima.bat\" --very-quiet --disable-readline"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
this.process = Runtime.getRuntime().exec(command);
this.writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(this.process.getOutputStream())));
this.reader = new BufferedReader(new InputStreamReader(this.process.getInputStream()));
initialize();
}
/**
* Maximaにコマンドを送ります。
*
* @param comands コマンド
*/
public void sendComand(final StringBuilder comands) {
this.writer.print(comands.toString() + lineSeparator);
this.writer.flush();
}
/**
* Maximaに終了処理コマンドを送ります。
*/
private void terminate() {
this.writer.print("quit();" + lineSeparator); //$NON-NLS-1$
this.writer.flush();
}
/**
* Maximaに初期化コマンドを送ります。
*/
private void initialize() {
this.writer.print("ttyoff:true;" + lineSeparator); //$NON-NLS-1$
this.writer.flush();
this.writer.print("ratprint:false;" + lineSeparator); //$NON-NLS-1$
this.writer.flush();
this.writer.print("display2d:false;" + lineSeparator); //$NON-NLS-1$
this.writer.flush();
this.writer.print("scalarmatrixp:all;" + lineSeparator); //$NON-NLS-1$
this.writer.flush();
this.writer.print("linel:200;" + lineSeparator); //$NON-NLS-1$
this.writer.flush();
this.writer.print("doallmxops:false;" + lineSeparator); //$NON-NLS-1$
this.writer.flush();
}
/**
* Maximaからの結果を受け取ります。
*
* @return 実行結果
* @throws IOException 入力できない場合
*/
public String receiveResult() throws IOException {
this.reader.readLine();
final String result = this.reader.readLine();
// String resultMatrix = "";
// while (true) {
// String result = this.reader.readLine();
// if (result == null) break;
// resultMatrix = result;
System.out.println(result);
// }
// System.out.println(resultMatrix);
close();
return result;
}
/**
* Maximaを終了します。
*
* @throws IOException 入力を閉じれない場合
*/
private void close() throws IOException {
terminate();
this.writer.close();
this.reader.close();
this.process.destroy();
variableList.clear();
}
/**
* systemの定数システムの宣言をMaxima用に生成します。
*
* @param system システム
* @return systemの定数システムの変数宣言
*/
public static StringBuilder getDeclearOfSystems(final DoubleSystemOperator system) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discrete/DoubleUserDefinedDiscreteDynamicSystem.java | 102 |
| org/mklab/tool/control/system/discrete/UserDefinedDiscreteDynamicSystem.java | 111 |
return (DoubleMatrix)this.stateFunction.invoke(this.obj, Integer.valueOf(k), x, u);
} catch (IllegalArgumentException e) {
throw new SolverStopException(e);
} catch (IllegalAccessException e) {
throw new SolverStopException(e);
} catch (InvocationTargetException e) {
throw new SolverStopException(e.getTargetException());
}
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの状態方程式を定義したメソッドを設定します。
*
* @param method システムの状態方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setStateFunction(Method method) throws SecurityException {
this.stateFunction = method;
this.stateFunction.setAccessible(true);
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try {
this.updateFunction.invoke(this.obj);
} catch (IllegalArgumentException e) {
throw new ParameterException(e);
} catch (IllegalAccessException e) {
throw new ParameterException(e);
} catch (InvocationTargetException e) {
throw new ParameterException(e.getTargetException());
} catch (Exception e) {
throw new ParameterException(e);
}
}
/**
* @see org.mklab.tool.control.system.discrete.BaseDiscreteStaticSystem#initialize()
*/
@Override
public void initialize() {
super.initialize();
try {
if (this.initializeFunction != null) {
this.initializeFunction.invoke(this.obj);
}
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e.getTargetException());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* 直達項があるか(出力が入力に直接依存するか)設定します。
*
* @param hasDirectFeedthrough 直達項があれば(出力が入力に直接依存すれば)true、そうでなければfalse
*/
public void setDirectFeedthrough(final boolean hasDirectFeedthrough) {
setHasDirectFeedthrough(hasDirectFeedthrough);
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/DoubleProperLinearSystem.java | 197 |
| org/mklab/tool/control/ProperLinearSystem.java | 203 |
final DoubleMatrix bd = this.b.appendDown(this.d);
ac.setElementFormat(this.a.getElementFormat());
bd.setElementFormat(this.a.getElementFormat());
final String[] acString = ac.getPrintingElementsString(Integer.MAX_VALUE).split("[\\r\\n]+"); //$NON-NLS-1$
final String[] bdString = bd.getPrintingElementsString(Integer.MAX_VALUE).split("[\\r\\n]+"); //$NON-NLS-1$
final String[] aString = new String[this.stateSize + 1];
if (this.stateSize != 0) {
System.arraycopy(acString, 0, aString, 0, this.stateSize + 1);
}
final String[] cString = new String[this.outputSize + 1];
if (this.stateSize != 0) {
cString[0] = aString[0];
System.arraycopy(acString, this.stateSize + 1, cString, 1, this.outputSize);
resetRowNumber(cString);
}
final String[] bString = new String[this.stateSize + 1];
System.arraycopy(bdString, 0, bString, 0, this.stateSize + 1);
final String[] dString = new String[this.outputSize + 1];
dString[0] = bString[0];
System.arraycopy(bdString, this.stateSize + 1, dString, 1, this.outputSize);
resetRowNumber(dString);
final PrintWriter pw = new PrintWriter(output);
if (this.stateSize == 0) {
for (int i = 0; i < this.outputSize + 1; i++) {
pw.println(dString[i]);
}
return;
}
for (int i = 0; i < this.stateSize + 1; i++) {
pw.print(aString[i]);
pw.print("|"); //$NON-NLS-1$
pw.println(bString[i]);
}
for (int i = 0; i < aString[0].length(); i++) {
pw.print("-"); //$NON-NLS-1$
}
pw.print("+"); //$NON-NLS-1$
for (int i = 0; i < bString[0].length(); i++) {
pw.print("-"); //$NON-NLS-1$
}
pw.println(""); //$NON-NLS-1$
for (int i = 0; i < this.outputSize + 1; i++) {
pw.print(cString[i]);
pw.print("|"); //$NON-NLS-1$
pw.println(dString[i]);
}
pw.flush();
}
/**
* @see org.mklab.nfc.matrix.GridElement#clone()
*/
@Override
public Object clone() {
final DoubleProperLinearSystem inst = new DoubleProperLinearSystem(); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleUserDefinedContinuousDynamicSystem.java | 88 |
| org/mklab/tool/control/system/continuous/UserDefinedContinuousDynamicSystem.java | 97 |
return (DoubleMatrix)this.outputFunction.invoke(this.object, Double.valueOf(t), x);
} catch (IllegalArgumentException e) {
throw new SolverStopException(e);
} catch (IllegalAccessException e) {
throw new SolverStopException(e);
} catch (InvocationTargetException e) {
throw new SolverStopException(e.getTargetException());
} catch (Exception e) {
throw new SolverStopException(e);
}
}
/**
* {@inheritDoc}
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* {@inheritDoc}
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの状態方程式を定義したメソッドを設定します。
*
* @param method システムの状態方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setStateFunction(final Method method) throws SecurityException {
this.stateFunction = method;
this.stateFunction.setAccessible(true);
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(final Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* {@inheritDoc}
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* {@inheritDoc}
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* {@inheritDoc}
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* {@inheritDoc}
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* {@inheritDoc}
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* {@inheritDoc}
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* {@inheritDoc}
*/
public void update() throws ParameterException {
try {
this.updateFunction.invoke(this.object);
} catch (IllegalArgumentException e) {
throw new ParameterException(e);
} catch (IllegalAccessException e) {
throw new ParameterException(e);
} catch (InvocationTargetException e) {
throw new ParameterException(e.getTargetException());
} catch (Exception e) {
throw new ParameterException(e);
}
}
/**
* {@inheritDoc}
*/
@Override
public void initialize() {
super.initialize();
try {
if (this.initializeFunction != null) {
this.initializeFunction.invoke(this.object);
}
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e.getTargetException());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* 直達項があるか(出力が入力に直接依存するか)設定します。
*
* @param hasDirectFeedthrough 直達項があれば(出力が入力に直接依存すれば)true、そうでなければfalse
*/
public void setDirectFeedthrough(final boolean hasDirectFeedthrough) {
setHasDirectFeedthrough(hasDirectFeedthrough);
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleAdjacencyMatrixUtil.java | 612 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrixUtil.java | 688 |
} else if (system.getLinearSystem().isProper() == false) {
// A取得
matrix[1][2] = new DoubleConstantSystem(linearSystem.getA());
if (linearSystem.hasVariableA()) {
// ((DoubleConstantSystem)matrix[1][2]).setExpression("A_" + linearSystem.getTag()); //$NON-NLS-1$
((DoubleConstantSystem)matrix[1][2]).setExpression(linearSystem.getTag() + "_A"); //$NON-NLS-1$
} else {
final DoubleMatrix value = linearSystem.getA();
((DoubleConstantSystem)matrix[1][2]).setExpression(toMmString(value, format));
}
((DoubleConstantSystem)matrix[1][2]).setTag(linearSystem.getTag());
((DoubleConstantSystem)matrix[1][2]).setVariable(linearSystem.hasVariableA());
// B取得
matrix[0][2] = new DoubleConstantSystem(linearSystem.getB());
if (linearSystem.hasVariableB()) {
// ((DoubleConstantSystem)matrix[0][2]).setExpression("B_" + linearSystem.getTag()); //$NON-NLS-1$
((DoubleConstantSystem)matrix[0][2]).setExpression(linearSystem.getTag() + "_B"); //$NON-NLS-1$
} else {
final DoubleMatrix value = linearSystem.getB();
((DoubleConstantSystem)matrix[0][2]).setExpression(toMmString(value, format));
}
((DoubleConstantSystem)matrix[0][2]).setTag(linearSystem.getTag());
((DoubleConstantSystem)matrix[0][2]).setVariable(linearSystem.hasVariableB());
// C取得
matrix[1][3] = new DoubleConstantSystem(linearSystem.getC());
if (linearSystem.hasVariableC()) {
// ((DoubleConstantSystem)matrix[1][3]).setExpression("C_" + linearSystem.getTag()); //$NON-NLS-1$
((DoubleConstantSystem)matrix[1][3]).setExpression(linearSystem.getTag() + "_C"); //$NON-NLS-1$
} else {
final DoubleMatrix value = linearSystem.getC();
((DoubleConstantSystem)matrix[1][3]).setExpression(toMmString(value, format));
}
((DoubleConstantSystem)matrix[1][3]).setTag(linearSystem.getTag());
((DoubleConstantSystem)matrix[1][3]).setVariable(linearSystem.hasVariableC());
// D取得
final DoubleMatrix value = linearSystem.getD();
if (value.isZero()) {
matrix[0][3] = DoubleZeroSystem.getInstance();
} else {
matrix[0][3] = new DoubleConstantSystem(linearSystem.getD());
if (linearSystem.hasVariableD()) {
// ((DoubleConstantSystem)matrix[0][3]).setExpression("D_" + linearSystem.getTag()); //$NON-NLS-1$
((DoubleConstantSystem)matrix[0][3]).setExpression(linearSystem.getTag() + "_D"); //$NON-NLS-1$
} else { | |
| File | Line |
|---|---|
| org/mklab/tool/control/DoubleImproperLinearSystem.java | 361 |
| org/mklab/tool/control/DoubleProperLinearSystem.java | 441 |
| org/mklab/tool/control/ImproperLinearSystem.java | 359 |
| org/mklab/tool/control/ProperLinearSystem.java | 447 |
string.append(" "); //$NON-NLS-1$
}
}
}
string.append("["); //$NON-NLS-1$
for (int column = 0; column < getSubSystemSize(); column++) {
final String format = "%" + columnLengthes[column] + "s"; //$NON-NLS-1$ //$NON-NLS-2$
string.append(String.format(format, this.getSymbolicCMatrix()[row][column]));
if (column != getSubSystemSize() - 1) {
string.append(" "); //$NON-NLS-1$
}
}
if (0 < getStateSize()) {
string.append("|"); //$NON-NLS-1$
}
for (int column = 0; column < getInputPortSize(); column++) {
final String format = "%" + columnLengthes[column + getSubSystemSize()] + "s"; //$NON-NLS-1$ //$NON-NLS-2$
string.append(String.format(format, this.getSymbolicDMatrix()[row][column]));
if (column != getInputPortSize() - 1) {
string.append(" "); //$NON-NLS-1$
}
}
string.append("]"); //$NON-NLS-1$
if (withInputOutput && row < symbolicInput.length) {
string.append("[" + symbolicInput[row] + "]"); //$NON-NLS-1$ //$NON-NLS-2$
if (row == getInputPortSize() / 2) {
if (isContinuous()) {
string.append("(t)"); //$NON-NLS-1$
} else {
string.append("(k)"); //$NON-NLS-1$
}
}
}
string.append(lineSeparator);
}
if (withInputOutput && symbolicOutput.length < symbolicInput.length) {
final int lengthTolastLineSeparator = string.lastIndexOf(lineSeparator, string.length() - lineSeparator.length() - 1) + lineSeparator.length();
final int widthOfInputVector = (1 + symbolicInput[0].length() + 1);
int spaceLength = (string.length() - lengthTolastLineSeparator) - 2 - widthOfInputVector;
if (getOutputPortSize() - 1 == getInputPortSize() / 2) {
spaceLength -= 3;
}
final String format = "%" + spaceLength + "s"; //$NON-NLS-1$ //$NON-NLS-2$
for (int i = 0; i < symbolicInput.length - symbolicOutput.length; i++) {
string.append(String.format(format, "")); //$NON-NLS-1$
final int row = symbolicOutput.length + i;
string.append("[" + symbolicInput[row] + "]"); //$NON-NLS-1$ //$NON-NLS-2$
if (row == getInputPortSize() / 2) {
if (isContinuous()) {
string.append("(t)"); //$NON-NLS-1$
} else {
string.append("(k)"); //$NON-NLS-1$
}
}
string.append(lineSeparator);
}
}
return string.toString();
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discrete/DoubleUserDefinedDiscreteStaticSystem.java | 83 |
| org/mklab/tool/control/system/discrete/UserDefinedDiscreteStaticSystem.java | 92 |
return (DoubleMatrix)this.outputFunction.invoke(this.obj, Integer.valueOf(k));
} catch (IllegalArgumentException e) {
throw new SolverStopException(e);
} catch (IllegalAccessException e) {
throw new SolverStopException(e);
} catch (InvocationTargetException e) {
throw new SolverStopException(e.getTargetException());
}
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(final Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try {
this.updateFunction.invoke(this.obj);
} catch (IllegalArgumentException e) {
throw new ParameterException(e);
} catch (IllegalAccessException e) {
throw new ParameterException(e);
} catch (InvocationTargetException e) {
throw new ParameterException(e.getTargetException());
} catch (Exception e) {
throw new ParameterException(e);
}
}
/**
* @see org.mklab.tool.control.system.discrete.BaseDiscreteStaticSystem#initialize()
*/
@Override
public void initialize() {
super.initialize();
try {
if (this.initializeFunction != null) {
this.initializeFunction.invoke(this.obj);
}
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e.getTargetException());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/source/DoubleUserDefinedDiscreteSource.java | 66 |
| org/mklab/tool/control/system/source/UserDefinedDiscreteSource.java | 75 |
return (DoubleMatrix)this.outputFunction.invoke(this.obj, Integer.valueOf(k));
} catch (IllegalArgumentException e) {
throw new SolverStopException(e);
} catch (IllegalAccessException e) {
throw new SolverStopException(e);
} catch (InvocationTargetException e) {
throw new SolverStopException(e.getTargetException());
}
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try {
this.updateFunction.invoke(this.obj);
} catch (IllegalArgumentException e) {
throw new ParameterException(e);
} catch (IllegalAccessException e) {
throw new ParameterException(e);
} catch (InvocationTargetException e) {
throw new ParameterException(e.getTargetException());
} catch (Exception e) {
throw new ParameterException(e);
}
}
/**
* @see org.mklab.tool.control.system.discrete.BaseDiscreteStaticSystem#initialize()
*/
@Override
public void initialize() {
super.initialize();
try {
if (this.initializeFunction != null) {
this.initializeFunction.invoke(this.obj);
}
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e.getTargetException());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discrete/UnitLeadSystem.java | 40 |
| org/mklab/tool/control/system/discrete/UnitLeadSystem.java | 87 |
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));
RS[][] aa = this.sunit.createArray(2, 2);
aa[0][0] = this.sunit.create(0);
aa[0][1] = this.sunit.create(1);
aa[1][0] = this.sunit.create(-1);
aa[1][1] = this.sunit.create(0);
RM a = this.sunit.createGrid(aa);
RS[][] bb = this.sunit.createArray(2, 1);
bb[0][0] = this.sunit.create(0);
bb[1][0] = this.sunit.create(1);
RM b= this.sunit.createGrid(bb);
RS[][] cc = this.sunit.createArray(1, 2);
cc[0][0] = this.sunit.create(0);
cc[0][1] = this.sunit.create(1);
RM c = this.sunit.createGrid(cc);
RS[][] dd = this.sunit.createArray(1,1);
dd[0][0] = this.sunit.create(0);
RM d = this.sunit.createGrid(dd);
RS[][] ee = this.sunit.createArray(2, 2);
ee[0][0] = this.sunit.create(1);
ee[0][1] = this.sunit.create(0);
ee[1][0] = this.sunit.create(0);
ee[1][1] = this.sunit.create(0);
RM e = this.sunit.createGrid(ee);
setLinearSystem(LinearSystemFactory.createLinearSystem(a, b, c, d, e));
}
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setOutputSize(int)
*/
@Override
public void setOutputSize(final int size) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleUserDefinedContinuousStaticSystem.java | 83 |
| org/mklab/tool/control/system/continuous/UserDefinedContinuousStaticSystem.java | 92 |
return (DoubleMatrix)this.outputFunction.invoke(this.object, Double.valueOf(t));
} catch (IllegalArgumentException e) {
throw new SolverStopException(e);
} catch (IllegalAccessException e) {
throw new SolverStopException(e);
} catch (InvocationTargetException e) {
throw new SolverStopException(e.getTargetException());
}
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try {
this.updateFunction.invoke(null);
} catch (IllegalArgumentException e) {
throw new ParameterException(e);
} catch (IllegalAccessException e) {
throw new ParameterException(e);
} catch (InvocationTargetException e) {
throw new ParameterException(e.getTargetException());
} catch (Exception e) {
throw new ParameterException(e);
}
}
/**
* @see org.mklab.tool.control.system.discrete.BaseDiscreteStaticSystem#initialize()
*/
@Override
public void initialize() {
super.initialize();
try {
if (this.initializeFunction != null) {
this.initializeFunction.invoke(this.object);
}
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e.getTargetException());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 2509 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 2502 |
final LinearSystem<RS, RM, CS, CM> linearSystem = LinearSystemFactory.createLinearSystem(a, b, c, d);
final String[][] aSymbol = allSystem.createSymbolicA(stateSizes, processor);
final String[][] bSymbol = allSystem.createSymbolicB(stateSizes, processor);
final String[][] cSymbol = allSystem.createSymbolicC(stateSizes, processor);
final String[][] dSymbol = allSystem.createSymbolicD(processor);
try (PrintWriter writer = new PrintWriter(new FileWriter("test.txt"))) { //$NON-NLS-1$
writer.print("A = ["); //$NON-NLS-1$
writer.flush();
createDeclearMM(aSymbol, writer);
writer.print("B = ["); //$NON-NLS-1$
writer.flush();
createDeclearMM(bSymbol, writer);
writer.print("C = ["); //$NON-NLS-1$
writer.flush();
createDeclearMM(cSymbol, writer);
writer.print("D = ["); //$NON-NLS-1$
writer.flush();
createDeclearMM(dSymbol, writer);
} catch (IOException e) {
throw new RuntimeException(e);
}
linearSystem.setSymbolicString(aSymbol, bSymbol, cSymbol, dSymbol, null);
allSystem.setInputOutputStateTagToLinearSystem(linearSystem, stateSizes);
if (allSystem.isContinuous()) {
linearSystem.setTimeDomainType(TimeDomainType.CONTINUOUS);
} else if (isDiscrete()) {
linearSystem.setTimeDomainType(TimeDomainType.DISCRETE);
} else {
linearSystem.setTimeDomainType(TimeDomainType.SAMPLED);
}
return linearSystem;
}
/**
* @param symbol シンボルの配列
* @param writer 出力先
*/
private void createDeclearMM(final String[][] symbol, PrintWriter writer) {
for (int i = 0; i < symbol.length; i++) {
if ((symbol.length == 1) == false) {
writer.print("["); //$NON-NLS-1$
}
for (int j = 0; j < symbol[0].length; j++) {
writer.print(symbol[i][j]);
writer.flush();
if ((j == symbol[0].length - 1) == false) {
writer.print(","); //$NON-NLS-1$
}
}
if ((symbol.length == 1) == false) {
writer.print("]"); //$NON-NLS-1$
}
}
writer.print("];"); //$NON-NLS-1$
writer.print(System.getProperty("line.separator")); //$NON-NLS-1$
writer.flush();
}
/**
* 入力ノードから出力ノードまでの線形システムを返します。
*
* @param requiringReachableSubSystem 可到達なサブシステム(入力ノードから出力ノードまでのパスに対応するシステム)を求めるならばtrue
* @param processor 逆ポーランド記法のプロセッサー
*
* @return 入力ノードから出力ノードまでの線形システム
*/
public LinearSystem<RS, RM, CS, CM> getLinearSystemByProcessor(final boolean requiringReachableSubSystem, final ReversePolishNotationProcessor<RS, RM> processor) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/parameter/DoubleParameterContainer.java | 669 |
| org/mklab/tool/control/system/parameter/ParameterContainer.java | 676 |
final Class<? extends DoubleSystemOperator> superKlass = klass.getSuperclass().asSubclass(DoubleSystemOperator.class);
if (ParameterUpdator.class.isAssignableFrom(superKlass) == false) {
return;
}
try {
final Method method = superKlass.getMethod("updateWith", String.class); //$NON-NLS-1$
final Boolean success = (Boolean)method.invoke(this.system, getName());
if (success.booleanValue()) {
return;
}
updateWithSuperParameter(superKlass);
} catch (SecurityException e) {
throw new ParameterAccessException(e);
} catch (NoSuchMethodException e) {
throw new ParameterAccessException(e);
} catch (IllegalArgumentException e) {
throw new ParameterAccessException(e);
} catch (IllegalAccessException e) {
throw new ParameterAccessException(e);
} catch (InvocationTargetException e) {
throw new ParameterAccessException(e.getTargetException());
}
}
/**
* 配列パラメータの指数を返します。
*
* @param elementName 配列パラメータの名前
* @return 配列パラメータの指数
*/
public static int getIndexOfArray(final String elementName) {
final int start = elementName.indexOf("["); //$NON-NLS-1$
final int end1 = elementName.indexOf("/"); //$NON-NLS-1$
final int end2 = elementName.indexOf("]"); //$NON-NLS-1$
if (end1 < 0) {
return Integer.parseInt(elementName.substring(start + 1, end2)) - 1;
}
final int index = Integer.parseInt(elementName.substring(start + 1, end1)) - 1;
return index;
}
/**
* 配列パラメータの成分の個数を返します。
*
* @param elementName 配列パラメータの名前
* @return 配列パラメータの成分の個数
*/
public static int getArrayLength(final String elementName) {
final int start = elementName.indexOf("["); //$NON-NLS-1$
final int end1 = elementName.indexOf("/"); //$NON-NLS-1$
final int end2 = elementName.indexOf("]"); //$NON-NLS-1$
if (start < 0) {
throw new IllegalArgumentException(Messages.getString("ParameterContainer.18")); //$NON-NLS-1$
}
if (end1 < 0) {
return Integer.parseInt(elementName.substring(start + 1, end2));
}
return Integer.parseInt(elementName.substring(end1 + 1, end2));
}
/**
* パラメータの説明が国際化されているか判定します。
*
* @return パラメータの説明が国際化されていればtrue、そうでなければfalse
*/
public boolean isInternationalized() {
return this.anotation.internationalization();
}
/**
* 国際化されたパラメータの説明を返します。
*
* @param key キー
* @return 国際化されたパラメータの説明
* @throws ParameterException パラメータの説明が国際化されていない場合
*/
public String getInternationalizedString(final String key) throws ParameterException {
if (this.system instanceof StringExternalizable) {
return ((StringExternalizable)this.system).getString(key);
}
throw new ParameterException(Messages.getString("ParameterContainer.19")); //$NON-NLS-1$
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sink/DoubleUserDefinedDiscreteSink.java | 84 |
| org/mklab/tool/control/system/sink/UserDefinedDiscreteSink.java | 93 |
return new DoubleMatrix(getInputSize(), 1);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try {
if (this.updateFunction != null) {
this.updateFunction.invoke(this.obj);
}
} catch (IllegalArgumentException e) {
throw new ParameterException(e);
} catch (IllegalAccessException e) {
throw new ParameterException(e);
} catch (InvocationTargetException e) {
throw new ParameterException(e.getTargetException());
} catch (Exception e) {
throw new ParameterException(e);
}
}
/**
* @see org.mklab.tool.control.system.discrete.BaseDiscreteStaticSystem#initialize()
*/
@Override
public void initialize() {
super.initialize();
try {
if (this.initializeFunction != null) {
this.initializeFunction.invoke(this.obj);
}
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e.getTargetException());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sink/DoubleUserDefinedContinuousSink.java | 84 |
| org/mklab/tool/control/system/sink/UserDefinedContinuousSink.java | 93 |
return new DoubleMatrix(getInputSize(), 1);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try {
this.updateFunction.invoke(this.obj);
} catch (IllegalArgumentException e) {
throw new ParameterException(e);
} catch (IllegalAccessException e) {
throw new ParameterException(e);
} catch (InvocationTargetException e) {
throw new ParameterException(e.getTargetException());
} catch (Exception e) {
throw new ParameterException(e);
}
}
/**
* @see org.mklab.tool.control.system.discrete.BaseDiscreteStaticSystem#initialize()
*/
@Override
public void initialize() {
super.initialize();
try {
if (this.initializeFunction != null) {
this.initializeFunction.invoke(this.obj);
}
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e.getTargetException());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discrete/UnitLeadSystem.java | 50 |
| org/mklab/tool/control/system/discrete/UnitLeadSystem.java | 97 |
| org/mklab/tool/control/system/discrete/UnitLeadSystem.java | 141 |
super.setInitialState(this.sunit.createZeroGrid(size, 1));
RS[][] aa = this.sunit.createArray(2, 2);
aa[0][0] = this.sunit.create(0);
aa[0][1] = this.sunit.create(1);
aa[1][0] = this.sunit.create(-1);
aa[1][1] = this.sunit.create(0);
RM a = this.sunit.createGrid(aa);
RS[][] bb = this.sunit.createArray(2, 1);
bb[0][0] = this.sunit.create(0);
bb[1][0] = this.sunit.create(1);
RM b= this.sunit.createGrid(bb);
RS[][] cc = this.sunit.createArray(1, 2);
cc[0][0] = this.sunit.create(0);
cc[0][1] = this.sunit.create(1);
RM c = this.sunit.createGrid(cc);
RS[][] dd = this.sunit.createArray(1,1);
dd[0][0] = this.sunit.create(0);
RM d = this.sunit.createGrid(dd);
RS[][] ee = this.sunit.createArray(2, 2);
ee[0][0] = this.sunit.create(1);
ee[0][1] = this.sunit.create(0);
ee[1][0] = this.sunit.create(0);
ee[1][1] = this.sunit.create(0);
RM e = this.sunit.createGrid(ee);
setLinearSystem(LinearSystemFactory.createLinearSystem(a, b, c, d, e));
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sink/DoubleUserDefinedContinuousSink.java | 85 |
| org/mklab/tool/control/system/sink/UserDefinedContinuousSink.java | 94 |
| org/mklab/tool/control/system/source/DoubleUserDefinedDiscreteSource.java | 74 |
| org/mklab/tool/control/system/source/UserDefinedDiscreteSource.java | 83 |
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try {
this.updateFunction.invoke(this.obj);
} catch (IllegalArgumentException e) {
throw new ParameterException(e);
} catch (IllegalAccessException e) {
throw new ParameterException(e);
} catch (InvocationTargetException e) {
throw new ParameterException(e.getTargetException());
} catch (Exception e) {
throw new ParameterException(e);
}
}
/**
* @see org.mklab.tool.control.system.discrete.BaseDiscreteStaticSystem#initialize()
*/
@Override
public void initialize() {
super.initialize();
try {
if (this.initializeFunction != null) {
this.initializeFunction.invoke(this.obj);
}
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e.getTargetException());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleSystemBuilder.java | 809 |
| org/mklab/tool/control/system/SystemBuilder.java | 830 |
return this.adjacencyMatrix.equals(((DoubleSystemBuilder)opponent).adjacencyMatrix);
}
/**
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
return this.blockSystem.hashCode();
}
/**
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
if (isDynamic()) {
return Messages.getString("ControlSystem.27") + getInputSize() + Messages.getString("ControlSystem.28") + getOutputSize() + Messages.getString("ControlSystem.29") + getStateSize() + Messages.getString("ControlSystem.30"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
return Messages.getString("ControlSystem.31") + getInputSize() + Messages.getString("ControlSystem.32") + getOutputSize() + Messages.getString("ControlSystem.33"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
/**
* 入力の数を返します。
*
* @return 入力の数
*/
public int getInputSize() {
if (isSingleSystem()) {
return (this.adjacencyMatrix.getElement(1, 2)).getInputSize();
}
return this.blockSystem.getInputSize();
}
/**
* 入力の数を設定します。
*
* @param inputSize 入力の数
*/
public void setInputSize(final int inputSize) {
if (isSingleSystem()) {
(this.adjacencyMatrix.getElement(1, 2)).setInputSize(inputSize);
}
this.blockSystem.setInputSize(inputSize);
}
/**
* 出力の数を返します。
*
* @return 出力の数
*/
public int getOutputSize() {
if (isSingleSystem()) {
return (this.adjacencyMatrix.getElement(1, 2)).getOutputSize();
}
return this.blockSystem.getOutputSize();
}
/**
* 出力の数を設定します。
*
* @param outputSize 出力の数
*/
public void setOutputSize(final int outputSize) {
if (isSingleSystem()) {
(this.adjacencyMatrix.getElement(1, 2)).setOutputSize(outputSize);
}
this.blockSystem.setOutputSize(outputSize);
}
/**
* 状態の数を返します。
*
* @return 状態の数
*/
public int getStateSize() {
if (isSingleSystem()) {
return (this.adjacencyMatrix.getElement(1, 2)).getStateSize();
}
return this.blockSystem.getStateSize();
}
/**
* 動的システムであるか判定します。
*
* @return 動的システムならばtrue、そうでなければfalse
*/
public boolean isDynamic() {
return this.blockSystem.isDynamic();
}
/**
* 静的システムであるか判定します。
*
* @return 静的システムならばtrue、そうでなければfalse
*/
public boolean isStatic() {
return this.blockSystem.isStatic();
}
/**
* 連続時間システムであるか判定します。
*
* @return 連続時間システムならばtrue、そうでなければfalse
*/
public boolean isContinuous() {
if (this.blockSystem instanceof DoubleBlockContinuousSystem) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/IntegratorSystem.java | 41 |
| org/mklab/tool/control/system/discrete/UnitDelaySystem.java | 41 |
public IntegratorSystem(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());
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/WeierstrassForm.java | 338 |
| org/mklab/tool/control/WeierstrassForm.java | 546 |
private List<RM> blockDiagonaliize(final RM A, final RM E, RS tolerance) {
int zeroCount = 0;
for (int i = 1; i <= E.getColumnSize(); i++) {
if (E.getElement(i, i).isZero(tolerance)) {
zeroCount = i - 1;
break;
}
}
final RM A11 = A.getSubMatrix(1, zeroCount, 1, zeroCount);
final RM A12 = A.getSubMatrix(1, zeroCount, 1 + zeroCount, A.getColumnSize());
final RM A22 = A.getSubMatrix(1 + zeroCount, A.getColumnSize(), 1 + zeroCount, A.getColumnSize());
final RM E11 = E.getSubMatrix(1, zeroCount, 1, zeroCount);
final RM E12 = E.getSubMatrix(1, zeroCount, 1 + zeroCount, E.getColumnSize());
final RM E22 = E.getSubMatrix(1 + zeroCount, E.getColumnSize(), 1 + zeroCount, E.getColumnSize());
if (zeroCount == 0) {
this.BDL = upperTriInverse(A22);
this.BDR = A.createUnit();
RM bA = A22.createUnit();
//NumericalMatrixOperator<?> bE = (NumericalMatrixOperator<?>)upperTriInverse(A22).multiply(E22);
RM bE = A22.leftDivide(E22);
List<RM> ans = new ArrayList<>();
ans.add(bA);
ans.add(bE);
return ans;
} else if (zeroCount == A.getColumnSize()) {
this.BDL = upperTriInverse(E11);
this.BDR = A.createUnit();
//NumericalMatrixOperator<?> bA = (NumericalMatrixOperator<?>)upperTriInverse(E11).multiply(A11);
RM bA = E11.leftDivide(A11);
RM bE = E22.createUnit();
List<RM> ans = new ArrayList<>();
ans.add(bA);
ans.add(bE);
return ans;
} else {
int m = A11.getColumnSize();
int n = A22.getColumnSize();
final RM blockMatrix = A.createZero(m * n, m * n); | |
| File | Line |
|---|---|
| org/mklab/tool/control/WeierstrassForm.java | 457 |
| org/mklab/tool/control/WeierstrassForm.java | 600 |
this.BDL.setSubMatrix(1, m, m + 1, m + n, invE11.multiply(BDL12));
this.BDL.setSubMatrix(m + 1, m + n, m + 1, m + n, upperTriInverse(A22));
RM bA = A.createClone();
//bA.setSubMatrix(1, A11.getRowSize(), 1, A11.getColumnSize(), upperTriInverse(E11).multiply(A11));
bA.setSubMatrix(1, A11.getRowSize(), 1, A11.getColumnSize(), E11.leftDivide(A11));
bA.setSubMatrix(1, A11.getRowSize(), 1 + A11.getColumnSize(), A.getColumnSize(), A12.createZero());
bA.setSubMatrix(1 + A11.getRowSize(), A.getRowSize(), 1, A11.getColumnSize(), A12.transpose().createZero());
bA.setSubMatrix(1 + A11.getRowSize(), A.getRowSize(), 1 + A11.getColumnSize(), A.getColumnSize(), A22.createUnit());
RM bE = E.createClone();
bE.setSubMatrix(1, A11.getRowSize(), 1, A11.getColumnSize(), E11.createUnit());
bE.setSubMatrix(1, A11.getRowSize(), 1 + A11.getColumnSize(), A.getColumnSize(), A12.createZero());
bE.setSubMatrix(1 + A11.getRowSize(), A.getRowSize(), 1, A11.getColumnSize(), A12.transpose().createZero());
//bE.setSubMatrix(1 + A11.getRowSize(), A.getRowSize(), 1 + A11.getColumnSize(), A.getColumnSize(), upperTriInverse(A22).multiply(E22));
bE.setSubMatrix(1 + A11.getRowSize(), A.getRowSize(), 1 + A11.getColumnSize(), A.getColumnSize(), A22.leftDivide(E22));
List<RM> ans = new ArrayList<>();
ans.add(bA);
ans.add(bE);
return ans;
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 2880 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 2872 |
ans = new AdjacencyMatrix<>(newMatrix, this.sunit);
ans.modifyID();
ans.setInputNodes(tempInputNodes);
ans.setSourceNodes(tempSourceNodes);
ans.setOutputNodes(tempOutputNodes);
ans.setSinkNodes(tempSinkNodes);
ans.setInputPortTags(tempInputPortTags);
ans.setOutputPortTags(tempOutputPortTags);
ans.setRequiringLinearSystem(this.requiringLinearSystem);
ans.setRequiringDescriptor(this.requiringDescriptor);
ans.setRequiringPrimitiveExpression(this.requiringPrimitiveExpression);
ans.shiftInputNodeByInserting(insertingNodes);
ans.shiftSourceNodeByInserting(insertingNodes);
ans.shiftOutputNodeByInserting(insertingNodes);
ans.shiftSinkNodeByInserting(insertingNodes);
final List<Integer> newOutputNodes = new ArrayList<>();
for (Integer node : ans.outputNodes) {
newOutputNodes.add(node);
if (false == (node.equals(output + offset))) continue;
for (int i = 1; i <= expandOutputSize; i++) {
newOutputNodes.add(i + output + offset);
}
}
ans.setOutputNodes(newOutputNodes);
tempOutputNodes = newOutputNodes;
final Map<Integer, String> newOutputPortTags = new HashMap<>();
final String tag = ans.outputPortTags.get(output + offset);
for (Integer node : ans.outputNodes) {
if (node < output + offset + 1) {
if (node.equals(output + offset)) {
newOutputPortTags.put(node, tag + "_" + 1); //$NON-NLS-1$
for (int i = 1; i <= expandOutputSize; i++) {
newOutputPortTags.put(node + i, tag + "_" + (i + 1)); //$NON-NLS-1$
}
continue;
}
newOutputPortTags.put(node, ans.outputPortTags.get(node));
}
if (node > output + offset + expandOutputSize) {
newOutputPortTags.put(node, ans.outputPortTags.get(node));
}
}
ans.setOutputPortTags(newOutputPortTags);
tempOutputPortTags = newOutputPortTags;
offset = expandOutputSize;
}
return ans;
}
/**
* 定数行列を最小の要素に分割した隣接行列を返します.
*
* @return 定数行列を展開した隣接行列
*/
private AdjacencyMatrix<RS, RM, CS, CM> expandConstantAndIntegratorSystem() { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyStringMatrix.java | 656 |
| org/mklab/tool/control/system/DoubleAdjacencyStringMatrix.java | 648 |
if (system instanceof Ground && isConnectedToMultiplexer(column - 1)) {
final int outputSize = system.getOutputSize();
if (outputSize == -1) {
changed = true;
this.nodeDegrees[column - 1] = 0;
system.setOutputSize(0);
}
}
} else if (weight.equals("P") || weight.equals("N")) { //$NON-NLS-1$ //$NON-NLS-2$
if (this.nodeDegrees[row - 1] == -1 && this.nodeDegrees[column - 1] != -1) {
changed = true;
this.nodeDegrees[row - 1] = this.nodeDegrees[column - 1];
}
if (this.nodeDegrees[column - 1] == -1 && this.nodeDegrees[row - 1] != -1) {
changed = true;
this.nodeDegrees[column - 1] = this.nodeDegrees[row - 1];
}
}
}
}
if (setupMultiplexerNodeDegree()) {
changed = true;
}
if (setupDeMultiplexerNodeDegree()) {
changed = true;
}
} while (changed);
setInputSizeAndOutputSize();
}
/**
* 接続先が多重器であるか判定します。
*
* @param node 接続先をしらべるノード
* @return 接続先が多重器ならばtrue、そうでなければfalse
*/
private boolean isConnectedToMultiplexer(final int node) {
for (int column = 1; column <= this.size(); column++) {
final String weight = this.elements.getElement(node + 1, column);
if (weight.length() == 0) {
continue;
}
if (weight.startsWith("M")) { //$NON-NLS-1$
return true;
}
}
return false;
}
/**
* 入力数と出力数が未定のシステムの入出力数を設定します。
*/
private void setInputSizeAndOutputSize() {
final int size = this.size();
for (int row = 1; row <= size; row++) {
for (int column = 1; column <= size; column++) {
final String weight = this.elements.getElement(row, column);
if (weight.length() == 0) {
continue;
}
final SystemBuilder<RS,RM,CS,CM> controlSystem = getControlSystem(weight); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discrete/DoubleUserDefinedDiscreteDynamicSystem.java | 135 |
| org/mklab/tool/control/system/discrete/UserDefinedDiscreteDynamicSystem.java | 144 |
| org/mklab/tool/control/system/sink/DoubleUserDefinedContinuousSink.java | 99 |
| org/mklab/tool/control/system/sink/UserDefinedContinuousSink.java | 108 |
| org/mklab/tool/control/system/source/DoubleUserDefinedDiscreteSource.java | 88 |
| org/mklab/tool/control/system/source/UserDefinedDiscreteSource.java | 97 |
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try {
this.updateFunction.invoke(this.obj);
} catch (IllegalArgumentException e) {
throw new ParameterException(e);
} catch (IllegalAccessException e) {
throw new ParameterException(e);
} catch (InvocationTargetException e) {
throw new ParameterException(e.getTargetException());
} catch (Exception e) {
throw new ParameterException(e);
}
}
/**
* @see org.mklab.tool.control.system.discrete.BaseDiscreteStaticSystem#initialize()
*/
@Override
public void initialize() {
super.initialize();
try {
if (this.initializeFunction != null) {
this.initializeFunction.invoke(this.obj);
}
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e.getTargetException());
} catch (Exception e) {
throw new RuntimeException(e);
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discrete/DoubleUserDefinedDiscreteStaticSystem.java | 113 |
| org/mklab/tool/control/system/discrete/UserDefinedDiscreteStaticSystem.java | 122 |
| org/mklab/tool/control/system/sink/DoubleUserDefinedContinuousSink.java | 107 |
| org/mklab/tool/control/system/sink/UserDefinedContinuousSink.java | 116 |
| org/mklab/tool/control/system/source/DoubleUserDefinedDiscreteSource.java | 96 |
| org/mklab/tool/control/system/source/UserDefinedDiscreteSource.java | 105 |
public void setOutputFunction(final Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try {
this.updateFunction.invoke(this.obj);
} catch (IllegalArgumentException e) {
throw new ParameterException(e);
} catch (IllegalAccessException e) {
throw new ParameterException(e);
} catch (InvocationTargetException e) {
throw new ParameterException(e.getTargetException());
} catch (Exception e) {
throw new ParameterException(e);
}
}
/**
* @see org.mklab.tool.control.system.discrete.BaseDiscreteStaticSystem#initialize()
*/
@Override
public void initialize() {
super.initialize();
try {
if (this.initializeFunction != null) {
this.initializeFunction.invoke(this.obj);
}
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e.getTargetException());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discrete/DoubleUserDefinedDiscreteDynamicSystem.java | 143 |
| org/mklab/tool/control/system/discrete/DoubleUserDefinedDiscreteStaticSystem.java | 113 |
| org/mklab/tool/control/system/discrete/UserDefinedDiscreteDynamicSystem.java | 152 |
| org/mklab/tool/control/system/discrete/UserDefinedDiscreteStaticSystem.java | 122 |
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try {
this.updateFunction.invoke(this.obj);
} catch (IllegalArgumentException e) {
throw new ParameterException(e);
} catch (IllegalAccessException e) {
throw new ParameterException(e);
} catch (InvocationTargetException e) {
throw new ParameterException(e.getTargetException());
} catch (Exception e) {
throw new ParameterException(e);
}
}
/**
* @see org.mklab.tool.control.system.discrete.BaseDiscreteStaticSystem#initialize()
*/
@Override
public void initialize() {
super.initialize();
try {
if (this.initializeFunction != null) {
this.initializeFunction.invoke(this.obj);
}
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e.getTargetException());
} catch (Exception e) {
throw new RuntimeException(e);
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 4184 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 4176 |
final AdjacencyMatrix<RS, RM, CS, CM> inst = super.createClone();
inst.requiringLinearSystem = this.requiringLinearSystem;
inst.requiringDescriptor = this.requiringDescriptor;
inst.requiringPrimitiveExpression = this.requiringPrimitiveExpression;
if (this.inputNodes == null) {
inst.inputNodes = null;
} else {
final Integer[] inNodes = new Integer[this.inputNodes.size()];
inst.inputNodes = new ArrayList<>(Arrays.asList(this.inputNodes.toArray(inNodes)));
}
if (this.sourceNodes == null) {
inst.sourceNodes = null;
} else {
final Integer[] inNodes = new Integer[this.sourceNodes.size()];
inst.sourceNodes = new ArrayList<>(Arrays.asList(this.sourceNodes.toArray(inNodes)));
}
if (this.outputNodes == null) {
inst.outputNodes = null;
} else {
final Integer[] outNodes = new Integer[this.outputNodes.size()];
inst.outputNodes = new ArrayList<>(Arrays.asList(this.outputNodes.toArray(outNodes)));
}
if (this.sinkNodes == null) {
inst.sinkNodes = null;
} else {
final Integer[] outNodes = new Integer[this.sinkNodes.size()];
inst.sinkNodes = new ArrayList<>(Arrays.asList(this.sinkNodes.toArray(outNodes)));
}
if (this.inputPortTags == null) {
inst.inputPortTags = null;
} else {
inst.inputPortTags = new TreeMap<>(this.inputPortTags);
}
if (this.inputPortTags == null) {
inst.outputPortTags = null;
} else {
inst.outputPortTags = new TreeMap<>(this.outputPortTags);
}
return inst;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleIntegratorSystem.java | 32 |
| org/mklab/tool/control/system/discrete/DoubleUnitDelaySystem.java | 32 |
public DoubleIntegratorSystem() {
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(size, size), DoubleMatrix.unit(size, size), DoubleMatrix.unit(size, size), new DoubleMatrix(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(new DoubleMatrix(size, 1));
setLinearSystem(DoubleLinearSystemFactory.createLinearSystem(new DoubleMatrix(size, size), DoubleMatrix.unit(size, size), DoubleMatrix.unit(size, size), new DoubleMatrix(size, size)));
}
}
/**
* {@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(size, size), DoubleMatrix.unit(size, size), DoubleMatrix.unit(size, size), new DoubleMatrix(size, size)));
}
setInputSize(initialState.length());
setOutputSize(initialState.length());
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 1617 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 1609 |
if (systemOperator instanceof ConstantSystem && false == (systemOperator.getLinearSystem() == null)) {
if (systemOperator.getLinearSystem().getD().isZero() == false) mat.setElement(row + 1, column + 1, true);
} else {
mat.setElement(row + 1, column + 1, true);
}
}
newElements[row][column] = systemOperator;
}
}
final BooleanMatrix anyInput = mat.anyTrueRowWise().transpose();
final BooleanMatrix anyOutput = mat.anyTrueColumnWise();
final IntMatrix noInputNoOutput = anyInput.orElementWise(anyOutput).notElementWise().find();
final int removingSize = noInputNoOutput.length();
int[] removingNodes = null;
if (removingSize > 0) {
removingNodes = new int[removingSize];
for (int i = 0; i < removingSize; i++) {
removingNodes[i] = noInputNoOutput.getIntElement(i + 1) - 1; // GridUtilのインデックスは0から
}
newElements = GridUtil.removeColumnVectors(newElements, removingNodes);
newElements = GridUtil.removeRowVectors(newElements, removingNodes);
for (int removingNode : removingNodes) {
if (this.inputNodes.contains(removingNode + 1)) {
this.inputNodes.remove(Integer.valueOf(removingNode + 1));
this.inputPortTags.remove(Integer.valueOf(removingNode + 1));
}
if (this.outputNodes.contains(removingNode + 1)) {
this.outputNodes.remove(Integer.valueOf(removingNode + 1));
this.outputPortTags.remove(Integer.valueOf(removingNode + 1));
}
}
}
final AdjacencyMatrix<RS, RM, CS, CM> ans = new AdjacencyMatrix<>(newElements, this.sunit); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/BlockSystem.java | 591 |
| org/mklab/tool/control/system/DoubleBlockSystem.java | 572 |
if (system == ZeroSystem.getInstance(this.sunit)) {
continue;
}
final int inputNodeSize = this.nodeSizes[row];
if (inputNodeSize != -1) {
if (system.isAutoSize() == false && system.getInputSize() != inputNodeSize) {
throw new RuntimeException("" + system + ": " + Messages.getString("BlockSystem.3")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
if (inputNodeSize != system.getInputSize()) {
system.setInputSize(inputNodeSize);
if (this.nodeSizes[column] != system.getOutputSize() && system.getOutputSize() != -1) {
this.nodeSizes[column] = system.getOutputSize();
nodeSizeResized = true;
}
}
}
final int outputNodeSize = this.nodeSizes[column];
if (outputNodeSize != -1) {
if (system.isAutoSize() == false && system.getOutputSize() != outputNodeSize) {
throw new RuntimeException("" + system + ": " + Messages.getString("BlockSystem.4")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
if (outputNodeSize != system.getOutputSize()) {
system.setOutputSize(outputNodeSize);
if (this.nodeSizes[row] != system.getInputSize() && system.getInputSize() != -1) {
this.nodeSizes[row] = system.getInputSize();
nodeSizeResized = true;
}
}
}
}
}
} while (nodeSizeResized);
}
/**
* システムと入力ノード番号の対を設定します。
*/
@SuppressWarnings("boxing")
private void setupInputMap() {
this.inputMap.clear();
final int size = this.nodeSize;
for (int row = 0; row < size; row++) {
for (int column = 0; column < size; column++) {
final SystemOperator<RS,RM,CS,CM> system = this.elements[row][column]; | |
| File | Line |
|---|---|
| org/mklab/tool/matrix/Makepoly.java | 81 |
| org/mklab/tool/matrix/Makepoly.java | 198 |
}
/**
* もし<code>A</code>が正方行列なら、<code>det(sI - A)</code>、すなわち <code>A</code>の特性多項式を返します。
*
* <p> もし<code>A</code>がベクトルなら、 <code>A</code>の成分を根とする多項式を返します。
*
* @param <RPS> 実多項式の型
* @param <RPM> 実多項式行列の型
* @param <CPS> 複素多項式の型
* @param <CPM> 複素多項式行列の型
* @param <RRS> 実有理多項式の型
* @param <RRM> 実有理多項式行列の型
* @param <CRS> 複素有理多項式の型
* @param <CRM> 複素有理多項式行列の型
* @param <RES> 実係数スカラーの型
* @param <REM> 実係数行列の型
* @param <CES> 複素係数スカラーの型
* @param <CEM> 複素係数行列の型
* @param A 多項式の根(正方行列)
* @param rs real symbolic
* @return 特性多項式 (characteristic polynomial)
*/
public static <RPS extends RealPolynomial<RPS,RPM,CPS,CPM,RRS,RRM,CRS,CRM,RES,REM,CES,CEM>, RPM extends RealPolynomialMatrix<RPS,RPM,CPS,CPM,RRS,RRM,CRS,CRM,RES,REM,CES,CEM>, CPS extends ComplexPolynomial<RPS,RPM,CPS,CPM,RRS,RRM,CRS,CRM,RES,REM,CES,CEM>, CPM extends ComplexPolynomialMatrix<RPS,RPM,CPS,CPM,RRS,RRM,CRS,CRM,RES,REM,CES,CEM>, RRS extends RealRationalPolynomial<RPS, RPM, CPS, CPM, RRS, RRM, CRS, CRM, RES, REM, CES, CEM>, RRM extends RealRationalPolynomialMatrix<RPS, RPM, CPS, CPM, RRS, RRM, CRS, CRM, RES, REM, CES, CEM>, CRS extends ComplexRationalPolynomial<RPS, RPM, CPS, CPM, RRS, RRM, CRS, CRM, RES, REM, CES, CEM>, CRM extends ComplexRationalPolynomialMatrix<RPS, RPM, CPS, CPM, RRS, RRM, CRS, CRM, RES, REM, CES, CEM>, RES extends RealNumericalScalar<RES,REM,CES,CEM>, REM extends RealNumericalMatrix<RES,REM,CES,CEM>, CES extends ComplexNumericalScalar<RES,REM,CES,CEM>, CEM extends ComplexNumericalMatrix<RES,REM,CES,CEM>> RPS makepoly(REM A, RPS rs) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleSystemBuilder.java | 565 |
| org/mklab/tool/control/system/SystemBuilder.java | 586 |
private void setupMultiplexer(final DoubleSystemOperator[][] systemMatrix, final DoubleAdjacencyStringMatrix matrix, final int inputPortSize) {
final int inputPortOutputPortLines = 2;
final int innerSize = matrix.size() - inputPortOutputPortLines;
int multiplexerInputPortSize = 0;
for (int column = 2; column <= innerSize + 1; column++) {
final Map<Integer, Integer> muxInputs = new TreeMap<>();
for (int row = 2; row <= innerSize + 1; row++) {
// 隣接関係を保持する文字列行列から値(文字列)を取り出す.
final String weight = matrix.getWeightOfEdge(row, column);
if (weight.startsWith("M") == false) { //$NON-NLS-1$
continue;
}
muxInputs.put(Integer.parseInt(weight.substring(1, weight.indexOf("/"))), matrix.getNodeDegree(row)); //$NON-NLS-1$
multiplexerInputPortSize = Integer.parseInt(weight.substring(weight.indexOf("/") + 1)); //$NON-NLS-1$
}
if (muxInputs.size() == 0) {
continue;
}
// 接続元のない入力ポートがある場合、信号の大きさを0とする。
for (int i = 1; i <= multiplexerInputPortSize; i++) {
if (muxInputs.containsKey(i)) {
continue;
}
muxInputs.put(i, 0);
}
// 出力ポートのノードの次数が未定の場合
if (matrix.getNodeDegree(column) == -1) {
int outputSize = 0;
boolean allInputSizeDefined = true;
for (int inputSize : muxInputs.values()) {
if (inputSize == -1) {
allInputSizeDefined = false;
break;
}
outputSize += inputSize;
}
if (allInputSizeDefined) {
matrix.setNodeDegree(column, outputSize);
}
}
setupUnconnectedPort(matrix, muxInputs, multiplexerInputPortSize, column);
final List<Integer> inputSizes = new ArrayList<>(muxInputs.values()); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleSystemBuilder.java | 657 |
| org/mklab/tool/control/system/SystemBuilder.java | 678 |
private void setupDeMultiplexer(final DoubleSystemOperator[][] systemMatrix, final DoubleAdjacencyStringMatrix matrix, final int inputPortSize) {
final int inputPortOutputPortLines = 2;
final int innerSize = matrix.size() - inputPortOutputPortLines;
int deMultiplexerOutputPortSize = 0;
for (int row = 2; row <= innerSize + 1; row++) {
final Map<Integer, Integer> deMuxOutputs = new TreeMap<>();
for (int column = 2; column <= innerSize + 1; column++) {
// 隣接関係を保持する文字列行列から値(文字列)を取り出す.
final String weight = matrix.getWeightOfEdge(row, column);
if (weight.startsWith("D") == false) { //$NON-NLS-1$
continue;
}
deMuxOutputs.put(Integer.parseInt(weight.substring(1, weight.indexOf("/"))), matrix.getNodeDegree(column)); //$NON-NLS-1$
deMultiplexerOutputPortSize = Integer.parseInt(weight.substring(weight.indexOf("/") + 1)); //$NON-NLS-1$
}
if (deMuxOutputs.size() == 0) {
continue;
}
// 接続先のない出力ポート、信号の大きさを1とする。
for (int i = 1; i <= deMultiplexerOutputPortSize; i++) {
if (deMuxOutputs.containsKey(i)) {
continue;
}
deMuxOutputs.put(i, 1);
}
// 入力ポートのノードの次数が未定の場合
if (matrix.getNodeDegree(row) == -1) {
int inputSize = 0;
boolean allOutputSizeDefined = true;
for (int outputSize : deMuxOutputs.values()) {
if (outputSize == -1) {
allOutputSizeDefined = false;
break;
}
inputSize += outputSize;
}
if (allOutputSizeDefined) {
matrix.setNodeDegree(row, inputSize);
}
}
setupUnconnectedPort(matrix, deMuxOutputs, deMultiplexerOutputPortSize, row);
final List<Integer> outputSizes = new ArrayList<>(deMuxOutputs.values()); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleSystemBuilder.java | 750 |
| org/mklab/tool/control/system/SystemBuilder.java | 771 |
private void setupUnconnectedPort(final DoubleAdjacencyStringMatrix matrix, final Map<Integer, Integer> ports, int portSize, int node) {
final int allSize = matrix.getNodeDegree(node);
// 反対側のポートのノードの次数が未定の場合
if (allSize == -1) {
return;
}
int tentativeSize = 0;
for (int size : ports.values()) {
if (size == -1) {
continue;
}
tentativeSize += size;
}
// 接続先のないポート、信号の数が未定のポート
final List<Integer> undefinedSizePorts = new ArrayList<>();
int definedPortSize = 0;
// 接続先のないポート、信号の数が未定のポートがある場合、未決定分の信号の大きさを等分割する。
for (int i = 1; i <= portSize; i++) {
if (ports.containsKey(i) && ports.get(i) != -1) {
definedPortSize += ports.get(i);
continue;
}
undefinedSizePorts.add(i);
}
int noConnectionPortSize = 0;
if (undefinedSizePorts.size() > 0) {
noConnectionPortSize = (allSize - tentativeSize) / undefinedSizePorts.size();
for (int port : undefinedSizePorts) {
ports.put(port, noConnectionPortSize);
}
}
for (int i = 0; i < allSize - definedPortSize - noConnectionPortSize * undefinedSizePorts.size(); i++) {
ports.put(undefinedSizePorts.get(i), noConnectionPortSize + 1);
}
}
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object opponent) {
if (opponent == this) {
return true;
}
if (opponent == null) {
return false;
}
if (opponent.getClass() != getClass()) {
return false;
}
return this.adjacencyMatrix.equals(((DoubleSystemBuilder)opponent).adjacencyMatrix); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/BlockSystem.java | 327 |
| org/mklab/tool/control/system/BlockSystem.java | 365 |
if (nodeTmpValue.get(row).isZero()) {
for (int k = 0; k < rowSize; k++) {
final SystemOperator<RS,RM,CS,CM> systemInRow = matrix[k][row];
final SystemOperator<RS,RM,CS,CM> systemInColumn = matrix[k][column];
if (systemInRow == ZeroSystem.getInstance(this.sunit)) {
continue;
}
if (isAllZeroInRow(matrix, row, column) == false) {
continue;
}
if (systemInRow instanceof ConstantSystem && systemInColumn instanceof ConstantSystem) {
matrix[k][column] = ((ConstantSystem<RS,RM,CS,CM>) systemInColumn)
.add(((ConstantSystem<RS,RM,CS,CM>) systemInRow).multiply(gainSystem));
} else {
final SystemOperator<RS,RM,CS,CM> contractedSystem;
if (systemInRow instanceof ConstantSystem) {
contractedSystem = ((ConstantSystem<RS,RM,CS,CM>) systemInRow).multiply(gainSystem);
} else {
contractedSystem = multiplyGain((LinearSystemOperator<RS,RM,CS,CM>) systemInRow, gain1);
}
if (contractedSystem.hasDirectFeedthrough()) {
matrix[k][column] = contractedSystem;
} else {
nodeTmpValue.set(k, nodeTmpValue.get(k).add(calcOutputOfNonDirectFeedthroughSystem(contractedSystem)));
matrix[k][column] = ZeroSystem.getInstance(this.sunit);
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/graph/DoubleNodeEquation.java | 46 |
| org/mklab/tool/control/system/graph/DoubleNodeIdentityFunctionEquation.java | 46 |
public DoubleNodeEquation(final DoubleBlockSystem blockSystem, final DoubleSystemOperator[][] matrix, final DoubleMatrix[] nodeTmpValue, final List<Integer> minimumNode) {
this.blockSystem = blockSystem;
this.nodeSize = nodeTmpValue.length;
this.matrix = matrix;
this.nodeTmpValue = nodeTmpValue;
this.minimumNode = minimumNode;
}
/**
* @see org.mklab.nfc.nleq.NonLinearFunction#eval(org.mklab.nfc.matrix.NumericalMatrix)
*/
public DoubleMatrix eval(final DoubleMatrix x) throws SolverStopException {
DoubleMatrix[] xx = new DoubleMatrix[this.nodeSize];
// 次数最小ノードの値を1個のベクトルから分離します。
int offset = 0;
for (int i : this.minimumNode) {
int n = this.nodeTmpValue[i - 1].length();
xx[i - 1] = x.getSubVector(offset + 1, offset + n);
offset = offset + n;
}
DoubleMatrix[] nodeValue = new DoubleMatrix[this.nodeSize];
DoubleSystemOperator[][] matrixLocal = new DoubleSystemOperator[this.nodeSize][this.nodeSize];
DoubleMatrix[] nodeTmpValueLocal = new DoubleMatrix[this.nodeSize];
for (int row = 0; row < this.nodeSize; row++) {
for (int column = 0; column < this.nodeSize; column++) {
matrixLocal[row][column] = this.matrix[row][column];
}
nodeTmpValueLocal[row] = this.nodeTmpValue[row];
}
// 与えられた次数最小ノードの値を用いて、自身を含む各ノードの値を計算します。
calcNonMinimumNodeValues(nodeValue, xx, matrixLocal, nodeTmpValueLocal);
// 次数最小ノードの値を1個のベクトルに結合します。
DoubleMatrix newX = new DoubleMatrix(0, 1);
for (int i : this.minimumNode) {
newX = newX.appendDown(xx[i - 1].subtract(nodeValue[i - 1])); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/math/DoubleMathematicalFunction.java | 103 |
| org/mklab/tool/control/system/math/MathematicalFunction.java | 112 |
return new DoubleMatrix(u.getRowSize(), 1);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setInputSize(int)
*/
@Override
public void setInputSize(final int size) {
super.setInputSize(size);
if (this.type == MathematicalFunctionType.POW || this.type == MathematicalFunctionType.REM || this.type == MathematicalFunctionType.MOD || this.type == MathematicalFunctionType.HYPOT) {
super.setOutputSize(size / 2);
} else {
super.setOutputSize(size);
}
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setOutputSize(int)
*/
@Override
public void setOutputSize(final int size) {
super.setOutputSize(size);
if (this.type == MathematicalFunctionType.POW || this.type == MathematicalFunctionType.REM || this.type == MathematicalFunctionType.MOD || this.type == MathematicalFunctionType.HYPOT) {
super.setInputSize(size * 2);
} else {
super.setInputSize(size);
}
}
/**
* @see org.mklab.tool.control.system.parameter.StringExternalizable#getString(java.lang.String)
*/
public String getString(String key) {
return Messages.getString(key);
}
/**
* 関数の式を返します。
*
* @return 関数の式
*/
public String getFunction() {
return this.type.getFunction();
}
/**
* 数学関数の種類を取得します。
*
* @return 数学関数
*/
public MathematicalFunctionType getType() {
return this.type;
}
/**
* 数学関数を設定します。
*
* @param type 数学関数
*/
public void setType(MathematicalFunctionType type) {
this.type = type;
}
/**
* @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discrete/DoubleUserDefinedDiscreteDynamicSystem.java | 161 |
| org/mklab/tool/control/system/discrete/DoubleUserDefinedDiscreteStaticSystem.java | 131 |
| org/mklab/tool/control/system/discrete/UserDefinedDiscreteDynamicSystem.java | 170 |
| org/mklab/tool/control/system/discrete/UserDefinedDiscreteStaticSystem.java | 140 |
| org/mklab/tool/control/system/sink/DoubleUserDefinedContinuousSink.java | 125 |
| org/mklab/tool/control/system/sink/UserDefinedContinuousSink.java | 134 |
| org/mklab/tool/control/system/source/DoubleUserDefinedContinuousSource.java | 144 |
| org/mklab/tool/control/system/source/DoubleUserDefinedDiscreteSource.java | 114 |
| org/mklab/tool/control/system/source/UserDefinedContinuousSource.java | 153 |
| org/mklab/tool/control/system/source/UserDefinedDiscreteSource.java | 123 |
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try {
this.updateFunction.invoke(this.obj);
} catch (IllegalArgumentException e) {
throw new ParameterException(e);
} catch (IllegalAccessException e) {
throw new ParameterException(e);
} catch (InvocationTargetException e) {
throw new ParameterException(e.getTargetException());
} catch (Exception e) {
throw new ParameterException(e);
}
}
/**
* @see org.mklab.tool.control.system.discrete.BaseDiscreteStaticSystem#initialize()
*/
@Override
public void initialize() {
super.initialize();
try {
if (this.initializeFunction != null) {
this.initializeFunction.invoke(this.obj);
}
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e.getTargetException());
} catch (Exception e) {
throw new RuntimeException(e);
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sink/UserDefinedContinuousSink.java | 84 |
| org/mklab/tool/control/system/sink/UserDefinedDiscreteSink.java | 84 |
this.outputFunction.invoke(this.obj, t, u);
} catch (IllegalArgumentException e) {
throw new SolverStopException(e);
} catch (IllegalAccessException e) {
throw new SolverStopException(e);
} catch (InvocationTargetException e) {
throw new SolverStopException(e.getTargetException());
}
return this.sunit.createZeroGrid(getInputSize(), 1);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sink/DoubleUserDefinedContinuousSink.java | 75 |
| org/mklab/tool/control/system/sink/DoubleUserDefinedDiscreteSink.java | 75 |
this.outputFunction.invoke(this.obj, Double.valueOf(t), u);
} catch (IllegalArgumentException e) {
throw new SolverStopException(e);
} catch (IllegalAccessException e) {
throw new SolverStopException(e);
} catch (InvocationTargetException e) {
throw new SolverStopException(e.getTargetException());
}
return new DoubleMatrix(getInputSize(), 1);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try { | |
| File | Line |
|---|---|
| org/mklab/tool/signal/Xcorr.java | 44 |
| org/mklab/tool/signal/Xcorr.java | 98 |
int xm = X.getRowSize();
int xn = X.getColumnSize();
int m = 2 * xm - 1;
DoubleMatrix c = x.createZero(m, xn * xn);
for (int i = 1; i <= xn; i++) {
DoubleMatrix tmp = X.getSubMatrix(xm, 1, i, i).conjugate();
tmp.setElement(m, 0);
for (int j = 1; j <= i; j++) {
List<DoubleMatrix> temp = Filter.filter(X.getSubMatrix(1, X.getRowSize(), j, j), x.createUnit(1), tmp);
DoubleMatrix cc = temp.get(0);
int k1 = (i - 1) * xn + j;
int k2 = (j - 1) * xn + i;
c.setSubMatrix(1, c.getRowSize(), k2, k2, cc.transpose());
if (i != j) {
c.setSubMatrix(1, c.getRowSize(), k1, k1, c.getSubMatrix(m, 1, k2, k2).conjugate());
}
}
}
c = c.getSubMatrix(1, c.getRowSize(), 1, 1);
if (x_.getRowSize() == 1) {
c = c.transpose();
}
return c;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/math/DoubleProduct.java | 61 |
| org/mklab/tool/control/system/math/Product.java | 70 |
final DoubleMatrix ui = u.getSubVector(offset + 1, offset + outputSize);
if (multiplier) {
y = y.multiplyElementWise(ui);
} else {
y = y.divideElementWise(ui);
}
offset += outputSize;
}
return y;
}
/**
* 乗算または除算の指定(乗算ならばtrue、除算ならばfalse)を設定します。
*
* @param multipliers 乗算または除算の指定(乗算ならばtrue、除算ならばfalse)
*/
public void setMultipliers(final List<Boolean> multipliers) {
this.multipliers = new ArrayList<>(multipliers.size());
for (Boolean multiplier : multipliers) {
this.multipliers.add(multiplier);
}
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setInputSize(int)
*/
@Override
public void setInputSize(final int size) {
super.setInputSize(size);
if (this.multipliers == null) {
super.setOutputSize(size);
} else {
super.setOutputSize(size / (this.multipliers.size() + 1));
}
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setOutputSize(int)
*/
@Override
public void setOutputSize(final int size) {
super.setOutputSize(size);
if (this.multipliers == null) {
super.setInputSize(size);
} else {
super.setInputSize(size * (this.multipliers.size() + 1));
}
}
/**
* @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 163 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 149 |
setZeroSystemToNullElement(elements);
this.inputNodes = new ArrayList<>(Arrays.asList(1));
this.sourceNodes = new ArrayList<>();
this.outputNodes = new ArrayList<>(Arrays.asList(getRowSize()));
this.sinkNodes = new ArrayList<>();
this.inputPortTags = new TreeMap<>();
this.inputPortTags.put(1, "u"); //$NON-NLS-1$
this.outputPortTags = new TreeMap<>();
this.outputPortTags.put(getRowSize(), "y"); //$NON-NLS-1$
}
/**
* 入力ポートが接続されているノードの番号のリストを設定します。
*
* @param inputNodes 入力ポートが接続されているノードの番号のリスト
*/
public void setInputNodes(final List<Integer> inputNodes) {
final Integer[] nodes = new Integer[inputNodes.size()];
this.inputNodes = new ArrayList<>(Arrays.asList(inputNodes.toArray(nodes)));
}
/**
* Sourceが接続されているノードの番号のリストを設定します。
*
* @param sourceNodes Sourceが接続されているノードの番号のリスト
*/
public void setSourceNodes(final List<Integer> sourceNodes) {
final Integer[] nodes = new Integer[sourceNodes.size()];
this.sourceNodes = new ArrayList<>(Arrays.asList(sourceNodes.toArray(nodes)));
}
/**
* Sourceが接続されているノードの番号のリストを返します。
*
* @return Sourceが接続されているノードの番号のリスト
*/
List<Integer> getSourceNodes() {
return this.sourceNodes;
}
/**
* 入力器のリストを返します。
*
* @return 入力器のリスト
*/
public List<Importer> getImporters() {
final List<Importer> importers = new ArrayList<>();
for (int sourceNode : this.sourceNodes) {
for (int column = 0; column < getColumnSize(); column++) {
final SystemOperator<RS, RM, CS, CM> system = this.elements[sourceNode - 1][column]; | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleUserDefinedContinuousStaticSystem.java | 83 |
| org/mklab/tool/control/system/source/DoubleUserDefinedDiscreteSource.java | 66 |
| org/mklab/tool/control/system/source/UserDefinedDiscreteSource.java | 75 |
return (DoubleMatrix)this.outputFunction.invoke(this.object, Double.valueOf(t));
} catch (IllegalArgumentException e) {
throw new SolverStopException(e);
} catch (IllegalAccessException e) {
throw new SolverStopException(e);
} catch (InvocationTargetException e) {
throw new SolverStopException(e.getTargetException());
}
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try {
this.updateFunction.invoke(null); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/UserDefinedContinuousStaticSystem.java | 92 |
| org/mklab/tool/control/system/source/DoubleUserDefinedDiscreteSource.java | 66 |
| org/mklab/tool/control/system/source/UserDefinedDiscreteSource.java | 75 |
return (RM)this.outputFunction.invoke(this.object, t);
} catch (IllegalArgumentException e) {
throw new SolverStopException(e);
} catch (IllegalAccessException e) {
throw new SolverStopException(e);
} catch (InvocationTargetException e) {
throw new SolverStopException(e.getTargetException());
}
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try {
this.updateFunction.invoke(null); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/BlockSystem.java | 1349 |
| org/mklab/tool/control/system/DoubleBlockSystem.java | 1318 |
protected SystemOperator<RS,RM,CS,CM> getSystemOperator(final int inputNode, final int outputNode) {
return this.elements[inputNode][outputNode];
}
/**
* @see org.mklab.tool.control.system.SystemOperator#isAutoSize()
*/
@Override
public boolean isAutoSize() {
if (this.isSingleSystem()) {
return getSingleSystem().isAutoSize();
}
return super.isAutoSize();
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setAutoSize(boolean)
*/
@Override
public void setAutoSize(final boolean autoSize) {
if (this.isSingleSystem()) {
this.getSingleSystem().setAutoSize(autoSize);
}
super.setAutoSize(autoSize);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#resetAutoSize()
*/
@Override
public void resetAutoSize() {
if (this.isSingleSystem() == false) {
return;
}
super.setInputSize(-1);
super.setOutputSize(-1);
this.getSingleSystem().resetAutoSize();
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setInputSize(int)
*/
@Override
public void setInputSize(final int inputSize) {
if (this.isSingleSystem()) {
final int singleInputSize = this.getSingleSystem().getInputSize();
if (singleInputSize != -1) {
super.setInputSize(singleInputSize);
}
} else {
super.setInputSize(inputSize);
}
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setOutputSize(int)
*/
@Override
public void setOutputSize(final int outputSize) {
if (this.isSingleSystem()) {
final int singoleOutputSize = this.getSingleSystem().getOutputSize();
if (singoleOutputSize != -1) {
super.setOutputSize(singoleOutputSize);
}
} else {
super.setOutputSize(outputSize);
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/math/DoubleUserDefinedConstantSystem.java | 51 |
| org/mklab/tool/control/system/math/UserDefinedConstantSystem.java | 60 |
public DoubleUserDefinedConstantSystem(DoubleMatrix gain) {
super(gain);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
@Override
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
@Override
public void update() throws ParameterException {
try {
this.updateFunction.invoke(null);
} catch (IllegalArgumentException e) {
throw new ParameterException(e);
} catch (IllegalAccessException e) {
throw new ParameterException(e);
} catch (InvocationTargetException e) {
throw new ParameterException(e.getTargetException());
} catch (Exception e) {
throw new ParameterException(e);
}
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleUserDefinedContinuousLinearDynamicSystem.java | 75 |
| org/mklab/tool/control/system/continuous/UserDefinedContinuousLinearDynamicSystem.java | 86 |
super(a, b, c, d);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(final String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(final String name, final Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try {
this.updateFunction.invoke(this.object);
} catch (IllegalArgumentException e) {
throw new ParameterException(e);
} catch (IllegalAccessException e) {
throw new ParameterException(e);
} catch (InvocationTargetException e) {
throw new ParameterException(e.getTargetException());
} catch (Exception e) {
throw new ParameterException(e);
}
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 3309 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 3301 |
private void setInputOutputStateTagToLinearSystem(final LinearSystem<RS, RM, CS, CM> linearSystem, final int[] stateSizes) {
final List<String> inputPortTagList = new ArrayList<>();
for (final Integer inputNode : this.inputNodes) {
final String tag = this.inputPortTags.get(inputNode);
if (tag == null) {
throw new RuntimeException(Messages.getString("AdjacencyMatrix.10")); //$NON-NLS-1$
}
inputPortTagList.add(tag);
}
final List<String> outputPortTagList = new ArrayList<>();
for (final Integer outputNode : this.outputNodes) {
final String tag = this.outputPortTags.get(outputNode);
if (tag == null) {
throw new RuntimeException(Messages.getString("AdjacencyMatrix.11")); //$NON-NLS-1$
}
outputPortTagList.add(tag);
}
final List<String> stateTags = getStateTags(stateSizes.length);
linearSystem.setInputPortTags(inputPortTagList);
linearSystem.setOutputTags(outputPortTagList);
linearSystem.setStateTags(stateTags);
}
/**
* サブシステムの状態数を返します。
*
* @return サブシステムの状態数
*/
private int[] getStateSizes() {
final int allSystemSize = getRowSize();
final int numberOfIntegrator = getIntegratorOrUnitDelaySystemSize();
final int inputNodeSize = this.inputNodes.size();
final int outputNodeSize = this.outputNodes.size();
final int[] stateSizes = new int[numberOfIntegrator];
for (int i = 0; i < numberOfIntegrator; i++) {
final int row = allSystemSize - numberOfIntegrator - outputNodeSize + i;
final int column = inputNodeSize + i;
final SystemOperator<RS, RM, CS, CM> system = this.elements[row][column]; | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discrete/DoubleUserDefinedDiscreteLinearDynamicSystem.java | 62 |
| org/mklab/tool/control/system/discrete/UserDefinedDiscreteLinearDynamicSystem.java | 72 |
super(A, B, C, D);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try {
this.updateFunction.invoke(null);
} catch (IllegalArgumentException e) {
throw new ParameterException(e);
} catch (IllegalAccessException e) {
throw new ParameterException(e);
} catch (InvocationTargetException e) {
throw new ParameterException(e.getTargetException());
} catch (Exception e) {
throw new ParameterException(e);
}
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 4552 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 4544 |
} else if (((ConstantSystem<RS, RM, CS, CM>)element).isVariable() && ((ConstantSystem<RS, RM, CS, CM>)element).getExpression().isEmpty() == false) {
loopColumnList.add(i);
}
}
}
if (loopColumnList.isEmpty()) {
return false;
}
final Map<Integer, Integer> targetMap = new HashMap<>();
for (int loopColumn : loopColumnList) {
for (int column = 1; column < ans.getColumnSize(); column++) {
if (ans.getColumnVector(loopColumn).compareColumnVectors(ans.getColumnVector(column))) {
if (loopColumnList.contains(column) == false) {
targetMap.put(loopColumn, column);
}
}
}
}
for (int loopColumn : loopColumnList) {
for (int column = 1; column < ans.getColumnSize(); column++) {
if (loopColumn != column && ans.getColumnVector(loopColumn).compareColumnVectors(ans.getColumnVector(column))) {
ans.moveElement(loopColumn, column, targetMap.get(loopColumn));
changed = true;
}
}
}
if (changed == true) {
for (int loopColumn : loopColumnList) {
for (int i = 1; i < ans.getColumnVector(loopColumn).getRowSize(); i++) {
if (targetMap.get(loopColumn) != null) {
ans.setElement(i, loopColumn, ZeroSystem.getInstance(this.sunit)); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/source/RampSource.java | 129 |
| org/mklab/tool/control/system/source/StepSource.java | 129 |
}
/**
* 遅れ時間を設定します。
*
* @param delayTime 遅れ時間
*/
public void setDelayTime(final RS delayTime) {
this.delayTime = delayTime;
}
/**
* 遅れ時間を返します。
*
* @return 遅れ時間
*/
public RS getDelayTime() {
return this.delayTime;
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("boxing")
public List<Integer> getPiece(final RS t, final RM u) {
if (t.isGreaterThanOrEquals(this.delayTime)) {
return new ArrayList<>(Arrays.asList(new Integer[] {1}));
}
return new ArrayList<>(Arrays.asList(new Integer[] {0}));
}
/**
* {@inheritDoc}
*/
public RS getDiscontinuousPoint(final RS t1, final RM u1, final RS t2, final RM u2) {
final List<Integer> piece1 = getPiece(t1, u1);
final List<Integer> piece2 = getPiece(t2, u2);
if (piece1.equals(piece2)) {
return this.sunit.getNaN();
}
return this.delayTime;
}
/**
* @see org.mklab.tool.control.system.parameter.StringExternalizable#getString(java.lang.String)
*/
public String getString(String key) {
return Messages.getString(key);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sampled/BaseSampledDataDynamicSystem.java | 208 |
| org/mklab/tool/control/system/sampled/DoubleBaseSampledDataDynamicSystem.java | 200 |
BaseSampledDataDynamicSystem<RS,RM,CS,CM> castedObj = (BaseSampledDataDynamicSystem<RS,RM,CS,CM>)o;
return ((this.continuousInitialState == null ? castedObj.continuousInitialState == null : this.continuousInitialState.equals(castedObj.continuousInitialState))
&& (this.discreteInitialState == null ? castedObj.discreteInitialState == null : this.discreteInitialState.equals(castedObj.discreteInitialState))
&& (this.continuousState == null ? castedObj.continuousState == null : this.continuousState.equals(castedObj.continuousState))
&& (this.discreteState == null ? castedObj.discreteState == null : this.discreteState.equals(castedObj.discreteState)) && (this.atSamplingPoint == castedObj.atSamplingPoint));
}
/**
* @see org.mklab.tool.control.system.SystemOperator#hashCode()
*/
@Override
public int hashCode() {
int hashCode = super.hashCode();
hashCode = 31 * hashCode + (this.continuousInitialState == null ? 0 : this.continuousInitialState.hashCode());
hashCode = 31 * hashCode + (this.discreteInitialState == null ? 0 : this.discreteInitialState.hashCode());
hashCode = 31 * hashCode + (this.continuousState == null ? 0 : this.continuousState.hashCode());
hashCode = 31 * hashCode + (this.discreteState == null ? 0 : this.discreteState.hashCode());
hashCode = 31 * hashCode + (this.atSamplingPoint ? 1231 : 1237);
return hashCode;
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/source/DoubleRampSource.java | 115 |
| org/mklab/tool/control/system/source/DoubleStepSource.java | 115 |
}
/**
* 遅れ時間を設定します。
*
* @param delayTime 遅れ時間
*/
public void setDelayTime(final double delayTime) {
this.delayTime = delayTime;
}
/**
* 遅れ時間を返します。
*
* @return 遅れ時間
*/
public double getDelayTime() {
return this.delayTime;
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("boxing")
public List<Integer> getPiece(final double t, final DoubleMatrix u) {
if (t >= this.delayTime) {
return new ArrayList<>(Arrays.asList(new Integer[] {1}));
}
return new ArrayList<>(Arrays.asList(new Integer[] {0}));
}
/**
* {@inheritDoc}
*/
public double getDiscontinuousPoint(final double t1, final DoubleMatrix u1, final double t2, final DoubleMatrix u2) {
final List<Integer> piece1 = getPiece(t1, u1);
final List<Integer> piece2 = getPiece(t2, u2);
if (piece1.equals(piece2)) {
return Double.NaN;
}
return this.delayTime;
}
/**
* @see org.mklab.tool.control.system.parameter.StringExternalizable#getString(java.lang.String)
*/
public String getString(String key) {
return Messages.getString(key);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/graph/NodeEquation.java | 69 |
| org/mklab/tool/control/system/graph/NodeIdentityFunctionEquation.java | 69 |
List<RM> xx = new ArrayList<>(this.nodeSize);
// 次数最小ノードの値を1個のベクトルから分離します。
int offset = 0;
for (int i : this.minimumNode) {
int n = this.nodeTmpValue.get(i - 1).length();
xx.set(i - 1, x.getSubVector(offset + 1, offset + n));
offset = offset + n;
}
List<RM> nodeValue = new ArrayList<>(this.nodeSize);
SystemOperator<RS,RM,CS,CM>[][] matrixLocal = new SystemOperator[this.nodeSize][this.nodeSize];
List<RM> nodeTmpValueLocal = new ArrayList<>(this.nodeSize);
for (int row = 0; row < this.nodeSize; row++) {
for (int column = 0; column < this.nodeSize; column++) {
matrixLocal[row][column] = this.matrix[row][column];
}
nodeTmpValueLocal.set(row, this.nodeTmpValue.get(row));
}
// 与えられた次数最小ノードの値を用いて、自身を含む各ノードの値を計算します。
calcNonMinimumNodeValues(nodeValue, xx, matrixLocal, nodeTmpValueLocal);
// 次数最小ノードの値を1個のベクトルに結合します。
RM newX = this.sunit.createZeroGrid(0, 1);
for (int i : this.minimumNode) {
newX = newX.appendDown(xx.get(i - 1).subtract(nodeValue.get(i - 1))); | |
| File | Line |
|---|---|
| org/mklab/tool/control/DoubleImproperLinearSystem.java | 499 |
| org/mklab/tool/control/DoubleProperLinearSystem.java | 368 |
| org/mklab/tool/control/ImproperLinearSystem.java | 497 |
| org/mklab/tool/control/ProperLinearSystem.java | 374 |
string.append(" "); //$NON-NLS-1$
}
}
}
string.append("["); //$NON-NLS-1$
for (int column = 0; column < getSubSystemSize(); column++) {
final String format = "%" + columnLengthes[column] + "s"; //$NON-NLS-1$ //$NON-NLS-2$
string.append(String.format(format, this.getSymbolicAMatrix()[row][column]));
if (column != getSubSystemSize() - 1) {
string.append(" "); //$NON-NLS-1$
}
}
string.append("|"); //$NON-NLS-1$
for (int column = 0; column < getInputPortSize(); column++) {
final String format = "%" + columnLengthes[column + getSubSystemSize()] + "s"; //$NON-NLS-1$ //$NON-NLS-2$
string.append(String.format(format, this.getSymbolicBMatrix()[row][column]));
if (column != getInputPortSize() - 1) {
string.append(" "); //$NON-NLS-1$
}
}
string.append("]"); //$NON-NLS-1$
if (withInputOutput) {
string.append("[" + symbolicState[row] + "]"); //$NON-NLS-1$ //$NON-NLS-2$
if (row == getSubSystemSize() / 2) {
if (isContinuous()) {
string.append("(t)"); //$NON-NLS-1$
} else {
string.append("(k)"); //$NON-NLS-1$
}
}
}
string.append(lineSeparator);
}
return string.toString();
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 638 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 624 |
final SystemOperator<RS, RM, CS, CM>[][] matrix = createClone(this.elements);
for (int row = 0; row < getRowSize(); row++) {
final Map<Integer, Integer> deMultiplexer = findDeMultiplexerInRow(matrix, row);
if (deMultiplexer.size() == 0) {
continue;
}
final Map<Integer, Integer> multiplexer = new TreeMap<>();
for (int node : new ArrayList<>(deMultiplexer.values())) {
final Map<Integer, Integer> singleMultiplexer = findMultiplexerInRow(matrix, node);
if (singleMultiplexer.size() != 1) {
continue;
}
multiplexer.putAll(singleMultiplexer);
}
if (deMultiplexer.size() != multiplexer.size()) {
continue;
}
final List<Integer> multiplexerOutputNodes = new ArrayList<>(multiplexer.values());
final int firstNode = multiplexerOutputNodes.get(0);
for (int node : multiplexerOutputNodes) {
if (node != firstNode) {
multiplexer.clear();
break;
}
if (findMultiplexerInColumn(matrix, node).size() != deMultiplexer.size()) {
multiplexer.clear();
break;
}
}
contracting = true;
shortDeMultiplexerAndMultiplexer(matrix, row, multiplexer, deMultiplexer);
}
if (contracting) {
final AdjacencyMatrix<RS, RM, CS, CM> ans = new AdjacencyMatrix<>(matrix, this.sunit); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/math/ConstantSystem.java | 643 |
| org/mklab/tool/control/system/math/DoubleConstantSystem.java | 637 |
inst.gainSystem = (LinearSystem<RS,RM,CS,CM>)this.gainSystem.clone();
}
if (this.expression == null) {
inst.expression = null;
} else {
inst.expression = new String(this.expression);
}
inst.singleTerm = this.singleTerm;
inst.tag = this.tag;
inst.symbolStack = Collections.unmodifiableList(this.symbolStack);
inst.isNegative = this.isNegative;
inst.isVariable = this.isVariable;
return inst;
}
/**
* @see org.mklab.tool.control.system.SystemOperator#hashCode()
*/
@Override
public int hashCode() {
int hashCode = super.hashCode();
hashCode = 31 * hashCode + (this.gainSystem == null ? 0 : this.gainSystem.hashCode());
hashCode = 31 * hashCode + (this.expression == null ? 0 : this.expression.hashCode());
hashCode = 31 * hashCode + (this.singleTerm ? 1231 : 1237);
hashCode = 31 * hashCode + (this.tag == null ? 0 : this.tag.hashCode());
hashCode = 31 * hashCode + (requiringABCD ? 1231 : 1237);
return hashCode;
}
/**
* @see org.mklab.nfc.rpn.ReversePolishNotationOperand#getSignedExpression()
*/
public String getSignedExpression() {
return this.isNegative() ? "-" + this.getExpression() : this.getExpression(); //$NON-NLS-1$
}
/**
* @see org.mklab.nfc.rpn.ReversePolishNotationOperand#getParsedOperand()
*/
public ReversePolishNotationOperand<RS,RM> getParsedOperand() { | |
| File | Line |
|---|---|
| org/mklab/tool/control/Dinitial.java | 245 |
| org/mklab/tool/control/Initial.java | 250 |
List<DoubleMatrix> yx = dinitial(A, B, C, D, x0, T);
DoubleMatrix Y = yx.get(0);
DoubleMatrix X = yx.get(1);
int outputSize = C.getRowSize();
String[] yy = new String[outputSize];
for (int i = 1; i <= outputSize; i++) {
if (outputSize == 1) {
yy[i - 1] = "y";
} else {
yy[i - 1] = "y" + i;
}
}
gnuplot.createCanvas(2, 1);
Canvas canvas1 = gnuplot.getCanvas(0, 0);
canvas1.setGridVisible(true);
canvas1.setXLabel("t [sec]");
canvas1.setYLabel("y");
canvas1.plot(T, Y, yy);
int stateSize = A.getRowSize();
String[] xx = new String[stateSize];
for (int i = 1; i <= stateSize; i++) {
xx[i - 1] = "x" + i;
}
Canvas canvas2 = gnuplot.getCanvas(1, 0);
canvas2.setGridVisible(true);
canvas2.setXLabel("t [sec]");
canvas2.setYLabel("x");
canvas2.plot(T, X, xx);
return gnuplot;
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/Dhinf.java | 123 |
| org/mklab/tool/control/Hinf.java | 50 |
throw new IllegalArgumentException(Messages.getString("Dhinf.1")); //$NON-NLS-1$
}
DoubleMatrix A = G.getSubMatrix(1, n, 1, n);
DoubleMatrix B1 = G.getSubMatrix(1, n, n + 1, n + mw);
DoubleMatrix B2 = G.getSubMatrix(1, n, n + mw + 1, CG);
DoubleMatrix C1 = G.getSubMatrix(n + 1, n + pz, 1, n);
DoubleMatrix D11 = G.getSubMatrix(n + 1, n + pz, n + 1, n + mw);
DoubleMatrix D12 = G.getSubMatrix(n + 1, n + pz, n + mw + 1, CG);
DoubleMatrix C2 = G.getSubMatrix(n + pz + 1, RG, 1, n);
DoubleMatrix D21 = G.getSubMatrix(n + pz + 1, RG, n + 1, n + mw);
DoubleMatrix D22 = G.getSubMatrix(n + pz + 1, RG, n + mw + 1, CG);
B1 = B1.divide(gamma);
D11 = D11.divide(gamma);
D21 = D21.divide(gamma);
DoubleNumber tmp = D11.maxSingularValue();
if (tmp.isGreaterThanOrEquals(1)) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 4478 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 4470 |
final AdjacencyMatrix<RS, RM, CS, CM> newAdjMatrix = new AdjacencyMatrix<>(getRowSize() + 1, getColumnSize() + 1, this.sunit);
newAdjMatrix.setSubMatrix(1, loopNode - 1, 1, loopNode - 1, oldAdjMatrix.getSubMatrix(1, loopNode - 1, 1, loopNode - 1));
newAdjMatrix.setSubMatrix(1, loopNode - 1, loopNode + 2, newAdjMatrix.getColumnSize(), oldAdjMatrix.getSubMatrix(1, loopNode - 1, loopNode + 1, srcColumnSize));
newAdjMatrix.setSubMatrix(loopNode + 1, newAdjMatrix.getRowSize(), 1, loopNode - 1, oldAdjMatrix.getSubMatrix(loopNode, oldAdjMatrix.getRowSize(), 1, loopNode - 1));
newAdjMatrix.setSubMatrix(loopNode + 1, newAdjMatrix.getRowSize(), loopNode + 2, newAdjMatrix.getColumnSize(),
oldAdjMatrix.getSubMatrix(loopNode, oldAdjMatrix.getRowSize(), loopNode + 1, srcColumnSize));
newAdjMatrix.setSubMatrix(1, loopNode - 1, loopNode, loopNode, oldAdjMatrix.getSubMatrix(1, loopNode - 1, loopNode, loopNode));
newAdjMatrix.setSubMatrix(loopNode + 2, newAdjMatrix.getRowSize(), loopNode, loopNode, oldAdjMatrix.getSubMatrix(loopNode + 1, oldAdjMatrix.getRowSize(), loopNode, loopNode)); | |
| File | Line |
|---|---|
| org/mklab/tool/matrix/Funm.java | 70 |
| org/mklab/tool/matrix/Funm.java | 117 |
for (int k = 1; k <= n - 1; k++) {
for (int i = 1; i <= n - k; i++) {
int j = i + k;
DoubleComplexNumber s = T.getElement(i, j).multiply(F.getElement(j, j).subtract(F.getElement(i, i)));
if (k > 1) {
DoubleComplexMatrix tp = T.getSubMatrix(i, i, i + 1, j - 1).multiply(F.getSubMatrix(i + 1, j - 1, j, j)).subtract(F.getSubMatrix(i, i, i + 1, j - 1).multiply(T.getSubMatrix(i + 1, j - 1, j, j)));
s = s.add(tp.getElement(1));
}
DoubleComplexNumber d = T.getElement(j, j).subtract(T.getElement(i, i));
if (d.abs().isLessThanOrEquals(tolerance)) {
System.err.println(Messages.getString("Funm.0")); //$NON-NLS-1$ | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/rpn/DoubleMaximaExpressionProcessor.java | 55 |
| org/mklab/tool/control/system/rpn/MaximaExpressionProcessor.java | 63 |
maxima.open();
maxima.sendComand(commands);
final String ans = maxima.receiveResult();
final String replacedAns = ans.replaceAll("division", "1/"); //$NON-NLS-1$ //$NON-NLS-2$
return convertMaximaToMatx(replacedAns);
} catch (IOException e) {
throw new IllegalArgumentException(e);
}
}
/**
* Maximaのコードに対応するMaTXのコードを返します。
*
* @param maximaCode Maximaのコード
* @return Maximaのコードに対応するMaTXのコード
*/
private String convertMaximaToMatx(final String maximaCode) {
final Pattern pattern1 = Pattern.compile("(matrix\\()"); //$NON-NLS-1$
final Matcher matcher1 = pattern1.matcher(maximaCode);
final String str1 = matcher1.replaceAll("["); //$NON-NLS-1$
final Pattern pattern2 = Pattern.compile("\\](,)\\["); //$NON-NLS-1$
final Matcher matcher2 = pattern2.matcher(str1);
final String str2 = matcher2.replaceAll("]["); //$NON-NLS-1$
final Pattern pattern3 = Pattern.compile("\\]\\)"); //$NON-NLS-1$
final Matcher matcher3 = pattern3.matcher(str2);
final String str3 = matcher3.replaceAll("]]"); //$NON-NLS-1$
final Pattern pattern4 = Pattern.compile(" . "); //$NON-NLS-1$
final Matcher matcher4 = pattern4.matcher(str3);
final String str4 = matcher4.replaceAll("*"); //$NON-NLS-1$
return str4;
}
/**
* {@inheritDoc}
*/
public String getLeftParenthesis() {
return "("; //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public String getRightParenthesis() {
return ")"; //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public String getInverseString() {
return "^(-1)"; //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public String getMultiplicationString() {
return "*"; //$NON-NLS-1$
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sink/DoubleUserDefinedContinuousSink.java | 84 |
| org/mklab/tool/control/system/sink/UserDefinedDiscreteSink.java | 93 |
return new DoubleMatrix(getInputSize(), 1);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sink/DoubleUserDefinedDiscreteSink.java | 84 |
| org/mklab/tool/control/system/sink/UserDefinedContinuousSink.java | 93 |
return new DoubleMatrix(getInputSize(), 1);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleUserDefinedContinuousStaticSystem.java | 91 |
| org/mklab/tool/control/system/continuous/UserDefinedContinuousStaticSystem.java | 100 |
| org/mklab/tool/control/system/sink/DoubleUserDefinedContinuousSink.java | 85 |
| org/mklab/tool/control/system/sink/UserDefinedContinuousSink.java | 94 |
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try {
this.updateFunction.invoke(null); | |
| File | Line |
|---|---|
| org/mklab/tool/control/Dinitial.java | 142 |
| org/mklab/tool/control/Initial.java | 140 |
List<DoubleMatrix> yx = dinitial(g, x0, T);
DoubleMatrix Y = yx.get(0);
Canvas canvas = gnuplot.createCanvas();
canvas.setGridVisible(true);
canvas.setXLabel("t [sec]");
canvas.setYLabel("y");
canvas.plot(T, Y, new String[] {"y"});
return gnuplot;
}
/**
* @param numerator 分子多項式の係数
* @param denominator 分母多項式の係数
* @param x0 初期状態
* @param T 評価する時刻
* @return Gnuplot
* @throws IOException gnuplotプロセスを起動できない場合
*/
public static Gnuplot plot(DoubleMatrix numerator, DoubleMatrix denominator, DoubleMatrix x0, DoubleMatrix T) throws IOException {
Gnuplot gp = new Gnuplot();
return plot(gp, numerator, denominator, x0, T);
}
/**
* @param gnuplot gnuplot
* @param numerator 分子多項式の係数
* @param denominator 分母多項式の係数
* @param x0 初期状態
* @param T 評価する時刻
* @return Gnuplot
*/
public static Gnuplot plot(Gnuplot gnuplot, DoubleMatrix numerator, DoubleMatrix denominator, DoubleMatrix x0, DoubleMatrix T) {
DoubleRationalPolynomial g = Tf2tfn.tf2tfn(numerator, denominator);
return plot(gnuplot, g, x0, T);
}
/**
* @param G 伝達関数行列
* @param x0 初期状態
* @param T 評価する時刻
* @return Gnuplot
* @throws IOException gnuplotプロセスを起動できない場合
*/
public static Gnuplot plot(DoubleRationalPolynomialMatrix G, DoubleMatrix x0, DoubleMatrix T) throws IOException {
Gnuplot gp = new Gnuplot();
return plot(gp, G, x0, T);
}
/**
* @param gnuplot gnuplot
* @param G 伝達関数行列
* @param x0 初期状態
* @param T 評価する時刻
* @return Gnuplot
*/
@SuppressWarnings("nls")
public static Gnuplot plot(Gnuplot gnuplot, DoubleRationalPolynomialMatrix G, DoubleMatrix x0, DoubleMatrix T) {
List<DoubleMatrix> yx = dinitial(G, x0, T); | |
| File | Line |
|---|---|
| org/mklab/tool/control/Ramp.java | 344 |
| org/mklab/tool/control/Step.java | 343 |
DoubleMatrix X = tmp.get(1);
int outputSize = C.getRowSize();
String[] yy = new String[outputSize];
for (int i = 1; i <= outputSize; i++) {
if (outputSize == 1) {
yy[i - 1] = "y"; //$NON-NLS-1$
} else {
yy[i - 1] = "y" + i; //$NON-NLS-1$
}
}
gnuplot.createCanvas(2, 1);
Canvas canvas1 = gnuplot.getCanvas(0, 0);
canvas1.setGridVisible(true);
canvas1.setXLabel("t [sec]"); //$NON-NLS-1$
canvas1.setYLabel("y"); //$NON-NLS-1$
canvas1.setTitle("Step response"); //$NON-NLS-1$
canvas1.plot(T, Y, yy);
int stateSize = A.getRowSize();
String[] xx = new String[stateSize];
for (int i = 1; i <= stateSize; i++) {
xx[i - 1] = "x" + i; //$NON-NLS-1$
}
Canvas canvas2 = gnuplot.getCanvas(1, 0);
canvas2.setGridVisible(true);
canvas2.setTitle(""); //$NON-NLS-1$
canvas2.setXLabel("t [sec]"); //$NON-NLS-1$
canvas2.setYLabel("x"); //$NON-NLS-1$
canvas2.plot(T, X, xx);
return gnuplot;
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleUserDefinedContinuousStaticSystem.java | 91 |
| org/mklab/tool/control/system/continuous/UserDefinedContinuousStaticSystem.java | 100 |
| org/mklab/tool/control/system/sink/DoubleUserDefinedDiscreteSink.java | 85 |
| org/mklab/tool/control/system/sink/UserDefinedDiscreteSink.java | 94 |
| org/mklab/tool/control/system/source/DoubleUserDefinedDiscreteSource.java | 74 |
| org/mklab/tool/control/system/source/UserDefinedDiscreteSource.java | 83 |
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try { | |
| File | Line |
|---|---|
| org/mklab/tool/control/Dinitial.java | 199 |
| org/mklab/tool/control/Initial.java | 201 |
List<DoubleMatrix> yx = dinitial(G, x0, T);
DoubleMatrix Y = yx.get(0);
int outputSize = G.getRowSize();
String[] yy = new String[outputSize];
for (int i = 1; i <= outputSize; i++) {
if (outputSize == 1) {
yy[i - 1] = "y";
} else {
yy[i - 1] = "y" + i;
}
}
Canvas canvas = gnuplot.createCanvas();
canvas.setGridVisible(true);
canvas.setXLabel("t [sec]");
canvas.setYLabel("y");
canvas.plot(T, Y, yy);
return gnuplot;
}
/**
* @param A A行列
* @param B B行列
* @param C C行列
* @param D D行列
* @param x0 初期状態
* @param T 評価する時刻
* @return Gnuplot
* @throws IOException gnuplotプロセスを起動できない場合
*/
public static Gnuplot plot(DoubleMatrix A, DoubleMatrix B, DoubleMatrix C, DoubleMatrix D, DoubleMatrix x0, DoubleMatrix T) throws IOException {
Gnuplot gp = new Gnuplot();
return plot(gp, A, B, C, D, x0, T);
}
/**
* @param gnuplot gnuplot
* @param A A行列
* @param B B行列
* @param C C行列
* @param D D行列
* @param x0 初期状態
* @param T 評価する時刻
* @return Gnuplot
*/
@SuppressWarnings("nls")
public static Gnuplot plot(Gnuplot gnuplot, DoubleMatrix A, DoubleMatrix B, DoubleMatrix C, DoubleMatrix D, DoubleMatrix x0, DoubleMatrix T) {
List<DoubleMatrix> yx = dinitial(A, B, C, D, x0, T); | |
| File | Line |
|---|---|
| org/mklab/tool/control/DoubleImproperLinearSystem.java | 465 |
| org/mklab/tool/control/DoubleProperLinearSystem.java | 334 |
| org/mklab/tool/control/ImproperLinearSystem.java | 463 |
| org/mklab/tool/control/ProperLinearSystem.java | 340 |
if (withInputOutput) {
if (isContinuous()) {
if (getSubSystemSize() == 1) {
string.append("d/dt"); //$NON-NLS-1$
} else if (getSubSystemSize() == 2) {
if (row == 0) {
string.append("d/"); //$NON-NLS-1$
} else {
string.append("dt"); //$NON-NLS-1$
}
} else {
if (row == getSubSystemSize() / 2 - 1) {
string.append("d "); //$NON-NLS-1$
} else if (row == getSubSystemSize() / 2) {
string.append("--"); //$NON-NLS-1$
} else if (row == getSubSystemSize() / 2 + 1) {
string.append("dt"); //$NON-NLS-1$
} else {
string.append(" "); //$NON-NLS-1$
}
}
}
string.append("[" + symbolicState[row] + "]"); //$NON-NLS-1$ //$NON-NLS-2$
if (row == getSubSystemSize() / 2) {
if (isContinuous()) {
string.append("(t)="); //$NON-NLS-1$
} else {
string.append("(k+1)="); //$NON-NLS-1$
}
} else {
if (isContinuous()) {
string.append(" "); //$NON-NLS-1$
} else {
string.append(" "); //$NON-NLS-1$ | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyStringMatrix.java | 549 |
| org/mklab/tool/control/system/DoubleAdjacencyStringMatrix.java | 541 |
private void setControlSystem(final String tag, final SystemBuilder<RS,RM,CS,CM> system) {
this.csMap.put(tag, system);
}
/**
* エッジの重み(隣接行列の成分)を返します。
*
* @param inputNode 入力ノード
* @param outputNode 出力ノード
* @return システムを表す文字列
*/
public String getWeightOfEdge(final int inputNode, final int outputNode) {
return this.elements.getElement(inputNode, outputNode);
}
/**
* 隣接行列のサイズを返します。
*
* @return 隣接行列のサイズ
*/
public int size() {
return this.elements.getColumnSize();
}
/**
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return this.elements.toString();
}
/**
* 行列を標準出力に出力します。
*/
public void print() {
this.elements.print();
}
/**
* ノードの次数を返します。
*
* @param nodeNumber ノードの番号
* @return ノードの次数
*/
public int getNodeDegree(final int nodeNumber) {
return this.nodeDegrees[nodeNumber - 1];
}
/**
* ノードの次数を設定します。
*
* @param nodeNumber ノードの番号
* @param degree ノードの次数
*/
public void setNodeDegree(int nodeNumber, int degree) {
this.nodeDegrees[nodeNumber - 1] = degree;
setupNodeDegree();
}
/**
* ノードの次数を設定します。
*/
void setupNodeDegree() {
boolean changed = false;
do {
changed = false;
for (int row = 1; row <= this.size(); row++) {
for (int column = 1; column <= this.size(); column++) {
final String weight = this.elements.getElement(row, column);
if (weight.length() == 0) {
continue;
}
final SystemBuilder<RS,RM,CS,CM> controlSystem = getControlSystem(weight); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleBlockSystem.java | 310 |
| org/mklab/tool/control/system/DoubleBlockSystem.java | 347 |
if (nodeTmpValue[row].isZero()) {
for (int k = 0; k < rowSize; k++) {
final DoubleSystemOperator systemInRow = matrix[k][row];
final DoubleSystemOperator systemInColumn = matrix[k][column];
if (systemInRow == DoubleZeroSystem.getInstance()) {
continue;
}
if (DoubleAdjacencyMatrixUtil.isAllZeroInRow(matrix, row, column) == false) {
continue;
}
if (systemInRow instanceof DoubleConstantSystem && systemInColumn instanceof DoubleConstantSystem) {
matrix[k][column] = ((DoubleConstantSystem)systemInColumn).add(((DoubleConstantSystem)systemInRow).multiply(gainSystem));
} else {
final DoubleSystemOperator contractedSystem;
if (systemInRow instanceof DoubleConstantSystem) {
contractedSystem = ((DoubleConstantSystem)systemInRow).multiply(gainSystem);
} else {
contractedSystem = DoubleAdjacencyMatrixUtil.multiplyGain((DoubleLinearSystemOperator)systemInRow, gain1);
}
if (contractedSystem.hasDirectFeedthrough()) {
matrix[k][column] = contractedSystem;
} else {
nodeTmpValue[k] = nodeTmpValue[k].add(calcOutputOfNonDirectFeedthroughSystem(contractedSystem));
matrix[k][column] = DoubleZeroSystem.getInstance();
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/DoubleWeierstrassForm.java | 253 |
| org/mklab/tool/control/WeierstrassForm.java | 442 |
DoubleMatrix BDL12 = A12.createZero();
for (int i = 0; i < n; i++) {
BDR12.setColumnVector(1 + i, step13.getSubMatrix(1 + i * m, (1 + i) * m, 1, 1));
}
for (int i = 0; i < n; i++) {
BDL12.setColumnVector(1 + i, step13.getSubMatrix(1 + (i + n) * m, (1 + i + n) * m, 1, 1));
}
this.BDR = A.createUnit();
this.BDL = A.createUnit();
this.BDR.setSubMatrix(1, m, m + 1, m + n, BDR12);
this.BDL.setSubMatrix(1, m, 1, m, invE11);
this.BDL.setSubMatrix(1, m, m + 1, m + n, invE11.multiply(BDL12));
this.BDL.setSubMatrix(m + 1, m + n, m + 1, m + n, A22.inverse()); | |
| File | Line |
|---|---|
| org/mklab/tool/control/Dimpulse.java | 169 |
| org/mklab/tool/control/Dstep.java | 168 |
List<DoubleMatrix> yx = dimpulse(g, seriesSize);
DoubleMatrix Y = yx.get(0);
Canvas canvas = gnuplot.createCanvas();
canvas.setGridVisible(true);
canvas.setXLabel("k");
canvas.setYLabel("y");
canvas.plot(DoubleMatrix.series(1, seriesSize, 1), Y, new String[] {"y"});
return gnuplot;
}
/**
* @param numerator 分子多項式の係数
* @param denominator 分母多項式の係数
* @param seriesSize 応答の個数
* @return Gnuplot
* @throws IOException gnuplotプロセスを起動できない場合
*/
public static Gnuplot plot(DoubleMatrix numerator, DoubleMatrix denominator, int seriesSize) throws IOException {
Gnuplot gp = new Gnuplot();
return plot(gp, numerator, denominator, seriesSize);
}
/**
* 単位インパルス応答をプロットする
*
* @param gnuplot gnuplot
* @param numerator 分子多項式の係数
* @param denominator 分母多項式の係数
* @param seriesSize 応答の個数
* @return Gnuplot
*/
public static Gnuplot plot(Gnuplot gnuplot, DoubleMatrix numerator, DoubleMatrix denominator, int seriesSize) {
DoubleRationalPolynomial g = Tf2tfn.tf2tfn(numerator, denominator);
return plot(gnuplot, g, seriesSize);
}
/**
* @param G 伝達関数行列
* @param inputNumber 入力番号
* @param seriesSize 応答の個数
* @return Gnuplot
* @throws IOException gnuplotプロセスを起動できない場合
*/
public static Gnuplot plot(DoubleRationalPolynomialMatrix G, int inputNumber, int seriesSize) throws IOException {
Gnuplot gp = new Gnuplot();
return plot(gp, G, inputNumber, seriesSize);
}
/**
* 単位インパルス応答をプロットする
*
* @param gnuplot gnuplot
* @param G 伝達関数行列
* @param inputNumber 入力番号
* @param seriesSize 応答の個数
* @return Gnuplot
*/
@SuppressWarnings("nls")
public static Gnuplot plot(Gnuplot gnuplot, DoubleRationalPolynomialMatrix G, int inputNumber, int seriesSize) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 3120 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 3114 |
final AdjacencyMatrix<RS, RM, CS, CM> ans = new AdjacencyMatrix<>(newMatrix, this.sunit);
ans.modifyID();
ans.setInputNodes(this.inputNodes);
ans.setSourceNodes(this.sourceNodes);
ans.setOutputNodes(this.outputNodes);
ans.setSinkNodes(this.sinkNodes);
ans.setInputPortTags(this.inputPortTags);
ans.setOutputPortTags(this.outputPortTags);
ans.setRequiringLinearSystem(this.requiringLinearSystem);
ans.setRequiringDescriptor(this.requiringDescriptor);
ans.setRequiringPrimitiveExpression(this.requiringPrimitiveExpression);
ans.shiftInputNodeByInserting(insertingColumnNodes);
ans.shiftSourceNodeByInserting(insertingColumnNodes);
ans.shiftOutputNodeByInserting(insertingRowNodes);
ans.shiftSinkNodeByInserting(insertingRowNodes);
return ans;
}
/**
* 挿入された列ノードを新しい列サイズと古い列サイズを基に計算して返します.
*
* @param column 拡張対象のある列
* @param newMatrixColumnSize 新しい行列の列サイズ
* @param oldMatrixColumnSize 古い行列の列サイズ
* @return 挿入された列ノードの配列
*/
private int[] getInsertingColumnNodes(int column, final int newMatrixColumnSize, final int oldMatrixColumnSize) {
final int[] insertingColumnNodes = new int[newMatrixColumnSize - oldMatrixColumnSize];
for (int i = 0; i < newMatrixColumnSize - oldMatrixColumnSize; i++) {
insertingColumnNodes[i] = column + i;
}
return insertingColumnNodes;
}
/**
* 挿入された行ノードを新しい行サイズと古い行サイズを基に計算して返します.
*
* @param row 拡張対象のある行
* @param newMatrixRowSize 新しい行列の行サイズ
* @param oldMatrixRowSize 古い行列の行サイズ
* @return 挿入された行ノードの配列
*/
private int[] getInsertingRowNodes(int row, final int newMatrixRowSize, final int oldMatrixRowSize) {
final int[] insertingRowNodes = getInsertingColumnNodes(row, newMatrixRowSize, oldMatrixRowSize);
return insertingRowNodes;
}
/**
* 定数行列を最小の要素に分割した隣接行列を作り,返します.
*
* @param column 定数行列の行番号(0から始まります)
* @param row 定数行列の列番号(0から始まります)
* @param system 定数行列
*
* @return 定数行列を展開した隣接行列
*/
private AdjacencyMatrix<RS, RM, CS, CM> createExpandConstantAndIntegratorSystem(final SystemOperator<RS, RM, CS, CM> system, final int row, final int column) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/Backlash.java | 342 |
| org/mklab/tool/control/system/discontinuous/DoubleBacklash.java | 332 |
Backlash<RS,RM,CS,CM> castedObj = (Backlash<RS,RM,CS,CM>)o;
return ((this.deadBandWidth == castedObj.deadBandWidth) && (this.initialOutput == null ? castedObj.initialOutput == null : this.initialOutput.equals(castedObj.initialOutput))
&& (this.initialState == castedObj.initialState) && (this.previousOutputTime == castedObj.previousOutputTime)
&& (this.previousInput == null ? castedObj.previousInput == null : this.previousInput.equals(castedObj.previousInput))
&& (this.previousRate == null ? castedObj.previousRate == null : this.previousRate.equals(castedObj.previousRate))
&& (this.previousOutput == null ? castedObj.previousOutput == null : this.previousOutput.equals(castedObj.previousOutput))
&& (this.holdOutput == null ? castedObj.holdOutput == null : this.holdOutput.equals(castedObj.holdOutput)) && (this.holdRateSign == castedObj.holdRateSign));
}
/**
* @see org.mklab.tool.control.system.SystemOperator#hashCode()
*/
@Override
public int hashCode() {
int hashCode = super.hashCode();
hashCode = 31 * hashCode + (this.deadBandWidth.hashCode() ^ (this.deadBandWidth.hashCode() >>> 32)); | |
| File | Line |
|---|---|
| org/mklab/tool/control/Ltifr.java | 44 |
| org/mklab/tool/control/Ltifr.java | 92 |
public static DoubleComplexMatrix ltifr(final DoubleMatrix A, final DoubleMatrix B, final DoubleComplexMatrix s_) {
String message;
if ((message = Abcdchk.abcdchk(A, B)).length() > 0) {
throw new IllegalArgumentException(message);
}
DoubleComplexMatrix ss;
if (s_.getRowSize() > s_.getColumnSize()) {
ss = s_.transpose();
} else {
ss = s_.createClone();
}
final int stateSize = A.getRowSize();
final int inputSize = B.getColumnSize();
DoubleNumber unit = A.getElement(1, 1);
final DoubleComplexMatrix cA = new DoubleComplexMatrix(A);
final DoubleComplexMatrix G = cA.createZero(stateSize * ss.getRowSize(), inputSize * ss.getColumnSize());
final int size = Math.max(ss.getRowSize(), ss.getColumnSize()); // length(s)
final DoubleNumber epsilon = unit.getMachineEpsilon();
for (int i = 1; i <= size; i++) {
final DoubleComplexNumber s = ss.getElement(i);
DoubleComplexMatrix sI_A = (new DoubleComplexMatrix(A.createUnit()).multiply(s).subtract(new DoubleComplexMatrix(A))); | |
| File | Line |
|---|---|
| org/mklab/tool/control/Ltifr.java | 189 |
| org/mklab/tool/control/Ltifr.java | 242 |
final RM A, final RM B, final CM s_) {
String message;
if ((message = Abcdchk.abcdchk(A, B)).length() > 0) {
throw new IllegalArgumentException(message);
}
CM ss;
if (s_.getRowSize() > s_.getColumnSize()) {
ss = s_.transpose();
} else {
ss = s_.createClone();
}
final int stateSize = A.getRowSize();
final int inputSize = B.getColumnSize();
RS unit = A.getElement(1, 1);
final CM cA = A.toComplex();
final CM G = cA.createZero(stateSize * ss.getRowSize(), inputSize * ss.getColumnSize());
final int size = Math.max(ss.getRowSize(), ss.getColumnSize()); // length(s)
final RS epsilon = unit.getMachineEpsilon();
for (int i = 1; i <= size; i++) {
final CS s = ss.getElement(i);
CM sI_A = (A.createUnit().toComplex().multiply(s).subtract(A.toComplex())); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 2813 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 2805 |
private Map<Integer, String> createInputPortTags(AdjacencyMatrix<RS, RM, CS, CM> ans, int offset, Integer input, int expandInputSize) {
final Map<Integer, String> newInputPortTags = new HashMap<>();
final String tag = ans.inputPortTags.get(input + offset);
Map<Integer, String> tempInputPortTags;
for (Integer node : ans.inputNodes) {
if (node < input + expandInputSize) {
if (node.equals(input + offset)) {
newInputPortTags.put(node, tag + "_" + 1); //$NON-NLS-1$
for (int i = 1; i <= expandInputSize; i++) {
newInputPortTags.put(node + i, tag + "_" + (i + 1)); //$NON-NLS-1$
}
continue;
}
newInputPortTags.put(node, ans.inputPortTags.get(node));
}
if (node > input + offset + expandInputSize) {
newInputPortTags.put(node, ans.inputPortTags.get(node));
}
}
ans.setInputPortTags(newInputPortTags);
tempInputPortTags = newInputPortTags;
return tempInputPortTags;
}
/**
* outputノードに繋る定数システムに応じて outputノードの数を拡張します.
*
* @return 拡張されたoutputノードを持つ隣接行列
*/
@SuppressWarnings("boxing")
private AdjacencyMatrix<RS, RM, CS, CM> expandOutput() { | |
| File | Line |
|---|---|
| org/mklab/tool/control/Dhinf.java | 66 |
| org/mklab/tool/control/Dhinf.java | 123 |
| org/mklab/tool/control/Hinf.java | 50 |
throw new IllegalArgumentException(Messages.getString("Dhinf.0")); //$NON-NLS-1$
}
DoubleMatrix A = G.getSubMatrix(1, n, 1, n);
DoubleMatrix B1 = G.getSubMatrix(1, n, n + 1, n + mw);
DoubleMatrix B2 = G.getSubMatrix(1, n, n + mw + 1, CG);
DoubleMatrix C1 = G.getSubMatrix(n + 1, n + pz, 1, n);
DoubleMatrix D11 = G.getSubMatrix(n + 1, n + pz, n + 1, n + mw);
DoubleMatrix D12 = G.getSubMatrix(n + 1, n + pz, n + mw + 1, CG);
DoubleMatrix C2 = G.getSubMatrix(n + pz + 1, RG, 1, n);
DoubleMatrix D21 = G.getSubMatrix(n + pz + 1, RG, n + 1, n + mw);
DoubleMatrix D22 = G.getSubMatrix(n + pz + 1, RG, n + mw + 1, CG); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/BlockSystem.java | 1127 |
| org/mklab/tool/control/system/DoubleBlockSystem.java | 1098 |
setZeroNodeTmpValue(nodeTmpValue);
calcOutputOfNonDirectFeedthroughSystem(noDirectMatrix, nodeTmpValue);
setNodeValueOfNoInputNode(matrix, this.nodeValue, nodeTmpValue, true);
do {
while (calcOutputOfDirectFeedthroughSystem(matrix, this.nodeValue, nodeTmpValue, true)) {
setNodeValueOfNoInputNode(matrix, this.nodeValue, nodeTmpValue, true);
}
boolean changed1 = contractConstantEdgeForwardRowWise(matrix, nodeTmpValue);
if (changed1) {
setNodeValueOfNoInputNode(matrix, this.nodeValue, nodeTmpValue, true);
}
boolean changed2 = resolveConstantSelfLoop(matrix, nodeTmpValue);
if (changed2) {
setNodeValueOfNoInputNode(matrix, this.nodeValue, nodeTmpValue, true);
}
if (!changed1 && !changed2) {
break;
}
} while (true);
int[] unknownNode = getUnknownNode(this.nodeValue);
if (unknownNode.length == 0) {
return;
}
calcUnknownMinimumNodeValues(matrix, nodeTmpValue, unknownNode);
while (calcOutputOfDirectFeedthroughSystem(matrix, this.nodeValue, nodeTmpValue, true)) {
setNodeValueOfNoInputNode(matrix, this.nodeValue, nodeTmpValue, true);
}
}
/**
* @see org.mklab.tool.control.system.SystemOperator#getLinearSystem()
*/
@Override
public LinearSystem<RS,RM,CS,CM> getLinearSystem() { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/source/AsynchronousSource.java | 60 |
| org/mklab/tool/control/system/source/DoubleAsynchronousSource.java | 51 |
public final RM outputEquation(RS t) throws SolverStopException {
// バッファが空の間待ち続ける
synchronized (this.inputSourceLock) {
while (isReadyFor(t) == false) {
// これ以上データの入力がない場合
if (isDone()) {
break;
}
try {
this.inputSourceLock.wait();
} catch (InterruptedException e) {
throw new SolverStopException(Messages.getString("AsynchronousSource.0"), e); //$NON-NLS-1$
}
}
}
checkSourceError();
try {
return getOutput(t);
} catch (Exception ex) {
// TODO ここでキャッチしなくてもいいようにする。
// FixedRateAsynchronousSourceで、値取得の際に、範囲外参照、未来の参照が起こり得る
// どう防ぐか。
throw new SolverStopException(Messages.getString("AsynchronousSource.2"), ex); //$NON-NLS-1$
}
}
/**
* 入力処理中に発生した例外のチェックを行います。
*
* @throws SolverStopException 入力処理中に例外が発生していた場合
*/
private void checkSourceError() throws SolverStopException {
final Throwable thrownInSource = getThrown();
if (thrownInSource != null) {
throw new SolverStopException(Messages.getString("AsynchronousSource.1"), thrownInSource); //$NON-NLS-1$
}
}
/**
* バッファの変更を通知します。
*/
protected void bufferChanged() {
synchronized (this.inputSourceLock) {
this.inputSourceLock.notifyAll();
}
}
/**
* doneを取得します。
*
* @return done
*/
protected final boolean isDone() {
return this.done;
}
/**
* 入力の終了を通知します。 <p> このメソッドは、読み込み処理終了時にこのクラスで呼び出されるため、このクラスのサブクラスで呼び出す必要はありません。
*/
final void done() {
this.done = true;
bufferChanged();
}
/**
* 与えられた時間の入力が準備できているか調べます。
*
* @param t 調べる時間
* @return 準備ができていればtrue,できていなければfalse
*/
protected abstract boolean isReadyFor(RS t); | |
| File | Line |
|---|---|
| org/mklab/tool/control/Dimpulse.java | 230 |
| org/mklab/tool/control/Dstep.java | 229 |
int outputSize = G.getRowSize();
String[] yy = new String[outputSize];
for (int i = 1; i <= outputSize; i++) {
if (outputSize == 1) {
yy[i - 1] = "y";
} else {
yy[i - 1] = "y" + i;
}
}
Canvas canvas = gnuplot.createCanvas();
canvas.setGridVisible(true);
canvas.setXLabel("k");
canvas.setYLabel("y");
canvas.plot(DoubleMatrix.series(1, seriesSize, 1), Y, yy);
return gnuplot;
}
/**
* @param A A行列
* @param B B行列
* @param C C行列
* @param D D行列
* @param inputNumber 入力番号
* @param seriesSize 応答の個数
* @return Gnuplot
* @throws IOException gnuplotプロセスを起動できない場合
*/
public static Gnuplot plot(DoubleMatrix A, DoubleMatrix B, DoubleMatrix C, DoubleMatrix D, int inputNumber, int seriesSize) throws IOException {
Gnuplot gp = new Gnuplot();
return plot(gp, A, B, C, D, inputNumber, seriesSize);
}
/**
* 単位インパルス応答をプロットする
*
* @param gnuplot gnuplot
* @param A A行列
* @param B B行列
* @param C C行列
* @param D D行列
* @param inputNumber 入力番号
* @param seriesSize 応答の個数
* @return Gnuplot
*/
@SuppressWarnings("nls")
public static Gnuplot plot(Gnuplot gnuplot, DoubleMatrix A, DoubleMatrix B, DoubleMatrix C, DoubleMatrix D, int inputNumber, int seriesSize) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 2718 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 2710 |
ans = new AdjacencyMatrix<>(newMatrix, this.sunit);
ans.modifyID();
ans.setInputNodes(tempInputNodes);
ans.setSourceNodes(tempSourceNodes);
ans.setOutputNodes(tempOutputNodes);
ans.setInputPortTags(tempInputPortTags);
ans.setOutputPortTags(tempOutputPortTags);
ans.setRequiringLinearSystem(this.requiringLinearSystem);
ans.setRequiringDescriptor(this.requiringDescriptor);
ans.setRequiringPrimitiveExpression(this.requiringPrimitiveExpression);
final int[] insertingNodes = createInsertingNodesArray(offset, input, expandInputSize);
ans.shiftInputNodeByInserting(insertingNodes);
ans.shiftSourceNodeByInserting(insertingNodes);
tempInputNodes = createInputNodes(ans, offset, input, expandInputSize);
tempInputPortTags = createInputPortTags(ans, offset, input, expandInputSize);
offset = expandInputSize;
}
return ans;
}
/**
* 挿入対象のノードの配列を返します.
*
* @param offset 挿入した列の数
* @param input 挿入対象の列
* @param expandInputSize 挿入した列の数
* @return 挿入対象のノードの配列
*/
@SuppressWarnings("boxing")
private int[] createInsertingNodesArray(int offset, Integer input, int expandInputSize) {
final int[] insertingNodes = new int[expandInputSize];
for (int i = 0; i < expandInputSize; i++) {
insertingNodes[i] = input + offset + i;
}
return insertingNodes;
}
/**
* 拡張されるinputのサイズを返します.
*
* @param inputNode 拡張対象のノード
* @param matrix 隣接行列の要素
* @return 拡張されるサイズ
*/
private int getExpandInputSize(final int inputNode, final SystemOperator<RS, RM, CS, CM>[][] matrix) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 3408 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 3400 |
final BooleanMatrix reachableToDestination = new ReachableMatrix<>(connection.transpose()).getBooleanMatrix().transpose();
final boolean[] reachableNodeToDestination = new boolean[getRowSize()];
for (final int outputNode : destinationNodes) {
for (int row = 1; row <= getRowSize(); row++) {
if (reachableToDestination.getElement(row, outputNode) == true) {
reachableNodeToDestination[row - 1] = true;
}
}
}
for (int column = 1; column <= getColumnSize(); column++) {
if (reachableNodeToDestination[column - 1] == true) {
continue;
}
for (int row = 1; row <= getRowSize(); row++) {
reachableToDestination.setElement(row, column, false);
}
for (int i = 1; i <= getColumnSize(); i++) {
reachableToDestination.setElement(column, i, false);
}
}
return reachableToDestination;
}
/**
* 指定されたノードからの可到達行列を返します。
*
* @param connection 連結行列
* @param sources 出発ノード
* @return 指定されたノードからの可到達行列
*/
private BooleanMatrix getReachableMatrixFromNodes(final BooleanMatrix connection, final List<Integer> sources) {
final BooleanMatrix reachableFromSource = new ReachableMatrix<>(connection).getBooleanMatrix(); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleUserDefinedContinuousDynamicSystem.java | 123 |
| org/mklab/tool/control/system/continuous/UserDefinedContinuousDynamicSystem.java | 132 |
| org/mklab/tool/control/system/discrete/DoubleUserDefinedDiscreteStaticSystem.java | 105 |
| org/mklab/tool/control/system/discrete/UserDefinedDiscreteStaticSystem.java | 114 |
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(final Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* {@inheritDoc}
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* {@inheritDoc}
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* {@inheritDoc}
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* {@inheritDoc}
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* {@inheritDoc}
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* {@inheritDoc}
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* {@inheritDoc}
*/
public void update() throws ParameterException {
try {
this.updateFunction.invoke(this.object); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 239 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 225 |
if (system == null || system == ZeroSystem.getInstance(this.sunit)) {
continue;
}
if (system instanceof Exporter) {
exporters.add((Exporter)system);
}
}
}
return exporters;
}
/**
* 出力ポートが接続されているノードの番号のリストを設定します。
*
* @param outputNodes 出力ポートが接続されているノードの番号のリスト
*/
public void setOutputNodes(final List<Integer> outputNodes) {
final Integer[] nodes = new Integer[outputNodes.size()];
this.outputNodes = new ArrayList<>(Arrays.asList(outputNodes.toArray(nodes)));
}
/**
* Sinkが接続されているノードの番号のリストを設定します。
*
* @param sinkNodes Sinkが接続されているノードの番号のリスト
*/
public void setSinkNodes(final List<Integer> sinkNodes) {
final Integer[] nodes = new Integer[sinkNodes.size()];
this.sinkNodes = new ArrayList<>(Arrays.asList(sinkNodes.toArray(nodes)));
}
/**
* Sinkが接続されているノードの番号のリストを返します。
*
* @return Sinkが接続されているノードの番号のリスト
*/
List<Integer> getSinkNodes() {
return this.sinkNodes;
}
/**
* 線形システムを求めるか設定します。
*
* @param requiringLinearSystem 線形システムを求めるならばtrue、そうでなければfalse
*/
void setRequiringLinearSystem(final boolean requiringLinearSystem) {
this.requiringLinearSystem = requiringLinearSystem;
}
/**
* 線形システムを求めるか判定します。
*
* @return 線形システムを求めるならばtrue、そうでなければfalse
*/
boolean isRequiringLinearSystem() {
return this.requiringLinearSystem;
}
/**
* @see org.mklab.nfc.matrix.BaseArray#printElements(java.io.Writer)
*/
@SuppressWarnings("nls") //$NON-NLS-1$
@Override
public void printElements(final Writer output) {
int maxColumnSize = 2; | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discrete/DiscreteLinearDynamicSystem.java | 153 |
| org/mklab/tool/control/system/discrete/DoubleDiscreteLinearDynamicSystem.java | 142 |
public void setLinearSystem(final LinearSystem<RS,RM,CS,CM> system) {
this.system = system;
this.system.setTimeDomainType(TimeDomainType.DISCRETE);
if (system.isStrictlyProper()) {
setHasDirectFeedthrough(false);
} else {
setHasDirectFeedthrough(true);
}
setStateSize(this.system.getStateSize());
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#hasVariableA()
*/
public boolean hasVariableA() {
return this.hasVariableA;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#hasVariableB()
*/
public boolean hasVariableB() {
return this.hasVariableB;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#hasVariableC()
*/
public boolean hasVariableC() {
return this.hasVariableC;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#hasVariableD()
*/
public boolean hasVariableD() {
return this.hasVariableD;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#hasVariableE()
*/
public boolean hasVariableE() {
return this.hasVariableE;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#setHasVariableA(boolean)
*/
public void setHasVariableA(final boolean hasVariableA) {
this.hasVariableA = hasVariableA;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#setHasVariableB(boolean)
*/
public void setHasVariableB(final boolean hasVariableB) {
this.hasVariableA = hasVariableB;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#setHasVariableC(boolean)
*/
public void setHasVariableC(final boolean hasVariableC) {
this.hasVariableC = hasVariableC;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#setHasVariableD(boolean)
*/
public void setHasVariableD(final boolean hasVariableD) {
this.hasVariableD = hasVariableD;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#setHasVariableE(boolean)
*/
public void setHasVariableE(final boolean hasVariableE) {
this.hasVariableE = hasVariableE;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#getA()
*/
public RM getA() { | |
| File | Line |
|---|---|
| org/mklab/tool/control/Tf2ss.java | 91 |
| org/mklab/tool/control/Tf2ss.java | 167 |
DoubleMatrix den = denominatorMatrix;
// Strip leading zeros
IntMatrix idx = den.compareElementWise(".!=", 0).find(); //$NON-NLS-1$
if (idx.length() > 0) {
den = den.getSubVector(idx.getIntElement(1), den.length());
} else {
den = den.createOnes(1); // new DoubleMatrix(new double[] {1});
}
int stateSize = den.length();
int nn = NUM.getColumnSize();
if (nn > stateSize) {
// Strip leading zeros;
BooleanMatrix tmp2 = NUM.getColumnVectors(1, nn - stateSize).compareElementWise(".==", 0); //$NON-NLS-1$
if (tmp2.allTrue()) {
NUM = NUM.getColumnVectors(nn - stateSize + 1, nn);
nn = NUM.getColumnSize();
} else {
throw new RuntimeException(Messages.getString("Tf2ss.0")); //$NON-NLS-1$
}
}
// Pad numerator with leading zeros and normalize
NUM = den.createZero(NUM.getRowSize(), stateSize - nn).appendRight(NUM).divide(den.getElement(1)); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 991 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 977 |
final SystemOperator<RS, RM, CS, CM>[][] matrix = this.elements;
final int localRowSize = matrix.length;
final int localColumnSize = localRowSize == 0 ? 0 : matrix[0].length;
final int integratorSize = this.getIntegratorOrUnitDelaySystemSize();
final int inputSize = this.inputNodes.size();
final int outputSize = this.outputNodes.size();
if ((localColumnSize - (inputSize + outputSize + integratorSize * 2)) <= 0) {
return false;
}
final List<Integer> connectedLoopNodes = getConnectedLoopNodes();
boolean changed = false;
for (final Integer unit : connectedLoopNodes) {
int target = 0;
for (int row = 0; row < localRowSize; row++) {
if (matrix[row][unit].isZero() == false) {
target = row;
break;
}
}
for (int row = 0; row < localColumnSize; row++) {
if (row == target) {
continue;
}
if (matrix[row][target] instanceof ZeroSystem) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleUserDefinedContinuousStaticSystem.java | 105 |
| org/mklab/tool/control/system/continuous/UserDefinedContinuousStaticSystem.java | 114 |
| org/mklab/tool/control/system/discrete/DoubleUserDefinedDiscreteDynamicSystem.java | 135 |
| org/mklab/tool/control/system/discrete/UserDefinedDiscreteDynamicSystem.java | 144 |
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try {
this.updateFunction.invoke(null); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/math/DoubleTrigonometricFunction.java | 121 |
| org/mklab/tool/control/system/math/TrigonometricFunction.java | 132 |
return new DoubleMatrix(u.getRowSize(), 1);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setInputSize(int)
*/
@Override
public void setInputSize(final int size) {
super.setInputSize(size);
if (this.type == TrigonometricFunctionType.ATAN2) {
super.setOutputSize(size / 2);
} else {
super.setOutputSize(size);
}
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setOutputSize(int)
*/
@Override
public void setOutputSize(final int size) {
super.setOutputSize(size);
if (this.type == TrigonometricFunctionType.ATAN2) {
super.setInputSize(size * 2);
} else {
super.setInputSize(size);
}
}
/**
* @see org.mklab.tool.control.system.parameter.StringExternalizable#getString(java.lang.String)
*/
public String getString(String key) {
return Messages.getString(key);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/Are.java | 99 |
| org/mklab/tool/control/Are.java | 173 |
DoubleNumber localTolerance = tolerance.clone();
if (localTolerance.isLessThan(0)) {
localTolerance = (T.diagonalToVector().absElementWise()).max().multiply(10).multiply(unit.getMachineEpsilon());
}
/*
* Location of eigenvalues: -1 : open left-half-plane 1 : open
* right-half-plane 0 : within tolerance of imaginary axis
*/
int np = 0;
IntMatrix idx = new IntMatrix(1, 2 * n);
for (int i = 1; i <= 2 * n; i++) {
if (T.getElement(i, i).isLessThan(localTolerance.unaryMinus())) {
idx.setElement(1, i, -1);
np++;
} else if (T.getElement(i, i).isGreaterThan(localTolerance)) {
idx.setElement(1, i, 1);
} else {
idx.setElement(1, i, 0);
}
}
if (np != n) {
throw new IllegalArgumentException(Messages.getString("Are.6")); //$NON-NLS-1$
}
List<DoubleComplexMatrix> tmp = Schord.schord(U, T, idx); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleSystemBuilder.java | 196 |
| org/mklab/tool/control/system/SystemBuilder.java | 217 |
final DoubleSystemOperator[][] systemMatrix = new DoubleSystemOperator[size][size];
setupDeMultiplexer(systemMatrix, stringMatrix, inputSourceSize);
setupMultiplexer(systemMatrix, stringMatrix, inputSourceSize);
setupSiSoSystem(systemMatrix, stringMatrix, inputSourceSize);
setupMiMoSystem(systemMatrix, stringMatrix, inputSourceSize);
// 接続先の無いポート、信号の数が未定のポートの信号を大きさを決定します。
setupDeMultiplexer(systemMatrix, stringMatrix, inputSourceSize);
setupMultiplexer(systemMatrix, stringMatrix, inputSourceSize);
final Map<Integer, String> inputPortTags = getInputPortTags(stringMatrix, inputSourceNodes);
final Map<Integer, String> outputPortTags = getOutputPortTags(stringMatrix, outputSinkNodes, inputSourceSize);
final List<List<Integer>> inputNodesSourceNodes = setupInputSource(systemMatrix, stringMatrix, inputSourceNodes);
final List<List<Integer>> outputNodesSinkNodes = setupOutputSink(systemMatrix, stringMatrix, outputSinkNodes, inputSourceSize);
final List<Integer> inputNodes = inputNodesSourceNodes.get(0);
final List<Integer> sourceNodes = inputNodesSourceNodes.get(1);
final List<Integer> outputNodes = outputNodesSinkNodes.get(0);
final List<Integer> sinkNodes = outputNodesSinkNodes.get(1);
final DoubleAdjacencyMatrix matrix = new DoubleAdjacencyMatrix(systemMatrix); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/ContinuousLinearDynamicSystem.java | 183 |
| org/mklab/tool/control/system/continuous/DoubleContinuousLinearDynamicSystem.java | 171 |
public void setLinearSystem(final LinearSystem<RS,RM,CS,CM> system) {
this.sys = system;
if (system.isStrictlyProper()) {
setHasDirectFeedthrough(false);
} else {
setHasDirectFeedthrough(true);
}
setStateSize(this.sys.getStateSize());
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#hasVariableA()
*/
public boolean hasVariableA() {
return this.hasVariableA;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#hasVariableB()
*/
public boolean hasVariableB() {
return this.hasVariableB;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#hasVariableC()
*/
public boolean hasVariableC() {
return this.hasVariableC;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#hasVariableD()
*/
public boolean hasVariableD() {
return this.hasVariableD;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#hasVariableE()
*/
public boolean hasVariableE() {
return this.hasVariableE;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#setHasVariableA(boolean)
*/
public void setHasVariableA(final boolean hasVariableA) {
this.hasVariableA = hasVariableA;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#setHasVariableB(boolean)
*/
public void setHasVariableB(final boolean hasVariableB) {
this.hasVariableB = hasVariableB;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#setHasVariableC(boolean)
*/
public void setHasVariableC(final boolean hasVariableC) {
this.hasVariableC = hasVariableC;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#setHasVariableD(boolean)
*/
public void setHasVariableD(final boolean hasVariableD) {
this.hasVariableD = hasVariableD;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#setHasVariableE(boolean)
*/
public void setHasVariableE(final boolean hasVariableE) {
this.hasVariableE = hasVariableE;
setDifferentialAlgebraicSystem(this.hasVariableE);
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#getA()
*/
public RM getA() { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleUserDefinedContinuousDynamicSystem.java | 131 |
| org/mklab/tool/control/system/continuous/UserDefinedContinuousDynamicSystem.java | 140 |
| org/mklab/tool/control/system/discrete/DoubleUserDefinedDiscreteDynamicSystem.java | 143 |
| org/mklab/tool/control/system/discrete/UserDefinedDiscreteDynamicSystem.java | 152 |
| org/mklab/tool/control/system/sink/DoubleUserDefinedContinuousSink.java | 107 |
| org/mklab/tool/control/system/sink/UserDefinedContinuousSink.java | 116 |
| org/mklab/tool/control/system/source/DoubleUserDefinedDiscreteSource.java | 96 |
| org/mklab/tool/control/system/source/UserDefinedDiscreteSource.java | 105 |
public void setOutputFunction(final Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* {@inheritDoc}
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* {@inheritDoc}
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* {@inheritDoc}
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* {@inheritDoc}
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* {@inheritDoc}
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* {@inheritDoc}
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* {@inheritDoc}
*/
public void update() throws ParameterException {
try {
this.updateFunction.invoke(this.object); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/CoulombViscousFriction.java | 119 |
| org/mklab/tool/control/system/discontinuous/DeadZone.java | 136 |
pieces.add(0);
} else {
pieces.add(1);
}
}
return pieces;
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("boxing")
public RS getDiscontinuousPoint(final RS t1, final RM u1, final RS t2, final RM u2) {
final List<Integer> pieces1 = getPiece(t1, u1);
final List<Integer> pieces2 = getPiece(t2, u2);
if (pieces1.equals(pieces2)) {
return this.sunit.getNaN();
}
final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
final int piece1 = pieces1.get(number - 1);
final int piece2 = pieces2.get(number - 1);
final boolean fromZeroToOne = piece1 == 0 && piece2 == 1;
final boolean fromOneToZero = piece1 == 1 && piece2 == 0;
final RS uu1 = u1.getElement(number);
final RS uu2 = u2.getElement(number);
if (fromZeroToOne || fromOneToZero) {
return t1.add(uu1.unaryMinus().divide(uu2.subtract(uu1)).multiply(t2.subtract(t1))); | |
| File | Line |
|---|---|
| org/mklab/tool/control/WeierstrassForm.java | 197 |
| org/mklab/tool/control/WeierstrassForm.java | 211 |
if (!blockFlag) {
RS q1e1 = tE.getElement(j, j + 1);
RS q1e2 = tE.getElement(j + 1, j + 1);
RM Q1 = givens(q1e1, q1e2, tolerance);
this.TL.setSubMatrix(j, j + 1, 1, this.TL.getColumnSize(), Q1.multiply(this.TL.getSubMatrix(j, j + 1, 1, this.TL.getColumnSize())));
tE.setSubMatrix(j, j + 1, j, tE.getColumnSize(), Q1.multiply(tE.getSubMatrix(j, j + 1, j, tE.getColumnSize())));
tA.setSubMatrix(j, j + 1, j, tA.getColumnSize(), Q1.multiply(tA.getSubMatrix(j, j + 1, j, tA.getColumnSize())));
RS z1a1 = tA.getElement(j + 1, j + 1); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleUserDefinedContinuousDynamicSystem.java | 131 |
| org/mklab/tool/control/system/continuous/DoubleUserDefinedContinuousStaticSystem.java | 113 |
| org/mklab/tool/control/system/continuous/UserDefinedContinuousDynamicSystem.java | 140 |
| org/mklab/tool/control/system/continuous/UserDefinedContinuousStaticSystem.java | 122 |
| org/mklab/tool/control/system/discrete/DoubleUserDefinedDiscreteStaticSystem.java | 113 |
| org/mklab/tool/control/system/discrete/UserDefinedDiscreteStaticSystem.java | 122 |
public void setOutputFunction(final Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* {@inheritDoc}
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* {@inheritDoc}
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* {@inheritDoc}
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* {@inheritDoc}
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* {@inheritDoc}
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* {@inheritDoc}
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* {@inheritDoc}
*/
public void update() throws ParameterException {
try {
this.updateFunction.invoke(this.object); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discrete/DoubleUserDefinedDiscreteDynamicSystem.java | 135 |
| org/mklab/tool/control/system/discrete/UserDefinedDiscreteDynamicSystem.java | 144 |
| org/mklab/tool/control/system/sink/DoubleUserDefinedDiscreteSink.java | 99 |
| org/mklab/tool/control/system/sink/UserDefinedDiscreteSink.java | 108 |
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try { | |
| File | Line |
|---|---|
| org/mklab/tool/control/Lqr.java | 144 |
| org/mklab/tool/control/Lqr.java | 194 |
private static DoubleMatrix getRiccatiSolution(DoubleMatrix A, DoubleMatrix B, DoubleMatrix Q, DoubleMatrix R) {
final String message;
if ((message = Abcdchk.abcdchk(A, B)).length() > 0) {
throw new IllegalArgumentException(message);
}
if (A.isSameSize(Q) == false) {
throw new IllegalArgumentException("Lqr: " + Messages.getString("Lqr.2")); //$NON-NLS-1$ //$NON-NLS-2$
}
if (B.getColumnSize() != R.getRowSize()) {
throw new IllegalArgumentException("Lqr: " + Messages.getString("Lqr.3")); //$NON-NLS-1$ //$NON-NLS-2$
}
final boolean qIsPositive = isPositive(Q);
final boolean qIsSymmetric = isSymmetric(Q);
if (qIsPositive == false || qIsSymmetric == false) {
throw new IllegalArgumentException("Lqr: " + Messages.getString("Lqr.4")); //$NON-NLS-1$ //$NON-NLS-2$
}
final boolean rIsPositive = isPositive(R);
final boolean rIsSymmetric = isSymmetric(R);
if (rIsPositive == false || rIsSymmetric == false) {
throw new IllegalArgumentException("Lqr: " + Messages.getString("Lqr.5")); //$NON-NLS-1$ //$NON-NLS-2$
}
final DoubleMatrix h = A.appendRight(B.divide(R).multiply(B.conjugateTranspose())).appendDown(Q.appendRight(A.conjugateTranspose().unaryMinus())); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 919 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 905 |
AdjacencyMatrix<RS, RM, CS, CM> ans = new AdjacencyMatrix<>(matrix, this.sunit);
ans.setInputNodes(this.inputNodes);
ans.setSourceNodes(this.sourceNodes);
ans.setOutputNodes(this.outputNodes);
ans.setSinkNodes(this.sinkNodes);
ans.setInputPortTags(this.inputPortTags);
ans.setOutputPortTags(this.outputPortTags);
ans.setRequiringLinearSystem(this.requiringLinearSystem);
ans.setRequiringDescriptor(this.requiringDescriptor);
ans.setRequiringPrimitiveExpression(this.requiringPrimitiveExpression);
boolean contracted = false;
boolean changed = false;
do {
if (changed) {
contracted = true;
ans = ans.removeZeroRowColumn();
ans.modifyID();
}
changed = ans.contractConstantEdgeForwardColumnWise(onlyUnit, onlyConstant);
if (changed) {
continue;
}
if (this.requiringDescriptor == false) {
changed = ans.removeArgebraicloop();
if (changed) {
continue;
}
}
changed = ans.removeRedundantNodes();
if (changed) {
continue;
}
changed = ans.contractLoopColumnWithUnit();
if (changed) {
continue;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/BaseContinuousDynamicSystem.java | 96 |
| org/mklab/tool/control/system/continuous/DoubleBaseContinuousDynamicSystem.java | 88 |
BaseContinuousDynamicSystem<RS,RM,CS,CM> castedObj = (BaseContinuousDynamicSystem<RS,RM,CS,CM>)o;
return ((this.initialState == null ? castedObj.initialState == null : this.initialState.equals(castedObj.initialState)) &&
(this.state == null ? castedObj.state == null : this.state.equals(castedObj.state)) &&
(this.index == null ? castedObj.index == null : this.index.equals(castedObj.index)));
}
/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
int hashCode = super.hashCode();
hashCode = 31 * hashCode + (this.initialState == null ? 0 : this.initialState.hashCode());
hashCode = 31 * hashCode + (this.state == null ? 0 : this.state.hashCode());
hashCode = 31 * hashCode + (this.index == null ? 0 : this.index.hashCode());
return hashCode;
}
/**
* {@inheritDoc}
*/
@Override
public BaseContinuousDynamicSystem<RS,RM,CS,CM> clone() { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/DoubleCoulombViscousFriction.java | 110 |
| org/mklab/tool/control/system/discontinuous/DoubleDeadZone.java | 127 |
pieces.add(0);
} else {
pieces.add(1);
}
}
return pieces;
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("boxing")
public double getDiscontinuousPoint(final double t1, final DoubleMatrix u1, final double t2, final DoubleMatrix u2) {
final List<Integer> pieces1 = getPiece(t1, u1);
final List<Integer> pieces2 = getPiece(t2, u2);
if (pieces1.equals(pieces2)) {
return Double.NaN;
}
final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
final int piece1 = pieces1.get(number - 1);
final int piece2 = pieces2.get(number - 1);
final boolean fromZeroToOne = piece1 == 0 && piece2 == 1;
final boolean fromOneToZero = piece1 == 1 && piece2 == 0;
final double uu1 = u1.getDoubleElement(number);
final double uu2 = u2.getDoubleElement(number);
if (fromZeroToOne || fromOneToZero) {
return t1 + (-uu1) / (uu2 - uu1) * (t2 - t1); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sink/DoubleFileSink.java | 73 |
| org/mklab/tool/control/system/sink/FileSink.java | 80 |
}
/**
* ファイルの形式を設定します。
*
* @param fileType ファイルの形式
*/
public void setFileType(final MatrixFileType fileType) {
this.fileType = fileType;
}
/**
* ファイルの形式を返します。
*
* @return ファイルの形式
*/
public MatrixFileType getFileType() {
return this.fileType;
}
/**
* ファイルの名前を返します。
*
* @return ファイルの名前
*/
public String getFileName() {
return this.fileName;
}
/**
* ファイルの名前を設定します。 拡張子がない場合、ファイルの形式に対応する拡張子が追加されます。
*
* @param fileName ファイルの名前
*/
public void setFileName(final String fileName) {
if (fileName.indexOf('.') == -1) {
this.fileName = fileName + "." + this.fileType.getExtension(); //$NON-NLS-1$
} else {
this.fileName = fileName;
}
}
/**
* 変数の名前を返します。
*
* @return 変数の名前
*/
public String getVariableName() {
return this.variableName;
}
/**
* 変数の名前を設定します。
*
* @param variableName 変数の名前
*/
public void setVariableName(final String variableName) {
this.variableName = variableName;
}
/**
* @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/math/DoubleAbsoluteFunction.java | 56 |
| org/mklab/tool/control/system/math/DoubleSignumFunction.java | 59 |
pieces.add(1);
}
}
return pieces;
}
/**
* {@inheritDoc}
*/
public double getDiscontinuousPoint(final double t1, final DoubleMatrix u1, final double t2, final DoubleMatrix u2) {
final List<Integer> pieces1 = getPiece(t1, u1);
final List<Integer> pieces2 = getPiece(t2, u2);
if (pieces1.equals(pieces2)) {
return Double.NaN;
}
final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
final double uu1 = u1.getDoubleElement(number);
final double uu2 = u2.getDoubleElement(number);
return t1 + (0 - uu1) / (uu2 - uu1) * (t2 - t1);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setInputSize(int)
*/
@Override
public void setInputSize(final int size) {
super.setInputSize(size);
super.setOutputSize(size);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setOutputSize(int)
*/
@Override
public void setOutputSize(final int size) {
super.setInputSize(size);
super.setOutputSize(size);
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sink/DoubleRestrictor.java | 149 |
| org/mklab/tool/control/system/sink/Restrictor.java | 162 |
public DoubleMatrix getRange() {
return this.range.createClone();
}
/**
* @see org.mklab.tool.control.system.parameter.ParameterUpdator#updateWith(java.lang.String)
*/
public boolean updateWith(final String parameter) {
if (parameter.equals("range")) { //$NON-NLS-1$
setRange(this.range);
return true;
}
return false;
}
/**
* @see org.mklab.tool.control.system.parameter.StringExternalizable#getString(java.lang.String)
*/
public String getString(String key) {
return Messages.getString(key);
}
/**
* @see org.mklab.tool.control.system.sink.ContinuousSink#setInputSize(int)
*/
@Override
public void setInputSize(final int inputSize) {
super.setInputSize(inputSize);
if (inputSize == -1) {
return;
}
if (this.range == null || this.range.getRowSize() != inputSize) {
setupRange(inputSize);
}
}
/**
* @see org.mklab.tool.control.system.sink.ContinuousSink#setOutputSize(int)
*/
@Override
public void setOutputSize(final int outputSize) {
super.setOutputSize(outputSize);
if (outputSize == -1) {
return;
}
if (this.range == null || this.range.getRowSize() != outputSize) {
setupRange(outputSize);
}
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("boxing")
public double getDiscontinuousPoint(double t1, DoubleMatrix u1, double t2, DoubleMatrix u2) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/DoubleFrequencyResponse.java | 105 |
| org/mklab/tool/control/DoubleFrequencyResponse.java | 145 |
private DoubleComplexMatrix getResponseForNonProperSystem(final DoubleComplexMatrix s, final int inputNumber) {
final DoubleMatrix a = this.system.getA();
final DoubleMatrix b = this.system.getB();
final DoubleMatrix c = this.system.getC();
final DoubleMatrix d = this.system.getD();
final DoubleMatrix e = this.system.getE();
// Balance A
final BalancedDecomposition<DoubleNumber,DoubleMatrix> ta = a.balancedDecompose();
final DoubleMatrix t = ta.getD();
final DoubleMatrix a1 = ta.getB();
final DoubleMatrix b1 = t.leftDivide(b);
final DoubleMatrix c1 = c.multiply(t);
final DoubleMatrix e1 = t.leftDivide(e).multiply(t);
final HessenbergDecomposition<DoubleNumber,DoubleMatrix> qa = a1.hessenbergDecompose();
final DoubleMatrix q = qa.getQ();
final DoubleMatrix a2 = qa.getH();
final DoubleMatrix b2 = q.conjugateTranspose().multiply(b1.getColumnVector(inputNumber)); | |
| File | Line |
|---|---|
| org/mklab/tool/control/DoubleImproperLinearSystem.java | 144 |
| org/mklab/tool/control/DoubleProperLinearSystem.java | 266 |
final DoubleImproperLinearSystem inst = new DoubleImproperLinearSystem(this.getA(), this.getB(), this.getC(), this.getD(), this.getE());
inst.proper = this.proper;
inst.strictlyProper = this.strictlyProper;
inst.inputSize = this.inputSize;
inst.stateSize = this.stateSize;
inst.outputSize = this.outputSize;
inst.timeDomainType = this.timeDomainType;
inst.inputPortTags = this.inputPortTags;
inst.outputPortTags = this.outputPortTags;
inst.a = this.a == null ? null : (DoubleMatrix)this.a.clone();
inst.b = this.b == null ? null : (DoubleMatrix)this.b.clone();
inst.c = this.c == null ? null : (DoubleMatrix)this.c.clone();
inst.d = this.d == null ? null : (DoubleMatrix)this.d.clone();
inst.e = this.e == null ? null : (DoubleMatrix)this.e.clone();
inst.index = this.index == null ? null : (IntMatrix)this.index.clone(); | |
| File | Line |
|---|---|
| org/mklab/tool/control/FrequencyResponse.java | 110 |
| org/mklab/tool/control/FrequencyResponse.java | 150 |
private CM getResponseForNonProperSystem(final CM s, final int inputNumber) {
final RM a = this.system.getA();
final RM b = this.system.getB();
final RM c = this.system.getC();
final RM d = this.system.getD();
final RM e = this.system.getE();
// Balance A
final BalancedDecomposition<RS, RM> ta = a.balancedDecompose();
final RM t = ta.getD();
final RM a1 = ta.getB();
final RM b1 = t.leftDivide(b);
final RM c1 = c.multiply(t);
final RM e1 = t.leftDivide(e).multiply(t);
final HessenbergDecomposition<RS, RM> qa = a1.hessenbergDecompose();
final RM q = qa.getQ();
final RM a2 = qa.getH();
final RM b2 = q.conjugateTranspose().multiply(b1.getColumnVector(inputNumber)); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/BaseContinuousExplicitDynamicSystem.java | 53 |
| org/mklab/tool/control/system/continuous/DoubleBaseContinuousExplicitDynamicSystem.java | 45 |
this.jacobian = sunit.createZeroGrid(stateSize, stateSize);
}
/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + (this.hasConsistentInitialValue ? 1231 : 1237);
result = prime * result + (this.hasJacobianMatrix ? 1231 : 1237);
result = prime * result + (this.isDifferentialAlgebraicSystem ? 1231 : 1237);
result = prime * result + ((this.jacobian == null) ? 0 : this.jacobian.hashCode());
result = prime * result + ((this.matrixM == null) ? 0 : this.matrixM.hashCode());
return result;
}
/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (!super.equals(obj)) return false;
if (getClass() != obj.getClass()) return false; | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleUserDefinedContinuousDynamicSystem.java | 131 |
| org/mklab/tool/control/system/continuous/UserDefinedContinuousDynamicSystem.java | 140 |
| org/mklab/tool/control/system/discrete/DoubleUserDefinedDiscreteStaticSystem.java | 113 |
| org/mklab/tool/control/system/discrete/UserDefinedDiscreteStaticSystem.java | 122 |
| org/mklab/tool/control/system/sink/DoubleUserDefinedDiscreteSink.java | 107 |
| org/mklab/tool/control/system/sink/UserDefinedDiscreteSink.java | 116 |
public void setOutputFunction(final Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* {@inheritDoc}
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* {@inheritDoc}
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* {@inheritDoc}
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* {@inheritDoc}
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* {@inheritDoc}
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* {@inheritDoc}
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* {@inheritDoc}
*/
public void update() throws ParameterException {
try { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sink/DoubleFileSink.java | 150 |
| org/mklab/tool/control/system/sink/FileSink.java | 157 |
DoubleFileSink castedObj = (DoubleFileSink)o;
return ((this.variableName == null ? castedObj.variableName == null : this.variableName.equals(castedObj.variableName))
&& (this.fileType == null ? castedObj.fileType == null : this.fileType.equals(castedObj.fileType)) && (this.fileName == null ? castedObj.fileName == null : this.fileName
.equals(castedObj.fileName)));
}
/**
* @see org.mklab.tool.control.system.SystemOperator#hashCode()
*/
@Override
public int hashCode() {
int hashCode = super.hashCode();
hashCode = 31 * hashCode + (this.variableName == null ? 0 : this.variableName.hashCode());
hashCode = 31 * hashCode + (this.fileType == null ? 0 : this.fileType.hashCode());
hashCode = 31 * hashCode + (this.fileName == null ? 0 : this.fileName.hashCode());
return hashCode;
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/matrix/Schord.java | 65 |
| org/mklab/tool/matrix/Schord.java | 124 |
DoubleComplexMatrix G = GivensMatrix.create(To.getElement(p - 1, p - 1).subtract(To.getElement(p, p)), To.getElement(p - 1, p)).flipUpDown();
// To.setSubMatrix(1, To.getRowSize(), p - 1, p, To.getSubMatrix(1, To.getRowSize(), p - 1, p).multiply(G));
To.setColumnVectors(p - 1, p, To.getColumnVectors(p - 1, p).multiply(G));
// To.setSubMatrix(p - 1, p, 1, To.getColumnSize(), G.conjugateTranspose().multiply(To.getSubMatrix(p - 1, p, 1, To.getColumnSize())));
To.setRowVectors(p - 1, p, G.conjugateTranspose().multiply(To.getRowVectors(p - 1, p)));
// Qo.setSubMatrix(1, Qo.getRowSize(), p - 1, p, Qo.getSubMatrix(1, Qo.getRowSize(), p - 1, p).multiply(G));
Qo.setColumnVectors(p - 1, p, Qo.getColumnVectors(p - 1, p).multiply(G));
int ix = idx.getIntElement(p - 1);
idx.setElement(1, p - 1, idx.getIntElement(p));
idx.setElement(1, p, ix);
}
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleDerivativeSystem.java | 26 |
| org/mklab/tool/control/system/continuous/DoubleDerivativeSystem.java | 45 |
| org/mklab/tool/control/system/discrete/DoubleUnitLeadSystem.java | 32 |
| org/mklab/tool/control/system/discrete/DoubleUnitLeadSystem.java | 51 |
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) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/Ramp.java | 233 |
| org/mklab/tool/control/Step.java | 230 |
DoubleMatrix Y = tmp.get(0);
Canvas canvas = gnuplot.createCanvas();
canvas.setGridVisible(true);
canvas.setTitle("Step response"); //$NON-NLS-1$
canvas.setXLabel("t [sec]"); //$NON-NLS-1$
canvas.setYLabel("y"); //$NON-NLS-1$
canvas.plot(T, Y, new String[] {"y"}); //$NON-NLS-1$
return gnuplot;
}
/**
* @param numerator 分子多項式の係数
* @param denominator 分母多項式の係数
* @param T 評価する時刻の列
* @return Gnuplot
* @throws IOException gnuplotプロセスを起動できない場合
*/
public static Gnuplot plot(DoubleMatrix numerator, DoubleMatrix denominator, DoubleMatrix T) throws IOException {
Gnuplot gp = new Gnuplot();
return plot(gp, numerator, denominator, T);
}
/**
* 単位ランプ応答をプロットします。
*
* @param gnuplot gnuplot
* @param numerator 分子多項式の係数
* @param denominator 分母多項式の係数
* @param T 評価する時刻の列
* @return Gnuplot
*/
public static Gnuplot plot(Gnuplot gnuplot, DoubleMatrix numerator, DoubleMatrix denominator, DoubleMatrix T) {
DoubleRationalPolynomial g = Tf2tfn.tf2tfn(numerator, denominator);
return plot(gnuplot, g, T);
}
/**
* @param G 伝達関数行列
* @param inputNumber 入力番号
* @param T 評価する時刻の列
* @return Gnuplot
* @throws IOException gnuplotプロセスを起動できない場合
*/
public static Gnuplot plot(DoubleRationalPolynomialMatrix G, int inputNumber, DoubleMatrix T) throws IOException {
Gnuplot gp = new Gnuplot();
return plot(gp, G, inputNumber, T);
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/Impulse.java | 206 |
| org/mklab/tool/control/Step.java | 234 |
canvas.setGridVisible(true);
canvas.setXLabel("t [sec]");
canvas.setYLabel("y");
canvas.plot(T, Y, new String[] {"y"});
return gnuplot;
}
/**
* @param numerator 分子多項式の係数
* @param denominator 分母多項式の係数
* @param T 評価する時刻の列
* @return Gnuplot
* @throws IOException gnuplotプロセスを起動できない場合
*/
public static Gnuplot plot(DoubleMatrix numerator, DoubleMatrix denominator, DoubleMatrix T) throws IOException {
Gnuplot gp = new Gnuplot();
return plot(gp, numerator, denominator, T);
}
/**
* 単位インパルス応答をプロットする
*
* @param gnuplot gnuplot
* @param numerator 分子多項式の係数
* @param denominator 分母多項式の係数
* @param T 評価する時刻の列
* @return Gnuplot
*/
public static Gnuplot plot(Gnuplot gnuplot, DoubleMatrix numerator, DoubleMatrix denominator, DoubleMatrix T) {
DoubleRationalPolynomial g = Tf2tfn.tf2tfn(numerator, denominator);
return plot(gnuplot, g, T);
}
/**
* @param G 伝達関数行列
* @param inputNumber 入力番号
* @param T 評価する時刻の列
* @return Gnuplot
* @throws IOException gnuplotプロセスを起動できない場合
*/
public static Gnuplot plot(DoubleRationalPolynomialMatrix G, int inputNumber, DoubleMatrix T) throws IOException {
Gnuplot gp = new Gnuplot();
return plot(gp, G, inputNumber, T);
}
/**
* 単位インパルス応答をプロットする
*
* @param gnuplot gnuplot
* @param G 伝達関数行列
* @param inputNumber 入力番号
* @param T 評価する時刻の列
* @return Gnuplot
*/
@SuppressWarnings("nls")
public static Gnuplot plot(Gnuplot gnuplot, DoubleRationalPolynomialMatrix G, int inputNumber, DoubleMatrix T) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/math/DoubleProductLikesSimulink.java | 66 |
| org/mklab/tool/control/system/math/ProductLikesSimulink.java | 75 |
DoubleMatrix input = u.getSubVector(i, i);
if (isMultiply == false) {
input = input.inverseElementWise();
}
y = y.multiply(input);
}
return y;
}
/**
* 乗算または除算の指定(乗算ならばtrue、除算ならばfalse)を設定します。
*
* @param multipliers 乗算または除算の指定(乗算ならばtrue、除算ならばfalse)
*/
public void setMultipliers(final List<Boolean> multipliers) {
this.multipliers = new ArrayList<>(multipliers.size());
for (Boolean multiplier : multipliers) {
this.multipliers.add(multiplier);
}
}
/**
* {@inheritDoc}
*/
@Override
public void setInputSize(final int size) {
super.setInputSize(size);
super.setOutputSize(1);
}
/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/graph/mgplot/Mgplot.java | 1719 |
| org/mklab/tool/graph/mgplot/Mgplot.java | 1807 |
public static void loglog(int win, DoubleMatrix X, DoubleMatrix Y, List<String> titles, List<String> cmds1, List<String> cmds2) {
IntMatrix idxx = X.getColumnVector(1).compareElementWise(".==", 0).find(); //$NON-NLS-1$
if (idxx.length() != 0) {
X.setSubMatrix(idxx, 1, DoubleMatrix.ones(idxx.length(), 1).multiply(DoubleNumberUtil.EPS));
}
IntMatrix idxy = Y.getColumnVector(1).compareElementWise(".==", 0).find(); //$NON-NLS-1$
if (idxy.length() != 0) {
Y.setSubMatrix(idxy, 1, DoubleMatrix.ones(idxy.length(), 1).multiply(DoubleNumberUtil.EPS));
}
grid(win, true);
logMode(win, multiplot(win), 4); | |
| File | Line |
|---|---|
| org/mklab/tool/control/AbstractLinearSystem.java | 936 |
| org/mklab/tool/control/AbstractLinearSystem.java | 965 |
.subtract(((AbstractLinearSystem<RS,RM,CS,CM>)feedbackElement).b.divide(T2).multiply(this.d).multiply(((AbstractLinearSystem<RS,RM,CS,CM>)feedbackElement).c));
ansA = a11.appendRight(a12).appendDown(a21.appendRight(a22));
// B = [[ B1/T1 ]
// [B2/T2*D1]];
final RM b1 = this.b.divide(T1);
final RM b2 = ((AbstractLinearSystem<RS,RM,CS,CM>)feedbackElement).b.divide(T2).multiply(this.d);
ansB = b1.appendDown(b2);
// [T2\C1, -T2\D1*C2];
ansC = T2.leftDivide(this.c).appendRight(T2.leftDivide(this.d).multiply(((AbstractLinearSystem<RS,RM,CS,CM>)feedbackElement).c).unaryMinus()); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleSystemBuilder.java | 342 |
| org/mklab/tool/control/system/SystemBuilder.java | 363 |
private void setupMiMoSystem(final DoubleSystemOperator[][] systemMatrix, final DoubleAdjacencyStringMatrix matrix, final int inputPortSize) {
final int inputPortOutputPortLines = 2;
final int innerSize = matrix.size() - inputPortOutputPortLines;
for (int row = 2; row <= innerSize + 1; row++) {
for (int column = 2; column <= innerSize + 1; column++) {
final String weight = matrix.getWeightOfEdge(row, column);
if (weight.startsWith("S") == false) { //$NON-NLS-1$
continue;
}
final int systemRow = row - 2 + inputPortSize;
final int systemColumn = column - 2 + inputPortSize;
if (column <= innerSize) {
final String rightWeight = matrix.getWeightOfEdge(row, column + 1);
if (weight.equals(rightWeight)) {
continue;
}
}
if (3 <= row) {
final String upperWeight = matrix.getWeightOfEdge(row - 1, column);
if (weight.equals(upperWeight)) {
continue;
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/BlockContinuousStaticSystem.java | 39 |
| org/mklab/tool/control/system/sampled/BlockSampledDataStaticSystem.java | 39 |
public BlockContinuousStaticSystem(final SystemOperator<RS,RM,CS,CM>[][] elements, final List<Integer> inputNodes, final List<Integer> outputNodes, RS sunit) {
super(elements, inputNodes, outputNodes, sunit);
setDynamic(false);
}
/**
* {@inheritDoc}
*/
public RM outputEquation(final RS t, final RM u) throws SolverStopException {
resetNodeValue();
setInputNodeValue(u);
calcNodeValue(t);
return getOutputNodeValue();
}
/**
* {@inheritDoc}
*/
public RM outputEquation(final RS t) throws SolverStopException {
resetNodeValue();
setInputNodeValue(this.sunit.createZeroGrid(getInputSize(), 1));
calcNodeValue(t);
return getOutputNodeValue();
}
/**
* {@inheritDoc}
*/
public RM inputOutputEquation(final RS t) throws SolverStopException {
final RM u =this.sunit.createZeroGrid(getInputSize(), 1);
final RM y = outputEquation(t);
return u.appendDown(y);
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/Ramp.java | 293 |
| org/mklab/tool/control/Step.java | 291 |
DoubleMatrix Y = tmp.get(0);
int outputSize = G.getRowSize();
String[] yy = new String[outputSize];
for (int i = 1; i <= outputSize; i++) {
if (outputSize == 1) {
yy[i - 1] = "y"; //$NON-NLS-1$
} else {
yy[i - 1] = "y" + i; //$NON-NLS-1$
}
}
Canvas canvas = gnuplot.createCanvas();
canvas.setGridVisible(true);
canvas.setTitle("Step response"); //$NON-NLS-1$
canvas.setXLabel("t [sec]"); //$NON-NLS-1$
canvas.setYLabel("y"); //$NON-NLS-1$
canvas.plot(T, Y, yy);
return gnuplot;
}
/**
* @param A A行列
* @param B B行列
* @param C C行列
* @param D D行列
* @param inputNumber 入力番号
* @param T 評価する時刻の列
* @return Gnuplot
* @throws IOException gnuplotプロセスを起動できない場合
*/
public static Gnuplot plot(DoubleMatrix A, DoubleMatrix B, DoubleMatrix C, DoubleMatrix D, int inputNumber, DoubleMatrix T) throws IOException {
Gnuplot gp = new Gnuplot();
return plot(gp, A, B, C, D, inputNumber, T);
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/BlockContinuousSystem.java | 106 |
| org/mklab/tool/control/system/discrete/BlockDiscreteSystem.java | 90 |
if (system instanceof DynamicSystem) {
final DynamicSystem<RS,RM,CS,CM> dSystem = (DynamicSystem<RS,RM,CS,CM>)system;
return dSystem.outputEquation(this.time, dSystem.getState());
}
return ((StaticSystem<RS,RM,CS,CM>)system).outputEquation(this.time);
}
/**
* {@inheritDoc}
*/
@Override
protected SystemOperator<RS,RM,CS,CM> createStrictlyProperLinearDynamicSystem(final SystemOperator<RS,RM,CS,CM> system) {
final LinearSystem<RS,RM,CS,CM> linearSystem = ((LinearSystemOperator<RS,RM,CS,CM>)system).getLinearSystem();
final RM a = linearSystem.getA();
final RM b = linearSystem.getB();
final RM c = linearSystem.getC();
final ContinuousLinearDynamicSystem<RS,RM,CS,CM> newSystem = new ContinuousLinearDynamicSystem<>(a, b, c, this.sunit); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 5140 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrixUtil.java | 419 |
SystemOperator<RS, RM, CS, CM>[][] newMatrix = new SystemOperator[newSize][newSize];
setZeroSystemToNullElement(newMatrix);
// left upper
GridUtil.setSubMatrix(newMatrix, 0, min - 1, 0, min - 1, getSubMatrix(matrix, 0, min - 1, 0, min - 1));
// right upper
GridUtil.setSubMatrix(newMatrix, 0, min - 1, max + 1, newSize - 1, getSubMatrix(matrix, 0, min - 1, min, size - 1));
// left lower
GridUtil.setSubMatrix(newMatrix, max + 1, newSize - 1, 0, min - 1, getSubMatrix(matrix, min, size - 1, 0, min - 1));
// right lower
GridUtil.setSubMatrix(newMatrix, max + 1, newSize - 1, max + 1, newSize - 1, getSubMatrix(matrix, min, size - 1, min, size - 1));
return newMatrix;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyStringMatrix.java | 439 |
| org/mklab/tool/control/system/DoubleAdjacencyStringMatrix.java | 431 |
if (((ContinuousSink<RS,RM,CS,CM>)system).isAutoSize() == false || inputSize != -1) {
this.nodeDegrees[outputNode - 1] = inputSize;
setupNodeDegree();
}
final int size = this.nodeDegrees[outputNode - 1];
if (size != -1) {
system.setInputSize(size);
}
}
}
/**
* ポート番号順にソートしたinputポートとsourceシステムが接続されたノードのリストを返します。
*
* @return 「ポート番号順にソートしたinputポート」+「sourceシステム」とが接続されたノードのリスト
*/
@SuppressWarnings("boxing")
public List<Integer> getSortedInputSourceNodes() {
final List<Integer> inputSourceNodes = new ArrayList<>();
final SortedMap<Integer, Integer> sortedInputMap = new TreeMap<>();
for (final Integer key : this.inputMap.keySet()) {
sortedInputMap.put(key, this.inputMap.get(key));
}
/** inputポートが接続れているノードのリスト */
for (final Integer node : sortedInputMap.values()) {
if (getControlSystem(getWeightOfEdge(1, node)).getSystemOperator() instanceof InputPort) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 4495 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 4487 |
final ConstantSystem<RS, RM, CS, CM> sys = ((ConstantSystem<RS, RM, CS, CM>)loopsystem).subtract(new UnitSystem<>(loopsystem.getOutputSize(), loopsystem.getInputSize(), this.sunit));
newAdjMatrix.elements[loopNode][loopNode - 1] = (sys);
newAdjMatrix.modifyID();
newAdjMatrix.setInputNodes(this.inputNodes);
newAdjMatrix.setSourceNodes(this.sourceNodes);
newAdjMatrix.setOutputNodes(this.outputNodes);
newAdjMatrix.setSinkNodes(this.sinkNodes);
newAdjMatrix.setInputPortTags(this.inputPortTags);
newAdjMatrix.setOutputPortTags(this.outputPortTags);
newAdjMatrix.setRequiringLinearSystem(this.requiringLinearSystem);
newAdjMatrix.setRequiringDescriptor(this.requiringDescriptor);
newAdjMatrix.setRequiringPrimitiveExpression(this.requiringPrimitiveExpression);
newAdjMatrix.shiftInputNodeByInserting(new int[] {loopNode});
newAdjMatrix.shiftSourceNodeByInserting(new int[] {loopNode});
newAdjMatrix.shiftOutputNodeByInserting(new int[] {loopNode});
newAdjMatrix.shiftSinkNodeByInserting(new int[] {loopNode});
return newAdjMatrix;
}
/**
* @param loopColumn ループが存在する列番号
* @param column 列番号
* @param targetNode 対象となるノード
*/
private void moveElement(int loopColumn, int column, int targetNode) {
final AdjacencyMatrix<RS, RM, CS, CM> ans = this; | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/BlockContinuousDynamicSystem.java | 195 |
| org/mklab/tool/control/system/continuous/DoubleBlockContinuousDynamicSystem.java | 187 |
final int size = ((SystemOperator<RS,RM,CS,CM> )system).getStateSize();
if (size > 0) {
final int end = offset + size - 1;
if (end > state.getRowSize()) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockContinuousDynamicSystem.0"), system.getClass().getName())); //$NON-NLS-1$
}
system.setState(state.getSubVector(offset, end));
offset += size;
stateSize += size;
}
}
if (state.getRowSize() != stateSize) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockContinuousDynamicSystem.1"), Integer.valueOf(state.getRowSize()), Integer.valueOf(stateSize))); //$NON-NLS-1$
}
}
/**
* {@inheritDoc}
*/
public void setIndex(final IntMatrix index) {
if (this.continuousDynamicSystems == null) {
return;
}
int stateSize = 0;
int offset = 1;
for (final ContinuousDynamicSystem<RS,RM,CS,CM> system : this.continuousDynamicSystems) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleUserDefinedContinuousStaticSystem.java | 83 |
| org/mklab/tool/control/system/source/DoubleUserDefinedContinuousSource.java | 76 |
return (DoubleMatrix)this.outputFunction.invoke(this.object, Double.valueOf(t));
} catch (IllegalArgumentException e) {
throw new SolverStopException(e);
} catch (IllegalAccessException e) {
throw new SolverStopException(e);
} catch (InvocationTargetException e) {
throw new SolverStopException(e.getTargetException());
}
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/CoulombViscousFriction.java | 151 |
| org/mklab/tool/control/system/discontinuous/DeadZone.java | 175 |
return t1.add(uu1.unaryMinus().divide(uu2.subtract(uu1)).multiply(t2.subtract(t1)));
}
assert false : "never reached"; //$NON-NLS-1$
return this.sunit.getNaN();
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setInputSize(int)
*/
@Override
public void setInputSize(final int size) {
super.setInputSize(size);
super.setOutputSize(size);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setOutputSize(int)
*/
@Override
public void setOutputSize(final int size) {
super.setInputSize(size);
super.setOutputSize(size);
}
/**
* @see org.mklab.tool.control.system.parameter.StringExternalizable#getString(java.lang.String)
*/
public String getString(String key) {
return Messages.getString(key);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/matrix/Unwrap.java | 152 |
| org/mklab/tool/matrix/Unwrap.java | 217 |
final DoubleMatrix pd = Diff.diff(p);
final IntMatrix idx = pd.absElementWise().compareElementWise(".>", tolerance).find(); //$NON-NLS-1$
for (int i = 1; i <= idx.length(); i++) {
final int k = idx.getIntElement(i);
if (2 <= k && sgn(pd.getElement(k - 1)) == sgn(pd.getElement(k))) {
continue;
}
p.setSubMatrix(k + 1, outputSize, 1, 1, p.getSubVector(k + 1, outputSize).subtractElementWise(2 * Math.PI * sgn(pd.getElement(k))));
}
ph2.setColumnVector(j, p);
}
if (mo < no) {
ph2 = ph2.transpose();
}
return ph2;
}
/**
* 符号を返します。
*
* @param x 実数データ
* @return 符合
*/
private static final int sgn(final DoubleNumber x) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 4252 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 4244 |
if (systemOperator instanceof UnitSystem) {
mat.setElement(row + 1, column + 1, true);
}
}
}
}
return mat;
}
/**
* 一つの列に単位行列が唯一存在する列を求めます.
*
* @return 一つの列に単位行列が唯一存在する列のリスト
*/
private List<Integer> getOnlyUnitColumnList() {
final List<Integer> onlyUnitColumnList = new ArrayList<>();
final int localRowSize = this.elements.length;
final int localColumnSize = localRowSize == 0 ? 0 : this.elements[0].length;
final BooleanMatrix mat = getBooleanMatrixForUnit();
for (int column = 0; column < localColumnSize; column++) {
int numberOfUnit = 0;
for (int row = 0; row < localRowSize; row++) {
if (mat.getElement(row + 1, column + 1) == true) {
numberOfUnit++;
}
}
if (numberOfUnit == 1) {
onlyUnitColumnList.add(Integer.valueOf(column));
}
}
return onlyUnitColumnList;
}
/**
* SystemOperatorの中身を出力します。
*
* <p> 一時的なものです。
*
* @param matrix 隣接行列
* @param debugMode デーバッグするならばtrue
* @param message メッセージ
*/
private void showMatrix(final SystemOperator<RS, RM, CS, CM>[][] matrix, boolean debugMode, final String message) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleTransportDelay.java | 227 |
| org/mklab/tool/control/system/continuous/TransportDelay.java | 236 |
public DoubleMatrix getInitialOutput() {
return this.initialOutput.createClone();
}
/**
* 初期バッファサイズを設定します。
*
* @param initialBufferSize 初期バッファサイズ
*/
public void setInitialBufferSize(final int initialBufferSize) {
this.initialBufferSize = initialBufferSize;
}
/**
* 初期バッファサイズを返します。
*
* @return 初期バッファサイズ
*/
public int getInitialBufferSize() {
return this.initialBufferSize;
}
/**
* @see org.mklab.tool.control.system.parameter.ParameterUpdator#updateWith(java.lang.String)
*/
public boolean updateWith(String parameter) {
if (parameter.equals("initialOutput")) { //$NON-NLS-1$
final int size = this.initialOutput.getRowSize();
setInputSize(size);
setOutputSize(size);
return true;
}
return false;
}
/**
* @see org.mklab.tool.control.system.parameter.StringExternalizable#getString(java.lang.String)
*/
public String getString(String key) {
return Messages.getString(key);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
}
final DoubleTransportDelay castedObj = (DoubleTransportDelay)o; | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleSystemOperator.java | 135 |
| org/mklab/tool/control/system/DoubleSystemOperator.java | 157 |
| org/mklab/tool/control/system/SystemOperator.java | 148 |
| org/mklab/tool/control/system/SystemOperator.java | 170 |
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + this.stateSize;
hashCode = 31 * hashCode + this.inputSize;
hashCode = 31 * hashCode + this.outputSize;
hashCode = 31 * hashCode + (this.hasDirectFeedthrough ? 1231 : 1237);
hashCode = 31 * hashCode + (this.forcedSystem ? 1231 : 1237);
hashCode = 31 * hashCode + (this.dynamic ? 1231 : 1237);
hashCode = 31 * hashCode + (this.linear ? 1231 : 1237);
hashCode = 31 * hashCode + (this.inlet ? 1231 : 1237);
hashCode = 31 * hashCode + (this.outlet ? 1231 : 1237);
hashCode = 31 * hashCode + (this.parameters == null ? 0 : getParameterHashCode());
hashCode = 31 * hashCode + (this.autoSize ? 1231 : 1237); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sink/DisplaySink.java | 149 |
| org/mklab/tool/control/system/sink/DoubleDisplaySink.java | 140 |
final DisplaySink<RS, RM, CS, CM> castedObj = (DisplaySink<RS,RM,CS,CM>)o;
return ((this.name == null ? castedObj.name == null : this.name.equals(castedObj.name)) && (this.displayable == castedObj.displayable));
}
/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
int hashCode = super.hashCode();
hashCode = 31 * hashCode + (this.name == null ? 0 : this.name.hashCode());
hashCode = 31 * hashCode + (this.displayable ? 1231 : 1237);
return hashCode;
}
/**
* {@inheritDoc}
*/
@Override
public void open() {
this.display.open(getInputSize());
}
/**
* {@inheritDoc}
*/
@Override
public void close() {
this.display.close();
}
/**
* {@inheritDoc}
*/
@Override
public void exportData() {
// do nothing
}
/**
* {@inheritDoc}
*/
@Override
public boolean isActive() {
return this.display != null;
}
/**
* コンソールへの出力を行うディスプレイです。
*
* @author Yuhi Ishikura
* @version $Revision$, 2010/02/10
* @param <RS2> type of real scalar
* @param <RM2> type of real matrix
* @param <CS2> type of complex scalar
* @param <CM2> type of complex matrix
*/
class ConsoleDisplay<RS2 extends RealNumericalScalar<RS2, RM2, CS2, CM2>, RM2 extends RealNumericalMatrix<RS2, RM2, CS2, CM2>, CS2 extends ComplexNumericalScalar<RS2, RM2, CS2, CM2>, CM2 extends ComplexNumericalMatrix<RS2, RM2, CS2, CM2>> | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 1820 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 1812 |
final AdjacencyMatrix<RS, RM, CS, CM> ans = new AdjacencyMatrix<>(matrix, this.sunit);
ans.setInputNodes(this.inputNodes);
ans.setSourceNodes(this.sourceNodes);
ans.setOutputNodes(this.outputNodes);
ans.setSinkNodes(this.sinkNodes);
ans.setInputPortTags(this.inputPortTags);
ans.setOutputPortTags(this.outputPortTags);
ans.setRequiringLinearSystem(this.requiringLinearSystem);
ans.setRequiringDescriptor(this.requiringDescriptor);
ans.setRequiringPrimitiveExpression(this.requiringPrimitiveExpression);
final int inputNodeSize = ans.inputNodes.size();
final int numberOfIntegrator = ans.getIntegratorOrUnitDelaySystemSize();
for (int row = 0; row < inputNodeSize + numberOfIntegrator; row++) {
ans.moveIntegratorLower(row);
}
for (int row = inputNodeSize + numberOfIntegrator * 2; row < ans.getRowSize(); row++) {
ans.moveIntegratorLower(row);
}
return ans;
}
/**
* 積分器が指定された行にあれば、下側へ移動する。
*
* @param row 対象となる行番号
*/
private void moveIntegratorLower(int row) {
final SystemOperator<RS, RM, CS, CM>[][] matrix = this.elements; | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 3442 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 3434 |
final BooleanMatrix reachableFromSource = new ReachableMatrix<>(connection).getBooleanMatrix();
final boolean[] reachableNodeFromSource = new boolean[getColumnSize()];
for (final int sourceNode : sources) {
for (int column = 1; column <= getColumnSize(); column++) {
if (reachableFromSource.getElement(sourceNode, column) == true) {
reachableNodeFromSource[column - 1] = true;
}
}
}
for (int row = 1; row <= getRowSize(); row++) {
if (reachableNodeFromSource[row - 1] == true) {
continue;
}
for (int column = 1; column <= getColumnSize(); column++) {
reachableFromSource.setElement(row, column, false);
}
for (int i = 1; i <= getRowSize(); i++) {
reachableFromSource.setElement(i, row, false);
}
}
return reachableFromSource;
}
/**
* 入力ノードと出力ノードが指定された順に並ぶようにソートしたシステムを返します。
*
* @return 入力ノードと出力ノードが指定された順に並ぶようにソートしたシステム
*/
private AdjacencyMatrix<RS, RM, CS, CM> sortByInputNodeAndOutputNode() { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/UserDefinedContinuousStaticSystem.java | 92 |
| org/mklab/tool/control/system/source/UserDefinedContinuousSource.java | 85 |
return (RM)this.outputFunction.invoke(this.object, t);
} catch (IllegalArgumentException e) {
throw new SolverStopException(e);
} catch (IllegalAccessException e) {
throw new SolverStopException(e);
} catch (InvocationTargetException e) {
throw new SolverStopException(e.getTargetException());
}
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/Backlash.java | 292 |
| org/mklab/tool/control/system/discontinuous/RateLimiter.java | 228 |
| org/mklab/tool/control/system/discontinuous/Saturation.java | 176 |
return t1.add(this.deadBandWidth.divide(2).subtract(uu2.subtract(uu1)).divide(this.deadBandWidth.divide(2)).multiply(t2.subtract(t1)));
}
assert false : "never reached"; //$NON-NLS-1$
return t1.add(t2).divide(2);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setInputSize(int)
*/
@Override
public void setInputSize(final int size) {
super.setInputSize(size);
super.setOutputSize(size);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setOutputSize(int)
*/
@Override
public void setOutputSize(final int size) {
super.setInputSize(size);
super.setOutputSize(size);
}
/**
* @see org.mklab.tool.control.system.parameter.StringExternalizable#getString(java.lang.String)
*/
public String getString(String key) {
return Messages.getString(key);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/graph/gnuplot/Canvas.java | 1169 |
| org/mklab/tool/graph/gnuplot/Canvas.java | 1256 |
for (int i = 1; i <= yData.getRowSize(); i++) {
String lineName;
if (i <= names.length) {
lineName = names[i - 1];
} else {
lineName = "data-" + (size + 1) + "-" + i; //$NON-NLS-1$ //$NON-NLS-2$
}
String cmd1;
if (i <= attribute1.length) {
cmd1 = attribute1[i - 1];
} else {
cmd1 = ""; //$NON-NLS-1$
}
String cmd2;
if (i <= attribute2.length) {
cmd2 = attribute2[i - 1];
} else {
cmd2 = ""; //$NON-NLS-1$
}
if (this.keepingLineProperties == false) {
this.lineWidthes.add(new LineWidth(1));
this.lineTypes.add(new LineType((i - 1)%this.colors.length));
this.lineVisibles.add(Boolean.TRUE);
this.lineNames.add(lineName);
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/DoubleLinearSystem.java | 447 |
| org/mklab/tool/control/LinearSystem.java | 444 |
DoubleLinearSystem simplify(DoubleNumber tolerance); /** * 時間領域でのシステムの種類を設定します。 * * @param type 時間領域でのシステムの種類 */ void setTimeDomainType(final TimeDomainType type); /** * 時間領域でのシステムの種類を返します。 * * @return 時間領域でのシステムの種類 */ public TimeDomainType getTimeDomainType(); /** * 連続時間システムであるか判定します。 * * @return 連続時間システムならばtrue、そうでなければfalse */ boolean isContinuous(); /** * 離散時間システムであるか判定します。 * * @return 離散時間システムならばtrue、そうでなければfalse */ boolean isDiscrete(); /** * サンプル値システムであるか判定します。 * * @return サンプル値システムならばtrue、そうでなければfalse */ boolean isSampled(); /** * 数値の出力フォーマットを設定します。 * * @param format 数値の出力フォーマット */ void setFormat(final String format); /** * 数値の出力フォーマットを返します。 * * @return 数値の出力フォーマット */ String getFormat(); /** * 状態空間実現の係数行列の数式を設定します。 * * @param aSymbol A行列の数式 * @param bSymbol B行列の数式 * @param cSymbol C行列の数式 * @param dSymbol D行列の数式 * @param eSymbol E行列の数式 */ void setSymbolicString(final String[][] aSymbol, final String[][] bSymbol, final String[][] cSymbol, final String[][] dSymbol, final String[][] eSymbol); /** * 入力ポートのタグを返します。 * * @return 入力ポートのタグ */ List<String> getInputPortTags(); /** * 入力ポートのタグを設定します。 * * @param inputPortTags 入力ポートのタグ */ void setInputPortTags(List<String> inputPortTags); /** * 出力ポートのタグを返します。 * * @return 出力ポートのタグ */ List<String> getOutputPortTags(); /** * 出力ポートのタグを設定します。 * * @param outputPortTags 出力ポートのタグ */ void setOutputTags(List<String> outputPortTags); /** * 状態のタグを返します。 * * @return 状態のタグ */ List<String> getStateTags(); /** * 状態のタグを設定します。 * * @param stateTags 状態のタグ */ void setStateTags(List<String> stateTags); /** * @return Object * @see org.mklab.nfc.matrix.GridElement#clone() */ Object clone(); /** * 表示文字列を返します。 * * @return 表示文字列 */ String getPrintingString(); /** * ライターに出力します。 * * @param output ライター */ void print(final Writer output); /** * 指数を返します。 * @return 指数 */ IntMatrix getIndex(); /** * 指数を設定します。 * @param index 指数 */ void setIndex(IntMatrix index); } | |
| File | Line |
|---|---|
| org/mklab/tool/control/ImproperLinearSystem.java | 142 |
| org/mklab/tool/control/ProperLinearSystem.java | 272 |
final ImproperLinearSystem<RS, RM, CS, CM> inst = new ImproperLinearSystem<>(this.getA(), this.getB(), this.getC(), this.getD(), this.getE());
inst.proper = this.proper;
inst.strictlyProper = this.strictlyProper;
inst.inputSize = this.inputSize;
inst.stateSize = this.stateSize;
inst.outputSize = this.outputSize;
inst.timeDomainType = this.timeDomainType;
inst.inputPortTags = this.inputPortTags;
inst.outputPortTags = this.outputPortTags;
inst.a = this.a == null ? null : this.a.createClone();
inst.b = this.b == null ? null : this.b.createClone();
inst.c = this.c == null ? null : this.c.createClone();
inst.d = this.d == null ? null : this.d.createClone();
inst.e = this.e == null ? null : this.e.createClone();
inst.index = this.index == null ? null : (IntMatrix)this.index.clone(); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyStringMatrix.java | 727 |
| org/mklab/tool/control/system/DoubleAdjacencyStringMatrix.java | 719 |
final SystemOperator<RS,RM,CS,CM> system = controlSystem == null ? null : controlSystem.getSystemOperator();
if (system == null) {
continue;
}
final int inputNodeSize = this.nodeDegrees[row - 1];
if (inputNodeSize != -1 && system.getInputSize() == -1) {
system.setInputSize(inputNodeSize);
final int outputSize = system.getOutputSize();
if (outputSize != -1) {
this.nodeDegrees[column - 1] = outputSize;
}
}
final int outputNodeSize = this.nodeDegrees[column - 1];
if (outputNodeSize != -1 && system.getOutputSize() == -1) {
system.setOutputSize(outputNodeSize);
final int inputSize = system.getInputSize();
if (inputSize != -1) {
this.nodeDegrees[row - 1] = inputSize;
}
}
}
}
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/source/DoubleUserDefinedContinuousSource.java | 76 |
| org/mklab/tool/control/system/source/DoubleUserDefinedDiscreteSource.java | 66 |
| org/mklab/tool/control/system/source/UserDefinedDiscreteSource.java | 75 |
return (DoubleMatrix)this.outputFunction.invoke(this.obj, Double.valueOf(t));
} catch (IllegalArgumentException e) {
throw new SolverStopException(e);
} catch (IllegalAccessException e) {
throw new SolverStopException(e);
} catch (InvocationTargetException e) {
throw new SolverStopException(e.getTargetException());
}
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* システムのクローズ処理を記述したメソッドを設定します。
*
* @param closeFunction システムのクローズ処理を記述したメソッド
*/
public void setCloseFunction(Method closeFunction) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleUserDefinedContinuousStaticSystem.java | 83 |
| org/mklab/tool/control/system/source/DoubleUserDefinedDiscreteSource.java | 66 |
| org/mklab/tool/control/system/source/UserDefinedContinuousSource.java | 85 |
| org/mklab/tool/control/system/source/UserDefinedDiscreteSource.java | 75 |
return (DoubleMatrix)this.outputFunction.invoke(this.object, Double.valueOf(t));
} catch (IllegalArgumentException e) {
throw new SolverStopException(e);
} catch (IllegalAccessException e) {
throw new SolverStopException(e);
} catch (InvocationTargetException e) {
throw new SolverStopException(e.getTargetException());
}
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/UserDefinedContinuousStaticSystem.java | 92 |
| org/mklab/tool/control/system/source/DoubleUserDefinedContinuousSource.java | 76 |
return (RM)this.outputFunction.invoke(this.object, t);
} catch (IllegalArgumentException e) {
throw new SolverStopException(e);
} catch (IllegalAccessException e) {
throw new SolverStopException(e);
} catch (InvocationTargetException e) {
throw new SolverStopException(e.getTargetException());
}
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 1876 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 1868 |
final AdjacencyMatrix<RS, RM, CS, CM> ans = new AdjacencyMatrix<>(matrix, this.sunit);
ans.setInputNodes(this.inputNodes);
ans.setSourceNodes(this.sourceNodes);
ans.setOutputNodes(this.outputNodes);
ans.setSinkNodes(this.sinkNodes);
ans.setInputPortTags(this.inputPortTags);
ans.setOutputPortTags(this.outputPortTags);
ans.setRequiringLinearSystem(this.requiringLinearSystem);
ans.setRequiringDescriptor(this.requiringDescriptor);
ans.setRequiringPrimitiveExpression(this.requiringPrimitiveExpression);
final int inputNodeSize = ans.inputNodes.size();
final int numberOfIntegrator = ans.getIntegratorOrUnitDelaySystemSize();
for (int column = 0; column < inputNodeSize; column++) {
ans.moveIntegratorLeft(column);
}
for (int column = inputNodeSize + numberOfIntegrator; column < ans.getColumnSize(); column++) {
ans.moveIntegratorLeft(column);
}
return ans;
}
/**
* 積分器が指定された列にあれば、左側へ移動する。
*
* @param column 対象となる列番号
*/
private void moveIntegratorLeft(final int column) {
final SystemOperator<RS, RM, CS, CM>[][] matrix = this.elements; | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleUserDefinedContinuousDynamicSystem.java | 185 |
| org/mklab/tool/control/system/continuous/DoubleUserDefinedContinuousStaticSystem.java | 167 |
| org/mklab/tool/control/system/continuous/UserDefinedContinuousDynamicSystem.java | 194 |
| org/mklab/tool/control/system/continuous/UserDefinedContinuousStaticSystem.java | 176 |
this.updateFunction.invoke(this.object);
} catch (IllegalArgumentException e) {
throw new ParameterException(e);
} catch (IllegalAccessException e) {
throw new ParameterException(e);
} catch (InvocationTargetException e) {
throw new ParameterException(e.getTargetException());
} catch (Exception e) {
throw new ParameterException(e);
}
}
/**
* {@inheritDoc}
*/
@Override
public void initialize() {
super.initialize();
try {
if (this.initializeFunction != null) {
this.initializeFunction.invoke(this.object);
}
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e.getTargetException());
} catch (Exception e) {
throw new RuntimeException(e);
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discrete/DoubleUserDefinedDiscreteStaticSystem.java | 168 |
| org/mklab/tool/control/system/discrete/UserDefinedDiscreteStaticSystem.java | 177 |
| org/mklab/tool/control/system/sink/DoubleUserDefinedContinuousSink.java | 162 |
| org/mklab/tool/control/system/sink/DoubleUserDefinedDiscreteSink.java | 164 |
| org/mklab/tool/control/system/sink/UserDefinedContinuousSink.java | 171 |
| org/mklab/tool/control/system/sink/UserDefinedDiscreteSink.java | 173 |
| org/mklab/tool/control/system/source/DoubleUserDefinedDiscreteSource.java | 151 |
| org/mklab/tool/control/system/source/UserDefinedDiscreteSource.java | 160 |
} catch (IllegalArgumentException e) {
throw new ParameterException(e);
} catch (IllegalAccessException e) {
throw new ParameterException(e);
} catch (InvocationTargetException e) {
throw new ParameterException(e.getTargetException());
} catch (Exception e) {
throw new ParameterException(e);
}
}
/**
* @see org.mklab.tool.control.system.discrete.BaseDiscreteStaticSystem#initialize()
*/
@Override
public void initialize() {
super.initialize();
try {
if (this.initializeFunction != null) {
this.initializeFunction.invoke(this.obj);
}
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e.getTargetException());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/parameter/DoubleParameterContainer.java | 494 |
| org/mklab/tool/control/system/parameter/ParameterContainer.java | 501 |
public int compareTo(final DoubleParameterContainer opponent) {
final String thisName = getName();
final String opponentName = opponent.getName();
int ans = thisName.compareToIgnoreCase(opponentName);
if (ans == 0) {
ans = thisName.compareTo(opponentName);
}
return ans;
}
/**
* パラメータの名前を返します。
*
* @return パラメータの名前
*/
public String getName() {
return this.name;
}
/**
* パラメータの定義式を返します。
*
* @return パラメータの定義式
*/
public String getExpression() {
return this.expression;
}
/**
* パラメータの型を識別するための Class オブジェクトを返します。
*
* @return パラメータの型を識別するための Class オブジェクトを返します。
*/
public Class<?> getType() {
return this.value.getType();
}
/**
* パラメータを宣言するクラスまたはインタフェースを表す Class オブジェクトを返します。
*
* @return パラメータを宣言するクラスまたはインタフェースを表す Class オブジェクト
*/
public Class<?> getParameterClass() {
return this.value.getDeclaringClass();
}
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
}
final DoubleParameterContainer castedObj = (DoubleParameterContainer)o; | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleSystemBuilder.java | 234 |
| org/mklab/tool/control/system/SystemBuilder.java | 255 |
private void createSystem(final DoubleAdjacencyMatrix matrix, final List<Integer> inputNodes, final List<Integer> outputNodes, final List<Integer> sourceNodes, final List<Integer> sinkNodes,
final Map<Integer, String> inputPortTags, final Map<Integer, String> outputPortTags, SystemBuilderOption option) {
final boolean requiringLinearSystem = option.isRequiringLinearSystem();
final boolean contractingAllConstantEdges = option.isContractingAllConstantEdges();
final boolean requiringReachableSubSystem = option.isRequiringReachableSubSystem();
final boolean requiringDescriptor = option.isRequiringDescriptor();
final boolean requiringPrimitiveExpression = option.isRequiringPrimitiveExpression();
matrix.setInputNodes(inputNodes);
matrix.setOutputNodes(outputNodes);
matrix.setSourceNodes(sourceNodes);
matrix.setSinkNodes(sinkNodes);
matrix.setInputPortTags(inputPortTags);
matrix.setOutputPortTags(outputPortTags);
matrix.setRequiringLinearSystem(requiringLinearSystem);
matrix.setRequiringDescriptor(requiringDescriptor);
matrix.setRequiringPrimitiveExpression(requiringPrimitiveExpression); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discrete/DoubleUserDefinedDiscreteDynamicSystem.java | 198 |
| org/mklab/tool/control/system/discrete/UserDefinedDiscreteDynamicSystem.java | 207 |
| org/mklab/tool/control/system/sink/DoubleUserDefinedDiscreteSink.java | 164 |
| org/mklab/tool/control/system/sink/UserDefinedDiscreteSink.java | 173 |
| org/mklab/tool/control/system/source/DoubleUserDefinedContinuousSource.java | 181 |
| org/mklab/tool/control/system/source/UserDefinedContinuousSource.java | 190 |
} catch (IllegalArgumentException e) {
throw new ParameterException(e);
} catch (IllegalAccessException e) {
throw new ParameterException(e);
} catch (InvocationTargetException e) {
throw new ParameterException(e.getTargetException());
} catch (Exception e) {
throw new ParameterException(e);
}
}
/**
* @see org.mklab.tool.control.system.discrete.BaseDiscreteStaticSystem#initialize()
*/
@Override
public void initialize() {
super.initialize();
try {
if (this.initializeFunction != null) {
this.initializeFunction.invoke(this.obj);
}
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e.getTargetException());
} catch (Exception e) {
throw new RuntimeException(e);
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/Are.java | 73 |
| org/mklab/tool/control/Are.java | 147 |
public static DoubleMatrix are(DoubleMatrix A, DoubleMatrix R, DoubleMatrix Q, DoubleNumber tolerance) {
String message;
if ((message = Abcdchk.abcdchk(A)).length() > 0) {
throw new IllegalArgumentException(message);
}
int n = A.getRowSize();
if (R.getRowSize() != n || R.getColumnSize() != n) {
message = Messages.getString("Are.0") + R.getRowSize() + "x" + R.getColumnSize() + Messages.getString("Are.2"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
throw new IllegalArgumentException(message);
}
if (Q.getRowSize() != n || Q.getColumnSize() != n) {
message = Messages.getString("Are.3") + Q.getRowSize() + "x" + Q.getColumnSize() + Messages.getString("Are.5"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
throw new IllegalArgumentException(message);
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyStringMatrix.java | 42 |
| org/mklab/tool/control/system/DoubleAdjacencyStringMatrix.java | 34 |
private Map<String, SystemBuilder<RS,RM,CS,CM>> csMap = new HashMap<>();
/** sourceシステムの番号とそれが接続するノードの番号のマップ */
private Map<Integer, Integer> sourceMap = new HashMap<>();
/** inputポートの番号とそれが接続するノードの番号のマップ */
private Map<Integer, Integer> inputMap = new HashMap<>();
/** sinkシステムの番号とそれが接続するノードの番号のマップ */
private Map<Integer, Integer> sinkMap = new HashMap<>();
/** outputポートの番号とそれが接続するノードの番号のマップ */
private Map<Integer, Integer> outputMap = new HashMap<>();
/** 多重器のマップ(出力ノード番号、入力ノード番号のリスト) */
private Map<Integer, List<Integer>> muxMap = new HashMap<>();
/** 分離器のマップ(入力ノード番号、出力ノード番号のリスト) */
private Map<Integer, List<Integer>> demuxMap = new HashMap<>();
/** 出力器のマップ(出力番号、出力器) */
private Map<Integer, Exporter> exporterMap = new TreeMap<>();
/** 入力器のマップ(入力番号、入力器) */
private Map<Integer, Importer> importerMap = new TreeMap<>();
// /** 乗除算器のマップ(出力ノード番号、入力ノード番号のリスト) */
// private Map<Integer, List<Integer>> productMap = new HashMap<Integer, List<Integer>>();
/** システムのID番号 */
private int systemId = 1;
/** 行列の成分を保持する文字列行列 */
private SparceStringMatrix elements;
/** ノードの次数 */
private int[] nodeDegrees;
/**
* 大きさ<code>size</code>の隣接行列を生成します。
*
* @param size 隣接行列のサイズ
*/
public AdjacencyStringMatrix(final int size) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleSystemOperator.java | 747 |
| org/mklab/tool/control/system/SystemOperator.java | 760 |
for (final DoubleParameterContainer parameter : this.parameters.values()) {
if (parameter.getType().isArray() && parameter.getName().contains("[") == false) { //$NON-NLS-1$
continue;
}
paras.add(parameter);
}
return paras;
}
/**
* 自動的に入出力の数を設定するか判定します。
*
* @return 自動的に入出力の数を設定するならばtrue、そうでなければfalse
*/
public boolean isAutoSize() {
return this.autoSize;
}
/**
* 自動的に入出力の数を設定するか設定します。
*
* @param autoSize 自動的に入出力の数を設定するならばtrue、そうでなければfalse
*/
public void setAutoSize(final boolean autoSize) {
this.autoSize = autoSize;
}
/**
* 自動的に入出力の数を設定するシステムの入出力数をリセットします。
*/
public void resetAutoSize() {
if (this.autoSize == false) {
return;
}
if (this.inputSize != -1) {
this.inputSize = -1;
}
if (this.outputSize != -1) {
this.outputSize = -1;
}
}
/**
* 入出力数が決定されたか判定します。
*
* @return 入出力数が決定されていればtrue、そうでなければfalse
*/
public boolean isSizeDefined() {
return this.inputSize != -1 && this.outputSize != -1;
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/BlockContinuousSystem.java | 73 |
| org/mklab/tool/control/system/discrete/BlockDiscreteSystem.java | 59 |
}
/**
* ノードの値を計算します。
*
* @param t 時刻
* @exception SolverStopException ソルバーが停止された場合
*/
protected void calcNodeValue(final RS t) throws SolverStopException {
this.time = t;
calcNodeValue();
}
/**
* {@inheritDoc}
*/
@Override
protected RM calcOutputOfDirectFeedthroughSystem(final SystemOperator<RS,RM,CS,CM> system, final RM u) throws SolverStopException {
if (system instanceof DynamicSystem) {
final DynamicSystem<RS,RM,CS,CM> dSystem = (DynamicSystem<RS,RM,CS,CM>)system;
return dSystem.outputEquation(this.time, dSystem.getState(), u);
}
return ((StaticSystem<RS,RM,CS,CM>)system).outputEquation(this.time, u);
}
/**
* {@inheritDoc}
*/
@Override
protected RM calcOutputOfNonDirectFeedthroughSystem(final SystemOperator<RS,RM,CS,CM> system) throws SolverStopException {
if (system == null) throw new NullPointerException(); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/DoubleCoulombViscousFriction.java | 142 |
| org/mklab/tool/control/system/discontinuous/DoubleDeadZone.java | 166 |
return t1 + (-uu1) / (uu2 - uu1) * (t2 - t1);
}
assert false : "never reached"; //$NON-NLS-1$
return Double.NaN;
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setInputSize(int)
*/
@Override
public void setInputSize(final int size) {
super.setInputSize(size);
super.setOutputSize(size);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setOutputSize(int)
*/
@Override
public void setOutputSize(final int size) {
super.setInputSize(size);
super.setOutputSize(size);
}
/**
* @see org.mklab.tool.control.system.parameter.StringExternalizable#getString(java.lang.String)
*/
public String getString(String key) {
return Messages.getString(key);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/math/DoubleRoundingFunction.java | 79 |
| org/mklab/tool/control/system/math/RoundingFunction.java | 88 |
return new DoubleMatrix(u.getRowSize(), 1);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setInputSize(int)
*/
@Override
public void setInputSize(final int size) {
super.setInputSize(size);
super.setOutputSize(size);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setOutputSize(int)
*/
@Override
public void setOutputSize(final int size) {
super.setOutputSize(size);
super.setInputSize(size);
}
/**
* @see org.mklab.tool.control.system.parameter.StringExternalizable#getString(java.lang.String)
*/
public String getString(String key) {
return Messages.getString(key);
}
/**
* 関数の式を返します。
*
* @return 関数の式
*/
public String getFunction() {
return this.type.getFunction();
}
/**
* @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sampled/BlockSampledDataDynamicSystem.java | 180 |
| org/mklab/tool/control/system/sampled/BlockSampledDataDynamicSystem.java | 208 |
for (final ContinuousExplicitDynamicSystem<RS,RM,CS,CM> system : this.continuousDynamicSystems) {
final int size = ((SystemOperator<RS,RM,CS,CM>)system).getStateSize();
if (size > 0) {
final int end = offset + size - 1;
if (end > initialState.getRowSize()) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDataDynamicSystem.0"), system.getClass().getName())); //$NON-NLS-1$
}
system.setInitialState(initialState.getSubVector(offset, end));
offset += size;
stateSize += size;
}
}
if (initialState.getRowSize() != stateSize) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDynamicSystem.1"), Integer.valueOf(initialState.getRowSize()), Integer.valueOf(stateSize))); //$NON-NLS-1$
}
}
/**
* {@inheritDoc}
*/
public void setDiscreteInitialState(final RM initialState) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/WeierstrassForm.java | 206 |
| org/mklab/tool/control/WeierstrassForm.java | 227 |
RS z1a2 = tA.getElement(j + 1, j);
RM Z1 = givens(z1a1, z1a2, tolerance);
this.TR.setSubMatrix(1, this.TR.getRowSize(), j, j + 1, this.TR.getSubMatrix(1, this.TR.getRowSize(), j, j + 1).multiply(Z1));
tA.setSubMatrix(1, tA.getRowSize(), j, j + 1, tA.getSubMatrix(1, tA.getRowSize(), j, j + 1).multiply(Z1));
tE.setSubMatrix(1, tE.getRowSize(), j, j + 1, tE.getSubMatrix(1, tE.getRowSize(), j, j + 1).multiply(Z1)); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/BlockSystem.java | 230 |
| org/mklab/tool/control/system/DoubleBlockSystem.java | 214 |
if (matrix[row][column] != ZeroSystem.getInstance(this.sunit)) {
nodeMatrix.setElement(row + 1, column + 1, true);
}
}
nodeMatrix.setElement(row + 1, row + 1, true);
}
// ノードの数だけ累乗を求める
final BooleanMatrix loopMatrix = nodeMatrix.power(size);
// iノードからjノードへのパスがあり、jノードからiノードへのパスがあれば、
// iノードとjノードは同一ループ中に存在する
for (int j = 1; j <= size; j++) {
final List<Integer> loop = new ArrayList<>();
for (int i = 1; i <= size; i++) {
if (loopMatrix.getElement(i, j) && loopMatrix.getElement(j, i)) {
loop.add(i);
}
}
if (loop.size() > 1 && loopList.contains(loop) == false) {
loopList.add(loop);
}
}
return loopList;
}
/**
* 自己ループをもつノード(システム)の入出力を求め、このシステムを隣接行列から削除します。
*
* @param matrix 隣接行列
* @param tmpValue ノードの仮の値
* @return 縮約したならばtrue、そうでなければfalse
*/
private boolean resolveConstantSelfLoop(final SystemOperator<RS, RM, CS, CM>[][] matrix, final List<RM> tmpValue) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/Ltifr.java | 295 |
| org/mklab/tool/control/Ltifr.java | 344 |
RM A, RM B, RM E, CM s_) {
String message;
if ((message = Abcdchk.abcdchk(A, B)).length() > 0) {
throw new IllegalArgumentException(message);
}
CM ss;
if (s_.getRowSize() > s_.getColumnSize()) {
ss = s_.transpose();
} else {
ss = s_.createClone();
}
RS unit = A.getElement(1, 1);
final int size = Math.max(ss.getRowSize(), ss.getColumnSize()); // length(s)
final RS epsilon = unit.getMachineEpsilon();
final List<CM> G = new ArrayList<>();
for (int i = 1; i <= size; i++) {
final CS s = ss.getElement(i);
CM sE_A = (E.toComplex().multiply(s).subtract(A.toComplex())); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sampled/BlockSampledDataDynamicSystem.java | 236 |
| org/mklab/tool/control/system/sampled/BlockSampledDataDynamicSystem.java | 264 |
for (final ContinuousExplicitDynamicSystem<RS,RM,CS,CM> system : this.continuousDynamicSystems) {
final int size = ((SystemOperator<RS,RM,CS,CM>)system).getStateSize();
if (size > 0) {
final int end = offset + size - 1;
if (end > state.getRowSize()) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDataDynamicSystem.0"), system.getClass().getName())); //$NON-NLS-1$
}
system.setState(state.getSubVector(offset, end));
offset += size;
stateSize += size;
}
}
if (state.getRowSize() != stateSize) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDynamicSystem.1"), Integer.valueOf(state.getRowSize()), Integer.valueOf(stateSize))); //$NON-NLS-1$
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/matrix/Rsf2csf.java | 56 |
| org/mklab/tool/matrix/Rsf2csf.java | 104 |
final DoubleComplexMatrix Q = elements2[0][0].createGrid(2, 2, elements2);
To.setSubMatrix(i - 1, i, i - 1, n, Q.multiply(To.getSubMatrix(i - 1, i, i - 1, n)));
To.setSubMatrix(1, i, i - 1, i, To.getSubMatrix(1, i, i - 1, i).multiply(Q.conjugateTranspose()));
Uo.setSubMatrix(1, n, i - 1, i, Uo.getSubMatrix(1, n, i - 1, i).multiply(Q.conjugateTranspose()));
}
To.setElement(i, i - 1, 0);
} | |
| File | Line |
|---|---|
| org/mklab/tool/signal/Filter.java | 118 |
| org/mklab/tool/signal/Filter.java | 280 |
DoubleMatrix tmp3 = a2t2.multiply(y.getElement(i)).appendDown(zab);
z = tmp1.add(tmp2).subtract(tmp3);
}
}
}
} else if (nb == na) {
if (na == 0) {
for (int i = 1; i <= nx; i++) {
y.setElement(i, 1, b.getElement(1).multiply(x.getElement(i)));
}
} else if (na == 1) {
for (int i = 1; i <= nx; i++) {
y.setElement(i, 1, b.getElement(1).multiply(x.getElement(i)).add(z.getElement(1))); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 1818 |
| org/mklab/tool/control/system/AdjacencyMatrix.java | 1874 |
private AdjacencyMatrix<RS, RM, CS, CM> sortIntegratorLower() {
final SystemOperator<RS, RM, CS, CM>[][] matrix = createClone(this.elements);
final AdjacencyMatrix<RS, RM, CS, CM> ans = new AdjacencyMatrix<>(matrix, this.sunit);
ans.setInputNodes(this.inputNodes);
ans.setSourceNodes(this.sourceNodes);
ans.setOutputNodes(this.outputNodes);
ans.setSinkNodes(this.sinkNodes);
ans.setInputPortTags(this.inputPortTags);
ans.setOutputPortTags(this.outputPortTags);
ans.setRequiringLinearSystem(this.requiringLinearSystem);
ans.setRequiringDescriptor(this.requiringDescriptor);
ans.setRequiringPrimitiveExpression(this.requiringPrimitiveExpression);
final int inputNodeSize = ans.inputNodes.size();
final int numberOfIntegrator = ans.getIntegratorOrUnitDelaySystemSize();
for (int row = 0; row < inputNodeSize + numberOfIntegrator; row++) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/DoubleBacklash.java | 282 |
| org/mklab/tool/control/system/discontinuous/DoubleRateLimiter.java | 219 |
| org/mklab/tool/control/system/discontinuous/DoubleSaturation.java | 167 |
return t1 + (this.deadBandWidth / 2 - (uu2 - uu1)) / (this.deadBandWidth / 2) * (t2 - t1);
}
assert false : "never reached"; //$NON-NLS-1$
return (t1 + t2) / 2;
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setInputSize(int)
*/
@Override
public void setInputSize(final int size) {
super.setInputSize(size);
super.setOutputSize(size);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setOutputSize(int)
*/
@Override
public void setOutputSize(final int size) {
super.setInputSize(size);
super.setOutputSize(size);
}
/**
* @see org.mklab.tool.control.system.parameter.StringExternalizable#getString(java.lang.String)
*/
public String getString(String key) {
return Messages.getString(key);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/source/DoubleFileSource.java | 65 |
| org/mklab/tool/control/system/source/FileSource.java | 71 |
}
/**
* @see org.mklab.tool.control.system.source.Importer#open()
*/
public void open() {
//
}
// /**
// * @see org.mklab.tool.control.system.source.ImportSource#initialize()
// */
// @Override
// public void initialize() {
// super.initialize();
//
// try {
// importData();
// } catch (IOException e) {
// throw new SystemOperatorException(e);
// }
// }
/**
* ファイル名を設定します。
*
* @param fileName ファイル名
*/
public void setFileName(final String fileName) {
if (this.fileName == null || this.fileName.equals(fileName) == false) {
this.fileName = fileName;
setData(null);
}
}
/**
* ファイル名を返します。
*
* @return ファイル名
*/
public String getFileName() {
return this.fileName;
}
/**
* ファイルの形式を設定します。
*
* @param fileType ファイルの形式
*/
public void setFileType(final MatrixFileType fileType) {
this.fileType = fileType;
}
/**
* ファイルの形式を返します。
*
* @return ファイルの形式
*/
public MatrixFileType getFileType() {
return this.fileType;
}
/**
* @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyStringMatrix.java | 102 |
| org/mklab/tool/control/system/DoubleAdjacencyStringMatrix.java | 94 |
public void addEdge(final int inputNode, final int outputNode, final SystemBuilder<RS,RM,CS,CM> system) {
system.resetAutoSize();
addEdge(inputNode, outputNode, "G" + this.systemId); //$NON-NLS-1$
setControlSystem("G" + this.systemId, system); //$NON-NLS-1$
this.systemId++;
if (system.isAutoSize() == false && system.getInputSize() != -1 && inputNode != 1) {
this.nodeDegrees[inputNode - 1] = system.getInputSize();
}
if (system.isAutoSize() == false && system.getOutputSize() != -1 && outputNode != this.nodeDegrees.length) {
this.nodeDegrees[outputNode - 1] = system.getOutputSize();
}
setupNodeDegree();
}
/**
* MOMOシステムを追加します。
*
* @param inputNodes 入力ノードのリスト
* @param outputNodes 出力ノードのリスト
* @param system MIMOシステム
*/
@SuppressWarnings("boxing")
public void addMIMO(final List<Integer> inputNodes, final List<Integer> outputNodes, final SystemBuilder<RS,RM,CS,CM> system) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleBlockContinuousStaticSystem.java | 31 |
| org/mklab/tool/control/system/sampled/DoubleBlockSampledDataStaticSystem.java | 31 |
public DoubleBlockContinuousStaticSystem(final DoubleSystemOperator[][] elements, final List<Integer> inputNodes, final List<Integer> outputNodes) {
super(elements, inputNodes, outputNodes);
setDynamic(false);
}
/**
* {@inheritDoc}
*/
public DoubleMatrix outputEquation(final double t, final DoubleMatrix u) throws SolverStopException {
resetNodeValue();
setInputNodeValue(u);
calcNodeValue(t);
return getOutputNodeValue();
}
/**
* {@inheritDoc}
*/
public DoubleMatrix outputEquation(final double t) throws SolverStopException {
resetNodeValue();
setInputNodeValue(new DoubleMatrix(getInputSize(), 1));
calcNodeValue(t);
return getOutputNodeValue();
}
/**
* {@inheritDoc}
*/
public DoubleMatrix inputOutputEquation(final double t) throws SolverStopException {
final DoubleMatrix u = new DoubleMatrix(getInputSize(), 1);
final DoubleMatrix y = outputEquation(t);
return u.appendDown(y);
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/graph/ConnectionMatrix.java | 69 |
| org/mklab/tool/control/system/graph/DoubleConnectionMatrix.java | 62 |
} else if (adjacencyMatrix.getElement(row + 1, column + 1).isZero() == false) {
this.connectionMatrix.setElement(row + 1, column + 1, true);
}
}
}
}
/**
* 連結情報を表わす行列を返します。
*
* @return 連結情報を表わす行列
*/
public BooleanMatrix getBooleanMatrix() {
return this.connectionMatrix.createClone();
}
/**
* 行列の次数を返します。
*
* @return 行列の次数
*/
public int getSize() {
return this.connectionMatrix.getRowSize();
}
/**
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
result = PRIME * result + ((this.connectionMatrix == null) ? 0 : this.connectionMatrix.hashCode());
return result;
}
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final ConnectionMatrix<RS, RM, CS, CM> other = (ConnectionMatrix<RS, RM, CS, CM>)obj; | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/source/AsynchronousSource.java | 141 |
| org/mklab/tool/control/system/source/DoubleAsynchronousSource.java | 132 |
protected abstract RM getOutput(RS t);
/**
* 別スレッドを開始し、入力処理を行います。
*
* @see org.mklab.tool.control.system.source.Importer#open()
*/
@Override
public final void open() {
if (this.opened) {
throw new IllegalStateException();
}
final Thread importerThread = new ImporterThread();
importerThread.start();
this.opened = true;
}
/**
* @see org.mklab.tool.control.system.source.Importer#importData()
*/
@Override
public final void importData() {
// do nothing
}
/**
* thrownを設定します。
*
* @param thrown thrown
*/
protected final void setThrown(Throwable thrown) {
this.thrown = thrown;
}
/**
* 入力処理中の例外を取得します。
*
* @return thrown 入力処理中の例外。例外が発生しなかった場合はnull
*/
protected final Throwable getThrown() {
return this.thrown;
}
/**
* @see org.mklab.tool.control.system.source.Importer#isActive()
*/
@Override
public final boolean isActive() {
return this.opened && isDone() == false;
}
/**
* ソースの記録を開始します。 <p> このメソッドは別スレッドにて呼び出されるため、ブロックしてかまいません。
*
* @throws Throwable 入力処理中に例外が発生した場合
*/
protected abstract void processImport() throws Throwable;
/**
* 入力処理を行うスレッドです。
*
* @author Yuhi Ishikura
* @version $Revision$, 2010/01/04
*/
class ImporterThread extends Thread {
/**
* @see java.lang.Thread#run()
*/
@Override
public void run() {
try {
processImport();
} catch (Throwable e) {
setThrown(e);
}
done();
}
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/DoubleFrequencyResponse.java | 198 |
| org/mklab/tool/control/DoubleFrequencyResponse.java | 235 |
private DoubleComplexMatrix getResponseForProperSystem(final DoubleComplexMatrix s, final int inputNumber) {
final DoubleMatrix a = this.system.getA();
final DoubleMatrix b = this.system.getB();
final DoubleMatrix c = this.system.getC();
final DoubleMatrix d = this.system.getD();
// Balance A
final BalancedDecomposition<DoubleNumber,DoubleMatrix> ta = a.balancedDecompose();
final DoubleMatrix t = ta.getD();
final DoubleMatrix a1 = ta.getB();
final DoubleMatrix b1 = t.leftDivide(b);
final DoubleMatrix c1 = c.multiply(t);
final HessenbergDecomposition<DoubleNumber,DoubleMatrix> qa = a1.hessenbergDecompose();
final DoubleMatrix q = qa.getQ();
final DoubleMatrix a2 = qa.getH();
final DoubleMatrix b2 = q.conjugateTranspose().multiply(b1.getColumnVector(inputNumber)); | |
| File | Line |
|---|---|
| org/mklab/tool/control/FrequencyResponse.java | 203 |
| org/mklab/tool/control/FrequencyResponse.java | 240 |
private CM getResponseForProperSystem(final CM s, final int inputNumber) {
final RM a = this.system.getA();
final RM b = this.system.getB();
final RM c = this.system.getC();
final RM d = this.system.getD();
// Balance A
final BalancedDecomposition<RS, RM> ta = a.balancedDecompose();
final RM t = ta.getD();
final RM a1 = ta.getB();
final RM b1 = t.leftDivide(b);
final RM c1 = c.multiply(t);
final HessenbergDecomposition<RS, RM> qa = a1.hessenbergDecompose();
final RM q = qa.getQ();
final RM a2 = qa.getH();
final RM b2 = q.conjugateTranspose().multiply(b1.getColumnVector(inputNumber)); | |
| File | Line |
|---|---|
| org/mklab/tool/control/Impulse.java | 206 |
| org/mklab/tool/control/Ramp.java | 237 |
canvas.setGridVisible(true);
canvas.setXLabel("t [sec]");
canvas.setYLabel("y");
canvas.plot(T, Y, new String[] {"y"});
return gnuplot;
}
/**
* @param numerator 分子多項式の係数
* @param denominator 分母多項式の係数
* @param T 評価する時刻の列
* @return Gnuplot
* @throws IOException gnuplotプロセスを起動できない場合
*/
public static Gnuplot plot(DoubleMatrix numerator, DoubleMatrix denominator, DoubleMatrix T) throws IOException {
Gnuplot gp = new Gnuplot();
return plot(gp, numerator, denominator, T);
}
/**
* 単位インパルス応答をプロットする
*
* @param gnuplot gnuplot
* @param numerator 分子多項式の係数
* @param denominator 分母多項式の係数
* @param T 評価する時刻の列
* @return Gnuplot
*/
public static Gnuplot plot(Gnuplot gnuplot, DoubleMatrix numerator, DoubleMatrix denominator, DoubleMatrix T) {
DoubleRationalPolynomial g = Tf2tfn.tf2tfn(numerator, denominator);
return plot(gnuplot, g, T);
}
/**
* @param G 伝達関数行列
* @param inputNumber 入力番号
* @param T 評価する時刻の列
* @return Gnuplot
* @throws IOException gnuplotプロセスを起動できない場合
*/
public static Gnuplot plot(DoubleRationalPolynomialMatrix G, int inputNumber, DoubleMatrix T) throws IOException {
Gnuplot gp = new Gnuplot();
return plot(gp, G, inputNumber, T);
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/Obsg.java | 65 |
| org/mklab/tool/control/Obsg.java | 123 |
throw new IllegalArgumentException("Obsg: " + Messages.getString("Obsg.3")); //$NON-NLS-1$ //$NON-NLS-2$
}
final DoubleMatrix Tinv = C.kernel().transpose().appendDown(C);
final DoubleMatrix T = Tinv.inverse();
final DoubleMatrix Ab = Tinv.multiply(A).multiply(T);
final DoubleMatrix Bb = Tinv.multiply(B);
// DoubleMatrix Cb = C.multiply(T);
final DoubleMatrix Ab11 = Ab.getSubMatrix(1, r, 1, r);
final DoubleMatrix Ab12 = Ab.getSubMatrix(1, r, r + 1, n);
final DoubleMatrix Ab21 = Ab.getSubMatrix(r + 1, n, 1, r);
final DoubleMatrix Ab22 = Ab.getSubMatrix(r + 1, n, r + 1, n);
final DoubleMatrix Bb1 = Bb.getSubMatrix(1, r, 1, m); | |
| File | Line |
|---|---|
| org/mklab/tool/control/Obsg.java | 203 |
| org/mklab/tool/control/Obsg.java | 270 |
throw new IllegalArgumentException("Obsg: " + Messages.getString("Obsg.3")); //$NON-NLS-1$ //$NON-NLS-2$
}
final RM Tinv = C.kernel().transpose().appendDown(C);
final RM T = Tinv.inverse();
final RM Ab = Tinv.multiply(A).multiply(T);
final RM Bb = Tinv.multiply(B);
// RM Cb = C.multiply(T);
final RM Ab11 = Ab.getSubMatrix(1, r, 1, r);
final RM Ab12 = Ab.getSubMatrix(1, r, r + 1, n);
final RM Ab21 = Ab.getSubMatrix(r + 1, n, 1, r);
final RM Ab22 = Ab.getSubMatrix(r + 1, n, r + 1, n);
final RM Bb1 = Bb.getSubMatrix(1, r, 1, m); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 2492 |
| org/mklab/tool/control/system/AdjacencyMatrix.java | 2580 |
public LinearSystem<RS, RM, CS, CM> getLinearSystemForMaxima(final boolean requiringReachableSubSystem, final ReversePolishNotationProcessor<RS, RM> processor) {
final AdjacencyMatrix<RS, RM, CS, CM> allSystem = getLinearSystemFromInputToOutput(requiringReachableSubSystem);
final int[] stateSizes = allSystem.getStateSizes();
int stateSize = 0;
for (int i = 0; i < stateSizes.length; i++) {
stateSize += stateSizes[i];
}
final int inputSize = allSystem.getInputSize();
final int outputSize = allSystem.getOutputSize();
final RM a = allSystem.createNumericalA(stateSizes, stateSize);
final RM b = allSystem.createNumericalB(stateSizes, stateSize, inputSize);
final RM c = allSystem.createNumericalC(stateSizes, stateSize, outputSize);
final RM d = allSystem.createNumericalD(inputSize, outputSize);
final LinearSystem<RS, RM, CS, CM> linearSystem = LinearSystemFactory.createLinearSystem(a, b, c, d); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sampled/DoubleBlockSampledDataDynamicSystem.java | 172 |
| org/mklab/tool/control/system/sampled/DoubleBlockSampledDataDynamicSystem.java | 200 |
for (final DoubleContinuousExplicitDynamicSystem system : this.continuousDynamicSystems) {
final int size = ((DoubleSystemOperator)system).getStateSize();
if (size > 0) {
final int end = offset + size - 1;
if (end > initialState.getRowSize()) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDataDynamicSystem.0"), system.getClass().getName())); //$NON-NLS-1$
}
system.setInitialState(initialState.getSubVector(offset, end));
offset += size;
stateSize += size;
}
}
if (initialState.getRowSize() != stateSize) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDynamicSystem.1"), Integer.valueOf(initialState.getRowSize()), Integer.valueOf(stateSize))); //$NON-NLS-1$
}
}
/**
* {@inheritDoc}
*/
public void setDiscreteInitialState(final DoubleMatrix initialState) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sink/DoubleMatrixExportSink.java | 50 |
| org/mklab/tool/control/system/sink/MatrixExportSink.java | 59 |
final boolean solverTrial = DoubleEquationSolver.isTrial() || NonLinearEquationSolver.isTrial();
if (solverTrial == false) {
if (this.data.getColumnSize() <= this.dataLength) {
this.data = this.data.resize(getInputSize() + 1, this.dataLength + this.capacityUnit);
}
this.data.setElement(1, this.dataLength + 1, t);
int uSize = getInputSize();
this.data.setSubMatrix(2, 2 + uSize - 1, this.dataLength + 1, this.dataLength + 1, u.createClone());
this.dataLength++;
}
return u.createClone();
}
/**
* {@inheritDoc}
*/
@Override
public void open() {
this.dataLength = 0;
this.data = new DoubleMatrix(getInputSize() + 1, this.capacityUnit); | |
| File | Line |
|---|---|
| org/mklab/tool/control/Ss2tfm.java | 127 |
| org/mklab/tool/control/Ss2tfm.java | 167 |
public static DoubleRationalPolynomialMatrix ss2tfm(DoubleMatrix A, DoubleMatrix B, DoubleMatrix C, DoubleMatrix D, boolean simplify) {
String message;
if ((message = Abcdchk.abcdchk(A, B, C, D)).length() > 0) {
throw new RuntimeException(message);
}
int outputSize = D.getRowSize();
int inputSize = D.getColumnSize();
DoubleRationalPolynomialMatrix G = new DoubleRationalPolynomialMatrix(outputSize, inputSize);
for (int j = 1; j <= inputSize; j++) {
List<DoubleMatrix> tmp = Ss2tf.ss2tf(A, B, C, D, j);
DoubleMatrix numerators = tmp.get(0);
DoubleMatrix denominator = tmp.get(1);
G.setSubMatrix(1, G.getRowSize(), j, j, Tf2tfm.tf2tfm(numerators, denominator, simplify)); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 1932 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 1924 |
final AdjacencyMatrix<RS, RM, CS, CM> ans = new AdjacencyMatrix<>(matrix, this.sunit);
ans.setInputNodes(this.inputNodes);
ans.setSourceNodes(this.sourceNodes);
ans.setOutputNodes(this.outputNodes);
ans.setSinkNodes(this.sinkNodes);
ans.setInputPortTags(this.inputPortTags);
ans.setOutputPortTags(this.outputPortTags);
ans.setRequiringLinearSystem(this.requiringLinearSystem);
ans.setRequiringDescriptor(this.requiringDescriptor);
ans.setRequiringPrimitiveExpression(this.requiringPrimitiveExpression);
final int inputNodeSize = ans.inputNodes.size();
final int outputNodeSize = ans.outputNodes.size();
final int integratorSize = getIntegratorOrUnitDelaySystemSize();
final int size = ans.getRowSize();
for (int i = 0; i < integratorSize; i++) {
final int row = size - outputNodeSize - integratorSize + i;
final int column = findIntegratorOrUnitDelayInRow(matrix, row); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 2451 |
| org/mklab/tool/control/system/AdjacencyMatrix.java | 2580 |
public LinearSystem<RS, RM, CS, CM> getLinearSystem(final boolean requiringReachableSubSystem) {
final AdjacencyMatrix<RS, RM, CS, CM> allSystem = getLinearSystemFromInputToOutput(requiringReachableSubSystem);
final int[] stateSizes = allSystem.getStateSizes();
int stateSize = 0;
for (int i = 0; i < stateSizes.length; i++) {
stateSize += stateSizes[i];
}
final int inputSize = allSystem.getInputSize();
final int outputSize = allSystem.getOutputSize();
final RM a = allSystem.createNumericalA(stateSizes, stateSize);
final RM b = allSystem.createNumericalB(stateSizes, stateSize, inputSize);
final RM c = allSystem.createNumericalC(stateSizes, stateSize, outputSize);
final RM d = allSystem.createNumericalD(inputSize, outputSize);
final RM e = allSystem.createNumericalE(stateSizes, stateSize);
final LinearSystem<RS, RM, CS, CM> linearSystem = this.requiringDescriptor ? LinearSystemFactory.createLinearSystem(a, b, c, d, e, true) | |
| File | Line |
|---|---|
| org/mklab/tool/control/DoubleImproperLinearSystem.java | 160 |
| org/mklab/tool/control/ImproperLinearSystem.java | 158 |
inst.G = this.G == null ? null : (DoubleRationalPolynomialMatrix)this.G.clone();
return inst;
}
/**
* @see org.mklab.tool.control.LinearSystem#print(java.io.Writer)
*/
public void print(Writer output) {
printABCD(output);
printE(output);
}
/**
* EをWriterへ出力します。
*
* @param output 出力先
*/
private void printE(final Writer output) {
final String[] eString = this.e.getPrintingElementsString(Integer.MAX_VALUE).split("[\\r\\n]+"); //$NON-NLS-1$
final PrintWriter pw = new PrintWriter(output);
pw.print("E(" + this.getStateSize() + "x" + this.getStateSize() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
pw.println();
for (int i = 0; i < this.getStateSize() + 1; i++) {
pw.print(eString[i]);
pw.println();
}
pw.flush();
}
/**
* A,B,C,DをWriterへ出力します。
*
* @param output 出力先
*/
private void printABCD(final Writer output) {
final DoubleMatrix ac = this.getA().appendDown(this.getC()); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sampled/DoubleBlockSampledDataDynamicSystem.java | 228 |
| org/mklab/tool/control/system/sampled/DoubleBlockSampledDataDynamicSystem.java | 256 |
for (final DoubleContinuousExplicitDynamicSystem system : this.continuousDynamicSystems) {
final int size = ((DoubleSystemOperator)system).getStateSize();
if (size > 0) {
final int end = offset + size - 1;
if (end > state.getRowSize()) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDataDynamicSystem.0"), system.getClass().getName())); //$NON-NLS-1$
}
system.setState(state.getSubVector(offset, end));
offset += size;
stateSize += size;
}
}
if (state.getRowSize() != stateSize) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDynamicSystem.1"), Integer.valueOf(state.getRowSize()), Integer.valueOf(stateSize))); //$NON-NLS-1$
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleAdjacencyMatrixUtil.java | 850 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrixUtil.java | 998 |
static DoubleSystemOperator[][] replaceLinearDynamicSystemWithBLockSystem(final DoubleSystemOperator[][] matrix, final boolean requireringPrimitive) {
final DoubleSystemOperator[][] newMatrix = DoubleAdjacencyMatrixUtil.createClone(matrix);
final int size = newMatrix.length;
for (int row = 0; row < size; row++) {
for (int column = 0; column < size; column++) {
if (newMatrix[row][column] == DoubleZeroSystem.getInstance()) {
continue;
}
if (!newMatrix[row][column].isLinear() || !newMatrix[row][column].isDynamic()) {
continue;
}
final List<Integer> inputNodes = new ArrayList<>(Arrays.asList(1));
final List<Integer> outputNodes = new ArrayList<>(Arrays.asList(4)); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleUserDefinedContinuousLinearDynamicSystem.java | 95 |
| org/mklab/tool/control/system/continuous/UserDefinedContinuousLinearDynamicSystem.java | 106 |
| org/mklab/tool/control/system/discrete/DoubleUserDefinedDiscreteLinearDynamicSystem.java | 82 |
| org/mklab/tool/control/system/discrete/UserDefinedDiscreteLinearDynamicSystem.java | 92 |
public void setParameterValue(final String name, final Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try {
this.updateFunction.invoke(this.object); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/math/ConstantSystem.java | 180 |
| org/mklab/tool/control/system/math/DoubleConstantSystem.java | 174 |
private void setSubtractiveExpression(final ConstantSystem<RS,RM,CS,CM> first, final ConstantSystem<RS,RM,CS,CM> second) {
String firstExpression = first.getMultipliedSystem().getExpression();
if (first.isSingleTerm() == false) {
firstExpression = "(" + firstExpression + ")"; //$NON-NLS-1$ //$NON-NLS-2$
}
String secondExpression = second.getMultipliedSystem().getExpression();
if (second.isSingleTerm() == false) {
secondExpression = "(" + secondExpression + ")"; //$NON-NLS-1$ //$NON-NLS-2$
}
if (second.isZero() || second.gainSystem.getD().isZero()) {
setExpression(firstExpression);
} else if (first.isZero() || first.gainSystem.getD().isZero()) {
setExpression("- " + secondExpression); //$NON-NLS-1$
} else {
setExpression(firstExpression + " - " + secondExpression); //$NON-NLS-1$
}
setSingleTerm(false);
}
/**
* 二つのシステムの積システムを返します。
*
* @param opponent 掛けるシステム
* @return 結合したシステム
*/
public ConstantSystem<RS,RM,CS,CM> multiply(final ConstantSystem<RS,RM,CS,CM> opponent) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/ApproximateDerivativeSystem.java | 157 |
| org/mklab/tool/control/system/continuous/DoubleApproximateDerivativeSystem.java | 147 |
final ApproximateDerivativeSystem<RS, RM, CS, CM> castedObj = (ApproximateDerivativeSystem<RS,RM,CS,CM>)o;
return ((this.initialOutput == null ? castedObj.initialOutput == null : this.initialOutput.equals(castedObj.initialOutput)) && (this.previousTime == castedObj.previousTime)
&& (this.previousInput == null ? castedObj.previousInput == null : this.previousInput.equals(castedObj.previousInput))
&& (this.previousOutput == null ? castedObj.previousOutput == null : this.previousOutput.equals(castedObj.previousOutput)));
}
/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
int hashCode = super.hashCode();
hashCode = 31 * hashCode + (this.initialOutput == null ? 0 : this.initialOutput.hashCode());
hashCode = 31 * hashCode + (this.previousTime.hashCode() ^ (this.previousTime.hashCode() >>> 32)); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/math/ConstantSystem.java | 275 |
| org/mklab/tool/control/system/math/DoubleConstantSystem.java | 269 |
public void setLinearSystem(final LinearSystem<RS,RM,CS,CM> system) {
this.gainSystem = system;
setInputSize(system.getInputSize());
setOutputSize(system.getOutputSize());
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#hasVariableA()
*/
public boolean hasVariableA() {
return this.isVariable;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#hasVariableB()
*/
public boolean hasVariableB() {
return this.isVariable;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#hasVariableC()
*/
public boolean hasVariableC() {
return this.isVariable;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#hasVariableD()
*/
public boolean hasVariableD() {
return this.isVariable;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#hasVariableE()
*/
public boolean hasVariableE() {
return this.isVariable;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#setHasVariableA(boolean)
*/
public void setHasVariableA( final boolean hasVariableA) {
// nothing to do;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#setHasVariableB(boolean)
*/
public void setHasVariableB( final boolean hasVariableB) {
// nothing to do;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#setHasVariableC(boolean)
*/
public void setHasVariableC( final boolean hasVariableC) {
// nothing to do;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#setHasVariableD(boolean)
*/
public void setHasVariableD(final boolean hasVariableD) {
this.isVariable = hasVariableD;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#setHasVariableE(boolean)
*/
public void setHasVariableE( final boolean hasVariableE) {
// nothing to do;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#getA()
*/
public RM getA() { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 1818 |
| org/mklab/tool/control/system/AdjacencyMatrix.java | 1874 |
| org/mklab/tool/control/system/AdjacencyMatrix.java | 1930 |
private AdjacencyMatrix<RS, RM, CS, CM> sortIntegratorLower() {
final SystemOperator<RS, RM, CS, CM>[][] matrix = createClone(this.elements);
final AdjacencyMatrix<RS, RM, CS, CM> ans = new AdjacencyMatrix<>(matrix, this.sunit);
ans.setInputNodes(this.inputNodes);
ans.setSourceNodes(this.sourceNodes);
ans.setOutputNodes(this.outputNodes);
ans.setSinkNodes(this.sinkNodes);
ans.setInputPortTags(this.inputPortTags);
ans.setOutputPortTags(this.outputPortTags);
ans.setRequiringLinearSystem(this.requiringLinearSystem);
ans.setRequiringDescriptor(this.requiringDescriptor);
ans.setRequiringPrimitiveExpression(this.requiringPrimitiveExpression);
final int inputNodeSize = ans.inputNodes.size();
final int numberOfIntegrator = ans.getIntegratorOrUnitDelaySystemSize(); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 3543 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 3535 |
final AdjacencyMatrix<RS, RM, CS, CM> ans = new AdjacencyMatrix<>(matrix, this.sunit);
ans.setInputNodes(this.inputNodes);
ans.setOutputNodes(this.outputNodes);
ans.setInputPortTags(this.inputPortTags);
ans.setOutputPortTags(this.outputPortTags);
ans.setRequiringLinearSystem(this.requiringLinearSystem);
ans.setRequiringDescriptor(this.requiringDescriptor);
ans.setRequiringPrimitiveExpression(this.requiringPrimitiveExpression);
return ans;
}
/**
* 配列中の指定されたデータが存在する指数を返します。
*
* @param value 指定されたデータ
* @param data 配列
* @return 配列中の指定されたデータが存在する指数を返します。
*/
@SuppressWarnings("boxing")
private int findIndex(final int value, final Integer[] data) {
for (int i = 0; i < data.length; i++) {
if (data[i] == value) {
return i;
}
}
assert false : Messages.getString("AdjacencyMatrix.12"); //$NON-NLS-1$
return -1;
}
/**
* 入力ノードが指定された順に並ぶようにソートします。
*
* @param matrix 隣接行列
* @return 指定された順にソートされた入力ノード
*/
@SuppressWarnings("boxing")
private List<Integer> sortByInputNode(final SystemOperator<RS, RM, CS, CM>[][] matrix) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/BlockContinuousDynamicSystem.java | 139 |
| org/mklab/tool/control/system/continuous/DoubleBlockContinuousDynamicSystem.java | 131 |
final int size = ((SystemOperator<RS,RM,CS,CM> )system).getStateSize();
if (size > 0) {
final int end = offset + size - 1;
if (end > initialState.getRowSize()) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockContinuousDynamicSystem.0"), system.getClass().getName())); //$NON-NLS-1$
}
system.setInitialState(initialState.getSubVector(offset, end));
offset += size;
stateSize += size;
}
}
if (initialState.getRowSize() != stateSize) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockContinuousDynamicSystem.1"), Integer.valueOf(initialState.getRowSize()), Integer.valueOf(stateSize))); //$NON-NLS-1$
}
}
/**
* {@inheritDoc}
*/
public void setInitialStateDerivative(final RM initialStateDerivative) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/BlockContinuousDynamicSystem.java | 167 |
| org/mklab/tool/control/system/continuous/DoubleBlockContinuousDynamicSystem.java | 159 |
final int size = ((SystemOperator<RS,RM,CS,CM> )system).getStateSize();
if (size > 0) {
final int end = offset + size - 1;
if (end > initialStateDerivative.getRowSize()) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockContinuousDynamicSystem.0"), system.getClass().getName())); //$NON-NLS-1$
}
system.setInitialStateDerivative(initialStateDerivative.getSubVector(offset, end));
offset += size;
stateSize += size;
}
}
if (initialStateDerivative.getRowSize() != stateSize) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockContinuousDynamicSystem.1"), Integer.valueOf(initialStateDerivative.getRowSize()), Integer.valueOf(stateSize))); //$NON-NLS-1$
}
}
/**
* {@inheritDoc}
*/
public void setState(final RM state) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discrete/BlockDiscreteDynamicSystem.java | 108 |
| org/mklab/tool/control/system/discrete/DoubleBlockDiscreteDynamicSystem.java | 100 |
final int size = ((SystemOperator<RS,RM,CS,CM>)system).getStateSize();
if (size > 0) {
final int end = offset + size - 1;
if (end > initialState.getRowSize()) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockDiscreteDynamicSystem.0"), system.getClass().getName())); //$NON-NLS-1$
}
system.setInitialState(initialState.getSubVector(offset, end));
offset += size;
stateSize += size;
}
}
if (initialState.getRowSize() != stateSize) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockDiscreteDynamicSystem.1"), Integer.valueOf(initialState.getRowSize()), Integer.valueOf(stateSize))); //$NON-NLS-1$
}
}
/**
* {@inheritDoc}
*/
public void setState(final RM state) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sampled/BlockSampledDataDynamicSystem.java | 181 |
| org/mklab/tool/control/system/sampled/DoubleBlockSampledDataDynamicSystem.java | 173 |
final int size = ((SystemOperator<RS,RM,CS,CM>)system).getStateSize();
if (size > 0) {
final int end = offset + size - 1;
if (end > initialState.getRowSize()) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDataDynamicSystem.0"), system.getClass().getName())); //$NON-NLS-1$
}
system.setInitialState(initialState.getSubVector(offset, end));
offset += size;
stateSize += size;
}
}
if (initialState.getRowSize() != stateSize) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDynamicSystem.1"), Integer.valueOf(initialState.getRowSize()), Integer.valueOf(stateSize))); //$NON-NLS-1$
}
}
/**
* {@inheritDoc}
*/
public void setDiscreteInitialState(final RM initialState) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sampled/BlockSampledDataDynamicSystem.java | 209 |
| org/mklab/tool/control/system/sampled/DoubleBlockSampledDataDynamicSystem.java | 201 |
final int size = ((SystemOperator<RS,RM,CS,CM>)system).getStateSize();
if (size > 0) {
final int end = offset + size - 1;
if (end > initialState.getRowSize()) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDataDynamicSystem.0"), system.getClass().getName())); //$NON-NLS-1$
}
system.setInitialState(initialState.getSubVector(offset, end));
offset += size;
stateSize += size;
}
}
if (initialState.getRowSize() != stateSize) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDynamicSystem.1"), Integer.valueOf(initialState.getRowSize()), Integer.valueOf(stateSize))); //$NON-NLS-1$
}
}
/**
* {@inheritDoc}
*/
public void setContinuousState(final RM state) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sampled/BlockSampledDataDynamicSystem.java | 237 |
| org/mklab/tool/control/system/sampled/DoubleBlockSampledDataDynamicSystem.java | 229 |
final int size = ((SystemOperator<RS,RM,CS,CM>)system).getStateSize();
if (size > 0) {
final int end = offset + size - 1;
if (end > state.getRowSize()) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDataDynamicSystem.0"), system.getClass().getName())); //$NON-NLS-1$
}
system.setState(state.getSubVector(offset, end));
offset += size;
stateSize += size;
}
}
if (state.getRowSize() != stateSize) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDynamicSystem.1"), Integer.valueOf(state.getRowSize()), Integer.valueOf(stateSize))); //$NON-NLS-1$
}
}
/**
* {@inheritDoc}
*/
public void setDiscreteState(final RM state) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sampled/BlockSampledDataDynamicSystem.java | 265 |
| org/mklab/tool/control/system/sampled/DoubleBlockSampledDataDynamicSystem.java | 257 |
final int size = ((SystemOperator<RS,RM,CS,CM>)system).getStateSize();
if (size > 0) {
final int end = offset + size - 1;
if (end > state.getRowSize()) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDataDynamicSystem.0"), system.getClass().getName())); //$NON-NLS-1$
}
system.setState(state.getSubVector(offset, end));
offset += size;
stateSize += size;
}
}
if (state.getRowSize() != stateSize) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDynamicSystem.1"), Integer.valueOf(state.getRowSize()), Integer.valueOf(stateSize))); //$NON-NLS-1$
}
}
/**
* 次のサンプリング周期で状態を更新すべき離散時間システムの状態を設定します。
*
* @param state 現在の全離散時間システムの状態
*/
private void setDiscreteStateForUpdating(final RM state) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/source/DoubleVariableSource.java | 28 |
| org/mklab/tool/control/system/source/VariableSource.java | 37 |
super();
}
/**
* @see org.mklab.tool.control.system.source.Importer#close()
*/
public void close() {
//
}
/**
* @see org.mklab.tool.control.system.source.Importer#importData()
*/
public void importData() {
if (isActive()) {
return;
}
}
/**
* @see org.mklab.tool.control.system.source.Importer#open()
*/
public void open() {
//
}
/**
* 名前を返します。
*
* @return 名前
*/
public String getVariableName() {
return this.variableName;
}
/**
* 名前を設定します。
*
* @param variableName 名前
*/
public void setVariableName(final String variableName) {
this.variableName = variableName;
}
/**
* @see org.mklab.tool.control.system.parameter.StringExternalizable#getString(java.lang.String)
*/
public String getString(String key) {
return Messages.getString(key);
}
/**
* @see org.mklab.tool.control.system.source.ImportSource#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/matrix/Funm.java | 51 |
| org/mklab/tool/matrix/Funm.java | 100 |
public static DoubleComplexMatrix funm(DoubleMatrix A, ComplexFunction fun) {
int n = A.getRowSize();
SchurDecomposition<DoubleNumber,DoubleMatrix> temp = A.schurDecompose();
DoubleMatrix Qr = temp.getU();
DoubleMatrix Tr = temp.getT();
List<DoubleComplexMatrix> tmp = Rsf2csf.rsf2csf(Qr, Tr);
DoubleComplexMatrix Q = tmp.get(0);
DoubleComplexMatrix T = tmp.get(1);
DoubleComplexNumber unit = fun.eval(T.getElement(1, 1));
DoubleComplexMatrix F = unit.createZeroGrid(n, n);
for (int i = 1; i <= n; i++) {
F.setElement(i, i, fun.eval(T.getElement(i, i)));
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/DoubleRateLimiter.java | 269 |
| org/mklab/tool/control/system/discontinuous/RateLimiter.java | 278 |
DoubleRateLimiter castedObj = (DoubleRateLimiter)o;
return ((this.rateLowerBound == castedObj.rateLowerBound) && (this.rateUpperBound == castedObj.rateUpperBound)
&& (this.initialOutput == null ? castedObj.initialOutput == null : this.initialOutput.equals(castedObj.initialOutput)) && (this.previousTime == castedObj.previousTime)
&& (this.previousOutput == null ? castedObj.previousOutput == null : this.previousOutput.equals(castedObj.previousOutput)) && (this.inputRate == null ? castedObj.inputRate == null
: this.inputRate.equals(castedObj.inputRate)));
}
/**
* @see org.mklab.tool.control.system.SystemOperator#hashCode()
*/
@Override
public int hashCode() {
int hashCode = super.hashCode();
hashCode = 31 * hashCode + (int)(Double.doubleToLongBits(this.rateLowerBound) ^ (Double.doubleToLongBits(this.rateLowerBound) >>> 32)); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/math/BiasFunction.java | 68 |
| org/mklab/tool/control/system/math/DoubleBiasFunction.java | 60 |
public RM getBias() {
return this.bias;
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setInputSize(int)
*/
@Override
public void setInputSize(final int size) {
super.setInputSize(size);
super.setOutputSize(size);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setOutputSize(int)
*/
@Override
public void setOutputSize(final int size) {
super.setInputSize(size);
super.setOutputSize(size);
}
/**
* @see org.mklab.tool.control.system.parameter.StringExternalizable#getString(java.lang.String)
*/
public String getString(String key) {
return Messages.getString(key);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
*/
@Override
public boolean equals(Object opponent) {
if (this == opponent) {
return true;
}
if (!super.equals(opponent)) {
return false;
}
if (opponent == null) {
return false;
}
if (opponent.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sampled/BaseSampledDataDynamicSystem.java | 159 |
| org/mklab/tool/control/system/sampled/DoubleBaseSampledDataDynamicSystem.java | 151 |
public RM outputEquation( final RS t, final RM xc, final RM xd) throws SolverStopException {
throw new SolverStopException(Messages.getString("BaseSampledDataDynamicSystem.1")); //$NON-NLS-1$
}
/**
* @see org.mklab.tool.control.system.sampled.SampledDataDynamicSystem#getContinuousStateSize()
*/
public int getContinuousStateSize() {
return this.continuousState.length();
}
/**
* @see org.mklab.tool.control.system.sampled.SampledDataDynamicSystem#getDiscreteStateSize()
*/
public int getDiscreteStateSize() {
return this.discreteState.length();
}
/**
* @see org.mklab.nfc.ode.Sampling#isAtSamplingPoint()
*/
public boolean isAtSamplingPoint() {
return this.atSamplingPoint;
}
/**
* @see org.mklab.nfc.ode.Sampling#setAtSamplingPoint(boolean)
*/
public void setAtSamplingPoint(final boolean samplingPoint) {
this.atSamplingPoint = samplingPoint;
}
/**
* @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/DoubleImproperLinearSystem.java | 282 |
| org/mklab/tool/control/DoubleProperLinearSystem.java | 296 |
| org/mklab/tool/control/ImproperLinearSystem.java | 280 |
| org/mklab/tool/control/ProperLinearSystem.java | 302 |
if (withInputOutput) {
if (isContinuous()) {
if (getSubSystemSize() == 1) {
string.append(" "); //$NON-NLS-1$
} else {
string.append(" "); //$NON-NLS-1$
}
}
if (isDiscrete()) {
string.append(" "); //$NON-NLS-1$
}
final String format = "%" + (symbolicState[0].length() + 1 + 1 + 1) + "s"; //$NON-NLS-1$ //$NON-NLS-2$
string.append(String.format(format, "")); //$NON-NLS-1$
}
string.append("["); //$NON-NLS-1$
drawHorizontalLine(string, columnLengthes);
string.append("]" + System.getProperty("line.separator")); //$NON-NLS-1$ //$NON-NLS-2$
}
string.append(getSymbolicOutputEquation(withInputOutput));
return string.toString();
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/AbstractLinearSystem.java | 1065 |
| org/mklab/tool/control/DoubleAbstractLinearSystem.java | 1054 |
final RM T = this.d.createUnit(this.d.getRowSize()).subtract(this.d);
if (T.isFullRank() == false) {
throw new RuntimeException(Messages.getString("LinearSystem.32")); //$NON-NLS-1$
}
ansA = this.a.add(this.b.divide(T).multiply(this.c));
ansB = this.b.multiply(T.inverse());
ansC = this.c.add(this.d.divide(T).multiply(this.c));
ansD = this.d.multiply(T.inverse());
}
if (simplify) {
final List<RM> abcd = Minreal.minreal(ansA, ansB, ansC, ansD); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 2485 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 2573 |
public DoubleLinearSystem getLinearSystemForMaxima(final boolean requiringReachableSubSystem, final ReversePolishNotationProcessor<DoubleNumber,DoubleMatrix> processor) {
final DoubleAdjacencyMatrix allSystem = getLinearSystemFromInputToOutput(requiringReachableSubSystem);
final int[] stateSizes = allSystem.getStateSizes();
int stateSize = 0;
for (int i = 0; i < stateSizes.length; i++) {
stateSize += stateSizes[i];
}
final int inputSize = allSystem.getInputSize();
final int outputSize = allSystem.getOutputSize();
final DoubleMatrix a = allSystem.createNumericalA(stateSizes, stateSize);
final DoubleMatrix b = allSystem.createNumericalB(stateSizes, stateSize, inputSize);
final DoubleMatrix c = allSystem.createNumericalC(stateSizes, stateSize, outputSize);
final DoubleMatrix d = allSystem.createNumericalD(inputSize, outputSize);
final DoubleLinearSystem linearSystem = DoubleLinearSystemFactory.createLinearSystem(a, b, c, d); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/graph/DoubleReachableMatrix.java | 56 |
| org/mklab/tool/control/system/graph/ReachableMatrix.java | 63 |
this(new DoubleConnectionMatrix(adjacencyMatrix).getBooleanMatrix());
}
/**
* 可到達情報を表わす行列を返します。
*
* @return 可到達情報を表わす行列
*/
public BooleanMatrix getBooleanMatrix() {
return this.reachableMatrix.createClone();
}
/**
* 行列の次数を返します。
*
* @return 行列の次数
*/
public int getSize() {
return this.reachableMatrix.getRowSize();
}
/**
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
result = PRIME * result + ((this.reachableMatrix == null) ? 0 : this.reachableMatrix.hashCode());
return result;
}
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final DoubleReachableMatrix other = (DoubleReachableMatrix)obj; | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sampled/BlockSampledDataDynamicSystem.java | 181 |
| org/mklab/tool/control/system/sampled/DoubleBlockSampledDataDynamicSystem.java | 201 |
final int size = ((SystemOperator<RS,RM,CS,CM>)system).getStateSize();
if (size > 0) {
final int end = offset + size - 1;
if (end > initialState.getRowSize()) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDataDynamicSystem.0"), system.getClass().getName())); //$NON-NLS-1$
}
system.setInitialState(initialState.getSubVector(offset, end));
offset += size;
stateSize += size;
}
}
if (initialState.getRowSize() != stateSize) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDynamicSystem.1"), Integer.valueOf(initialState.getRowSize()), Integer.valueOf(stateSize))); //$NON-NLS-1$
}
}
/**
* {@inheritDoc}
*/
public void setDiscreteInitialState(final RM initialState) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sampled/BlockSampledDataDynamicSystem.java | 209 |
| org/mklab/tool/control/system/sampled/DoubleBlockSampledDataDynamicSystem.java | 173 |
final int size = ((SystemOperator<RS,RM,CS,CM>)system).getStateSize();
if (size > 0) {
final int end = offset + size - 1;
if (end > initialState.getRowSize()) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDataDynamicSystem.0"), system.getClass().getName())); //$NON-NLS-1$
}
system.setInitialState(initialState.getSubVector(offset, end));
offset += size;
stateSize += size;
}
}
if (initialState.getRowSize() != stateSize) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDynamicSystem.1"), Integer.valueOf(initialState.getRowSize()), Integer.valueOf(stateSize))); //$NON-NLS-1$
}
}
/**
* {@inheritDoc}
*/
public void setContinuousState(final RM state) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 2445 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 2573 |
public DoubleLinearSystem getLinearSystem(final boolean requiringReachableSubSystem) {
final DoubleAdjacencyMatrix allSystem = getLinearSystemFromInputToOutput(requiringReachableSubSystem);
final int[] stateSizes = allSystem.getStateSizes();
int stateSize = 0;
for (int i = 0; i < stateSizes.length; i++) {
stateSize += stateSizes[i];
}
final int inputSize = allSystem.getInputSize();
final int outputSize = allSystem.getOutputSize();
final DoubleMatrix a = allSystem.createNumericalA(stateSizes, stateSize);
final DoubleMatrix b = allSystem.createNumericalB(stateSizes, stateSize, inputSize);
final DoubleMatrix c = allSystem.createNumericalC(stateSizes, stateSize, outputSize);
final DoubleMatrix d = allSystem.createNumericalD(inputSize, outputSize);
final DoubleMatrix e = allSystem.createNumericalE(stateSizes, stateSize);
final DoubleLinearSystem linearSystem = this.requiringDescriptor ? DoubleLinearSystemFactory.createLinearSystem(a, b, c, d, e, true) : DoubleLinearSystemFactory.createLinearSystem(a, b, c, d, e, false); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/BlockContinuousDynamicSystem.java | 223 |
| org/mklab/tool/control/system/continuous/DoubleBlockContinuousDynamicSystem.java | 215 |
final int size = ((SystemOperator<RS,RM,CS,CM> )system).getStateSize();
if (size > 0) {
final int end = offset + size - 1;
if (end > index.getRowSize()) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockContinuousDynamicSystem.2"), system.getClass().getName())); //$NON-NLS-1$
}
system.setIndex(index.getSubVector(offset, end));
offset += size;
stateSize += size;
}
}
if (index.getRowSize() != stateSize) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockContinuousDynamicSystem.3"), Integer.valueOf(index.getRowSize()), Integer.valueOf(stateSize))); //$NON-NLS-1$
}
}
/**
* {@inheritDoc}
*/
public RM outputEquation(final RS t, final RM x) throws SolverStopException { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/BlockContinuousDynamicSystem.java | 322 |
| org/mklab/tool/control/system/continuous/DoubleBlockContinuousDynamicSystem.java | 314 |
final int size = ((SystemOperator<RS,RM,CS,CM> )system).getStateSize();
if (size > 0) {
final int end = offset + size - 1;
if (end > stateDerivative.getRowSize()) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockContinuousDynamicSystem.0"), system.getClass().getName())); //$NON-NLS-1$
}
system.setStateDerivative(stateDerivative.getSubVector(offset, end));
offset += size;
stateSize += size;
}
}
if (stateDerivative.getRowSize() != stateSize) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockContinuousDynamicSystem.1"), Integer.valueOf(stateDerivative.getRowSize()), Integer.valueOf(stateSize))); //$NON-NLS-1$
}
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discrete/BlockDiscreteDynamicSystem.java | 136 |
| org/mklab/tool/control/system/discrete/DoubleBlockDiscreteDynamicSystem.java | 128 |
final int size = ((SystemOperator<RS,RM,CS,CM>)system).getStateSize();
if (size > 0) {
final int end = offset + size - 1;
if (end > state.getRowSize()) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockDiscreteDynamicSystem.0"), system.getClass().getName())); //$NON-NLS-1$
}
system.setState(state.getSubVector(offset, end));
offset += size;
stateSize += size;
}
}
if (state.getRowSize() != stateSize) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockDiscreteDynamicSystem.1"), Integer.valueOf(state.getRowSize()), Integer.valueOf(stateSize))); //$NON-NLS-1$
}
}
/**
* {@inheritDoc}
*/
public RM stateEquation(final int k, final RM x, final RM u) throws SolverStopException { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discrete/DiscreteLinearDynamicSystem.java | 367 |
| org/mklab/tool/control/system/discrete/DoubleDiscreteLinearDynamicSystem.java | 356 |
return new DiscreteLinearDynamicSystem<>(this.system.unityFeedback(negative, simplify), this.sunit);
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#getTag()
*/
public String getTag() {
return this.tag;
}
/**
* @see org.mklab.tool.control.system.LinearSystemOperator#setTag(java.lang.String)
*/
public void setTag(final String tag) {
this.tag = tag;
}
/**
* @see org.mklab.tool.control.system.discrete.BaseDiscreteDynamicSystem#hashCode()
*/
@Override
public int hashCode() {
int hashCode = super.hashCode();
hashCode = 31 * hashCode + (this.system == null ? 0 : this.system.hashCode());
return hashCode;
}
/**
* @see org.mklab.tool.control.system.discrete.BaseDiscreteDynamicSystem#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/DoubleAbstractLinearSystem.java | 925 |
| org/mklab/tool/control/DoubleAbstractLinearSystem.java | 954 |
.subtract(((DoubleAbstractLinearSystem)feedbackElement).b.divide(T2).multiply(this.d).multiply(((DoubleAbstractLinearSystem)feedbackElement).c));
ansA = a11.appendRight(a12).appendDown(a21.appendRight(a22));
// B = [[ B1/T1 ]
// [B2/T2*D1]];
final DoubleMatrix b1 = this.b.divide(T1);
final DoubleMatrix b2 = ((DoubleAbstractLinearSystem)feedbackElement).b.divide(T2).multiply(this.d);
ansB = b1.appendDown(b2);
// [T2\C1, -T2\D1*C2];
ansC = T2.leftDivide(this.c).appendRight(T2.leftDivide(this.d).multiply(((DoubleAbstractLinearSystem)feedbackElement).c).unaryMinus()); | |
| File | Line |
|---|---|
| org/mklab/tool/control/WeierstrassForm.java | 102 |
| org/mklab/tool/control/WeierstrassForm.java | 174 |
private List<RM> hessenbergPushDownZero(final RM A, final RM E, RS tolerance) {
this.TL = A.createUnit();
this.TR = A.createUnit();
RM tA = A.createClone();
RM tE = E.createClone();
for (int i = 1; i <= tA.getColumnSize(); i++) {
for (int j = 1; j <= tA.getColumnSize() - i; j++) {
RS e11 = tE.getElement(j, j);
RS e22 = tE.getElement(j + 1, j + 1);
if (!e11.isZero(tolerance) || e22.isZero(tolerance)) {
continue;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/graph/ConnectionMatrix.java | 37 |
| org/mklab/tool/control/system/graph/DoubleConnectionMatrix.java | 30 |
public ConnectionMatrix(final FundamentalArray<SystemOperator<RS, RM, CS, CM>, ?> adjacencyMatrix) {
final int rowSize = adjacencyMatrix.getRowSize();
final int columnSize = adjacencyMatrix.getColumnSize();
this.connectionMatrix = new BooleanMatrix(rowSize, columnSize);
for (int row = 0; row < rowSize; row++) {
for (int column = 0; column < columnSize; column++) {
if (row == column) {
this.connectionMatrix.setElement(row + 1, column + 1, true);
} else if (adjacencyMatrix.getElement(row + 1, column + 1).isZero() == false) {
this.connectionMatrix.setElement(row + 1, column + 1, true);
}
}
}
}
/**
* 新しく生成された<code>ConnectionMatrix</code>オブジェクトを初期化します。
*
* @param adjacencyMatrix 隣接行列
*/
public ConnectionMatrix(final RM adjacencyMatrix) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sampled/BlockSampledDataDynamicSystem.java | 237 |
| org/mklab/tool/control/system/sampled/DoubleBlockSampledDataDynamicSystem.java | 257 |
final int size = ((SystemOperator<RS,RM,CS,CM>)system).getStateSize();
if (size > 0) {
final int end = offset + size - 1;
if (end > state.getRowSize()) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDataDynamicSystem.0"), system.getClass().getName())); //$NON-NLS-1$
}
system.setState(state.getSubVector(offset, end));
offset += size;
stateSize += size;
}
}
if (state.getRowSize() != stateSize) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDynamicSystem.1"), Integer.valueOf(state.getRowSize()), Integer.valueOf(stateSize))); //$NON-NLS-1$
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sampled/BlockSampledDataDynamicSystem.java | 265 |
| org/mklab/tool/control/system/sampled/DoubleBlockSampledDataDynamicSystem.java | 229 |
final int size = ((SystemOperator<RS,RM,CS,CM>)system).getStateSize();
if (size > 0) {
final int end = offset + size - 1;
if (end > state.getRowSize()) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDataDynamicSystem.0"), system.getClass().getName())); //$NON-NLS-1$
}
system.setState(state.getSubVector(offset, end));
offset += size;
stateSize += size;
}
}
if (state.getRowSize() != stateSize) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDynamicSystem.1"), Integer.valueOf(state.getRowSize()), Integer.valueOf(stateSize))); //$NON-NLS-1$
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyStringMatrix.java | 479 |
| org/mklab/tool/control/system/DoubleAdjacencyStringMatrix.java | 471 |
if (getControlSystem(getWeightOfEdge(1, node)).getSystemOperator() instanceof InputPort == false) {
inputSourceNodes.add(node);
}
}
return inputSourceNodes;
}
/**
* ポート番号順にソートしたoutputポートとsinkシステムが接続されたノードのリストを返します。
*
* @return 「sinkシステム」+「ポート番号順にソートしたoutputポート」とが接続されたノードのリスト
*/
@SuppressWarnings("boxing")
public List<Integer> getSortedOutputSinkNodes() {
final List<Integer> outputSinkNodes = new ArrayList<>();
final int size = this.elements.getRowSize();
final SortedMap<Integer, Integer> sortedSinkMap = new TreeMap<>();
for (final Integer key : this.sinkMap.keySet()) {
sortedSinkMap.put(key, this.sinkMap.get(key));
}
/** sinkが接続されているノードのリスト */
for (final Integer node : sortedSinkMap.values()) {
if (getControlSystem(getWeightOfEdge(node, size)).getSystemOperator() instanceof OutputPort == false) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 2451 |
| org/mklab/tool/control/system/AdjacencyMatrix.java | 2492 |
public LinearSystem<RS, RM, CS, CM> getLinearSystem(final boolean requiringReachableSubSystem) {
final AdjacencyMatrix<RS, RM, CS, CM> allSystem = getLinearSystemFromInputToOutput(requiringReachableSubSystem);
final int[] stateSizes = allSystem.getStateSizes();
int stateSize = 0;
for (int i = 0; i < stateSizes.length; i++) {
stateSize += stateSizes[i];
}
final int inputSize = allSystem.getInputSize();
final int outputSize = allSystem.getOutputSize();
final RM a = allSystem.createNumericalA(stateSizes, stateSize);
final RM b = allSystem.createNumericalB(stateSizes, stateSize, inputSize);
final RM c = allSystem.createNumericalC(stateSizes, stateSize, outputSize);
final RM d = allSystem.createNumericalD(inputSize, outputSize);
final RM e = allSystem.createNumericalE(stateSizes, stateSize); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 3017 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 3011 |
newMatrix[i][j] = new NegativeUnitSystem<>(1, this.sunit);
}
}
insertingRowNodeList.add(k);
rowOffset += rowSize - 1;
}
final int[] insertingColumnNodes = new int[columnSize - 1];
int c = 0;
for (int i = column; i < column + columnSize - 1; i++) {
insertingColumnNodes[c] = i;
c++;
}
final int[] insertingRowNodes = new int[insertingRowNodeList.size() * (rowSize - 1)];
int counter = 0;
for (Integer i : insertingRowNodeList) {
for (int j = i.intValue(); j < i.intValue() + rowSize - 1; j++) {
insertingRowNodes[counter] = j;
counter++;
}
}
final AdjacencyMatrix<RS, RM, CS, CM> ans = updateExpandedAdjacencyMatrix(newMatrix, insertingRowNodes, insertingColumnNodes); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 3084 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 3078 |
newMatrix[i][j] = new NegativeUnitSystem<>(1, this.sunit);
}
}
insertingColumnNodeList.add(k);
columnOffset += columnSize - 1;
}
final int[] insertingRowNodes = new int[rowSize - 1];
int c = 0;
for (int i = row; i < row + rowSize - 1; i++) {
insertingRowNodes[c] = i;
c++;
}
final int[] insertingColumnNodes = new int[insertingColumnNodeList.size() * (columnSize - 1)];
int counter = 0;
for (Integer i : insertingColumnNodeList) {
for (int j = i.intValue(); j < i.intValue() + columnSize - 1; j++) {
insertingColumnNodes[counter] = j;
counter++;
}
}
final AdjacencyMatrix<RS, RM, CS, CM> ans = updateExpandedAdjacencyMatrix(newMatrix, insertingRowNodes, insertingColumnNodes); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/Saturation.java | 151 |
| org/mklab/tool/control/system/sink/Restrictor.java | 219 |
public RS getDiscontinuousPoint(final RS t1, final RM u1, final RS t2, final RM u2) {
final List<Integer> pieces1 = getPiece(t1, u1);
final List<Integer> pieces2 = getPiece(t2, u2);
if (pieces1.equals(pieces2)) {
return this.sunit.getNaN();
}
final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
final int piece1 = pieces1.get(number - 1);
final int piece2 = pieces2.get(number - 1);
final RS uu1 = u1.getElement(number);
final RS uu2 = u2.getElement(number);
final boolean fromOneToTwo = piece1 == 1 && piece2 == 2;
final boolean fromTwoToOne = piece1 == 2 && piece2 == 1; | |
| File | Line |
|---|---|
| org/mklab/tool/control/AbstractLinearSystem.java | 1055 |
| org/mklab/tool/control/DoubleAbstractLinearSystem.java | 1044 |
final RM T = this.d.createUnit(this.d.getRowSize()).add(this.d);
if (T.isFullRank() == false) {
throw new RuntimeException(Messages.getString("LinearSystem.31")); //$NON-NLS-1$
}
ansA = this.a.subtract(this.b.divide(T).multiply(this.c));
ansB = this.b.multiply(T.inverse());
ansC = this.c.subtract(this.d.divide(T).multiply(this.c));
ansD = this.d.multiply(T.inverse());
} else {
final RM T = this.d.createUnit(this.d.getRowSize()).subtract(this.d); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 1044 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 1030 |
final SystemOperator<RS, RM, CS, CM>[][] matrix = this.elements;
final int localRowSize = matrix.length;
final List<Integer> connectedIntegrator = getConnectedIntegratorNodes();
final List<Integer> selfLoopNumbers = getSelfLoopNodes();
final List<Integer> connectedLoopNodes = new ArrayList<>();
for (final Integer unit : connectedIntegrator) {
for (int row = 0; row < localRowSize; row++) {
if (matrix[row][unit].isZero() == false) {
if (selfLoopNumbers.contains(row)) {
connectedLoopNodes.add(unit);
}
}
}
}
return connectedLoopNodes;
}
/**
* 積分器につながる,かつ,列に唯一の単位行列が存在するノードのリストを得ます.
*
* @return 積分器につながる単位行列が存在するノードのリスト
*/
@SuppressWarnings("boxing")
private List<Integer> getConnectedIntegratorNodes() {
final SystemOperator<RS, RM, CS, CM>[][] matrix = this.elements; | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/BlockSystem.java | 1274 |
| org/mklab/tool/control/system/BlockSystem.java | 1295 |
final int output = firstColumn + j;
matrix[input][output] = system;
setupSourceSink(system, input + 1, output + 1, sourceNodes, sinkNodes);
}
}
for (int i = inputNodeSize; i < blockSize; i++) {
for (int j = 0; j < blockSize; j++) {
final SystemOperator<RS,RM,CS,CM> system = blockMatrix[i][j + 1];
final int input = firstColumn - 1 + i;
final int output = firstColumn + j;
matrix[input][output] = system;
setupSourceSink(system, input + 1, output + 1, sourceNodes, sinkNodes);
}
}
} else { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/Backlash.java | 297 |
| org/mklab/tool/control/system/discontinuous/CoulombViscousFriction.java | 156 |
| org/mklab/tool/control/system/discontinuous/DeadZone.java | 180 |
| org/mklab/tool/control/system/discontinuous/RateLimiter.java | 233 |
| org/mklab/tool/control/system/discontinuous/Saturation.java | 181 |
return t1.add(t2).divide(2);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setInputSize(int)
*/
@Override
public void setInputSize(final int size) {
super.setInputSize(size);
super.setOutputSize(size);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setOutputSize(int)
*/
@Override
public void setOutputSize(final int size) {
super.setInputSize(size);
super.setOutputSize(size);
}
/**
* @see org.mklab.tool.control.system.parameter.StringExternalizable#getString(java.lang.String)
*/
public String getString(String key) {
return Messages.getString(key);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/graph/ConnectionMatrix.java | 37 |
| org/mklab/tool/control/system/graph/ConnectionMatrix.java | 59 |
| org/mklab/tool/control/system/graph/DoubleConnectionMatrix.java | 30 |
public ConnectionMatrix(final FundamentalArray<SystemOperator<RS, RM, CS, CM>, ?> adjacencyMatrix) {
final int rowSize = adjacencyMatrix.getRowSize();
final int columnSize = adjacencyMatrix.getColumnSize();
this.connectionMatrix = new BooleanMatrix(rowSize, columnSize);
for (int row = 0; row < rowSize; row++) {
for (int column = 0; column < columnSize; column++) {
if (row == column) {
this.connectionMatrix.setElement(row + 1, column + 1, true);
} else if (adjacencyMatrix.getElement(row + 1, column + 1).isZero() == false) {
this.connectionMatrix.setElement(row + 1, column + 1, true);
}
}
}
}
/**
* 新しく生成された<code>ConnectionMatrix</code>オブジェクトを初期化します。
*
* @param adjacencyMatrix 隣接行列
*/
public ConnectionMatrix(final RM adjacencyMatrix) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sink/DoubleRestrictor.java | 287 |
| org/mklab/tool/control/system/sink/Restrictor.java | 300 |
DoubleRestrictor castedObj = (DoubleRestrictor)o;
return ((this.range == null ? castedObj.range == null : this.range.equals(castedObj.range)) && java.util.Arrays.equals(this.restrictedSignals, castedObj.restrictedSignals));
}
/**
* @see org.mklab.tool.control.system.SystemOperator#hashCode()
*/
@Override
public int hashCode() {
int hashCode = super.hashCode();
hashCode = 31 * hashCode + (this.range == null ? 0 : this.range.hashCode());
for (int i0 = 0; this.restrictedSignals != null && i0 < this.restrictedSignals.length; i0++) {
hashCode = 31 * hashCode + this.restrictedSignals[i0];
}
return hashCode;
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/signal/Filter.java | 109 |
| org/mklab/tool/signal/Filter.java | 133 |
z = z.getSubMatrix(2, z.getRowSize(), 1, 1).appendDown(a.createZero(1, 1)).add(b2t2.multiply(x.getElement(i)));
}
} else {
for (int i = 1; i <= nx; i++) {
y.setElement(i, 1, b.getElement(1).multiply(x.getElement(i)).add(z.getElement(1)));
DoubleMatrix tmp1 = z.getSubMatrix(2, z.getRowSize(), 1, 1).appendDown(a.createZero(1, 1));
DoubleMatrix b2t2 = b2t;
DoubleMatrix tmp2 = b2t2.multiply(x.getElement(i));
DoubleMatrix a2t2 = a2t;
DoubleMatrix tmp3 = a2t2.multiply(y.getElement(i)).appendDown(zab); | |
| File | Line |
|---|---|
| org/mklab/tool/signal/Filter.java | 271 |
| org/mklab/tool/signal/Filter.java | 295 |
z = z.getSubMatrix(2, z.getRowSize(), 1, 1).appendDown(a.createZero(1, 1)).add(b2t2.multiply(x.getElement(i)));
}
} else {
for (int i = 1; i <= nx; i++) {
y.setElement(i, 1, b.getElement(1).multiply(x.getElement(i)).add(z.getElement(1)));
RM tmp1 = z.getSubMatrix(2, z.getRowSize(), 1, 1).appendDown(a.createZero(1, 1));
RM b2t2 = b2t;
RM tmp2 = b2t2.multiply(x.getElement(i));
RM a2t2 = a2t;
RM tmp3 = a2t2.multiply(y.getElement(i)).appendDown(zab); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/Backlash.java | 298 |
| org/mklab/tool/control/system/discontinuous/CoulombViscousFriction.java | 157 |
| org/mklab/tool/control/system/discontinuous/DeadZone.java | 181 |
| org/mklab/tool/control/system/discontinuous/DoubleBacklash.java | 288 |
| org/mklab/tool/control/system/discontinuous/DoubleCoulombViscousFriction.java | 148 |
| org/mklab/tool/control/system/discontinuous/DoubleDeadZone.java | 172 |
| org/mklab/tool/control/system/discontinuous/DoubleRateLimiter.java | 225 |
| org/mklab/tool/control/system/discontinuous/DoubleSaturation.java | 173 |
| org/mklab/tool/control/system/discontinuous/RateLimiter.java | 234 |
| org/mklab/tool/control/system/discontinuous/Saturation.java | 182 |
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setInputSize(int)
*/
@Override
public void setInputSize(final int size) {
super.setInputSize(size);
super.setOutputSize(size);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setOutputSize(int)
*/
@Override
public void setOutputSize(final int size) {
super.setInputSize(size);
super.setOutputSize(size);
}
/**
* @see org.mklab.tool.control.system.parameter.StringExternalizable#getString(java.lang.String)
*/
public String getString(String key) {
return Messages.getString(key);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/math/DeMultiplexer.java | 154 |
| org/mklab/tool/control/system/math/Multiplexer.java | 156 |
}
/**
* {@inheritDoc}
*/
@Override
public ConstantSystem<RS,RM,CS,CM> multiply(final ConstantSystem<RS,RM,CS,CM> opponent) {
if (opponent instanceof Multiplexer || opponent instanceof DeMultiplexer) {
final RM gain = getGain().multiply(opponent.getGain());
if (gain.isUnit()) {
return new UnitSystem<>(gain.getRowSize(), this.sunit);
}
if (gain.unaryMinus().isUnit()) {
return new NegativeUnitSystem<>(gain.getRowSize(), this.sunit);
}
}
return super.multiply(opponent);
}
/**
* {@inheritDoc}
*/
@Override
public DeMultiplexer<RS,RM,CS,CM> clone() { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 4091 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 4083 |
if (this.elements[row][nodeNumber - 1] != ZeroSystem.getInstance(this.sunit)) {
return (this.elements[row][nodeNumber - 1]).getOutputSize();
}
}
return 0;
}
/**
* 入力の数を返します。
*
* @return 入力ノードの入力の数
*/
public int getInputSize() {
int inputSize = 0;
for (final int inputNode : this.inputNodes) {
inputSize += getNodeSignalSize(inputNode);
}
return inputSize;
}
/**
* 出力の数を返します。
*
* @return 出力ノードの出力の数
*/
public int getOutputSize() {
int outputSize = 0;
for (final int outputNode : this.outputNodes) {
outputSize += getNodeSignalSize(outputNode);
}
return outputSize;
}
/**
* 隣接行列の要素であるシステムオペレータのIDを設定します。
*/
void setupSystemIDForElements() {
for (int row = 0; row < getRowSize(); row++) {
for (int column = 0; column < getColumnSize(); column++) {
final SystemOperator<RS, RM, CS, CM> system = getElement(row + 1, column + 1); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 4422 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 4414 |
final SystemOperator<RS, RM, CS, CM>[][] matrix = adjacencyMatrix.getElements();
final String lineseparator = System.getProperty("line.separator"); //$NON-NLS-1$
final StringBuffer stringBuffer = new StringBuffer();
final String separator = ","; //$NON-NLS-1$
stringBuffer.append(" " + separator); //$NON-NLS-1$
for (int row = 0; row < matrix.length; row++) {
stringBuffer.append(row % 10 + separator);
}
stringBuffer.append(lineseparator);
for (int row = 0; row < matrix.length; row++) {
stringBuffer.append(row % 10 + separator);
for (int col = 0; col < matrix.length; col++) {
if (matrix[row][col] instanceof ZeroSystem) stringBuffer.append("0" + separator); //$NON-NLS-1$ | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleSystemBuilder.java | 1290 |
| org/mklab/tool/control/system/SystemBuilder.java | 1311 |
public DoubleSystemBuilder feedback(final DoubleSystemBuilder feedbackElement, final boolean negative) {
if (this.isAutoSize() && this.getInputSize() == -1) {
this.setInputSize(feedbackElement.getOutputSize());
}
if (this.isAutoSize() && this.getOutputSize() == -1) {
this.setOutputSize(feedbackElement.getInputSize());
}
if (feedbackElement.isAutoSize() && feedbackElement.getInputSize() == -1) {
feedbackElement.setInputSize(this.getOutputSize());
}
if (feedbackElement.isAutoSize() && feedbackElement.getOutputSize() == -1) {
feedbackElement.setOutputSize(this.getInputSize());
}
final DoubleAdjacencyMatrix matrix1 = this.adjacencyMatrix; | |
| File | Line |
|---|---|
| org/mklab/tool/control/Tfm2ss.java | 110 |
| org/mklab/tool/control/Tfm2ss.java | 220 |
final List<DoubleMatrix> tmp2 = Minreal.minreal(a, b, c, d, tolerance);
a = tmp2.get(0);
b = tmp2.get(1);
c = tmp2.get(2);
d = tmp2.get(3);
// a, b, c, d matrices are returned in controllable canonical form
// Revised with the advice of Dr. Nonaka (1999.11.04)
if (a.getRowSize() == 0) {
// G(j,i) is constant
a = num.createZero(0, 0);
b = num.createZero(0, 1);
c = num.createZero(1, 0);
}
if (j == 1) {
A = a;
B = b;
C = c;
D = d;
} else {
A = Diag.diag(A, a); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 1810 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 1866 |
private DoubleAdjacencyMatrix sortIntegratorLower() {
final DoubleSystemOperator[][] matrix = DoubleAdjacencyMatrixUtil.createClone(this.elements);
final DoubleAdjacencyMatrix ans = new DoubleAdjacencyMatrix(matrix);
ans.setInputNodes(this.inputNodes);
ans.setSourceNodes(this.sourceNodes);
ans.setOutputNodes(this.outputNodes);
ans.setSinkNodes(this.sinkNodes);
ans.setInputPortTags(this.inputPortTags);
ans.setOutputPortTags(this.outputPortTags);
ans.setRequiringLinearSystem(this.requiringLinearSystem);
ans.setRequiringDescriptor(this.requiringDescriptor);
ans.setRequiringPrimitiveExpression(this.requiringPrimitiveExpression);
final int inputNodeSize = ans.inputNodes.size();
final int numberOfIntegrator = ans.getIntegratorOrUnitDelaySystemSize();
for (int row = 0; row < inputNodeSize + numberOfIntegrator; row++) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleSystemBuilder.java | 388 |
| org/mklab/tool/control/system/SystemBuilder.java | 409 |
private List<List<Integer>> setupOutputSink(final DoubleSystemOperator[][] systemMatrix, final DoubleAdjacencyStringMatrix matrix, final List<Integer> outputSinkNodes, final int inputSourceSize) {
final int inputPortOutputPortLines = 2;
final int innerSize = matrix.size() - inputPortOutputPortLines;
final List<Integer> outputNodes = new ArrayList<>();
final List<Integer> sinkNodes = new ArrayList<>();
int systemColumn2 = innerSize + inputSourceSize;
for (final int outputSinkNode : outputSinkNodes) {
final String weight = matrix.getWeightOfEdge(outputSinkNode, matrix.size());
if (weight == null || weight.equals("")) { //$NON-NLS-1$
throw new IllegalArgumentException(Messages.getString("ControlSystem.13")); //$NON-NLS-1$
}
final int systemRow2 = outputSinkNode - 2 + inputSourceSize;
final DoubleSystemOperator system = matrix.getControlSystem(weight).getSystemOperator(); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/BlockPiecewiseContinuousDynamicSystem.java | 96 |
| org/mklab/tool/control/system/sampled/BlockPiecewiseSampledDataDynamicSystem.java | 367 |
private List<RS> getDiscontinuousPoints(RS t1, final List<RM> inputs1, RS t2, final List<RM> inputs2) throws SolverStopException {
final List<RS> points = new ArrayList<>();
for (int i = 0; i < this.piecewiseContinuousAlgebraicSystems.size(); i++) {
final PiecewiseContinuousAlgebraicSystem<RS, RM, CS, CM> system = this.piecewiseContinuousAlgebraicSystems.get(i);
final RM u1 = inputs1.get(i);
final RM u2 = inputs2.get(i);
points.add(system.getDiscontinuousPoint(t1, u1, t2, u2));
}
return points;
}
/**
* 指定された区間内([(t1,state1,inputs1),(t2,state2,inputs2)]の不連続点の時刻を返します。
*
* @param t1 不連続点の前の時刻
* @param states1 不連続点の前の状態
* @param inputs1 不連続点の前の入力
* @param t2 不連続点の後の時刻
* @param states2 不連続点の後の状態
* @param inputs2 不連続点の後の入力
* @return 指定された区間内([(t1,x1,inputs1),(t2,x2,inputs2)]の不連続点の時刻
* @exception SolverStopException ソルバーが停止された場合
*/
private List<RS> getDiscontinuousPoints(RS t1, List<RM> states1, final List<RM> inputs1, RS t2, List<RM> states2, final List<RM> inputs2) throws SolverStopException { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleTransportDelay.java | 287 |
| org/mklab/tool/control/system/continuous/TransportDelay.java | 296 |
final DoubleTransportDelay castedObj = (DoubleTransportDelay)o;
return ((this.timeDelay == castedObj.timeDelay) && (this.initialOutput == null ? castedObj.initialOutput == null : this.initialOutput.equals(castedObj.initialOutput))
&& (this.initialBufferSize == castedObj.initialBufferSize) && (this.timeQue == null ? castedObj.timeQue == null : this.timeQue.equals(castedObj.timeQue)) && (this.inputQue == null
? castedObj.inputQue == null : this.inputQue.equals(castedObj.inputQue)));
}
/**
* @see org.mklab.tool.control.system.SystemOperator#hashCode()
*/
@Override
public int hashCode() {
int hashCode = super.hashCode();
hashCode = 31 * hashCode + (int)(Double.doubleToLongBits(this.timeDelay) ^ (Double.doubleToLongBits(this.timeDelay) >>> 32)); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/DoubleSaturation.java | 142 |
| org/mklab/tool/control/system/sink/DoubleRestrictor.java | 206 |
public double getDiscontinuousPoint(final double t1, final DoubleMatrix u1, final double t2, final DoubleMatrix u2) {
final List<Integer> pieces1 = getPiece(t1, u1);
final List<Integer> pieces2 = getPiece(t2, u2);
if (pieces1.equals(pieces2)) {
return Double.NaN;
}
final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
final int piece1 = pieces1.get(number - 1);
final int piece2 = pieces2.get(number - 1);
final double uu1 = u1.getDoubleElement(number);
final double uu2 = u2.getDoubleElement(number);
final boolean fromOneToTwo = piece1 == 1 && piece2 == 2;
final boolean fromTwoToOne = piece1 == 2 && piece2 == 1; | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/math/DoubleLookupTable.java | 219 |
| org/mklab/tool/control/system/math/LookupTable.java | 231 |
DoubleLookupTable castedObj = (DoubleLookupTable)opponent;
return ((this.inputData == null ? castedObj.inputData == null : this.inputData.equals(castedObj.inputData)) && (this.outputData == null ? castedObj.outputData == null : this.outputData
.equals(castedObj.outputData)));
}
/**
* @see org.mklab.tool.control.system.SystemOperator#hashCode()
*/
@Override
public int hashCode() {
int hashCode = super.hashCode();
hashCode = 31 * hashCode + (this.inputData == null ? 0 : this.inputData.hashCode());
hashCode = 31 * hashCode + (this.outputData == null ? 0 : this.outputData.hashCode());
return hashCode;
}
/**
* @see org.mklab.tool.control.system.SystemOperator#clone()
*/
@Override
public DoubleLookupTable clone() { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sink/DoubleVariableSink.java | 27 |
| org/mklab/tool/control/system/sink/VariableSink.java | 36 |
super();
}
/**
* @see org.mklab.tool.control.system.sink.Exporter#close()
*/
public void close() {
// nothing
}
/**
* @see org.mklab.tool.control.system.sink.Exporter#isActive()
*/
public boolean isActive() {
if (0 < getDataLength()) {
return true;
}
return false;
}
/**
* @see org.mklab.tool.control.system.sink.Exporter#exportData()
*/
public void exportData() {
//
}
/**
* 名前を返します。
*
* @return 名前
*/
public String getVariableName() {
return this.variableName;
}
/**
* 名前を設定します。
*
* @param variableName 名前
*/
public void setVariableName(final String variableName) {
this.variableName = variableName;
}
/**
* @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/Dinitial.java | 245 |
| org/mklab/tool/control/Initial.java | 250 |
| org/mklab/tool/control/Step.java | 341 |
List<DoubleMatrix> yx = dinitial(A, B, C, D, x0, T);
DoubleMatrix Y = yx.get(0);
DoubleMatrix X = yx.get(1);
int outputSize = C.getRowSize();
String[] yy = new String[outputSize];
for (int i = 1; i <= outputSize; i++) {
if (outputSize == 1) {
yy[i - 1] = "y";
} else {
yy[i - 1] = "y" + i;
}
}
gnuplot.createCanvas(2, 1);
Canvas canvas1 = gnuplot.getCanvas(0, 0);
canvas1.setGridVisible(true);
canvas1.setXLabel("t [sec]");
canvas1.setYLabel("y");
canvas1.plot(T, Y, yy); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 1117 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 1103 |
final ConstantSystem<RS, RM, CS, CM> opponentElement = (ConstantSystem<RS, RM, CS, CM>)opponent.getElement(i, 1);
if ((element.getGain() == null ? opponentElement.getGain() == null : false == element.getGain().equals(opponentElement.getGain()))
&& (element.getExpression() == null ? opponentElement.getExpression() == null : false == element.getExpression().equals(opponentElement.getExpression()))
&& false == (element.isSingleTerm() == opponentElement.isSingleTerm()) && false == (element.isNegative() == opponentElement.isNegative())) {
return false;
}
} else {
final SystemOperator<RS, RM, CS, CM> element = this.getElement(i, 1); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/source/DoubleFileSource.java | 144 |
| org/mklab/tool/control/system/source/FileSource.java | 150 |
DoubleFileSource castedObj = (DoubleFileSource)o;
return ((this.fileName == null ? castedObj.fileName == null : this.fileName.equals(castedObj.fileName)) && (this.fileType == null ? castedObj.fileType == null : this.fileType
.equals(castedObj.fileType)));
}
/**
* @see org.mklab.tool.control.system.SystemOperator#hashCode()
*/
@Override
public int hashCode() {
int hashCode = super.hashCode();
hashCode = 31 * hashCode + (this.fileName == null ? 0 : this.fileName.hashCode());
hashCode = 31 * hashCode + (this.fileType == null ? 0 : this.fileType.hashCode());
return hashCode;
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/source/DoublePeriodicSource.java | 184 |
| org/mklab/tool/control/system/source/PeriodicSource.java | 201 |
DoublePeriodicSource castedObj = (DoublePeriodicSource)o;
return ((this.timeValues == null ? castedObj.timeValues == null : this.timeValues.equals(castedObj.timeValues)) && (this.outputValues == null ? castedObj.outputValues == null : this.outputValues
.equals(castedObj.outputValues)));
}
/**
* @see org.mklab.tool.control.system.SystemOperator#hashCode()
*/
@Override
public int hashCode() {
int hashCode = super.hashCode();
hashCode = 31 * hashCode + (this.timeValues == null ? 0 : this.timeValues.hashCode());
hashCode = 31 * hashCode + (this.outputValues == null ? 0 : this.outputValues.hashCode());
return hashCode;
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/matrix/Dft.java | 41 |
| org/mklab/tool/matrix/Dft.java | 85 |
DoubleMatrix W0 = new DoubleMatrix(IntMatrix.series(0, N - 1)).transpose().multiply(pi.multiply(2).divide(N));
DoubleComplexMatrix Wn = new DoubleComplexMatrix(W0).multiply(j).unaryMinus().expElementWise();
DoubleComplexMatrix Y = j.createZeroGrid(X.getRowSize(), X.getColumnSize());
for (int k = 0; k <= N - 1; k++) {
Y.setColumnVector(k + 1, new DoubleComplexMatrix(X).multiply(Wn.powerElementWise(k)));
}
return Y;
}
/**
* <code>X</code> の離散時間フーリエ変換
*
* <pre><code>
*
* W = expˆ{-j*2PI/N}
*
* Y(k) = sum_{n=0}ˆ{N-1} X(n) Wˆ{k n} k = 0,1,...,N-1
*
* Y(k) = Y(j*k * 2*PI/(N*T)) T := サンプリング周期
*
* </code></pre>
*
* を求めます。
*
* @param X_ データ
* @param N データの個数
* @return 離散フーリエ変換の結果 (transformed result)
*/
public static DoubleComplexMatrix dft(DoubleMatrix X_, int N) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/Pplace.java | 301 |
| org/mklab/tool/control/Pplace.java | 366 |
final DoubleMatrix V2 = tmp.multiply(B.multiply(b));
V.setColumnVector(i, V1.multiply(gzi.getColumnVector(i)).subtract(V2.multiply(gzi.getColumnVector(i + 1))));
V.setColumnVector(i + 1, V1.multiply(gzi.getColumnVector(i + 1)).add(V2.multiply(gzi.getColumnVector(i))));
i++;
}
}
// V is a singular matrix
if (V.minSingularValue().isLessThan(epsilon)) {
throw new RuntimeException("Pplace: " + Messages.getString("Pplace.2")); //$NON-NLS-1$ //$NON-NLS-2$
}
break;
// read gzi;
}
final DoubleMatrix F = gzi.multiply(V.inverse()); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleSystemBuilder.java | 258 |
| org/mklab/tool/control/system/SystemBuilder.java | 279 |
DoubleAdjacencyMatrix contractedSystem = allSystem;
do {
allSystem = contractedSystem;
contractedSystem = allSystem.contractConstantEdge(true, true);
} while (allSystem != contractedSystem);
do {
allSystem = contractedSystem;
contractedSystem = allSystem.contractConstantEdge(false, true);
} while (allSystem != contractedSystem);
if (requiringLinearSystem || contractingAllConstantEdges) {
do {
allSystem = contractedSystem;
contractedSystem = allSystem.contractConstantEdge(false, false);
} while (allSystem != contractedSystem);
}
allSystem.setupUndefinedMultiplexer();
allSystem.setupUndefinedDeMultiplexer();
this.adjacencyMatrix = allSystem;
this.blockSystem = this.adjacencyMatrix.getBlockSystem();
if (requiringLinearSystem || contractingAllConstantEdges) {
this.blockSystem.setZeroSizeToUnDefinedInputPortOutputPort();
}
}
/**
* SourceブロックからSinkブロックまでのパスに存在する(シミュレーション計算用)システムを返します。
*
* @return SourceブロックからSinkブロックまでのパスに存在する(シミュレーション計算用)システム
*/
public DoubleSystemBuilder getSystemForSimulation() { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleSystemOperator.java | 388 |
| org/mklab/tool/control/system/SystemOperator.java | 401 |
public DoubleLinearSystem getLinearSystem() {
throw new RuntimeException(Messages.getString("SystemOperator.0")); //$NON-NLS-1$
}
/**
* 状態などの初期化を行います。
*/
public abstract void initialize();
/**
* 入力数、出力数、状態数を文字列に変換します。
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return getClass().getSimpleName()
+ "(" + this.inputSize + " inputs, "+ this.outputSize + " outputs, " + this.stateSize + " states)"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
/**
* @see org.mklab.nfc.matrix.GridElement#toString(java.lang.String)
*/
@Override
public String toString( String valueFormat) {
return getClass().getSimpleName()
+ "(" + this.inputSize + " inputs, " + this.outputSize + " outputs, "+ this.stateSize + " states)"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
/**
* SISO(1入力1出力)システムであるか判定します。
*
* @return SISO(1入力1出力)システムならばtrue、そうでなければfalse
*/
public boolean isSISO() {
return getInputSize() == 1 && getOutputSize() == 1;
}
/**
* @see org.mklab.nfc.matrix.ArrayElement#createGrid(org.mklab.nfc.matrix.ArrayElement[][])
*/
@Override
public DoubleAdjacencyMatrix createGrid(final DoubleSystemOperator[][] elements) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/source/DoublePeriodicSource.java | 144 |
| org/mklab/tool/control/system/source/PeriodicSource.java | 161 |
}
/**
* @see org.mklab.tool.control.system.parameter.ParameterUpdator#updateWith(java.lang.String)
*/
public boolean updateWith(String parameter) {
if (parameter.equals("outputValues")) { //$NON-NLS-1$
final int size = this.outputValues.getRowSize();
setInputSize(size);
setOutputSize(size);
return true;
}
return false;
}
/**
* @see org.mklab.tool.control.system.parameter.StringExternalizable#getString(java.lang.String)
*/
public String getString(String key) {
return Messages.getString(key);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/DoubleNyquist.java | 240 |
| org/mklab/tool/control/NyquistPlotter.java | 233 |
private void drawRealAxis(final Canvas canvas, final double min, final double max) {
double reMin = min;
double reMax = max;
if (0.1 < Math.abs(reMax) || 0.1 < Math.abs(reMin)) {
if (reMax < 1) {
reMax = 1;
} else if (100 < reMax) {
reMax = 100;
} else {
reMax = Math.ceil(reMax / 10) * 10;
}
if (-1 < reMin) {
reMin = -2;
} else if (reMin < -100) {
reMin = -100;
} else {
reMin = Math.floor(reMin / 10) * 10;
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/DoubleNyquist.java | 277 |
| org/mklab/tool/control/NyquistPlotter.java | 269 |
private void drawImaginaryAxis(final Canvas canvas, final double min, final double max) {
double imMin = min;
double imMax = max;
if (0.1 < Math.abs(imMax) || 0.1 < Math.abs(imMin)) {
if (imMax < 1) {
imMax = 1;
} else if (100 < imMax) {
imMax = 100;
} else {
imMax = Math.ceil(imMax / 10) * 10;
}
if (-1 < imMin) {
imMin = -1;
} else if (imMin < -100) {
imMin = -100;
} else {
imMin = Math.floor(imMin / 10) * 10;
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleSystemOperator.java | 718 |
| org/mklab/tool/control/system/SystemOperator.java | 731 |
final Map<String, DoubleParameterContainer> subParameters = new TreeMap<>();
final Parameter parameter = field.getAnnotation(Parameter.class);
final int length = Array.getLength(array);
for (int i = 0; i < length; i++) {
final String elementName;
if (length == 1) {
elementName = name + "[" + (i + 1) + "]"; //$NON-NLS-1$ //$NON-NLS-2$
} else {
elementName = name + "[" + (i + 1) + "/" + length + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
if (subParameters.containsKey(elementName)) {
throw new RuntimeException(Messages.getString("SystemOperator.14") + elementName); //$NON-NLS-1$
}
subParameters.put(elementName, new DoubleParameterContainer(this, field, parameter, elementName)); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleBlockPiecewiseContinuousDynamicSystem.java | 91 |
| org/mklab/tool/control/system/sampled/DoubleBlockPiecewiseSampledDataDynamicSystem.java | 362 |
private List<Double> getDiscontinuousPoints(double t1, final List<DoubleMatrix> inputs1, double t2, final List<DoubleMatrix> inputs2) throws SolverStopException {
final List<Double> points = new ArrayList<>();
for (int i = 0; i < this.piecewiseContinuousAlgebraicSystems.size(); i++) {
final DoublePiecewiseContinuousAlgebraicSystem system = this.piecewiseContinuousAlgebraicSystems.get(i);
final DoubleMatrix u1 = inputs1.get(i);
final DoubleMatrix u2 = inputs2.get(i);
points.add(system.getDiscontinuousPoint(t1, u1, t2, u2));
}
return points;
}
/**
* 指定された区間内([(t1,state1,inputs1),(t2,state2,inputs2)]の不連続点の時刻を返します。
*
* @param t1 不連続点の前の時刻
* @param states1 不連続点の前の状態
* @param inputs1 不連続点の前の入力
* @param t2 不連続点の後の時刻
* @param states2 不連続点の後の状態
* @param inputs2 不連続点の後の入力
* @return 指定された区間内([(t1,x1,inputs1),(t2,x2,inputs2)]の不連続点の時刻
* @exception SolverStopException ソルバーが停止された場合
*/
@SuppressWarnings("boxing")
private List<Double> getDiscontinuousPoints(double t1, List<DoubleMatrix> states1, final List<DoubleMatrix> inputs1, double t2, List<DoubleMatrix> states2, final List<DoubleMatrix> inputs2) throws SolverStopException { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/source/ConstantSource.java | 77 |
| org/mklab/tool/control/system/source/DoubleConstantSource.java | 69 |
public RM getConstant() {
return this.constant.createClone();
}
/**
* @see org.mklab.tool.control.system.parameter.ParameterUpdator#updateWith(java.lang.String)
*/
public boolean updateWith(String parameter) {
if (parameter.equals("constant")) { //$NON-NLS-1$
setConstant(this.constant);
return true;
}
return false;
}
/**
* @see org.mklab.tool.control.system.parameter.StringExternalizable#getString(java.lang.String)
*/
public String getString(String key) {
return Messages.getString(key);
}
/**
* @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 3679 |
| org/mklab/tool/control/system/AdjacencyMatrix.java | 4317 |
final int row = inputNodeSize + i;
int offsetRow = 1;
int k2 = 0;
for (int j = 0; j < numberOfSubsystem; j++) {
final int column = inputNodeSize + numberOfSubsystem + j;
final SystemOperator<RS, RM, CS, CM> system = this.elements[row][column];
if (system == ZeroSystem.getInstance(this.sunit)) {
offsetRow += stateSizes[k2++];
continue;
}
final RM aij = ((ConstantSystem<RS, RM, CS, CM>)system).getGain();
final int aijRowSize = aij.getRowSize();
final int aijColumnSize = aij.getColumnSize(); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 4035 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 4027 |
if (system == ZeroSystem.getInstance(this.sunit)) {
continue;
}
inputSizeMatrix.setElement(row + 1, column + 1, system.getInputSize());
}
}
return inputSizeMatrix;
}
/**
* @see org.mklab.nfc.matrix.BaseArray#hashCode()
*/
@Override
public int hashCode() {
final int PRIME = 31;
int result = super.hashCode();
result = PRIME * result + (this.requiringLinearSystem ? 1231 : 1237);
return result;
}
/**
* @see org.mklab.nfc.matrix.BaseArray#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final AdjacencyMatrix<RS, RM, CS, CM> other = (AdjacencyMatrix<RS,RM,CS,CM>)obj; | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 4376 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 4368 |
public void showMatrix(SystemOperator<RS, RM, CS, CM>[][] matrix) {
String lineseparator = System.getProperty("line.separator"); //$NON-NLS-1$
StringBuffer stringBuffer = new StringBuffer();
final String separator = ","; //$NON-NLS-1$
stringBuffer.append(" " + separator); //$NON-NLS-1$
for (int row = 0; row < matrix.length; row++) {
stringBuffer.append(row % 10 + separator);
}
stringBuffer.append(lineseparator);
for (int row = 0; row < matrix.length; row++) {
stringBuffer.append(row % 10 + separator);
for (int col = 0; col < matrix.length; col++) {
if (matrix[row][col] instanceof ZeroSystem) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 2445 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 2485 |
public DoubleLinearSystem getLinearSystem(final boolean requiringReachableSubSystem) {
final DoubleAdjacencyMatrix allSystem = getLinearSystemFromInputToOutput(requiringReachableSubSystem);
final int[] stateSizes = allSystem.getStateSizes();
int stateSize = 0;
for (int i = 0; i < stateSizes.length; i++) {
stateSize += stateSizes[i];
}
final int inputSize = allSystem.getInputSize();
final int outputSize = allSystem.getOutputSize();
final DoubleMatrix a = allSystem.createNumericalA(stateSizes, stateSize);
final DoubleMatrix b = allSystem.createNumericalB(stateSizes, stateSize, inputSize);
final DoubleMatrix c = allSystem.createNumericalC(stateSizes, stateSize, outputSize);
final DoubleMatrix d = allSystem.createNumericalD(inputSize, outputSize);
final DoubleMatrix e = allSystem.createNumericalE(stateSizes, stateSize); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/BaseContinuousExplicitDynamicSystem.java | 78 |
| org/mklab/tool/control/system/continuous/DoubleBaseContinuousExplicitDynamicSystem.java | 70 |
BaseContinuousExplicitDynamicSystem<RS,RM,CS,CM> other = (BaseContinuousExplicitDynamicSystem<RS,RM,CS,CM>)obj;
if (this.hasConsistentInitialValue != other.hasConsistentInitialValue) return false;
if (this.hasJacobianMatrix != other.hasJacobianMatrix) return false;
if (this.isDifferentialAlgebraicSystem != other.isDifferentialAlgebraicSystem) return false;
if (this.jacobian == null) {
if (other.jacobian != null) return false;
} else if (!this.jacobian.equals(other.jacobian)) return false;
if (this.matrixM == null) {
if (other.matrixM != null) return false;
} else if (!this.matrixM.equals(other.matrixM)) return false;
return true;
}
/**
* {@inheritDoc}
*/
@Override
public BaseContinuousExplicitDynamicSystem<RS,RM,CS,CM> clone() { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/math/RoundingFunction.java | 187 |
| org/mklab/tool/control/system/sink/Restrictor.java | 219 |
public RS getDiscontinuousPoint(RS t1, RM u1, RS t2, RM u2) {
final List<Integer> pieces1 = getPiece(t1, u1);
final List<Integer> pieces2 = getPiece(t2, u2);
if (pieces1.equals(pieces2)) {
return this.sunit.getNaN();
}
final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
final int piece1 = pieces1.get(number - 1);
final int piece2 = pieces2.get(number - 1);
final RS uu1 = u1.getElement(number);
final RS uu2 = u2.getElement(number); | |
| File | Line |
|---|---|
| org/mklab/tool/control/Dimpulse.java | 276 |
| org/mklab/tool/control/Dlsim.java | 135 |
List<DoubleMatrix> yx = dimpulse(A, B, C, D, inputNumber, seriesSize);
DoubleMatrix Y = yx.get(0);
DoubleMatrix X = yx.get(1);
int outputSize = C.getRowSize();
String[] yy = new String[outputSize];
for (int i = 1; i <= outputSize; i++) {
if (outputSize == 1) {
yy[i - 1] = "y";
} else {
yy[i - 1] = "y" + i;
}
}
gnuplot.createCanvas(2, 1);
Canvas canvas1 = gnuplot.getCanvas(0, 0);
canvas1.setGridVisible(true);
canvas1.setXLabel("k");
canvas1.setYLabel("y"); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/BlockSystem.java | 1254 |
| org/mklab/tool/control/system/DoubleBlockSystem.java | 1224 |
final SystemOperator<RS,RM,CS,CM>[][] blockMatrix = blockSystem.elements;
final int blockSize = blockMatrix.length - 1; // 最初のinputNodeSize列と最終のoutputNodeSize行は全て零成分
final int inputNodeSize = blockSystem.getInputNodeSize();
final int outputNodeSize = blockSystem.getOutputNodeSize();
final int inputOutputNodeSize = Math.min(inputNodeSize, outputNodeSize);
final int firstColumn = column - inputOutputNodeSize + 1;
// final int firstColumn = column - outputNodeSize + 1;
final List<Integer> sourceNodes = new ArrayList<>();
final List<Integer> sinkNodes = new ArrayList<>();
if (row <= column) {
// input row
for (int i = 0; i < inputNodeSize; i++) {
for (int j = 0; j < blockSize; j++) {
final SystemOperator<RS,RM,CS,CM> system = blockMatrix[i][j + 1]; | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleBlockSystem.java | 1244 |
| org/mklab/tool/control/system/DoubleBlockSystem.java | 1265 |
final int output = firstColumn + j;
matrix[input][output] = system;
setupSourceSink(system, input + 1, output + 1, sourceNodes, sinkNodes);
}
}
for (int i = inputNodeSize; i < blockSize; i++) {
for (int j = 0; j < blockSize; j++) {
final DoubleSystemOperator system = blockMatrix[i][j + 1];
final int input = firstColumn - 1 + i;
final int output = firstColumn + j;
matrix[input][output] = system;
setupSourceSink(system, input + 1, output + 1, sourceNodes, sinkNodes);
}
}
} else { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleSystemOperator.java | 627 |
| org/mklab/tool/control/system/SystemOperator.java | 640 |
final Map<String, DoubleParameterContainer> superParameters = createParameters(superKlass);
subParameters.putAll(superParameters);
}
try {
for (final Field field : klass.getDeclaredFields()) {
final Parameter parameter = field.getAnnotation(Parameter.class);
if (parameter == null) {
continue;
}
final String name;
if (1 <= parameter.name().length()) {
name = parameter.name();
} else {
name = field.getName();
}
if (subParameters.containsKey(name)) {
throw new IllegalArgumentException(Messages.getString("SystemOperator.8") + name); //$NON-NLS-1$
}
subParameters.put(name, new DoubleParameterContainer(this, field, parameter, name)); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/controller/DoubleObserverDesigner.java | 113 |
| org/mklab/tool/control/system/controller/ObserverDesigner.java | 120 |
final DoubleMatrix Dh = this.observer.getD().getColumnVectors(inputSize + 1, inputSize + outputSize);
Ah.print("Ah");
System.out.println("");
Jh.print("Jh");
System.out.println("");
Bh.print("Bh");
System.out.println("");
Ch.print("Ch");
System.out.println("");
Dh.print("Dh");
System.out.println("");
}
/**
* オブザーバーの極が指定済みで、オブザーバーが設計可能であるか判定します。
*
* @return オブザーバーが設計可能ならばtrue、そうでなければfalse
*/
public boolean isAvailable() {
if (this.observerPoles == null) {
return false;
}
return true;
}
//
// /**
// * メインメソッド
// *
// * @param args
// * コマンドライン引数
// */
// public static void main(String[] args) {
// final ObserverDesigner designer = new ObserverDesigner(new LinearSinglePendulum());
// final DoubleMatrix observerPoles = new DoubleComplexMatrix(new double[] {-20, -20}, new double[] {0, 0}).transpose();
// designer.setObserverPoles(observerPoles);
// designer.showObserver();
// }
/**
* 状態推定の対象(線形システム)を設定します。
*
* @param plant 状態推定の対象(線形システム)
*/
public void setPlant(final DoubleLinearSystemOperator plant) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/RateLimiter.java | 193 |
| org/mklab/tool/control/system/discontinuous/Saturation.java | 145 |
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("boxing")
public RS getDiscontinuousPoint(final RS t1, final RM u1, final RS t2, final RM u2) {
final List<Integer> pieces1 = getPiece(t1, u1);
final List<Integer> pieces2 = getPiece(t2, u2);
if (pieces1.equals(pieces2)) {
return this.sunit.getNaN();
}
final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
final int piece1 = pieces1.get(number - 1);
final int piece2 = pieces2.get(number - 1);
final RS uu1 = u1.getElement(number, 1); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discrete/DoubleUserDefinedDiscreteStaticSystem.java | 75 |
| org/mklab/tool/control/system/source/DoubleUserDefinedDiscreteSource.java | 58 |
}
/**
* @see org.mklab.tool.control.system.discrete.BaseDiscreteStaticSystem#outputEquation(int)
*/
@Override
public DoubleMatrix outputEquation(int k) throws SolverStopException {
try {
return (DoubleMatrix)this.outputFunction.invoke(this.obj, Integer.valueOf(k));
} catch (IllegalArgumentException e) {
throw new SolverStopException(e);
} catch (IllegalAccessException e) {
throw new SolverStopException(e);
} catch (InvocationTargetException e) {
throw new SolverStopException(e.getTargetException());
}
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(final Method method) throws SecurityException { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discrete/UserDefinedDiscreteStaticSystem.java | 84 |
| org/mklab/tool/control/system/source/UserDefinedDiscreteSource.java | 67 |
}
/**
* @see org.mklab.tool.control.system.discrete.BaseDiscreteStaticSystem#outputEquation(int)
*/
@Override
public RM outputEquation(int k) throws SolverStopException {
try {
return (RM)this.outputFunction.invoke(this.obj, Integer.valueOf(k));
} catch (IllegalArgumentException e) {
throw new SolverStopException(e);
} catch (IllegalAccessException e) {
throw new SolverStopException(e);
} catch (InvocationTargetException e) {
throw new SolverStopException(e.getTargetException());
}
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(final Method method) throws SecurityException { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/source/DoublePulseSource.java | 264 |
| org/mklab/tool/control/system/source/PulseSource.java | 277 |
hashCode = 31 * hashCode + (int)(Double.doubleToLongBits(this.phaseDelay) ^ (Double.doubleToLongBits(this.phaseDelay) >>> 32));
return hashCode;
}
/**
* @see org.mklab.tool.control.system.parameter.ParameterUpdator#updateWith(java.lang.String)
*/
public boolean updateWith(String parameter) {
if (parameter.equals("offset")) { //$NON-NLS-1$
setOffset(this.offset);
return true;
}
if (parameter.equals("amplitude")) { //$NON-NLS-1$
setAmplitude(this.amplitude);
return true;
}
if (parameter.equals("period")) { //$NON-NLS-1$
setPeriodTime(this.period);
return true;
}
if (parameter.equals("pulseWidth")) { //$NON-NLS-1$
setPulseWidth(this.pulseWidth);
return true;
}
if (parameter.equals("phaseDelay")) { //$NON-NLS-1$
setPhaseDelay(this.phaseDelay);
return true;
}
return false;
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/DoubleProperLinearSystem.java | 131 |
| org/mklab/tool/control/ProperLinearSystem.java | 136 |
final List<DoubleMatrix> abcd = Tfm2ss.tfm2ss(transferFunctionMatrix);
this.a = abcd.get(0);
this.b = abcd.get(1);
this.c = abcd.get(2);
this.d = abcd.get(3);
this.e = this.a.createUnit();
this.G = transferFunctionMatrix.createClone();
this.stateSize = this.a.getRowSize();
this.inputSize = this.b.getColumnSize();
this.outputSize = this.c.getRowSize();
this.index = new IntMatrix(this.stateSize, 1);
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 1682 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 1674 |
final AdjacencyMatrix<RS, RM, CS, CM> blockSystem = new AdjacencyMatrix<>(blockMatrix, this.sunit);
blockSystem.setInputNodes(new ArrayList<>(this.inputNodes));
blockSystem.setSourceNodes(new ArrayList<>(this.sourceNodes));
blockSystem.setOutputNodes(new ArrayList<>(this.outputNodes));
blockSystem.setSinkNodes(new ArrayList<>(this.sinkNodes));
blockSystem.setInputPortTags(new TreeMap<>(this.inputPortTags));
blockSystem.setOutputPortTags(new TreeMap<>(this.outputPortTags));
blockSystem.setRequiringLinearSystem(this.requiringLinearSystem);
blockSystem.setRequiringDescriptor(this.requiringDescriptor);
blockSystem.setRequiringPrimitiveExpression(this.requiringPrimitiveExpression);
// blockSystem.setInputNodes(this.inputNodes);
// blockSystem.setSourceNodes(this.sourceNodes);
// blockSystem.setOutputNodes(this.outputNodes);
// blockSystem.setSinkNodes(this.sinkNodes);
// blockSystem.setInputPortTags(this.inputPortTags);
// blockSystem.setOutputPortTags(this.outputPortTags);
// blockSystem.setRequiringLinearSystem(this.requiringLinearSystem);
// blockSystem.setRequiringDescriptor(this.requiringDescriptor);
// blockSystem.setRequiringPrimitiveExpression(this.requiringPrimitiveExpression);
return blockSystem.expandAllBlockSystem();
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleSystemBuilder.java | 77 |
| org/mklab/tool/control/system/SystemBuilder.java | 89 |
final DoubleAdjacencyMatrix adjMatrix = new DoubleAdjacencyMatrix(matrix);
adjMatrix.setInputNodes(new ArrayList<>(Arrays.asList(1)));
adjMatrix.setOutputNodes(new ArrayList<>(Arrays.asList(2)));
final Map<Integer, String> inputPortTags = new TreeMap<>();
inputPortTags.put(1, "u_1"); //$NON-NLS-1$
final Map<Integer, String> outputPortTags = new TreeMap<>();
outputPortTags.put(2, "y_1"); //$NON-NLS-1$
adjMatrix.setInputPortTags(inputPortTags);
adjMatrix.setOutputPortTags(outputPortTags);
this.adjacencyMatrix = adjMatrix;
this.blockSystem = this.adjacencyMatrix.getBlockSystem();
}
/**
* 新しく生成された<code>SystemBuilder</code>オブジェクトを初期化します。
*
* <p>入力ノードの番号は1、出力ノードの番号は行列の次数となります。
*
* @param matrix 隣接行列
*/
@SuppressWarnings("boxing")
public DoubleSystemBuilder(final DoubleAdjacencyMatrix matrix) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/controller/LqServoIntegratorGain.java | 29 |
| org/mklab/tool/control/system/controller/LqServoStateFeedback.java | 29 |
public class LqServoIntegratorGain<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 ConstantSystem<RS,RM,CS,CM> implements ParameterUpdator {
/** 出力に関する重み行列 */
@Parameter(name = "Qe", description = "出力に関する重み行列", update = true)
private RM Qe;
/** 入力に関する重み行列 */
@Parameter(name = "Re", description = "入力に関する重み行列", update = true)
private RM Re;
/** 入力外乱に対するLQ最適サーボのための積分ゲインの設計器 */
private LqServoDesigner<RS,RM,CS,CM> designer;
/**
* コンストラクター
*
* @param plant 制御対象(線形システム)
* @param sunit unit of scalar
*/
public LqServoIntegratorGain(final SystemOperator<RS,RM,CS,CM> plant, RS sunit) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 3599 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 3591 |
exchangeRowAndColumn(matrix, node1 - 1, node2 - 1);
for (int j = 0; j < inputNodeSize; j++) {
if (inputNodes1[j] == node2) {
inputNodes1[j] = node1;
}
}
inputNodes1[i] = node2;
final String tag1 = this.inputPortTags.get(node1);
final String tag2 = this.inputPortTags.get(node2);
this.inputPortTags.put(node1, tag2);
this.inputPortTags.put(node2, tag1);
}
return Arrays.asList(inputNodes2);
}
/**
* 出力ノードが指定された順に並ぶようにソートします。
*
* @param matrix 隣接行列
* @return 指定された順にソートされた出力ノード
*/
@SuppressWarnings("boxing")
private List<Integer> sortByOutputNode(final SystemOperator<RS, RM, CS, CM>[][] matrix) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/BlockSystem.java | 842 |
| org/mklab/tool/control/system/BlockSystem.java | 1048 |
private SystemOperator<RS, RM, CS, CM>[][] getDirectFeedthroughPart(final SystemOperator<RS, RM, CS, CM>[][] matrix) {
final int size = this.nodeSize;
final SystemOperator<RS, RM, CS, CM>[][] newMatrix = new SystemOperator[size][size];
for (int row = 0; row < size; row++) {
for (int column = 0; column < size; column++) {
final SystemOperator<RS,RM,CS,CM> system = matrix[row][column];
if (!system.hasDirectFeedthrough()) {
newMatrix[row][column] = ZeroSystem.getInstance(this.sunit); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discrete/DiscretePIDSystem.java | 144 |
| org/mklab/tool/control/system/discrete/DoubleDiscretePIDSystem.java | 82 |
AnyRealRationalPolynomial<RS, RM, CS, CM> Gs;
switch (this.pidType) {
case PARALELL:
Gs = a.multiply(i).add(p).add(b.multiply(n).add(1).inverse().multiply(n).multiply(d));
break;
case IDEAL:
Gs = a.multiply(i).add(1).add(b.multiply(n).add(1).inverse().multiply(n).multiply(d)).multiply(p);
break;
default:
throw new IllegalArgumentException();
}
setLinearSystem(LinearSystemFactory.createLinearSystem(Gs)); | |
| File | Line |
|---|---|
| org/mklab/tool/control/AbstractLinearSystem.java | 587 |
| org/mklab/tool/control/AbstractLinearSystem.java | 757 |
public LinearSystem<RS,RM,CS,CM> add(final LinearSystem<RS,RM,CS,CM> opponent, final boolean simplify) {
if (isProper() && opponent.isProper()) {
RM ansA = Diag.diag(this.a, ((AbstractLinearSystem<RS,RM,CS,CM>)opponent).a);
RM ansB = this.b.appendDown(((AbstractLinearSystem<RS,RM,CS,CM>)opponent).b);
RM ansC = this.c.appendRight(((AbstractLinearSystem<RS,RM,CS,CM>)opponent).c); | |
| File | Line |
|---|---|
| org/mklab/tool/control/DoubleProperLinearSystem.java | 166 |
| org/mklab/tool/control/ProperLinearSystem.java | 171 |
this.G = new DoubleRationalPolynomialMatrix(new DoubleRationalPolynomial[][] {{transferFunction.clone()}});
this.stateSize = this.a.getRowSize();
this.inputSize = this.b.getColumnSize();
this.outputSize = this.c.getRowSize();
this.index = new IntMatrix(this.stateSize, 1);
}
/**
* 三対(入力数, 出力数, 状態数)の文字列に変換します。
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "ProperLinearSystem(" + this.inputSize + " inputs, " + this.outputSize + " outputs, " + this.stateSize + " states)"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
/**
* @see org.mklab.tool.control.LinearSystem#print(java.io.Writer)
*/
public void print(final Writer output) {
printABCD(output);
}
/**
* 出力ストリームにプロパーなシステムの係数行列A,B,C,Dを出力します。
*
* @param output 出力ストリーム
*/
private void printABCD(final Writer output) {
final DoubleMatrix ac = this.a.appendDown(this.c); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/CoulombViscousFriction.java | 121 |
| org/mklab/tool/control/system/discontinuous/DeadZone.java | 138 |
| org/mklab/tool/control/system/discontinuous/Saturation.java | 140 |
pieces.add(1);
}
}
return pieces;
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("boxing")
public RS getDiscontinuousPoint(final RS t1, final RM u1, final RS t2, final RM u2) {
final List<Integer> pieces1 = getPiece(t1, u1);
final List<Integer> pieces2 = getPiece(t2, u2);
if (pieces1.equals(pieces2)) {
return this.sunit.getNaN();
}
final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
final int piece1 = pieces1.get(number - 1);
final int piece2 = pieces2.get(number - 1);
final boolean fromZeroToOne = piece1 == 0 && piece2 == 1; | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/graph/NodeEquation.java | 97 |
| org/mklab/tool/control/system/graph/NodeIdentityFunctionEquation.java | 97 |
newX = newX.appendDown(xx.get(i - 1).subtract(nodeValue.get(i - 1)));
}
return newX;
}
/**
* 与えられた次数最小ノードの値から他のノードの値を計算します。
*
* @param nodeValue ノードの値
* @param xx 次数最小ノードの値の配列
* @param matrixLocal 隣接行列
* @param nodeTmpValueLocal ノードの仮の値
* @throws SolverStopException ソルバーが停止された場合
*/
protected void calcNonMinimumNodeValues(final List<RM> nodeValue, final List<RM> xx, final SystemOperator<RS,RM,CS,CM>[][] matrixLocal, final List<RM> nodeTmpValueLocal) throws SolverStopException {
for (int i : this.minimumNode) {
nodeValue.set(i - 1, xx.get(i - 1));
}
while (this.blockSystem.calcOutputOfDirectFeedthroughSystem(matrixLocal, nodeValue, nodeTmpValueLocal, false)) {
this.blockSystem.setNodeValueOfNoInputNode(matrixLocal, nodeValue, nodeTmpValueLocal, false);
}
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/math/DoubleRoundingFunction.java | 178 |
| org/mklab/tool/control/system/sink/DoubleRestrictor.java | 206 |
public double getDiscontinuousPoint(double t1, DoubleMatrix u1, double t2, DoubleMatrix u2) {
final List<Integer> pieces1 = getPiece(t1, u1);
final List<Integer> pieces2 = getPiece(t2, u2);
if (pieces1.equals(pieces2)) {
return Double.NaN;
}
final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
final int piece1 = pieces1.get(number - 1);
final int piece2 = pieces2.get(number - 1);
final double uu1 = u1.getDoubleElement(number);
final double uu2 = u2.getDoubleElement(number); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sampled/BlockPiecewiseSampledDataDynamicSystem.java | 346 |
| org/mklab/tool/control/system/sampled/BlockPiecewiseSampledDataStaticSystem.java | 199 |
private List<RS> getContinuousDiscreteDiscontinuousPoints(RS t1, final List<RM> inputs1, RS t2, final List<RM> inputs2) throws SolverStopException {
final List<RS> points = new ArrayList<>();
for (int i = 0; i < this.piecewiseContinuousDiscreteAlgebraicSystems.size(); i++) {
final PiecewiseContinuousDiscreteAlgebraicSystem<RS, RM, CS, CM> system = this.piecewiseContinuousDiscreteAlgebraicSystems.get(i);
final RM u1 = inputs1.get(i);
final RM u2 = inputs2.get(i);
points.add(system.getDiscontinuousPoint(t1, u1, t2, u2));
}
return points;
}
/**
* 指定された区間内([(t1,inputs1),(t2,inputs2)]の連続代数システムの不連続点の時刻を返します。
*
* @param t1 不連続点の前の時刻
* @param inputs1 不連続点の前の入力
* @param t2 不連続点の後の時刻
* @param inputs2 不連続点の後の入力
* @return 指定された区間内([(t1,inputs1),(t2,inputs2)]の不連続点の時刻
* @throws SolverStopException ソルバーが停止しば場合
*/
private List<RS> getContinuousDiscontinuousPoints(RS t1, final List<RM> inputs1, RS t2, final List<RM> inputs2) throws SolverStopException { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 677 |
| org/mklab/tool/control/system/AdjacencyMatrix.java | 722 |
shortDeMultiplexerAndMultiplexer(matrix, row, multiplexer, deMultiplexer);
}
if (contracting) {
final AdjacencyMatrix<RS, RM, CS, CM> ans = new AdjacencyMatrix<>(matrix, this.sunit);
ans.setInputNodes(this.inputNodes);
ans.setSourceNodes(this.sourceNodes);
ans.setOutputNodes(this.outputNodes);
ans.setSinkNodes(this.sinkNodes);
ans.setInputPortTags(this.inputPortTags);
ans.setOutputPortTags(this.outputPortTags);
ans.setRequiringLinearSystem(this.requiringLinearSystem);
ans.setRequiringDescriptor(this.requiringDescriptor);
ans.setRequiringPrimitiveExpression(this.requiringPrimitiveExpression);
return ans;
}
return this;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 1810 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 1866 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 1922 |
private DoubleAdjacencyMatrix sortIntegratorLower() {
final DoubleSystemOperator[][] matrix = DoubleAdjacencyMatrixUtil.createClone(this.elements);
final DoubleAdjacencyMatrix ans = new DoubleAdjacencyMatrix(matrix);
ans.setInputNodes(this.inputNodes);
ans.setSourceNodes(this.sourceNodes);
ans.setOutputNodes(this.outputNodes);
ans.setSinkNodes(this.sinkNodes);
ans.setInputPortTags(this.inputPortTags);
ans.setOutputPortTags(this.outputPortTags);
ans.setRequiringLinearSystem(this.requiringLinearSystem);
ans.setRequiringDescriptor(this.requiringDescriptor);
ans.setRequiringPrimitiveExpression(this.requiringPrimitiveExpression);
final int inputNodeSize = ans.inputNodes.size();
final int numberOfIntegrator = ans.getIntegratorOrUnitDelaySystemSize(); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleUserDefinedContinuousDynamicSystem.java | 149 |
| org/mklab/tool/control/system/continuous/UserDefinedContinuousDynamicSystem.java | 158 |
| org/mklab/tool/control/system/source/DoubleUserDefinedContinuousSource.java | 144 |
| org/mklab/tool/control/system/source/UserDefinedContinuousSource.java | 153 |
this.updateFunction.setAccessible(true);
}
/**
* {@inheritDoc}
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* {@inheritDoc}
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* {@inheritDoc}
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* {@inheritDoc}
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* {@inheritDoc}
*/
public void update() throws ParameterException {
try {
this.updateFunction.invoke(this.object); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/DoubleRateLimiter.java | 184 |
| org/mklab/tool/control/system/discontinuous/DoubleSaturation.java | 136 |
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("boxing")
public double getDiscontinuousPoint(final double t1, final DoubleMatrix u1, final double t2, final DoubleMatrix u2) {
final List<Integer> pieces1 = getPiece(t1, u1);
final List<Integer> pieces2 = getPiece(t2, u2);
if (pieces1.equals(pieces2)) {
return Double.NaN;
}
final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
final int piece1 = pieces1.get(number - 1);
final int piece2 = pieces2.get(number - 1);
final double uu1 = u1.getDoubleElement(number, 1); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discrete/DoubleBaseDiscreteDynamicSystem.java | 253 |
| org/mklab/tool/control/system/discrete/DoubleBaseDiscreteStaticSystem.java | 178 |
hashCode = 31 * hashCode + (this.state == null ? 0 : this.state.hashCode());
hashCode = 31 * hashCode + (int)(Double.doubleToLongBits(this.samplingInterval) ^ (Double.doubleToLongBits(this.samplingInterval) >>> 32));
hashCode = 31 * hashCode + (this.atSamplingPoint ? 1231 : 1237);
return hashCode;
}
/**
* @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/graph/DirectedCycleRemover.java | 105 |
| org/mklab/tool/control/system/graph/DoubleDirectedCycleRemover.java | 98 |
if (new CycleMatrix<>(this.maximumNoDirectedCycleGraph).hasCycle()) {
for (int i = 1; i <= nonZeroColumn.length(); i++) {
this.maximumNoDirectedCycleGraph.setElement(row, nonZeroColumn.getIntElement(i), 0);
}
this.cuttingNodes.add(row);
}
for (int i = 1; i <= nonZeroColumn.length(); i++) {
adjMatrix.setElement(row, nonZeroColumn.getIntElement(i), 0);
}
}
if (adjMatrix.isZero()) {
return;
}
throw new RuntimeException(Messages.getString("DirectedCycleRemover.1")); //$NON-NLS-1$
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sink/DoubleRestrictor.java | 124 |
| org/mklab/tool/control/system/sink/Restrictor.java | 137 |
public void setRange(final DoubleMatrix range, final int[] restrictedSignal) {
this.range = range.createClone();
this.restrictedSignals = cloneIntArray(restrictedSignal);
final int size = range.getRowSize();
if (getInputSize() != size) {
super.setInputSize(size);
}
if (getOutputSize() != size) {
super.setOutputSize(size);
}
}
private int[] cloneIntArray(int[] array) {
final int[] clone = new int[array.length];
System.arraycopy(array, 0, clone, 0, array.length);
return clone;
}
/**
* 許容範囲を返します。
*
* @return 許容範囲
*/
public DoubleMatrix getRange() { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleSystemBuilder.java | 1494 |
| org/mklab/tool/control/system/SystemBuilder.java | 1515 |
public DoubleSystemBuilder add(final DoubleSystemBuilder opponent) {
if (this.isAutoSize() && this.getInputSize() == -1) {
setInputSize(opponent.getInputSize());
}
if (this.isAutoSize() && this.getOutputSize() == -1) {
setOutputSize(opponent.getOutputSize());
}
if (opponent.isAutoSize() && opponent.getInputSize() == -1) {
opponent.setInputSize(getInputSize());
}
if (opponent.isAutoSize() && opponent.getOutputSize() == -1) {
opponent.setOutputSize(getOutputSize());
}
final DoubleAdjacencyMatrix matrix1 = this.adjacencyMatrix; | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/BlockPiecewiseContinuousDynamicSystem.java | 242 |
| org/mklab/tool/control/system/sampled/BlockPiecewiseSampledDataDynamicSystem.java | 260 |
this.piecewiseDifferentialSystems.add((PiecewiseDifferentialSystem<RS, RM, CS, CM>)system);
}
}
}
}
/**
* 区分的連続代数システムのリストを設定します。
*/
private void setupPiecewiseContinuousAlgebraicSystems() {
this.piecewiseContinuousAlgebraicSystems.clear();
final int size = getNodeSize();
for (int row = 0; row < size; row++) {
for (int column = 0; column < size; column++) {
final SystemOperator<RS, RM, CS, CM> system = getSystemOperator(row, column);
if (system instanceof PiecewiseContinuousAlgebraicSystem) {
this.piecewiseContinuousAlgebraicSystems.add((PiecewiseContinuousAlgebraicSystem<RS, RM, CS, CM>)system);
}
}
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleDerivativeSystem.java | 36 |
| org/mklab/tool/control/system/continuous/DoubleDerivativeSystem.java | 55 |
| org/mklab/tool/control/system/continuous/DoubleDerivativeSystem.java | 70 |
| org/mklab/tool/control/system/discrete/DoubleUnitLeadSystem.java | 42 |
| org/mklab/tool/control/system/discrete/DoubleUnitLeadSystem.java | 61 |
| org/mklab/tool/control/system/discrete/DoubleUnitLeadSystem.java | 76 |
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}})));
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/IntegratorSystem.java | 50 |
| org/mklab/tool/control/system/continuous/IntegratorSystem.java | 69 |
| org/mklab/tool/control/system/discrete/UnitDelaySystem.java | 50 |
| org/mklab/tool/control/system/discrete/UnitDelaySystem.java | 69 |
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) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/Backlash.java | 360 |
| org/mklab/tool/control/system/discontinuous/DoubleBacklash.java | 350 |
hashCode = 31 * hashCode + (this.previousOutputTime.hashCode() ^ (this.previousOutputTime.hashCode() >>> 32));
hashCode = 31 * hashCode + (this.previousInput == null ? 0 : this.previousInput.hashCode());
hashCode = 31 * hashCode + (this.previousRate == null ? 0 : this.previousRate.hashCode());
hashCode = 31 * hashCode + (this.previousOutput == null ? 0 : this.previousOutput.hashCode());
hashCode = 31 * hashCode + (this.holdOutput == null ? 0 : this.holdOutput.hashCode());
hashCode = 31 * hashCode + this.holdRateSign;
return hashCode;
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/util/Bench.java | 355 |
| org/mklab/tool/control/util/Bench2.java | 116 |
ode(1.0);
ts.setElement(6, timer.getElapsedTime());
System.out.print(" " + format(ts.getDoubleElement(6))); //$NON-NLS-1$
// merit
double merit = (this.js5.divideElementWise(ts.getSubVector(1, 6)).powerElementWise(1.0 / 6)).product().doubleValue();
ts.setElement(7, merit);
System.out.print(" " + format(ts.getDoubleElement(7))); //$NON-NLS-1$
/*
* System.out.println(""); System.out.println(""); System.out.println("");
* System.out.println(""); System.out.println("
* **************************************************************");
* System.out.println(" * あたなた計算機(機種、OS、コンパイラ)のベンチマーク結果を *");
* System.out.println(" * *"); System.out.println(" * matx-info@matx.org
* *"); System.out.println(" * *"); System.out.println(" *
* まで連絡して下さい。ベンチマークの比較表に追加します。 *"); System.out.println("
* **************************************************************");
* System.out.println(""); System.out.println("");
*/
Pause.pause();
MatxList yours = new MatxList(new Object[] {Messages.getString("Bench.406"), Messages.getString("Bench.407"), ts}); //$NON-NLS-1$ //$NON-NLS-2$ | |
| File | Line |
|---|---|
| org/mklab/tool/control/DoubleWeierstrassForm.java | 234 |
| org/mklab/tool/control/WeierstrassForm.java | 425 |
DoubleMatrix step11 = new DoubleMatrix(m * n * 2, m * n * 2);
step11.setSubMatrix(1, n * m, 1, n * m, step10);
step11.setSubMatrix(1, n * m, n * m + 1, n * m * 2, step7.multiply(-1));
step11.setSubMatrix(1 + n * m, n * m * 2, 1, n * m, step8.multiply(-1));
step11.setSubMatrix(n * m + 1, n * m * 2, n * m + 1, n * m * 2, step5); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleUserDefinedContinuousStaticSystem.java | 131 |
| org/mklab/tool/control/system/continuous/UserDefinedContinuousStaticSystem.java | 140 |
| org/mklab/tool/control/system/source/DoubleUserDefinedContinuousSource.java | 144 |
| org/mklab/tool/control/system/source/UserDefinedContinuousSource.java | 153 |
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try {
this.updateFunction.invoke(null); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/controller/DiscreteObserverDesigner.java | 107 |
| org/mklab/tool/control/system/controller/DoubleDiscreteObserverDesigner.java | 98 |
final RM Dhd = this.observer.getD().getColumnVectors(inputSize + 1, inputSize + outputSize);
Ahd.print("Ahd");
System.out.println("");
Jhd.print("Jhd");
System.out.println("");
Bhd.print("Bhd");
System.out.println("");
Chd.print("Chd");
System.out.println("");
Dhd.print("Dhd");
System.out.println("");
}
//
// /**
// * メインメソッド
// *
// * @param args
// * コマンドライン引数
// */
// public static void main(String[] args) {
// RM observerPoles = new DoubleComplexMatrix(new double[] {-20, -20}, new
// double[] {0, 0}).transpose();
// double samplingInterval = 0.005;
// DiscreteObserverDesigner dDesigner = new DiscreteObserverDesigner(new
// LinearSinglePendulum());
// dDesigner.setSamplingInterval(samplingInterval);
// dDesigner.setContinuousObserverPoles(observerPoles);
// dDesigner.showObserver();
// }
/**
* オブザーバーの極とサンプリング周期が設定済みで、オブザーバーが設計可能であるか判定します。
*
* @return オブザーバーが設計可能であればtrue、そうでなければfalse
*/
public boolean isAvailable() {
return this.samplingIntervalAvailable && this.observerDesigner.isAvailable();
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/CoulombViscousFriction.java | 123 |
| org/mklab/tool/control/system/discontinuous/DeadZone.java | 140 |
| org/mklab/tool/control/system/discontinuous/Quantizer.java | 102 |
| org/mklab/tool/control/system/discontinuous/Saturation.java | 142 |
}
return pieces;
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("boxing")
public RS getDiscontinuousPoint(final RS t1, final RM u1, final RS t2, final RM u2) {
final List<Integer> pieces1 = getPiece(t1, u1);
final List<Integer> pieces2 = getPiece(t2, u2);
if (pieces1.equals(pieces2)) {
return this.sunit.getNaN();
}
final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
final int piece1 = pieces1.get(number - 1);
final int piece2 = pieces2.get(number - 1); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/math/DeMultiplexer.java | 203 |
| org/mklab/tool/control/system/math/DoubleDeMultiplexer.java | 195 |
DeMultiplexer<RS,RM,CS,CM> castedObj = (DeMultiplexer<RS,RM,CS,CM>)o;
return ((this.outputNumber == castedObj.outputNumber) && (this.offset == castedObj.offset) && (this.group == null ? castedObj.group == null : this.group.equals(castedObj.group)));
}
/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
int hashCode = super.hashCode();
hashCode = 31 * hashCode + this.outputNumber;
hashCode = 31 * hashCode + this.offset;
hashCode = 31 * hashCode + (this.group == null ? 0 : this.group.hashCode());
return hashCode;
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/math/DoubleMultiplexer.java | 197 |
| org/mklab/tool/control/system/math/Multiplexer.java | 205 |
DoubleMultiplexer castedObj = (DoubleMultiplexer)o;
return ((this.inputNumber == castedObj.inputNumber) && (this.offset == castedObj.offset) && (this.group == null ? castedObj.group == null : this.group.equals(castedObj.group)));
}
/**
* @see org.mklab.tool.control.system.math.ConstantSystem#hashCode()
*/
@Override
public int hashCode() {
int hashCode = super.hashCode();
hashCode = 31 * hashCode + this.inputNumber;
hashCode = 31 * hashCode + this.offset;
hashCode = 31 * hashCode + (this.group == null ? 0 : this.group.hashCode());
return hashCode;
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/Dimpulse.java | 280 |
| org/mklab/tool/control/Dstep.java | 281 |
int outputSize = C.getRowSize();
String[] yy = new String[outputSize];
for (int i = 1; i <= outputSize; i++) {
if (outputSize == 1) {
yy[i - 1] = "y";
} else {
yy[i - 1] = "y" + i;
}
}
gnuplot.createCanvas(2, 1);
Canvas canvas1 = gnuplot.getCanvas(0, 0);
canvas1.setGridVisible(true);
canvas1.setXLabel("k");
canvas1.setYLabel("y");
canvas1.plot(DoubleMatrix.series(1, seriesSize, 1), Y, yy); | |
| File | Line |
|---|---|
| org/mklab/tool/control/Gmargin.java | 84 |
| org/mklab/tool/control/Pmargin.java | 84 |
for (;;) {
final DoubleMatrix w = LogarithmicallySpacedVector.create(Math.log(wmin2) / Math.log(10), Math.log(wmax2) / Math.log(10), 100);
final List<DoubleMatrix> gainPhase = new DoubleBode(DoubleLinearSystemFactory.createLinearSystem(g)).getGainAndPhase(w).get(0);
DoubleMatrix gain = gainPhase.get(0);
DoubleMatrix phase = gainPhase.get(1);
gain = gain.log10ElementWise().multiply(20);
phase = Unwrap.unwrapRowWise(phase);
IntMatrix idx = phase.compareElementWise(".<", -180.0).find(); //$NON-NLS-1$ | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/ContinuousPIDSystem.java | 67 |
| org/mklab/tool/control/system/continuous/ContinuousPIDSystem.java | 85 |
case PARALELL:
aa[0][0] = this.sunit.createZero();
aa[0][1] = this.sunit.createZero();
aa[1][1] = this.sunit.createZero();
aa[1][1] = n.unaryMinus();
A = this.sunit.createGrid(aa);
bb[0][0] = i;
bb[1][0] =n.multiply(d);
B = this.sunit.createGrid(bb);
cc[0][0] = this.sunit.createUnit(); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/DoubleCoulombViscousFriction.java | 112 |
| org/mklab/tool/control/system/discontinuous/DoubleDeadZone.java | 129 |
| org/mklab/tool/control/system/discontinuous/DoubleSaturation.java | 131 |
pieces.add(1);
}
}
return pieces;
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("boxing")
public double getDiscontinuousPoint(final double t1, final DoubleMatrix u1, final double t2, final DoubleMatrix u2) {
final List<Integer> pieces1 = getPiece(t1, u1);
final List<Integer> pieces2 = getPiece(t2, u2);
if (pieces1.equals(pieces2)) {
return Double.NaN;
}
final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
final int piece1 = pieces1.get(number - 1);
final int piece2 = pieces2.get(number - 1);
final boolean fromZeroToOne = piece1 == 0 && piece2 == 1; | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sampled/DoubleBlockPiecewiseSampledDataDynamicSystem.java | 340 |
| org/mklab/tool/control/system/sampled/DoubleBlockPiecewiseSampledDataStaticSystem.java | 193 |
private List<Double> getContinuousDiscreteDiscontinuousPoints(double t1, final List<DoubleMatrix> inputs1, double t2, final List<DoubleMatrix> inputs2) throws SolverStopException {
final List<Double> points = new ArrayList<>();
for (int i = 0; i < this.piecewiseContinuousDiscreteAlgebraicSystems.size(); i++) {
final DoublePiecewiseContinuousDiscreteAlgebraicSystem system = this.piecewiseContinuousDiscreteAlgebraicSystems.get(i);
final DoubleMatrix u1 = inputs1.get(i);
final DoubleMatrix u2 = inputs2.get(i);
points.add(system.getDiscontinuousPoint(t1, u1, t2, u2));
}
return points;
}
/**
* 指定された区間内([(t1,inputs1),(t2,inputs2)]の連続代数システムの不連続点の時刻を返します。
*
* @param t1 不連続点の前の時刻
* @param inputs1 不連続点の前の入力
* @param t2 不連続点の後の時刻
* @param inputs2 不連続点の後の入力
* @return 指定された区間内([(t1,inputs1),(t2,inputs2)]の不連続点の時刻
* @throws SolverStopException ソルバーが停止しば場合
*/
@SuppressWarnings("boxing")
private List<Double> getContinuousDiscontinuousPoints(double t1, final List<DoubleMatrix> inputs1, double t2, final List<DoubleMatrix> inputs2) throws SolverStopException { | |
| File | Line |
|---|---|
| org/mklab/tool/graph/gnuplot/Canvas.java | 1205 |
| org/mklab/tool/graph/gnuplot/Canvas.java | 1301 |
if (i == 1 && size == 0) {
this.plotStrings.clear();
this.removedPlotStrings.clear();
}
if (this.lineVisibles.get(i - 1).booleanValue()) {
this.plotStrings.add(command);
this.removedPlotStrings.add(""); //$NON-NLS-1$
} else {
this.plotStrings.add(""); //$NON-NLS-1$
this.removedPlotStrings.add(command);
}
}
File f = new File(dataFile);
while (!f.exists()) {
//
}
this.gnuplot.redraw();
}
/**
* {@inheritDoc}
*/
public void plot2D(DoubleMatrix xData, DoubleMatrix yData, String[] names, String[] attribute1, String[] attribute2) { | |
| File | Line |
|---|---|
| org/mklab/tool/graph/mgplot/Mgplot.java | 1893 |
| org/mklab/tool/graph/mgplot/Mgplot.java | 1921 |
command(win, "set size 1.0,1.0"); //$NON-NLS-1$
command(win, "set origin 0,0"); //$NON-NLS-1$
command(win, "set multiplot"); //$NON-NLS-1$
for (int i = 1; i <= MAX_FRAME; i++) {
String str = size_strings(win, i);
if (str.length() > 0) {
out(win, str);
}
str = title_strings(win, i);
if (str.length() > 0) {
out(win, str);
}
str = plot_strings(win, i);
if (str.length() > 0) {
out(win, "plot " + str + newLine); //$NON-NLS-1$
// mgplot_out(win, str + "\n");
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/AbstractLinearSystem.java | 59 |
| org/mklab/tool/control/DoubleAbstractLinearSystem.java | 52 |
protected RM e = null;
/** 指数 */
protected IntMatrix index = null;
/** システム行列の式 */
private String[][] aSymbol;
/** 入力行列の式 */
private String[][] bSymbol;
/** 出力行列の式 */
private String[][] cSymbol;
/** ゲイン行列の式 */
private String[][] dSymbol;
/** ディスクリプタ行列の式 */
private String[][] eSymbol;
/** 入力ポートのタグ */
protected List<String> inputPortTags;
/** 出力ポートのタグ */
protected List<String> outputPortTags;
/** 状態のタグ */
private List<String> stateTags;
/**
* 2個のシステムが等しいか判定します。
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object opponent) {
if (this == opponent) {
return true;
}
if (opponent == null) {
return false;
}
if (opponent.getClass() != getClass()) {
return false;
}
final AnyRealRationalPolynomialMatrix<RS,RM,CS,CM> g1 = getTransferFunctionMatrix(); | |
| File | Line |
|---|---|
| org/mklab/tool/control/Dimpulse.java | 276 |
| org/mklab/tool/control/Dinitial.java | 245 |
| org/mklab/tool/control/Dlsim.java | 135 |
| org/mklab/tool/control/Initial.java | 250 |
| org/mklab/tool/control/Step.java | 341 |
List<DoubleMatrix> yx = dimpulse(A, B, C, D, inputNumber, seriesSize);
DoubleMatrix Y = yx.get(0);
DoubleMatrix X = yx.get(1);
int outputSize = C.getRowSize();
String[] yy = new String[outputSize];
for (int i = 1; i <= outputSize; i++) {
if (outputSize == 1) {
yy[i - 1] = "y";
} else {
yy[i - 1] = "y" + i;
}
}
gnuplot.createCanvas(2, 1);
Canvas canvas1 = gnuplot.getCanvas(0, 0);
canvas1.setGridVisible(true);
canvas1.setXLabel("k"); | |
| File | Line |
|---|---|
| org/mklab/tool/control/Dinitial.java | 247 |
| org/mklab/tool/control/Initial.java | 252 |
| org/mklab/tool/control/Lsim.java | 236 |
DoubleMatrix X = yx.get(1);
int outputSize = C.getRowSize();
String[] yy = new String[outputSize];
for (int i = 1; i <= outputSize; i++) {
if (outputSize == 1) {
yy[i - 1] = "y";
} else {
yy[i - 1] = "y" + i;
}
}
gnuplot.createCanvas(2, 1);
Canvas canvas1 = gnuplot.getCanvas(0, 0);
canvas1.setGridVisible(true);
canvas1.setXLabel("t [sec]");
canvas1.setYLabel("y");
canvas1.plot(T, Y, yy); | |
| File | Line |
|---|---|
| org/mklab/tool/control/DoubleWeierstrassForm.java | 241 |
| org/mklab/tool/control/WeierstrassForm.java | 431 |
DoubleMatrix step12 = new DoubleMatrix(m * n * 2, 1);
for (int i = 0; i < n; i++) {
step12.setSubMatrix(1 + i * m, (1 + i) * m, 1, 1, E12.getColumnVector(1 + i).multiply(-1));
}
for (int i = 0; i < n; i++) {
step12.setSubMatrix(1 + (i + n) * m, (1 + i + n) * m, 1, 1, A12.getColumnVector(1 + i).multiply(-1));
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 1475 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 1465 |
private List<Integer> getLoopStartNode(final SystemOperator<RS, RM, CS, CM>[][] matrix, final List<List<Integer>> localMaximumCycle) {
final List<Integer> loopStartList = new ArrayList<>();
final int localRowSize = matrix.length;
for (List<Integer> loopPath : localMaximumCycle) {
for (Integer node : loopPath) {
for (int row = 0; row < localRowSize; row++) {
if (false == matrix[node][row].isZero() && false == loopPath.contains(Integer.valueOf(row)) && false == loopStartList.contains(Integer.valueOf(row))) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 4134 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 4126 |
final SystemOperator<RS, RM, CS, CM> system = getElement(row + 1, column + 1);
if (system == null) {
continue;
}
system.setID("" + row + "," + column); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
/**
* 入力ポートのノード番号(番号は1から始まります)とタグのマップを返します。
*
* @return 入力ポートのノード番号(番号は1から始まります)とタグのマップ
*/
public Map<Integer, String> getInputPortTags() {
return this.inputPortTags;
}
/**
* 入力ポートのノード番号(番号は1から始まります)とタグのマップを設定します。
*
* @param inputPortTags 入力ポートのノード番号(番号は1から始まります)とタグのマップ
*/
public void setInputPortTags(Map<Integer, String> inputPortTags) {
this.inputPortTags = inputPortTags;
}
/**
* 出力ポートのノード番号(番号は1から始まります)とタグのマップを返します。
*
* @return 出力ポートのノード番号(番号は1から始まります)とタグのマップ
*/
public Map<Integer, String> getOutputPortTags() {
return this.outputPortTags;
}
/**
* 出力ポートのノード番号(番号は1から始まります)とタグのマップを設定します。
*
* @param outputPortTags 出力ポートのノード番号(番号は1から始まります)とタグのマップ
*/
public void setOutputPortTags(Map<Integer, String> outputPortTags) {
this.outputPortTags = outputPortTags;
}
/**
* @see org.mklab.nfc.matrix.BaseArray#clone()
*/
@Override
public AdjacencyMatrix<RS, RM, CS, CM> clone() { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/CoulombViscousFriction.java | 126 |
| org/mklab/tool/control/system/discontinuous/DeadZone.java | 143 |
| org/mklab/tool/control/system/discontinuous/RateLimiter.java | 193 |
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("boxing")
public RS getDiscontinuousPoint(final RS t1, final RM u1, final RS t2, final RM u2) {
final List<Integer> pieces1 = getPiece(t1, u1);
final List<Integer> pieces2 = getPiece(t2, u2);
if (pieces1.equals(pieces2)) {
return this.sunit.getNaN();
}
final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
final int piece1 = pieces1.get(number - 1);
final int piece2 = pieces2.get(number - 1);
final boolean fromZeroToOne = piece1 == 0 && piece2 == 1; | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/math/AbsoluteFunction.java | 64 |
| org/mklab/tool/control/system/math/SignumFunction.java | 67 |
pieces.add(1);
}
}
return pieces;
}
/**
* {@inheritDoc}
*/
public RS getDiscontinuousPoint(final RS t1, final RM u1, final RS t2, final RM u2) {
final List<Integer> pieces1 = getPiece(t1, u1);
final List<Integer> pieces2 = getPiece(t2, u2);
if (pieces1.equals(pieces2)) {
return this.sunit.getNaN();
}
final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
final RS uu1 = u1.getElement(number);
final RS uu2 = u2.getElement(number);
return t1.add((uu1.unaryMinus()).divide((uu2.subtract(uu1))).multiply(t2.subtract(t1))); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/source/PulseSource.java | 210 |
| org/mklab/tool/control/system/source/RampSource.java | 154 |
| org/mklab/tool/control/system/source/StepSource.java | 154 |
if (percentage.isLessThan(this.pulseWidth)) {
return new ArrayList<>(Arrays.asList(new Integer[] {1}));
}
return new ArrayList<>(Arrays.asList(new Integer[] {0}));
}
/**
* {@inheritDoc}
*/
public RS getDiscontinuousPoint(final RS t1, final RM u1, final RS t2, final RM u2) {
final List<Integer> piece1 = getPiece(t1, u1);
final List<Integer> piece2 = getPiece(t2, u2);
if (piece1.equals(piece2)) {
return this.sunit.getNaN();
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/DoubleImproperLinearSystem.java | 341 |
| org/mklab/tool/control/DoubleProperLinearSystem.java | 421 |
| org/mklab/tool/control/ImproperLinearSystem.java | 339 |
| org/mklab/tool/control/ProperLinearSystem.java | 427 |
if (withInputOutput) {
if (isContinuous()) {
if (getSubSystemSize() == 1) {
string.append(" "); //$NON-NLS-1$
} else {
string.append(" "); //$NON-NLS-1$
}
}
string.append("[" + symbolicOutput[row] + "]"); //$NON-NLS-1$ //$NON-NLS-2$
if (row == getOutputPortSize() / 2) {
if (isContinuous()) {
string.append("(t)="); //$NON-NLS-1$
} else {
string.append("(k) ="); //$NON-NLS-1$
}
} else {
if (isContinuous()) {
string.append(" "); //$NON-NLS-1$
} else {
string.append(" "); //$NON-NLS-1$ | |
| File | Line |
|---|---|
| org/mklab/tool/control/Ramp.java | 34 |
| org/mklab/tool/control/Step.java | 33 |
public class Ramp {
/**
* メインメソッド
*
* @param args コマンドライン引数
* @throws IOException キーボードから入力できない場合
*/
public static void main(String[] args) throws IOException {
DoublePolynomial s = new DoublePolynomial("s"); //$NON-NLS-1$
DoubleRationalPolynomial g1 = new DoubleRationalPolynomial(1);
DoubleRationalPolynomial g2 = new DoubleRationalPolynomial(new DoublePolynomial(1), s.add(1));
DoubleRationalPolynomial g = g1.multiply(g2);
g.print();
DoubleMatrix T = LinearlySpacedVector.create(0, 2, 100);
Gnuplot gp = plot(g, T);
try {
Pause.pause();
} finally {
gp.close();
}
}
/**
* 連続時間システム
*
* <pre><code>
*
* . x = Ax + Bu y = Cx + Du
*
* </code></pre>
*
* の <code>inputNumber</code> 番目の入力に単位ランプ入力が加えられた 場合のランプ応答を求めます。
*
* <p>もし <code>inputNumber = 0</code>なら、 <pre><code>
*
* [[Y for 1st input] [[X for 1st input] [Y for 2nd input] [X for 2nd input] [...............] [...............] [Y for m'th input]] と [Y for m'th input]].
*
* </code></pre> を返します。
*
* @param A A行列
* @param B B行列
* @param C C行列
* @param D D行列
* @param inputNumber 入力番号
* @param T 時刻の列(等間隔)
* @return {YY, XX} (出力と状態の応答) response
*/
public static List<DoubleMatrix> ramp(DoubleMatrix A, DoubleMatrix B, DoubleMatrix C, DoubleMatrix D, int inputNumber, DoubleMatrix T) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 1654 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 1646 |
final AdjacencyMatrix<RS, RM, CS, CM> ans = new AdjacencyMatrix<>(newElements, this.sunit);
ans.setInputNodes(this.inputNodes);
ans.setSourceNodes(this.sourceNodes);
ans.setOutputNodes(this.outputNodes);
ans.setSinkNodes(this.sinkNodes);
ans.setInputPortTags(this.inputPortTags);
ans.setOutputPortTags(this.outputPortTags);
ans.setRequiringLinearSystem(this.requiringLinearSystem);
ans.setRequiringDescriptor(this.requiringDescriptor);
ans.setRequiringPrimitiveExpression(this.requiringPrimitiveExpression);
if (removingSize > 0) {
ans.shiftInputNodeByRemoving(removingNodes);
ans.shiftSourceNodeByRemoving(removingNodes);
ans.shiftOutputNodeByRemoving(removingNodes);
ans.shiftSinkNodeByRemoving(removingNodes);
}
return ans;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyStringMatrix.java | 631 |
| org/mklab/tool/control/system/DoubleAdjacencyStringMatrix.java | 623 |
if (system instanceof BlockSystem == false || ((BlockSystem<RS,RM,CS,CM>)system).getOutputNodeSize() == 1) {
system.setOutputSize(this.nodeDegrees[column - 1]);
if (row != 1 && this.nodeDegrees[row - 1] == -1) {
final int inputSize = system.getInputSize();
if (inputSize != -1) {
changed = true;
this.nodeDegrees[row - 1] = inputSize;
}
}
}
}
if (this.nodeDegrees[column - 1] == -1 && this.nodeDegrees[row - 1] != -1) {
if (system instanceof BlockSystem == false || ((BlockSystem<RS,RM,CS,CM>)system).getInputNodeSize() == 1) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/Quantizer.java | 105 |
| org/mklab/tool/control/system/discontinuous/RateLimiter.java | 193 |
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("boxing")
public RS getDiscontinuousPoint(final RS t1, final RM u1, final RS t2, final RM u2) {
final List<Integer> pieces1 = getPiece(t1, u1);
final List<Integer> pieces2 = getPiece(t2, u2);
if (pieces1.equals(pieces2)) {
return this.sunit.getNaN();
}
final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
final int piece1 = pieces1.get(number - 1);
final int piece2 = pieces2.get(number - 1); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discrete/BaseDiscreteDynamicSystem.java | 262 |
| org/mklab/tool/control/system/discrete/BaseDiscreteStaticSystem.java | 186 |
hashCode = 31 * hashCode + (this.state == null ? 0 : this.state.hashCode());
hashCode = 31 * hashCode + (this.samplingInterval.hashCode() ^ (this.samplingInterval.hashCode() >>> 32));
hashCode = 31 * hashCode + (this.atSamplingPoint ? 1231 : 1237);
return hashCode;
}
/**
* @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/graph/NodeEquation.java | 32 |
| org/mklab/tool/control/system/graph/NodeIdentityFunctionEquation.java | 32 |
public class NodeEquation<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>> implements NonLinearFunction<RS,RM> {
/** 隣接行列 */
protected SystemOperator<RS,RM,CS,CM>[][] matrix;
/** ノードの仮の値 */
protected List<RM> nodeTmpValue;
/** 各ループ内で最も次数の小さなノードの番号のリスト(ノード番号は1から始まる) */
protected List<Integer> minimumNode;
/** ノードの数 */
protected int nodeSize;
/** ブロックシステム */
protected BlockSystem<RS,RM,CS,CM> blockSystem;
/** unit of scalar */
private RS sunit;
/**
* 新しく生成された<code>NodeEquation</code>オブジェクトを初期化します。
*
* @param blockSystem ブロックシステム
* @param matrix 隣接行列
* @param nodeTmpValue ノードの仮の値
* @param minimumNode 各ループ内で最も次数の小さなノードの番号のリスト
*/
public NodeEquation(final BlockSystem<RS,RM,CS,CM> blockSystem, final SystemOperator<RS,RM,CS,CM>[][] matrix, final List<RM> nodeTmpValue, final List<Integer> minimumNode) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/graph/NodeEquation.java | 56 |
| org/mklab/tool/control/system/graph/NodeIdentityFunctionEquation.java | 56 |
public NodeEquation(final BlockSystem<RS,RM,CS,CM> blockSystem, final SystemOperator<RS,RM,CS,CM>[][] matrix, final List<RM> nodeTmpValue, final List<Integer> minimumNode) {
this.blockSystem = blockSystem;
this.nodeSize = nodeTmpValue.size();
this.matrix = matrix;
this.nodeTmpValue = nodeTmpValue;
this.minimumNode = minimumNode;
this.sunit = nodeTmpValue.get(0).getElement(1,1).createUnit();
}
/**
* @see org.mklab.nfc.nleq.NonLinearFunction#eval(org.mklab.nfc.matrix.NumericalMatrix)
*/
public RM eval(final RM x) throws SolverStopException { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sink/DoubleUserDefinedContinuousSink.java | 85 |
| org/mklab/tool/control/system/sink/DoubleUserDefinedDiscreteSink.java | 85 |
| org/mklab/tool/control/system/sink/UserDefinedContinuousSink.java | 94 |
| org/mklab/tool/control/system/sink/UserDefinedDiscreteSink.java | 94 |
| org/mklab/tool/control/system/source/DoubleUserDefinedContinuousSource.java | 84 |
| org/mklab/tool/control/system/source/UserDefinedContinuousSource.java | 93 |
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
*/
public void setSystemClass(final Class<?> klass) {
this.systemKlass = klass;
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
*/
public Class<?> getSystemClass() {
return this.systemKlass;
}
/**
* システムの出力方程式を定義したメソッドを設定します。
*
* @param method システムの出力方程式を定義したメソッド
* @throws SecurityException メソッドにアクセスする権利が無い場合
*/
public void setOutputFunction(Method method) throws SecurityException {
this.outputFunction = method;
this.outputFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
*/
public void setInitializeFunction(final Method method) throws SecurityException {
this.initializeFunction = method;
this.initializeFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
*/
public void setUpdateFunction(final Method method) throws SecurityException {
this.updateFunction = method;
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException { | |
| File | Line |
|---|---|
| org/mklab/tool/graph/mgplot/Mgplot.java | 614 |
| org/mklab/tool/graph/mgplot/Mgplot.java | 753 |
for (int i = 1; i <= Y.getRowSize(); i++) {
String tit;
if (i <= titles.size()) {
tit = titles.get(i - 1);
} else {
tit = "data-" + (num + 1) + "-" + i; //$NON-NLS-1$ //$NON-NLS-2$
}
String cmd1;
if (i <= cmds1.size()) {
cmd1 = cmds1.get(i - 1);
} else {
cmd1 = ""; //$NON-NLS-1$
}
String cmd2;
if (i <= cmds2.size()) {
cmd2 = cmds2.get(i - 1);
} else {
cmd2 = ""; //$NON-NLS-1$
}
String str = "'" + datafile + "' u 0:" + i + " " + cmd1 + " t '" + tit + "' " + cmd2; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ | |
| File | Line |
|---|---|
| org/mklab/tool/control/AbstractLinearSystem.java | 703 |
| org/mklab/tool/control/AbstractLinearSystem.java | 980 |
List<RM> abcd = Minreal.minreal(ansA, ansB, ansC, ansD);
ansA = abcd.get(0);
ansB = abcd.get(1);
ansC = abcd.get(2);
ansD = abcd.get(3);
}
return LinearSystemFactory.createLinearSystem(ansA, ansB, ansC, ansD);
}
final AnyRealRationalPolynomialMatrix<RS,RM,CS,CM> g1, g2;
if (isProper()) {
g1 = getTransferFunctionMatrix(simplify);
g2 = ((AbstractLinearSystem<RS,RM,CS,CM>)opponent).G; | |
| File | Line |
|---|---|
| org/mklab/tool/control/DoubleImproperLinearSystem.java | 236 |
| org/mklab/tool/control/DoubleProperLinearSystem.java | 234 |
| org/mklab/tool/control/ImproperLinearSystem.java | 234 |
| org/mklab/tool/control/ProperLinearSystem.java | 240 |
for (int i = 0; i < this.getStateSize() + 1; i++) {
pw.print(aString[i]);
pw.print("|"); //$NON-NLS-1$
pw.println(bString[i]);
}
for (int i = 0; i < aString[0].length(); i++) {
pw.print("-"); //$NON-NLS-1$
}
pw.print("+"); //$NON-NLS-1$
for (int i = 0; i < bString[0].length(); i++) {
pw.print("-"); //$NON-NLS-1$
}
pw.println(""); //$NON-NLS-1$
for (int i = 0; i < this.getOutputSize() + 1; i++) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 1556 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 1548 |
private void setupInputSizeAndOutputSize(final SystemOperator<RS, RM, CS, CM> system, int inputNode, int outputNode) {
if (system.getInputSize() == -1) {
final int inputSize = findNodeSize(inputNode);
if (inputSize != -1) {
system.setInputSize(inputSize);
}
}
if (system.getOutputSize() == -1) {
final int outputSize = findNodeSize(outputNode);
if (outputSize != -1) {
system.setOutputSize(outputSize);
}
}
}
/**
* ノードの信号の大きさを返します。
*
* @param node ノード番号
* @return ノードの信号の大きさ
*/
private int findNodeSize(final int node) {
for (int column = 0; column < getColumnSize(); column++) {
final SystemOperator<RS, RM, CS, CM> system = this.elements[node][column]; | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/BlockPiecewiseContinuousDynamicSystem.java | 96 |
| org/mklab/tool/control/system/sampled/BlockPiecewiseSampledDataDynamicSystem.java | 367 |
| org/mklab/tool/control/system/sampled/BlockPiecewiseSampledDataStaticSystem.java | 220 |
private List<RS> getDiscontinuousPoints(RS t1, final List<RM> inputs1, RS t2, final List<RM> inputs2) throws SolverStopException {
final List<RS> points = new ArrayList<>();
for (int i = 0; i < this.piecewiseContinuousAlgebraicSystems.size(); i++) {
final PiecewiseContinuousAlgebraicSystem<RS, RM, CS, CM> system = this.piecewiseContinuousAlgebraicSystems.get(i);
final RM u1 = inputs1.get(i);
final RM u2 = inputs2.get(i);
points.add(system.getDiscontinuousPoint(t1, u1, t2, u2));
}
return points;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/DoubleCoulombViscousFriction.java | 114 |
| org/mklab/tool/control/system/discontinuous/DoubleDeadZone.java | 131 |
| org/mklab/tool/control/system/discontinuous/DoubleQuantizer.java | 93 |
| org/mklab/tool/control/system/discontinuous/DoubleSaturation.java | 133 |
}
return pieces;
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("boxing")
public double getDiscontinuousPoint(final double t1, final DoubleMatrix u1, final double t2, final DoubleMatrix u2) {
final List<Integer> pieces1 = getPiece(t1, u1);
final List<Integer> pieces2 = getPiece(t2, u2);
if (pieces1.equals(pieces2)) {
return Double.NaN;
}
final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
final int piece1 = pieces1.get(number - 1);
final int piece2 = pieces2.get(number - 1); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discrete/BlockDiscreteDynamicSystem.java | 100 |
| org/mklab/tool/control/system/sampled/BlockSampledDataDynamicSystem.java | 201 |
public void setInitialState(final RM initialState) {
if (this.discreteDynamicSystems == null) {
return;
}
int stateSize = 0;
int offset = 1;
for (final DiscreteDynamicSystem<RS,RM,CS,CM> system : this.discreteDynamicSystems) {
final int size = ((SystemOperator<RS,RM,CS,CM>)system).getStateSize();
if (size > 0) {
final int end = offset + size - 1;
if (end > initialState.getRowSize()) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockDiscreteDynamicSystem.0"), system.getClass().getName())); //$NON-NLS-1$ | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discrete/BlockDiscreteDynamicSystem.java | 128 |
| org/mklab/tool/control/system/sampled/BlockSampledDataDynamicSystem.java | 257 |
public void setState(final RM state) {
if (this.discreteDynamicSystems == null) {
return;
}
int stateSize = 0;
int offset = 1;
for (final DiscreteDynamicSystem<RS,RM,CS,CM> system : this.discreteDynamicSystems) {
final int size = ((SystemOperator<RS,RM,CS,CM>)system).getStateSize();
if (size > 0) {
final int end = offset + size - 1;
if (end > state.getRowSize()) {
throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockDiscreteDynamicSystem.0"), system.getClass().getName())); //$NON-NLS-1$ | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleSystemBuilder.java | 477 |
| org/mklab/tool/control/system/SystemBuilder.java | 498 |
private List<List<Integer>> setupInputSource(final DoubleSystemOperator[][] systemMatrix, final DoubleAdjacencyStringMatrix matrix, final List<Integer> inputSourceNodes) {
final int inputSourceSize = inputSourceNodes.size();
final List<Integer> inputNodes = new ArrayList<>();
final List<Integer> sourceNodes = new ArrayList<>();
int systemRow1 = 0;
for (final int inputSourceNode : inputSourceNodes) {
final String weight = matrix.getWeightOfEdge(1, inputSourceNode);
if (weight == null || weight.equals("")) { //$NON-NLS-1$
throw new IllegalArgumentException(Messages.getString("ControlSystem.18")); //$NON-NLS-1$
}
final int systemColumn1 = inputSourceNode - 2 + inputSourceSize;
final DoubleSystemOperator system = matrix.getControlSystem(weight).getSystemOperator(); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/BlockPiecewiseContinuousDynamicSystem.java | 139 |
| org/mklab/tool/control/system/sampled/BlockPiecewiseSampledDataDynamicSystem.java | 291 |
for (PiecewiseContinuousAlgebraicSystem<RS, RM, CS, CM> system : this.piecewiseContinuousAlgebraicSystems) {
inputs.add(getInputNodeValueOf((SystemOperator<RS, RM, CS, CM>)system).createClone());
}
return inputs;
}
/**
* 区分的微分可能システムのへの入力を返します。
*
* @return 区分的微分可能システムのへの入力
*/
private List<RM> getDifferentialSystemInputs() {
final List<RM> inputs = new ArrayList<>();
for (PiecewiseDifferentialSystem<RS, RM, CS, CM> system : this.piecewiseDifferentialSystems) {
inputs.add(getInputNodeValueOf((SystemOperator<RS, RM, CS, CM>)system).createClone());
}
return inputs;
}
/**
* 区分的微分可能システムの状態を返します。
*
* @return 区分的微分可能システムの状態
*/
private List<RM> getDifferentialSystemStates() { | |
| File | Line |
|---|---|
| org/mklab/tool/graph/gnuplot/Canvas.java | 1332 |
| org/mklab/tool/graph/gnuplot/Canvas.java | 1413 |
final int ySize = zData.getColumnSize();
setLineSize(1);
String dataFile = getDataFilePath(0);
try(final PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(dataFile)))) {
for (int i = 1; i <= xSize; i++) {
for (int j = 1; j <= ySize; j++) {
pw.println("" + xData.getDoubleElement(i, j) + " " + yData.getDoubleElement(i, j) + " " + zData.getDoubleElement(i, j)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
pw.println(""); //$NON-NLS-1$ | |
| File | Line |
|---|---|
| org/mklab/tool/graph/mgplot/Mgplot.java | 2015 |
| org/mklab/tool/graph/mgplot/Mgplot.java | 2112 |
public static void semilogx(int win, DoubleMatrix X, DoubleMatrix Y, List<String> titles, List<String> cmds1, List<String> cmds2) {
IntMatrix idx = X.getColumnVector(1).compareElementWise(".==", 0).find(); //$NON-NLS-1$
if (idx.length() != 0) {
X.setSubMatrix(idx, 1, DoubleMatrix.ones(idx.length(), 1).multiply(DoubleNumberUtil.EPS));
}
grid(win, true);
logMode(win, multiplot(win), 1); | |
| File | Line |
|---|---|
| org/mklab/tool/graph/mgplot/Mgplot.java | 2209 |
| org/mklab/tool/graph/mgplot/Mgplot.java | 2306 |
public static void semilogy(int win, DoubleMatrix X, DoubleMatrix Y, List<String> titles, List<String> cmds1, List<String> cmds2) {
IntMatrix idx = Y.getColumnVector(1).compareElementWise(".==", 0).find(); //$NON-NLS-1$
if (idx.length() != 0) {
Y.setSubMatrix(idx, 1, DoubleMatrix.ones(idx.length(), 1).multiply(DoubleNumberUtil.EPS));
}
grid(win, true);
logMode(win, multiplot(win), 2); | |
| File | Line |
|---|---|
| org/mklab/tool/control/Dinitial.java | 247 |
| org/mklab/tool/control/Initial.java | 252 |
| org/mklab/tool/control/Ramp.java | 344 |
DoubleMatrix X = yx.get(1);
int outputSize = C.getRowSize();
String[] yy = new String[outputSize];
for (int i = 1; i <= outputSize; i++) {
if (outputSize == 1) {
yy[i - 1] = "y";
} else {
yy[i - 1] = "y" + i;
}
}
gnuplot.createCanvas(2, 1);
Canvas canvas1 = gnuplot.getCanvas(0, 0);
canvas1.setGridVisible(true);
canvas1.setXLabel("t [sec]");
canvas1.setYLabel("y");
canvas1.plot(T, Y, yy); | |
| File | Line |
|---|---|
| org/mklab/tool/control/Obsg.java | 80 |
| org/mklab/tool/control/Obsg.java | 143 |
final DoubleMatrix L = Pplace.pplace(Ab11.transpose(), Ab21.transpose().unaryMinus(), poles).transpose().unaryMinus();
final DoubleMatrix U = L.createUnit(r).appendRight(L.unaryMinus()).multiply(Tinv);
final DoubleMatrix Ah = Ab11.subtract(L.multiply(Ab21));
final DoubleMatrix Bh = Ah.multiply(L).add(Ab12).subtract(L.multiply(Ab22));
final DoubleMatrix Ch = T.multiply(T.createUnit(r).appendDown(T.createZero(p, r)));
final DoubleMatrix Dh = T.multiply(L.appendDown(A.createUnit(p))); | |
| File | Line |
|---|---|
| org/mklab/tool/control/Obsg.java | 218 |
| org/mklab/tool/control/Obsg.java | 290 |
final RM L = Pplace.pplace(Ab11.transpose(), Ab21.transpose().unaryMinus(), poles).transpose().unaryMinus();
final RM U = L.createUnit(r).appendRight(L.unaryMinus()).multiply(Tinv);
final RM Ah = Ab11.subtract(L.multiply(Ab21));
final RM Bh = Ah.multiply(L).add(Ab12).subtract(L.multiply(Ab22));
final RM Ch = T.multiply(T.createUnit(r).appendDown(T.createZero(p, r)));
final RM Dh = T.multiply(L.appendDown(A.createUnit(p))); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 2035 |
| org/mklab/tool/control/system/AdjacencyMatrix.java | 2167 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 2027 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 2159 |
Arrays.sort(sortedInsertingNodes);
final Map<Integer, String> originalInputPortTags = new TreeMap<>();
for (final Integer key : this.inputPortTags.keySet()) {
originalInputPortTags.put(key, this.inputPortTags.get(key));
}
final Map<Integer, String> newInputPortTags = new TreeMap<>();
for (int i = 0; i < this.inputNodes.size(); i++) {
final int inputNode = this.inputNodes.get(i);
int shiftSize = 0;
for (int j = 0; j < sortedInsertingNodes.length; j++) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 2101 |
| org/mklab/tool/control/system/AdjacencyMatrix.java | 2233 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 2093 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 2225 |
Arrays.sort(sortedInsertingNodes);
final Map<Integer, String> originalOutputPortTags = new TreeMap<>();
for (final Integer key : this.outputPortTags.keySet()) {
originalOutputPortTags.put(key, this.outputPortTags.get(key));
}
final Map<Integer, String> newOutputPortTags = new TreeMap<>();
for (int i = 0; i < this.outputNodes.size(); i++) {
final int outputNode = this.outputNodes.get(i);
int shiftSize = 0;
for (int j = 0; j < sortedInsertingNodes.length; j++) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 2788 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 2780 |
private List<Integer> createInputNodes(AdjacencyMatrix<RS, RM, CS, CM> ans, int offset, Integer input, int expandInputSize) {
final List<Integer> newInputNodes = new ArrayList<>();
for (Integer node : ans.inputNodes) {
newInputNodes.add(node);
if (false == (node.equals(input + offset))) continue;
for (int i = 1; i <= expandInputSize; i++) {
newInputNodes.add(i + input + offset);
}
}
ans.setInputNodes(newInputNodes);
return newInputNodes;
}
/**
* 入力ポートタグを拡張します.
*
* @param ans 対象となる隣接行列
* @param offset 隣接行列が拡張された分のオフセット
* @param input 拡張対象の入力ポートのノード
* @param expandInputSize 拡張された入力の数
* @return 拡張された入力ポートタグのMap
*/
@SuppressWarnings("boxing")
private Map<Integer, String> createInputPortTags(AdjacencyMatrix<RS, RM, CS, CM> ans, int offset, Integer input, int expandInputSize) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleSystemBuilder.java | 154 |
| org/mklab/tool/control/system/SystemBuilder.java | 172 |
final Map<Integer, String> inputPortTags = new TreeMap<>();
int inputNumber = 1;
for (final Integer inputNode : inputNodes) {
inputPortTags.put(inputNode, "u_" + inputNumber++); //$NON-NLS-1$
}
final Map<Integer, String> outputPortTags = new TreeMap<>();
int outputNumber = 1;
for (final Integer outputNode : outputNodes) {
outputPortTags.put(outputNode, "y_" + outputNumber++); //$NON-NLS-1$
}
matrix.setupSystemIDForElements();
createSystem(matrix, inputNodes, outputNodes, sourceNodes, sinkNodes, inputPortTags, outputPortTags, option);
}
/**
* 新しく生成された<code>SystemBuilder</code>オブジェクトを初期化します。
*
* @param stringMatrix 隣接関係を保持する文字列行列
*/
public DoubleSystemBuilder(final DoubleAdjacencyStringMatrix stringMatrix) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleSystemBuilder.java | 307 |
| org/mklab/tool/control/system/SystemBuilder.java | 328 |
private void setupSiSoSystem(final DoubleSystemOperator[][] systemMatrix, final DoubleAdjacencyStringMatrix matrix, final int inputPortSize) {
final int inputPortOutputPortLines = 2;
final int innerSize = matrix.size() - inputPortOutputPortLines;
for (int row = 2; row <= innerSize + 1; row++) {
for (int column = 2; column <= innerSize + 1; column++) {
final String weight = matrix.getWeightOfEdge(row, column);
final int systemRow = row - 2 + inputPortSize;
final int systemColumn = column - 2 + inputPortSize;
if (weight == null || weight.equals("")) { //$NON-NLS-1$
systemMatrix[systemRow][systemColumn] = DoubleZeroSystem.getInstance(); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleSystemOperator.java | 584 |
| org/mklab/tool/control/system/SystemOperator.java | 597 |
final DoubleParameterContainer parameter = this.parameters.get(name);
if (parameter == null) {
throw new NoSuchParameterException();
}
parameter.setValue(value);
if (value.getClass().isArray()) {
try {
//this.parameters.putAll(createArrayElement(this.getClass().getDeclaredField(name), name, value));
this.parameters.putAll(createArrayElement(findField(this.getClass(), name), name, value));
} catch (SecurityException e) {
throw new ParameterAccessException(e);
} catch (NoSuchFieldException e) {
throw new ParameterAccessException(e);
}
}
}
/**
* 指定されたクラスとそのスーパークラスに属するパラメータの集合を生成します。
*
* @param klass パラメータ集合を生成するクラス
* @throws ParameterAccessException パラメータにアクセスできない場合
*/
public void setupParameters(Class<? extends DoubleSystemOperator> klass) throws ParameterAccessException { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/DoubleCoulombViscousFriction.java | 117 |
| org/mklab/tool/control/system/discontinuous/DoubleDeadZone.java | 134 |
| org/mklab/tool/control/system/discontinuous/DoubleRateLimiter.java | 184 |
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("boxing")
public double getDiscontinuousPoint(final double t1, final DoubleMatrix u1, final double t2, final DoubleMatrix u2) {
final List<Integer> pieces1 = getPiece(t1, u1);
final List<Integer> pieces2 = getPiece(t2, u2);
if (pieces1.equals(pieces2)) {
return Double.NaN;
}
final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
final int piece1 = pieces1.get(number - 1);
final int piece2 = pieces2.get(number - 1);
final boolean fromZeroToOne = piece1 == 0 && piece2 == 1; | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/Saturation.java | 151 |
| org/mklab/tool/control/system/math/RoundingFunction.java | 187 |
public RS getDiscontinuousPoint(final RS t1, final RM u1, final RS t2, final RM u2) {
final List<Integer> pieces1 = getPiece(t1, u1);
final List<Integer> pieces2 = getPiece(t2, u2);
if (pieces1.equals(pieces2)) {
return this.sunit.getNaN();
}
final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
final int piece1 = pieces1.get(number - 1);
final int piece2 = pieces2.get(number - 1);
final RS uu1 = u1.getElement(number);
final RS uu2 = u2.getElement(number); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sink/DisplaySink.java | 55 |
| org/mklab/tool/control/system/sink/DoubleDisplaySink.java | 46 |
public RM outputEquation(final RS t, final RM u) throws SolverStopException {
// 方程式のソルバーが仮の値で計算しているか判定します
final boolean solverTrial = EquationSolver.isTrial() || NonLinearEquationSolver.isTrial();
if (solverTrial == false && this.displayable) {
this.display.display(t, u);
}
return super.outputEquation(t, u);
}
/**
* 名前を返します。
*
* @return 名前
*/
public String getName() {
return this.name;
}
/**
* 名前を設定します。
*
* @param name 名前
*/
public void setName(final String name) {
this.name = name;
}
/**
* 表示の有無を返します
*
* @return 表示
*/
public boolean isDisplayable() {
return this.displayable;
}
/**
* 表示の有無を設定します
*
* @param display 表示
*/
public void setDisplayable(final boolean display) {
this.displayable = display;
}
/**
* 出力表示に使用するディスプレイを取得します。
*
* @return 出力表示に使用するディスプレイ
*/
public Display<RS, RM, CS, CM> getDisplay() { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sink/DoubleUserDefinedDiscreteSink.java | 125 |
| org/mklab/tool/control/system/sink/UserDefinedDiscreteSink.java | 134 |
| org/mklab/tool/control/system/source/DoubleUserDefinedContinuousSource.java | 144 |
| org/mklab/tool/control/system/source/UserDefinedContinuousSource.java | 153 |
this.updateFunction.setAccessible(true);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
*/
public Object getParameterValue(String name) throws NoSuchParameterException {
return ParameterUtil.getValue(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
*/
public Set<String> getParameterNames() throws NoSuchParameterException {
return ParameterUtil.getParameterNames(this.systemKlass);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
*/
public void setParameterValue(String name, Object value) throws NoSuchParameterException {
ParameterUtil.setValue(this.systemKlass, name, value);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
*/
public boolean containParameter(String name) {
return ParameterUtil.contains(this.systemKlass, name);
}
/**
* @see org.mklab.tool.control.system.UserDefinedSystem#update()
*/
public void update() throws ParameterException {
try { | |
| File | Line |
|---|---|
| org/mklab/tool/control/Minreal.java | 219 |
| org/mklab/tool/control/Minreal.java | 281 |
int k = (int)K.sum().doubleValue();
if (k > 0) {
int uc = n - k; // number of uncontrollable mode
Am = Am.getSubMatrix(uc + 1, n, uc + 1, n);
Bm = Bm.getRowVectors(uc + 1, n);
Cm = Cm.getColumnVectors(uc + 1, n);
n = n - uc; // number of controllable mode
} else {
Am = A.createZero(0, 0);
Bm = A.createZero(0, m);
Cm = A.createZero(p, 0);
}
if (n > 0) {
final List<DoubleMatrix> abctkObsf = Obsf.obsf(Am, Bm, Cm, tolerance); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 4378 |
| org/mklab/tool/control/system/AdjacencyMatrix.java | 4424 |
StringBuffer stringBuffer = new StringBuffer();
final String separator = ","; //$NON-NLS-1$
stringBuffer.append(" " + separator); //$NON-NLS-1$
for (int row = 0; row < matrix.length; row++) {
stringBuffer.append(row % 10 + separator);
}
stringBuffer.append(lineseparator);
for (int row = 0; row < matrix.length; row++) {
stringBuffer.append(row % 10 + separator);
for (int col = 0; col < matrix.length; col++) {
if (matrix[row][col] instanceof ZeroSystem) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 4370 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 4416 |
StringBuffer stringBuffer = new StringBuffer();
final String separator = ","; //$NON-NLS-1$
stringBuffer.append(" " + separator); //$NON-NLS-1$
for (int row = 0; row < matrix.length; row++) {
stringBuffer.append(row % 10 + separator);
}
stringBuffer.append(lineseparator);
for (int row = 0; row < matrix.length; row++) {
stringBuffer.append(row % 10 + separator);
for (int col = 0; col < matrix.length; col++) {
if (matrix[row][col] instanceof DoubleZeroSystem) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleBlockContinuousSystem.java | 65 |
| org/mklab/tool/control/system/discrete/DoubleBlockDiscreteSystem.java | 51 |
}
/**
* ノードの値を計算します。
*
* @param t 時刻
* @exception SolverStopException ソルバーが停止された場合
*/
protected void calcNodeValue(final double t) throws SolverStopException {
this.time = t;
calcNodeValue();
}
/**
* {@inheritDoc}
*/
@Override
protected DoubleMatrix calcOutputOfDirectFeedthroughSystem(final DoubleSystemOperator system, final DoubleMatrix u) throws SolverStopException {
if (system instanceof DoubleDynamicSystem) {
final DoubleDynamicSystem dSystem = (DoubleDynamicSystem)system;
return dSystem.outputEquation(this.time, dSystem.getState(), u);
}
return ((DoubleStaticSystem)system).outputEquation(this.time, u);
}
/**
* {@inheritDoc}
*/
@Override
protected DoubleMatrix calcOutputOfNonDirectFeedthroughSystem(final DoubleSystemOperator system) throws SolverStopException {
if (system == null) throw new NullPointerException(); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/DoubleQuantizer.java | 96 |
| org/mklab/tool/control/system/discontinuous/DoubleRateLimiter.java | 184 |
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("boxing")
public double getDiscontinuousPoint(final double t1, final DoubleMatrix u1, final double t2, final DoubleMatrix u2) {
final List<Integer> pieces1 = getPiece(t1, u1);
final List<Integer> pieces2 = getPiece(t2, u2);
if (pieces1.equals(pieces2)) {
return Double.NaN;
}
final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
final int piece1 = pieces1.get(number - 1);
final int piece2 = pieces2.get(number - 1); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sampled/BlockPiecewiseSampledDataDynamicSystem.java | 125 |
| org/mklab/tool/control/system/sampled/DoubleBlockPiecewiseSampledDataDynamicSystem.java | 118 |
final List<RM> discreteStates = getDifferentialDifferneceSystemDiscreteStates();
final List<Integer> differentialDifferencePieces = getDifferentialDifferencePieces(t, differentialDiffernceContinuousStates, discreteStates);
final List<Integer> differentialPieces = getDifferentialPieces(t, differentialContinuousStates);
final List<Integer> continuousDiscretePieces = getContinuousDiscretePieces(t);
final List<Integer> continuousPieces = getContinuousPieces(t);
setContinuousState(originalContinuousState);
setDiscreteState(originalDiscreteState);
calcNodeValue(t);
final List<Integer> pieces = differentialDifferencePieces;
pieces.addAll(differentialPieces);
pieces.addAll(continuousDiscretePieces);
pieces.addAll(continuousPieces);
return pieces;
}
/**
* 区分的連続離散代数システムの区分の番号のリストを返します。
*
* @param t 時刻
* @return 区分的連続離散代数システムの区分の番号のリスト
* @exception SolverStopException ソルバーが停止された場合
*/
private List<Integer> getContinuousDiscretePieces(RS t) throws SolverStopException { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/source/DoubleImportSource.java | 130 |
| org/mklab/tool/control/system/source/ImportSource.java | 137 |
return previousData.add(nextData.subtract(previousData).multiply((t - previousTime) / (nextTime - previousTime)));
}
/**
* @see org.mklab.tool.control.system.source.Importer#isActive()
*/
public boolean isActive() {
if (this.data != null) {
return true;
}
return false;
}
/**
* @see org.mklab.tool.control.system.continuous.BaseContinuousStaticSystem#initialize()
*/
@Override
public void initialize() {
super.initialize();
this.last = 1;
}
/**
* @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/source/DoublePulseSource.java | 197 |
| org/mklab/tool/control/system/source/DoubleRampSource.java | 140 |
| org/mklab/tool/control/system/source/DoubleStepSource.java | 140 |
if (percentage < this.pulseWidth) {
return new ArrayList<>(Arrays.asList(new Integer[] {1}));
}
return new ArrayList<>(Arrays.asList(new Integer[] {0}));
}
/**
* {@inheritDoc}
*/
public double getDiscontinuousPoint(final double t1, final DoubleMatrix u1, final double t2, final DoubleMatrix u2) {
final List<Integer> piece1 = getPiece(t1, u1);
final List<Integer> piece2 = getPiece(t2, u2);
if (piece1.equals(piece2)) {
return Double.NaN;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/source/DoubleSoundLineSource.java | 87 |
| org/mklab/tool/control/system/source/SoundLineSource.java | 101 |
super(size, 1. / audioFormat.getSampleRate());
this.audioFormat = audioFormat;
}
/**
* @throws LineUnavailableException ラインが利用不可能だった場合
* @see org.mklab.tool.control.system.source.AsynchronousSource#processImport()
*/
@Override
protected void processImport() throws LineUnavailableException {
try (final TargetDataLine line = AudioSystem.getTargetDataLine(this.audioFormat)) {
final byte[] buf = new byte[DEFAULT_AUDIO_FORMAT.getSampleSizeInBits() / 8];
try {
line.open();
line.start();
while (isClosed() == false && isOutputDataFilled() == false) {
final int size = line.read(buf, 0, buf.length);
if (size < buf.length) {
break;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/Ltifr.java | 210 |
| org/mklab/tool/control/Ltifr.java | 362 |
final RS epsilon = unit.getMachineEpsilon();
for (int i = 1; i <= size; i++) {
final CS s = ss.getElement(i);
CM sI_A = (A.createUnit().toComplex().multiply(s).subtract(A.toComplex()));
if (sI_A.isFullRank() == false) {
sI_A = (A.createUnit().toComplex().multiply(s.add(epsilon.toComplex())).subtract(A.toComplex()));
}
G.setColumnVectors((i - 1) * inputSize + 1, i * inputSize, sI_A.leftDivide(B.toComplex())); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 3644 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 3636 |
exchangeRowAndColumn(matrix, node1 - 1, node2 - 1);
for (int j = 0; j < outputNodeSize; j++) {
if (outputNodes1[j] == node2) {
outputNodes1[j] = node1;
}
}
outputNodes1[i] = node2;
final String tag1 = this.outputPortTags.get(node1);
final String tag2 = this.outputPortTags.get(node2);
this.outputPortTags.put(node1, tag2);
this.outputPortTags.put(node2, tag1);
}
return Arrays.asList(outputNodes2);
}
/**
* 隣接行列から線形動的システムのシステム行列Aを生成します。
*
* @param stateSizes サブシステムの状態の数の配列
* @param stateSize 全システムの状態の数
* @return 線形動的システムのシステム行列A
*/
private RM createNumericalA(final int[] stateSizes, final int stateSize) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 4792 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrixUtil.java | 959 |
final ConstantSystem<RS, RM, CS, CM> element = new ConstantSystem<>(d.getSubMatrix(i + 1, i + 1, j + 1, j + 1));
final int rowIndex = i + 1;
final int columnIndex = j + 1;
element.setExpression(linearSystem.getTag() + "_d_" + rowIndex + "_" + columnIndex); //$NON-NLS-1$ //$NON-NLS-2$
element.setTag(linearSystem.getTag() + "_d_" + rowIndex + "_" + columnIndex); //$NON-NLS-1$ //$NON-NLS-2$
element.setVariable(true);
matrix[j][aSize * 2 + 1 + i] = element;
}
}
if (linearSystem.getLinearSystem() instanceof ImproperLinearSystem) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 4857 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrixUtil.java | 797 |
ConstantSystem<RS, RM, CS, CM> a = new ConstantSystem<>(valueMatrix.unaryMinus()).unaryMinus();
a.setExpression(linearSystem.getTag() + "_d" + "_" + (size - i - 1)); //$NON-NLS-1$ //$NON-NLS-2$
a.setTag(linearSystem.getTag() + "_" + (size - i - 1)); //$NON-NLS-1$
a.setVariable(true);
matrix[1 + i][size + 1] = a;
}
for (int i = 0; i < size - 1; i++) {
matrix[1 + i][size + 2 + i] = new UnitSystem<>(1, this.sunit); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleSystemBuilder.java | 442 |
| org/mklab/tool/control/system/SystemBuilder.java | 463 |
private Map<Integer, String> getOutputPortTags(final DoubleAdjacencyStringMatrix matrix, final List<Integer> outputSinkNodes, final int inputSourceSize) {
final Map<Integer, String> outputPortTags = new TreeMap<>();
final int inputPortOutputPortLines = 2;
final int innerSize = matrix.size() - inputPortOutputPortLines;
int systemColumn2 = innerSize + inputSourceSize;
for (final int outputSinkNode : outputSinkNodes) {
final String weight = matrix.getWeightOfEdge(outputSinkNode, matrix.size());
if (weight == null || weight.equals("")) { //$NON-NLS-1$
throw new IllegalArgumentException(Messages.getString("ControlSystem.13")); //$NON-NLS-1$
}
final DoubleSystemOperator system = matrix.getControlSystem(weight).getSystemOperator(); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/BaseContinuousDynamicSystem.java | 66 |
| org/mklab/tool/control/system/continuous/DoubleBaseContinuousDynamicSystem.java | 58 |
this.initialStateDerivative = sunit.createZeroGrid(stateSize, 1);
this.state = this.initialState.createClone();
this.index = new IntMatrix(stateSize, 1);
}
/**
* {@inheritDoc}
*/
@Override
public void initialize() {
setState(getInitialState());
}
/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sampled/BaseSampledDataStaticSystem.java | 67 |
| org/mklab/tool/control/system/sampled/DoubleBaseSampledDataStaticSystem.java | 59 |
public RM outputEquation( final RS t, final RM input) throws SolverStopException {
throw new SolverStopException(Messages.getString("BaseSampledDataStaticSystem.1")); //$NON-NLS-1$
}
/**
* @see org.mklab.nfc.ode.Sampling#isAtSamplingPoint()
*/
public boolean isAtSamplingPoint() {
return this.atSamplingPoint;
}
/**
* @see org.mklab.nfc.ode.Sampling#setAtSamplingPoint(boolean)
*/
public void setAtSamplingPoint(final boolean samplingPoint) {
this.atSamplingPoint = samplingPoint;
}
/**
* @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/LinearSystemFactory.java | 110 |
| org/mklab/tool/control/LinearSystemFactory.java | 153 |
return new ImproperLinearSystem<>(a, b, c, d, e);
}
/**
* 係数行列から線形システムを生成します。
*
* @param a 状態行列
* @param b ゲイン行列
* @param c 出力行列
* @param d ゲイン行列
* @param e ディスクリプター行列
* @param index 指数
* @return LinearSystemのインスタンス
* @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 static <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>> LinearSystem<RS, RM, CS, CM> createLinearSystem(
final RM a, final RM b, final RM c, final RM d, final RM e, final IntMatrix index) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 3385 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 3377 |
final AdjacencyMatrix<RS, RM, CS, CM> selectedSystem = getSubgraph(selectedElement);
// TODO findINputNodes と findOutputNodesを使用するように要変更
selectedSystem.setInputNodes(this.inputNodes);
selectedSystem.setSourceNodes(this.sourceNodes);
selectedSystem.setOutputNodes(this.outputNodes);
selectedSystem.setSinkNodes(this.sinkNodes);
selectedSystem.setInputPortTags(this.inputPortTags);
selectedSystem.setOutputPortTags(this.outputPortTags);
selectedSystem.setRequiringLinearSystem(this.requiringLinearSystem);
selectedSystem.setRequiringDescriptor(this.requiringDescriptor);
selectedSystem.setRequiringPrimitiveExpression(this.requiringPrimitiveExpression);
return selectedSystem;
}
/**
* 指定されたノードへの可到達行列を返します。
*
* @param connection 連結行列
* @param destinationNodes 到着ノード
* @return 指定されたノードへの可到達行列
*/
private BooleanMatrix getReachableMatrixToNodes(final BooleanMatrix connection, final List<Integer> destinationNodes) {
final BooleanMatrix reachableToDestination = new ReachableMatrix<>(connection.transpose()).getBooleanMatrix().transpose(); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 4378 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 4416 |
StringBuffer stringBuffer = new StringBuffer();
final String separator = ","; //$NON-NLS-1$
stringBuffer.append(" " + separator); //$NON-NLS-1$
for (int row = 0; row < matrix.length; row++) {
stringBuffer.append(row % 10 + separator);
}
stringBuffer.append(lineseparator);
for (int row = 0; row < matrix.length; row++) {
stringBuffer.append(row % 10 + separator);
for (int col = 0; col < matrix.length; col++) {
if (matrix[row][col] instanceof ZeroSystem) { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 4424 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 4370 |
final StringBuffer stringBuffer = new StringBuffer();
final String separator = ","; //$NON-NLS-1$
stringBuffer.append(" " + separator); //$NON-NLS-1$
for (int row = 0; row < matrix.length; row++) {
stringBuffer.append(row % 10 + separator);
}
stringBuffer.append(lineseparator);
for (int row = 0; row < matrix.length; row++) {
stringBuffer.append(row % 10 + separator);
for (int col = 0; col < matrix.length; col++) {
if (matrix[row][col] instanceof ZeroSystem) stringBuffer.append("0" + separator); //$NON-NLS-1$ | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 4778 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrixUtil.java | 945 |
final ConstantSystem<RS, RM, CS, CM> element = new ConstantSystem<>(c.getSubMatrix(i + 1, i + 1, j + 1, j + 1));
final int rowIndex = i + 1;
final int columnIndex = j + 1;
element.setExpression(linearSystem.getTag() + "_c_" + rowIndex + "_" + columnIndex); //$NON-NLS-1$ //$NON-NLS-2$
element.setTag(linearSystem.getTag() + "_c_" + i + 1 + "_" + j + 1); //$NON-NLS-1$ //$NON-NLS-2$
element.setVariable(true);
matrix[inputSize + j][aSize * 2 + 1 + i] = element;
}
}
// D取得
final RM d = linearSystem.getD(); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discrete/BaseDiscreteDynamicSystem.java | 285 |
| org/mklab/tool/control/system/discrete/DoubleBaseDiscreteDynamicSystem.java | 276 |
BaseDiscreteDynamicSystem<RS,RM,CS,CM> castedObj = (BaseDiscreteDynamicSystem<RS,RM,CS,CM>)o;
return ((this.initialState == null ? castedObj.initialState == null : this.initialState.equals(castedObj.initialState))
&& (this.state == null ? castedObj.state == null : this.state.equals(castedObj.state)) && (this.samplingInterval == castedObj.samplingInterval) && (this.atSamplingPoint == castedObj.atSamplingPoint));
}
/**
* @see org.mklab.tool.control.system.DynamicSystem#getStateNumber()
*/
public int getStateNumber() {
return this.stateNumber;
}
/**
* @see org.mklab.tool.control.system.DynamicSystem#setStateNumber(int)
*/
public void setStateNumber(final int stateNumber) {
this.stateNumber = stateNumber;
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/math/DoubleMathematicalFunction.java | 90 |
| org/mklab/tool/control/system/math/MathematicalFunction.java | 99 |
final DoubleMatrix u2 = u.getSubVector(size / 2 + 1, size);
if (this.type == MathematicalFunctionType.POW) {
return u1.powerElementWise(u2);
} else if (this.type == MathematicalFunctionType.REM) {
return u1.remainderElementWise(u2);
} else if (this.type == MathematicalFunctionType.MOD) {
return u1.modulusElementWise(u2);
}
return u1.powerElementWise(2).add(u2.powerElementWise(2)).sqrtElementWise();
default:
assert false : "never reached"; //$NON-NLS-1$
}
return new DoubleMatrix(u.getRowSize(), 1); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/sink/DisplaySink.java | 117 |
| org/mklab/tool/control/system/sink/DoubleDisplaySink.java | 108 |
public void setDisplay(Display<RS, RM, CS, CM> display) {
if (display == null) {
throw new NullPointerException();
}
this.display = display;
}
/**
* {@inheritDoc}
*/
@Override
public String getString(String key) {
return Messages.getString(key);
}
/**
* {@inheritDoc}
*/
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
if (o == null) {
return false;
}
if (o.getClass() != getClass()) {
return false;
}
final DisplaySink<RS, RM, CS, CM> castedObj = (DisplaySink<RS,RM,CS,CM>)o; | |
| File | Line |
|---|---|
| org/mklab/tool/signal/Filter.java | 109 |
| org/mklab/tool/signal/Filter.java | 133 |
| org/mklab/tool/signal/Filter.java | 160 |
z = z.getSubMatrix(2, z.getRowSize(), 1, 1).appendDown(a.createZero(1, 1)).add(b2t2.multiply(x.getElement(i)));
}
} else {
for (int i = 1; i <= nx; i++) {
y.setElement(i, 1, b.getElement(1).multiply(x.getElement(i)).add(z.getElement(1)));
DoubleMatrix tmp1 = z.getSubMatrix(2, z.getRowSize(), 1, 1).appendDown(a.createZero(1, 1));
DoubleMatrix b2t2 = b2t;
DoubleMatrix tmp2 = b2t2.multiply(x.getElement(i)); | |
| File | Line |
|---|---|
| org/mklab/tool/signal/Filter.java | 271 |
| org/mklab/tool/signal/Filter.java | 295 |
| org/mklab/tool/signal/Filter.java | 322 |
z = z.getSubMatrix(2, z.getRowSize(), 1, 1).appendDown(a.createZero(1, 1)).add(b2t2.multiply(x.getElement(i)));
}
} else {
for (int i = 1; i <= nx; i++) {
y.setElement(i, 1, b.getElement(1).multiply(x.getElement(i)).add(z.getElement(1)));
RM tmp1 = z.getSubMatrix(2, z.getRowSize(), 1, 1).appendDown(a.createZero(1, 1));
RM b2t2 = b2t;
RM tmp2 = b2t2.multiply(x.getElement(i)); | |
| File | Line |
|---|---|
| org/mklab/tool/control/Dimpulse.java | 64 |
| org/mklab/tool/control/Dstep.java | 64 |
throw new IllegalArgumentException(message);
}
DoubleMatrix XX, YY;
if (inputNumber == 0) {
int inputSize = B.getColumnSize();
YY = A.createZero(C.getRowSize() * inputSize, seriesSize);
XX = A.createZero(A.getRowSize() * inputSize, seriesSize);
for (int i = 1; i <= inputSize; i++) {
List<DoubleMatrix> yx = Dlsim.dlsim(A, B.getColumnVector(i), C, D.getColumnVector(i), A.createOnes(1).appendRight(A.createZero(1, seriesSize - 1))); | |
| File | Line |
|---|---|
| org/mklab/tool/control/Lsim.java | 236 |
| org/mklab/tool/control/Ramp.java | 344 |
| org/mklab/tool/control/Step.java | 343 |
int stateSize = A.getRowSize();
int outputSize = C.getRowSize();
String[] yy = new String[outputSize];
for (int i = 1; i <= outputSize; i++) {
if (outputSize == 1) {
yy[i - 1] = "y";
} else {
yy[i - 1] = "y" + i;
}
}
gnuplot.createCanvas(2, 1);
Canvas canvas1 = gnuplot.getCanvas(0, 0);
canvas1.setGridVisible(true);
canvas1.setXLabel("t [sec]");
canvas1.setYLabel("y");
canvas1.plot(T, Y, yy); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 3495 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 3487 |
final SystemOperator<RS, RM, CS, CM>[][] matrix = createClone(this.elements);
final int integratorSize = getIntegratorOrUnitDelaySystemSize();
final Integer[] originalStateNumbers = new Integer[integratorSize];
final Integer[] sortedStateNumbers = new Integer[integratorSize];
final int inputNodeSize = this.inputNodes.size();
final int outputNodeSize = this.outputNodes.size();
final int size = matrix.length;
for (int i = 0; i < integratorSize; i++) {
final int row = size - outputNodeSize - integratorSize + i;
final int column = inputNodeSize + i;
final int stateNumber = ((DynamicSystem<RS, RM, CS, CM>)matrix[row][column]).getStateNumber(); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/DoubleSystemOperator.java | 649 |
| org/mklab/tool/control/system/SystemOperator.java | 662 |
subParameters.put(name, new DoubleParameterContainer(this, field, parameter, name));
if (field.getType().isArray()) {
field.setAccessible(true);
final Object array = field.get(this);
if (array == null) {
continue;
}
subParameters.putAll(createArrayElement(field, name, array));
}
}
} catch (IllegalArgumentException e) {
throw new ParameterAccessException(e);
} catch (IllegalAccessException e) {
throw new ParameterAccessException(e);
}
return subParameters;
}
/**
* クラスおよびそのスーパークラスの指定された名前のフィールドを返します。
*
* @param klass 対象となるクラス
* @param name フィールドの名前
* @return クラスおよびそのスーパークラスの指定された名前のフィールド
* @throws SecurityException セキュリティの権限がない場合
* @throws NoSuchFieldException フィールドがない場合
*/
private Field findField(Class<? extends DoubleSystemOperator> klass, final String name) throws SecurityException, NoSuchFieldException { | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/BlockContinuousExplicitDynamicSystem.java | 211 |
| org/mklab/tool/control/system/continuous/DoubleBlockContinuousExplicitDynamicSystem.java | 203 |
f0[i] = dx.getElement(i + 1, 1);
}
} catch (SolverStopException e) {
throw new RuntimeException(e);
}
return f0;
}
/**
* {@inheritDoc}
*/
public boolean isDifferentialAlgebraicSystem() {
return this.isDifferentialAlgebraicSystem;
}
/**
* {@inheritDoc}
*/
public boolean hasJacobianMatrix() {
return this.hasJacobianMatrix;
}
/**
* {@inheritDoc}
*/
public boolean hasConsistentInitialValue() {
return this.hasConsistentInitialValue;
}
/**
* 微分代数方程式で表されるシステムであるか設定します。
* @param isDifferentialAlgebraicSystem 微分代数方程式で表されるシステムならばtrue
*/
protected void setDifferentialAlgebraicSystem(boolean isDifferentialAlgebraicSystem) {
this.isDifferentialAlgebraicSystem = isDifferentialAlgebraicSystem;
}
/**
* ヤコビ行列を持っているか設定します。
* @param hasJacobianMatrix ヤコビ行列をもっていればtrue
*/
protected void setHasJacobianMatrix(boolean hasJacobianMatrix) {
this.hasJacobianMatrix = hasJacobianMatrix;
}
/**
* 状態と状態の微分の初期値が整合しているか設定します。
* @param hasConsistentInitialValue 状態と状態の微分の初期値が整合していればtrue
*/
protected void setHasConsistentInitialValue(boolean hasConsistentInitialValue) {
this.hasConsistentInitialValue = hasConsistentInitialValue;
}
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/discontinuous/DoubleSaturation.java | 142 |
| org/mklab/tool/control/system/math/DoubleRoundingFunction.java | 178 |
public double getDiscontinuousPoint(final double t1, final DoubleMatrix u1, final double t2, final DoubleMatrix u2) {
final List<Integer> pieces1 = getPiece(t1, u1);
final List<Integer> pieces2 = getPiece(t2, u2);
if (pieces1.equals(pieces2)) {
return Double.NaN;
}
final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
final int piece1 = pieces1.get(number - 1);
final int piece2 = pieces2.get(number - 1);
final double uu1 = u1.getDoubleElement(number);
final double uu2 = u2.getDoubleElement(number); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/math/DoubleMathematicalFunction.java | 59 |
| org/mklab/tool/control/system/math/MathematicalFunction.java | 68 |
public DoubleMatrix outputEquation( final double t, final DoubleMatrix u) {
switch (this.type) {
case CONJ:
return u.conjugate();
case EXP:
return u.expElementWise();
case HERMITIAN:
return u.conjugateTranspose();
case LOG:
return u.logElementWise();
case LOG10:
return u.log10ElementWise();
case MAGNITUDE2:
return u.absElementWise().powerElementWise(2);
case SQUARE:
return u.powerElementWise(2);
case SQRT:
return u.sqrtElementWise();
case RECIPROCAL:
return u.inverseElementWise();
case TEN_POW:
return DoubleMatrix.powerElementWise(10, u); | |
| File | Line |
|---|---|
| org/mklab/tool/control/model/matxbook/MotorContinuousObserver1.java | 52 |
| org/mklab/tool/control/model/matxbook/MotorContinuousObserver2.java | 22 |
@Override
public DoubleMatrix inputOutputEquation(double t, DoubleMatrix xx) {
DoubleMatrix x = xx.getSubVector(1, 2);
DoubleMatrix z = xx.getSubVector(3, 3);
DoubleMatrix y = this.motor.outputEquation(t, x);
DoubleMatrix uh = new DoubleMatrix(1, 1);
DoubleMatrix uyh = uh.appendDown(y);
DoubleMatrix xh = this.observer.outputEquation(t, z, uyh);
DoubleMatrix u = this.stateFeedback.outputEquation(t, xh).unaryMinus();
DoubleMatrix uy = u.appendDown(y); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 3581 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 3573 |
private List<Integer> sortByInputNode(final SystemOperator<RS, RM, CS, CM>[][] matrix) {
final int inputNodeSize = this.inputNodes.size();
final Integer[] inputNodes1 = new Integer[inputNodeSize];
final Integer[] inputNodes2 = new Integer[inputNodeSize];
this.inputNodes.toArray(inputNodes1);
this.inputNodes.toArray(inputNodes2);
// 昇順にソート
Arrays.sort(inputNodes2);
for (int i = 0; i < inputNodeSize; i++) {
final int node1 = inputNodes1[i];
final int node2 = inputNodes2[i];
if (node1 == node2) {
continue;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/AdjacencyMatrix.java | 3626 |
| org/mklab/tool/control/system/DoubleAdjacencyMatrix.java | 3618 |
private List<Integer> sortByOutputNode(final SystemOperator<RS, RM, CS, CM>[][] matrix) {
final int outputNodeSize = this.outputNodes.size();
final Integer[] outputNodes1 = new Integer[outputNodeSize];
final Integer[] outputNodes2 = new Integer[outputNodeSize];
this.outputNodes.toArray(outputNodes1);
this.outputNodes.toArray(outputNodes2);
// 昇順にソート
Arrays.sort(outputNodes2);
for (int i = 0; i < outputNodeSize; i++) {
final int node1 = outputNodes1[i];
final int node2 = outputNodes2[i];
if (node1 == node2) {
continue;
} | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/continuous/DoubleTransportDelay.java | 183 |
| org/mklab/tool/control/system/continuous/TransportDelay.java | 192 |
public void setInitialOutput(final DoubleMatrix initialOutput) {
this.initialOutput = initialOutput.createClone();
final int size = initialOutput.getRowSize();
if (getInputSize() != size) {
super.setInputSize(size);
}
if (getOutputSize() != size) {
super.setOutputSize(size);
}
}
/**
* @see org.mklab.tool.control.system.SystemOperator#setInputSize(int)
*/
@Override
public void setInputSize(final int inputSize) {
if (inputSize != -1) {
super.setOutputSize(inputSize);
if (this.initialOutput == null || this.initialOutput.length() != inputSize) {
setInitialOutput(new DoubleMatrix(inputSize, 1)); | |
| File | Line |
|---|---|
| org/mklab/tool/control/system/graph/CycleMatrix.java | 66 |
| org/mklab/tool/control/system/graph/DoubleCycleMatrix.java | 59 |
private void setAdjacencyConnectionMatrix(final FundamentalArray<SystemOperator<RS,RM,CS,CM>,?> adjacencyMatrix) {
final int rowSize = adjacencyMatrix.getRowSize();
final int columnSize = adjacencyMatrix.getColumnSize();
this.adjacencyConnectionMatrix = new BooleanMatrix(rowSize, columnSize);
for (int row = 1; row <= rowSize; row++) {
for (int column = 1; column <= columnSize; column++) {
if (adjacencyMatrix.getElement(row, column).isZero() == false) {
this.adjacencyConnectionMatrix.setElement(row, column, true);
}
}
}
}
/**
* 隣接連結行列の値を設定します。
*
* @param adjacencyMatrix 隣接行列
*/
private void setAdjacencyConnectionMatrix(final RM adjacencyMatrix) { | |
| File | Line |
|---|---|
| org/mklab/tool/signal/Filter.java | 108 |
| org/mklab/tool/signal/Filter.java | 270 |
DoubleMatrix b2t2 = b2t;
z = z.getSubMatrix(2, z.getRowSize(), 1, 1).appendDown(a.createZero(1, 1)).add(b2t2.multiply(x.getElement(i)));
}
} else {
for (int i = 1; i <= nx; i++) {
y.setElement(i, 1, b.getElement(1).multiply(x.getElement(i)).add(z.getElement(1))); | |