JointStp

Joint multiple inputs and output the sum of them averaged within constant intervals

[ ohymos | Source | Keywords | Summary | Ancestors | All Members | Descendants ]

Quick Index

DESCRIPTION

Class Summary

class JointStp : public Element
{
public:
JointStp* NewElement() ;
Boolean Init(char* o_name, int o_num, FILE* fp);
Boolean Init(char* o_name, int o_num, int numinput);
JointStp(char* o_name, int o_num, int numinput) ;
JointStp(void) ;
~JointStp(void) ;
void Set_parameter(FILE* fp);
void Set_port(int n);
void Set_initial_state(FILE* fp) ;
void Set_initial_state(time_t ct) ;
void Save_terminal_state(FILE* fp) ;
void Save_terminal_state(time_t& ct) ;
Boolean Initial_output(void);
time_t Calculate_time_step(void) ;
Boolean Can_you_calculate(void) ;
Boolean Work(void) ;
Boolean Calculate(void);
protected:
}; // JointStp

Back to the top of JointStp


DESCRIPTION

An object of class JointStp has a number of receive ports which receive Data< double> data and send sum of the received data averaged within constant time intervals through a send port.

The averaged value from t to t + Dt is sent at t + Dt, where Dt is the time interval.

[モデル名] JointStp

[機能]

JointStp は、複数個数の receive port を持ち、そこから Data<double> 型のデータ (データ接続型は、折れ線データ、ステップ データ、またはパルスデータのいずれか) を受信し、それらの線形和をステッ プデータ形式で send port から送出します。

時刻 t から時刻 t + Dt までの平均値を、時刻 t + Dt に送出します。

式で表すと

    a[0]r[0](t,t+Dt) + a[1]r[1](t,t+Dt) + ... + a[n-1]r[n-1](t,t+Dt))
を計算して出力します。ただし、n: receive port の個数、a[0], a[1], ..., a[n-1]: 係数、Dt: 時間間隔です, r[i](t,t+Dt): i番目の受信端 子データの時刻 t から時刻 t+Dt の間の平均値。

各受信端子のデータ接続型 (Data Connection Type, DCT) は、

      0  折線
      1  ステップ (時刻 t-Dt から時刻 t までの値を t に記録)
      2  パルス

の中から選択して指定します。

[受信端子の仕様]

受信端子の個数は,任意です。

受信端子の個数 n は、

  1. コンストラクタ JointStp(char* o_name, int o_num, int numinput)
  2. 構造定義ファイルの Init のための追加情報
  3. メンバ関数 Init(char* o_name, int o_num, int numinput)
  4. メンバ関数 Set_ports(int n)

のいずれかを使用して指定します。

受信端子の仕様を項目別に列挙します。

[送信端子の仕様] 

[Init のための追加情報]

構造定義ファイルの Init のための追加情報には、

    n Dt dct[0] a[0] dct[1] a[1] ... dct[n-1] a[n-1]
の値を並べます。受信端子の個数 n は、Init の中で読みます。Dt 以降は、 Init の中で、Set_parameter(FILE*) を使って読みます。Dt 以降について は、[パラメタの説明] を参照してください。データの間には、1個以上の空 白を置いてください。データを一行に書けないときは、複数行に渡っても構 いません。

[パラメタの指定] パラメタは、

です。受信端子のデータ接続型DCT は、0 (折線), 1 (ステップ)、2 (パルス) です。パラメタは、パラメタファイルに、つぎの順で並べ ます。

    Dt dct[0] a[0] dct[1] a[1] ...  dct[n-1] a[n-1]
    

JointStp を構造定義ファイルに登録して使用する場合は、ここのパラメタ 値もInit のための追加情報として与えるようにし、パラメタファイルには 書かないでください。

[初期状態の指定] 状態量は,current_time (sec) だけです。

初期状態を読み取る関数は,つぎのようです。

    void Set_initial_state(FILE* fp) {
      time_t tnow; fscanf(fp, "%ld", &tnow);
      if (tnow > 0) current_time = tnow;
    }

[解説] 

受信端子から受信するデータの単位、受信端子の乗数の単位、送信端子から 送出されるデータの単位は特に記述しませんでした。

一般には、受信端子から受信するデータと送信端子から送出するデータの単 位は同じで、例えば、m^3/sec であり、受信端子の乗数は、無次元でしょう。

特別には、受信端子の乗数を単位変換のために使用することも可能です。

Back to the top of JointStp


JointStp* NewElement() ;

Returns a pointer to a new JointStp

構造定義ファイルに対応するための関数です。デフォルトコンストラクタ によってヒープに作成した要素モデルへのポインタを返します。

  JointStp* NewElement()                           
;

Function is currently defined inline.


Back to the top of JointStp


Boolean Init(char* o_name, int o_num, FILE* fp);

Init function for SCF.

Additional information for Init:

       n Dt dct[0] a[0] dct[1] a[1] ... dct[n-1] a[n-1]
     
where n: number of receive ports, Dt: time interval, dct[0]. .... dct[n-1]: data connection type, a[0], ... a[n-1]: multipliers

