OHyMoS.NET Class Library

OhElement.calculate メソッド 

1ステップ分の計算手続きを定義します。

各ユーザが独自の要素モデルを作成する際、1ステップ分の計算手続きを定義して下さい。 一般的な要素では、 の3点を満足するように、下記の (1) から (4) を順に記述して下さい。
 (1) 受信端子からの入力。 (2) 数理計算。 (3) 送信端子への出力。 (4) 状態量の更新。 
(2) では、パラメータ、_currentTime における状態量、受信端子からの入力を用い、 _currentTime + _timeStep における状態量、送信すべき出力値を計算する数理モデルの1ステップ分を 具体的に定義して下さい。

このメソッドの中で _currentTime, _timeStep を変更しないで下さい。 必要ならば _timeStep を更に細かい時間区分に分割して計算できますが、 この時は作業用変数を用い、_currentTime, _timeStep を変更しないように注意して下さい。

計算に必要な全ての数値は、データメンバ及び所有受信端子からの入力として取得できます。 従って引数は不要です。

予定通り計算できた場合は、true を返します。 calculate() の内部で計算時間ステップを計算し、 その計算時間ステップ分のデータを取得できないなどして、 計算を進めることができなかった場合は、false を返します。

抽象メソッドなので、派生クラスで必ず定義して下さい。
 [ACCIDENT] ・このメソッドの中で _currentTime, _timeStep が変更された場合。 

Calculation procedure for 1 step. In classes derived from class Element, its definition should be given. In a general element, Please describe following (1) to (4) in order to fulfill these 3 points.
 (1) the input from a receiving port. (2) numerical computation. (3) the output to a sending port. (4) updating of the amount of states. 
At (2), by using parameters, the amount of states in "_currentTime" , and the input from a receiving ports, please define concretely one step of a numerical model which calculate the amount of states and the output value which should be transmitted in "_currentTime + _timeStep".

In this method, please do not change "_currentTime" and "_timeStep".

All numerical values required for calculation are acquirable as instance variable and input from a possession receiving port. Therefore, arguments are unnecessary.

The case where it is calculable as planned, "true" is returned. When a calculation time step is calculated inside "calculate()", the data for the calculation time step cannot be acquired and calculation is not able to be advanced, "false" is returned.
public abstract bool calculate();

戻り値

a bool value

例外

例外の種類条件
OhCannotGetDataErrorif an error occurs
OhErrorif an error occurs

参照

OhElement クラス | OhymosNet 名前空間