areYouReady | 計算作業前の確認を行ないます。 Execute checks before calculation work. |
calculate | 1ステップ分の計算手続きを定義します。 各ユーザが独自の要素モデルを作成する際、1ステップ分の計算手続きを定義して下さい。 一般的な要素では、
- 最初、各状態量には _currentTime における値が格納されている。
- ここでは _currentTime + _timeStep における状態量, 出力値を計算する。
- このメソッド終了後、状態量は _currentTime + _timeStep における値に更新されている。
の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.
- At first, in each amount of states, the value at "_currentTime" is stored.
- Here, the amount of states and output value in "_currentTime + _timeStep" are calculated.
- Next, the amount of states is updated by the value in a certain time.
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. |
calculateIterationStep | 反復計算目標時刻を計算します。 Calculates repeated calculation target time. |
calculateTimeStep | タイムステップの計算を行ないます。 Calculation of a time step. |
calReq | この要素が依存している他の要素へ計算要請を伝達します。 |
canYouCalculate | 計算開始の可・不可の判断をします。 Judgment whether calculation can be started or not. |
canYouCalculate0 | canYouCalculate() の候補です。
|
canYouCalculate1 | canYouCalculate() の候補です。
|
clearDataString | データ文字列 _dataString を null に設定します。 Clear the data string. |
construct | Object 型オブジェクト記憶用配列を作成します。 つまり、_receivePortArray, _sendPortArray, _objectArray を作成します。 Makes "_receivePortArray" and "_sendPortArray". |
doInitialWork | 初期作業 initialWork() を終えたかどうかを判断します。
|
doShareInfo | このメソッドは doShareInfo() を呼び出すメソッドです。 戻り値は OperationFlag 型です。 This is the method which calls 'doShareInfo()'. |
doSwitch | 全ての所有送信端子で OhSendPort.doSwitch() を実行します。 Orders the send ports of this element to execute doSwitch(). |
flushData | 反復目標時刻までのデータの出力と、データパックの処理をするメソッドです。 It is the method which carries out output of the data by repetitive target time, and processing of a data pack. |
getComponent | オーバーロード。 構成オブジェクト(構成要素)を取得します。 Acquires a composition object. |
getFromArray | オーバーロード。 OhObject 型オブジェクトを取得します。 gets object typed Object. |
getFromList | オーバーロード。 _objectList から OhObject 型オブジェクトを取得します。 Finds an object typed Object from "_objectList". |
getInitialState | 初期状態量を読み込むメソッドです。 Gets the initial state. |
getLine | 引数のストリーム aSr から行を読み込み、その行を文字列として返します。 Read a line from the input stream aSr and store the line into aStr. |
getObject | オーバーロード。 _objectArrayからオブジェクトを取得します。 gets a object from _objectArray. |
getParameter | パラメタを読み込むメソッドです。 定義済みで、ユーザは新規に定義する必要はありません。 Gets the parameter. |
getReceivePort | オーバーロード。 _receivePortArray から受信端子を取得します。 gets a receiving port from "_receivePortArray". |
getSendPort | オーバーロード。 _sendPortArray から送信端子を取得します。 gets a sending port from "_sendPortArray". |
hasConverged | Convergence of the repeated calculation between elements is judged. Please be sure to re-define by the element which performs repeated calculation. In the function, please return 'true' if it converges. When not giving a re-definition, an error message is sent and it exits. 要素間の反復計算の収束を判定します。反復計算を行なう要素で 必ず再定義して下さい。収束したら true、収束していなければ false を返して下さい。再定義しない場合はエラーメッセージを 出して exit します。 |
hasReachedTargetTime | 反復計算が _targetTime に到達したかどうかを判断します。 Judges whether repeated calculation reached '_targetTime'. |
init | オーバーロード。 構成要素のクラス名をファイルから読みとってつくりあげる全体系モデル または部分系モデルで利用される コンストラクタの補助メソッドです。 Initialization with the information which is given through a file. |
initializeTargetTime | このメソッドは OhElement では使いません。 This method is not used by OhElement. |
initialOutput | 初期の出力を行ないます。 初期状態量を決めた直後に、_currentTime での出力を定義します。 送信端子に時刻と出力値を書き込みます。 _currnetTime での出力が計算できた場合は true を返します。 必要な入力データが得られていないなどして、 _currentTime の出力が計算できなかった場合は false を返します。 要素によっては、setInitialState() の中で 初期の出力をするようにした方が都合がよいかも知れません。 たとえば、初期値設定のために与えられる文字列によって、 初期の出力のやり方を変えたりする場合などです。 そうした場合は、initialOutput() は何もしないように定義して、 setInitialState() で初期の出力をするように定義しても構いません。 An initial output. In classes derived from class Element, its definition should be given. The output in "_currentTime" is defined immediately after deciding the amount of initial states. Time and an output value are written in a sending port. "true" is returned when the output in "_currentTime" is able to be calculated. "false" is returned when the output of "_currentTime" is not able to be calculated by required input data not being obtained. |
initialTime | 現在時刻と計算時間間隔を引数の値に初期化します。
_currentTime and _timeStep of OhElement are initialized to aTp. |
initialWork | 初期作業を行ないます。 初期時刻において、全データを取得します。 |
makeObjectArray | _objectList を配列化して返し、 同時に、引数 aNumOfObjs (配列)の1番目に要素数 _numberOfObjects を格納します。 Creates an array of objects which are included in '_objectList' and stores it in '_aObjArray' and the number of elements in 'aNumOfObjs'. |
NecessaryTimeFrom | 要素が次回の計算に必要なデータのうち、aRp (arg) から受け取 るべきデータのデータ記録時刻を返します。 NecessaryTimeFrom() から NecessaryTimeTo() までのデー タパックが受信端子 aRp から受信されていなければ、要素は計算 を開始することができません。 ここでは受信端子に依らず、_currentTimeを返すようにしています。 必要があれば派生クラス(各要素モデル)で再定義してください。 Returns the data record time of the data which OhElement should receive from aRp out of data required for next calculation.
OhElement cannot start calculation if the data pack from getNecessaryTimeFrom to getNecessaryTimeTo is not received from the receiving terminal aRp, OhElement cannot start calculation. |
NecessaryTimeTo | 要素が次回の計算に必要なデータのうち、aRp (arg) から受け取 るべきデータのデータ記録時刻を返します。 NecessaryTimeFrom() から NecessaryTimeTo() までのデー タパックが受信端子 aRp から受信されていなければ、要素は計算 を開始することができません。 ここでは受信端子に依らず、_currentTimeを返すようにしています。 必要があれば派生クラス(各要素モデル)で再定義してください。 Returns the data record time of the data which OhElement should receive from aRp out of data required for next calculation.
OhElement cannot start calculation if the data pack from NecessaryTimeFrom to NecessaryTimeTo is not received from the receiving terminal aRp, OhElement cannot start calculation. |
printConnection | オーバーロード。 接続情報を出力します。 Information output on connection. |
printObjects | 所有オブジェクトの情報を出力します。 Information output on possession objects. |
printReceivePorts | オーバーロード。 所有受信端子の情報を出力します。 Information output on possession receiving ports. |
printSendPorts | オーバーロード。 所有送信端子の情報を出力します。 Information output on possession sending ports. |
printStatus | Returns true. |
recordStatus | Records status. |
reduceDataPackStock | 不要データパックを消去します。 Deletion of an unnecessary datapacks. |
register | オーバーロード。 OhObject 型オブジェクトの登録と _owner の設定を行います。 Registers an object 'aObj' to the data member '_objectList'. |
registerForCLI | オーバーロード。 C++/CLIで記述する場合のregisterです。実装内容は register(OhObject)と 同様です。 |
registerReceivePorts | 派生クラスの全受信端子を登録します。 このメソッドは、派生クラスの全受信端子を OhElement.register(Object)
OhElement.register(Object, int) により登録します。 登録されていない端子は接続できないので送受信に利用できません。 例えば、派生クラスで受信端子 abc を定義した場合、 public void registerReceivePort() { register((Object) abc); } とすれば、abc を受信端子として登録できます。 Declares method registerReceivePorts() as abstract method. In classes derived from class Element, its definition should be given. "registerReceivePorts()" registers all the receiving ports of an inherited class, and all sending ports by OhElement.register(Object)
OhElement.register(Object, int). The port which is not registered is not applicable to sending and receiving, since it is not connectable. For example, when an inherited class defines the receiving port "abc", if it is performed as follows, "abc" can be registered as a receiving terminal. void registerReceivePort() { register((Object)abc); }
|
registerSendPorts | 派生クラスの全送信端子を登録します。 このメソッドは、派生クラスの全送信端子を OhElement.register(Object)
OhElement.register(Object, int) により登録します。 登録されていない端子は接続できないので送受信に利用できません。 例えば、派生クラスで送信端子 abc を定義した場合、 public void registerSendPort() { register((Object) abc); } とすれば、abc を送信端子として登録できます。 Declares method "registerSendPorts() as abstract method. In classes derived from class Element, its definition should be given. "registerSendPorts()" registers all the receiving ports of an inherited class, and all sending ports by OhElement.register(Object)
OhElement.register(Object, int). The port which is not registered is not applicable to sending and receiving, since it is not connectable. For example, when an inherited class defines the receiving port "abc", if it is performed as follows, "abc" can be registered as a receiving terminal. void registerSendPort() { register((Object)abc); }
|
renewCurrentTime | _currentTime を更新します。 |
renewFixedTime | _fixedTime を _currentTime に進めます。 Updates '_fixedTime'. |
renewTargetTime | 反復計算目標時刻 _targetTime を更新します。 引数に反復計算時間間隔をとります。 Updates '_targetTime'. |
restoreSendPortStock | データ文字列 _dataString を読みとり、要素に接続されている送信端子にデータを収録します。 The data character sequence '_dataString' is read and data is recorded on the sending port connected to the element. |
rewindCurrentTime | _currentTime を _fixedTime に戻します。 |
saveSendPortStock | 要素に接続されているすべての送信端子のデータに収録されているデータパックを、 ストリーム aSw(引数)で指定されているファイルに書き出します。 The data pack recorded on the data of all the sending ports connected to the element is written out to the file specified by stream 'aSw'. |
saveTerminalState | 要素の最終状態を出力ストリーム sw で指定されるファイルに書き込む作業をするメソッドです。 ユーザが定義する要素モデルでは、このメソッドを必ず定義しなければなりません。 最終状態を書き込む仕様は次のようにしてください。 (data_string)
This is the method which does the work which writes the last state of an element in the file specified by the output stream "aSr". In classes derived from class Element, its definition should be given. |
sendStockedData | 反復目標時刻までにたまったデータを出力するメソッドです。 It is the method which outputs the data which accumulated by repetitive target time. |
setCur2Fix2Tar | _targetTime, _fixedTime を _currentTime に一致させるメソッドです。 |
setDataPackArray | 送信データパック配列を更新します。 Sends data packs.
|
setInitialState | 初期状態量を設定するメソッドを、各派生クラスに応じて定義します。 入力ストリーム aSr で指定されるファイルからデータを読みとって初期状態量を設定します。 最終状態をファイルに保存するプログラムとつじつまがあうようにしてください。 Declares method "setInitialState()" as abstract method. In classes derived from class Element, its definition should be given. The method which sets up the amount of initial states is defined according to each inherited class. |
setParameter | パラメタを設定するメソッドを、各派生クラスに応じて定義します。 入力ストリーム aSr で指定されるファイルからデータを読みとってパラメタを設定します。
Declares method "setParameter()" as abstract method. In classes derived from class Element, its definition should be given. Parameters are read in the input stream "aSr". It is necessary to create an element model according to each inherited class. Data is read in the file specified by the input stream "aSr", and the amount of initial states is set up. Please have the program and consistency which save the last state at a file. |
shareInfo | 直接通信を利用してパラメタなどの情報を共有するためのメソッドです。 This is a method for sharing information, such as a parameter, using direct communication. |
terminalState | 最終状態を保存します。 |
work | _currentime から OhTotal_terminalTime 間の計算アルゴリズムを定義します。 calculate(), calculateTimeStep() などを用いて、_terminalTime までの計算を実行します。 まず、 OhElement.canYouCalculate() の戻り値が false ならば、計算開始不可と判断し、false を返します。 戻り値が true の場合は、 true である限り、 OhElement.calculate(), _currentTime.add(_timeStep) を繰り返し実行します。 最後に、 OhElement.setDataPackArray(), を実行し、true を返します。 [戻り値] ・true --> 計算を実行した場合。 ・false -> 計算不可能の場合、または計算済みの場合。
Calculate between "_currentTime" and "_terminalTime". In classes derived from class Element, its definition should be given. Calculation by "_terminalTime" is performed using "calculate()", "calculateTimeStep()", etc. First, if return value of "canYouCalculate()" becomes "false", it will be judged that a calculation start is impossible, "false" is returned. When the return value is "true", "calculate()" and "_currentTime += _timeStep" are repeated and performed, as long as the return value of "canYouCalculate" is "true". Finally, "setDataPackArray()" and "reportToSender()" are performed and "true" is returned. [RETURN] ・true --> When calculation was performed. ・false -> When calculation is impossible. When calculation has finished.
|
work0 | work() の例です。 Example for "work()". |
work1 | work() の例です。 Example for "work()". |
work2 | 反復計算要素用 work() の例です。 For the element which carries out repeated calculation. |