構造定義ファイル用 init 関数。"Init のための追加情報" を読み取りま す。"Init のための追加情報" 部分には、

      n Dt dct[0] a[0] dct[1] a[1] ... dct[n-1] a[n-1]
     
の値を並べます。受信端子の個数 n は、Init の中で読みます。Dt 以降は、 Init の中で、Set_parameter(FILE*) を使って読みます。Dt 以降について は、class JointStp の DESCRIPTION の中の [パラメタの説明] を参照し てください。データの間には、1個以上の空白を置いてください。データを 一行に書けないときは、複数行に渡っても構いません。

構造定義ファイルでは、この関数がパラメタを読み込むので、パラメタファ イルには、パラメタを書かないでください。

  Boolean Init(char* o_name, int o_num, FILE* fp);

Back to the top of JointStp


Boolean Init(char* o_name, int o_num, int numinput);

in o_name
- object name
in o_num
- object number
in numinput
- number of receive ports

  Boolean Init(char* o_name, int o_num, int numinput);

Back to the top of JointStp


JointStp(char* o_name, int o_num, int numinput) ;

Constructor

  JointStp(char* o_name, int o_num, int numinput)
    ;

Function is currently defined inline.


Back to the top of JointStp


JointStp(void) ;

Default constructor

  JointStp(void)
    ;

Function is currently defined inline.


Back to the top of JointStp


~JointStp(void) ;

Destructor

  ~JointStp(void)
	                                              
;

Function is currently defined inline.


Back to the top of JointStp


void Set_parameter(FILE* fp);

Read in paramters

     void Set_parameter(FILE* fp) {
      fscanf(fp, "%d", &mDt); int dct;
      for (int i = 0; i < mNumRps; i++) {
        fscanf(fp, "%d %lf ", &dct, &(mA[i]));
        mRps[i].Set_data_connection_type(dct);
      }
     }
     

  void Set_parameter(FILE* fp);

Back to the top of JointStp


void Set_port(int n);

Set the number of receive ports

  void Set_port(int n);

Back to the top of JointStp


void Set_initial_state(FILE* fp) ;

current_time を fscanf(fp, "%ld", ¤t_time) で読み とった値に変更します。読みとった値が非正なら変更しません。

     void Set_initial_state(FILE* fp) {
      time_t tnow; fscanf(fp, "%ld", &tnow);
      if (tnow > 0) current_time = tnow;
     }
     

  void Set_initial_state(FILE* fp)                                                                                        
;

Function is currently defined inline.


Back to the top of JointStp


void Set_initial_state(time_t ct) ;

current_time を ct に変更します。 ct が非正なら変更しません。

  void Set_initial_state(time_t ct)                                         
;

Function is currently defined inline.


Back to the top of JointStp


void Save_terminal_state(FILE* fp) ;

current_time を fprintf(fp, "%ld", current_time) で書き出します。

  void Save_terminal_state(FILE* fp)                                            
;

Function is currently defined inline.


Back to the top of JointStp


void Save_terminal_state(time_t& ct) ;

current_time を ct に格納して戻ってきます。

  void Save_terminal_state(time_t& ct)                             
;

Function is currently defined inline.


Back to the top of JointStp


Boolean Initial_output(void);

初期時刻の入力を加算して,送信端子に書き出します。

  Boolean Initial_output(void);

Back to the top of JointStp


time_t Calculate_time_step(void) ;

time_step は、mDt に固定です。

  time_t Calculate_time_step(void)                
;

Function is currently defined inline.


Back to the top of JointStp


Boolean Can_you_calculate(void) ;

すべての受信端子で、Necessary_time_from, Necessary_time_to で定義さ れる時間の間のデータが取得できれば計算可能と判断します。

  Boolean Can_you_calculate(void)                                 
;

Function is currently defined inline.


Back to the top of JointStp


Boolean Work(void) ;

計算時間間隔を決めてから calculate を実行する Work0 を採用していま す。

  Boolean Work(void)                    
;

Function is currently defined inline.


Back to the top of JointStp


Boolean Calculate(void);

個々の受信端子から、Dt 時間毎の平均値データを取得して、それぞれの値 に係数を乗じて和をとり、送信端子から送出します。

  Boolean Calculate(void);

Back to the top of JointStp


All Members

public:
JointStp* NewElement() ;
Boolean Init(char* o_name, int o_num, FILE* fp);
Boolean Init(char* o_name, int o_num, int numinput);
void Set_parameter(FILE* fp);
void Set_port(int n);
void Set_initial_state(FILE* fp) ;
void Set_initial_state(time_t ct) ;
void Save_terminal_state(FILE* fp) ;
void Save_terminal_state(time_t& ct) ;
Boolean Initial_output(void);
time_t Calculate_time_step(void) ;
Boolean Can_you_calculate(void) ;
Boolean Work(void) ;
Boolean Calculate(void);
protected:

Back to the top of JointStp


Ancestors

Inheritance chain for JointStp:

Back to the top of JointStp


Descendants

Class is not inherited by any others.

Back to the top of JointStp


Generated from source by the Cocoon utilities on Sun Sep 17 20:23:56 2000 .

Report problems to jkotula@stratasys.com