[ libohymos | Source | Keywords | Summary | Ancestors | All Members | Descendants ]
Back to the top of Sub_system
そこで本システムでは部分系モデルを新たに作成するのではなく, 要素モデ
ルを継承して作成することとしました。 部分系モデルでは, 受信用中継端
子・送信用中継端子を Element::receive\_port\_array,
Element::send_port_array に記憶しています。 また, 端子の登録に関
わる{\tt Element} のメンバ関数を, 構成要素の登録作業にも用い, 端子の
登録と全く同一の手続きで構成要素の登録を行い, 部分系モデル作成者の利
便性を高めています。
部分系モデルでは, 上記のように登録した各構成要素・中継端子間の接続を
定義しなければなりません。しかし, 基本型部分系モデルに接続のためのメ
ンバ関数が既に定義されているので, 基本型部分系モデルを継承して作成し
た部分系モデルでは, 接続作業は基本型部分系モデルのメンバ関数に引数を
与えるのみの作業に単純化されています。
基本型部分系モデルを表すクラス Sub_system で新たに追加されたデー
タメンバ, メンバ関数, また Element と異なる内容に再定義されたメン
バ関数は以下の通りです。
要素・部分系どうしが直接通信を用いて反復計算を行なうためには、
それらを所有する部分系がそれらを管理する必要があります。
反復計算のためのデータメンバはつぎのようです。
反復計算のためのメンバ関数はつぎのようです。
Back to the top of Sub_system
void** component_array;
Pointer to the area where the pointers to the constituent elements
are stored.
void** component_array;
Back to the top of Sub_system
int number_of_components;
Number of constituent elements
int number_of_components;
Back to the top of Sub_system
void*** iterator_array; //; 反復計算する構成要素記憶用配列
Back to the top of Sub_system
int number_of_iterator_sets; //; 反復計算する要素群の数
Back to the top of Sub_system
int* number_of_iterators; //; 要素群を構成する要素の数
Back to the top of Sub_system
void Register_receive_ports(void) ;
void Register_receive_ports(void) = NULL;
Back to the top of Sub_system
void Register_send_ports(void) ;
void Register_send_ports(void) = NULL;
Back to the top of Sub_system
登録されていない構成オブジェクトには, 計算実行命令が送れません.
例えば, 派生クラスで構成オブジェクト abc をデータメンバとして定義
した場合, 次のように abc を登録します.
これにより &abc は, 一時的に object_list に収録された後, 最終的に
void* 型配列 component_array 中に記憶されます.
(Sub_system::Construct 参照)
void Register_components(void) ;
void Register_components(void) { Register((void*) &abc); }
この時, 必ず &abc を void* 型にキャストして下さい.
virtual void Register_components(void) = NULL;
Back to the top of Sub_system
void Initialize_iterator_array(void);
void Initialize_iterator_array(void);
Back to the top of Sub_system
同様に、派生クラスで反復計算する構成オブジェクト def, gih
をデータメンバとして定義した場合, 次のように def, gih を登録します.
void Register_iterators(void) ;
void Register_iterators(void)
{ Register(2, (void*) &def, (void*) &gih); }
最初の引数は反復計算するオブジェクトの数です.
これにより &def, &gih は, 一時的に object_list に収録さ
れた後, 最終的に void* 型配列 iterator_array 中に記憶されます.
virtual void Register_iterators(void) = NULL;
Back to the top of Sub_system
Boolean Register(int num, ...);
Boolean Register(int num, ...);
Back to the top of Sub_system
Boolean Register(void* p) ;
Function is currently defined inline.
Back to the top of Sub_system
Boolean Register(void* p, int obj) ;
Boolean Register(void* p, int obj) ;
Function is currently defined inline.
Back to the top of Sub_system
指定されたオブジェクトのアドレスが登録されていない場合は, NULL を
返します.
number_of_components が負の場合, component_array が作成されていな
いと判断し, エラーメッセージを表示後 NULL を返します.
void* Get_component(char* c_name, char* o_name, int o_num);
ARGUMENT:
・c_name 取得する構成オブジェクトのクラス名.
・o_name 取得する構成オブジェクトのオブジェクト名.
・o_num 取得する構成オブジェクトのオブジェクト番号.
RETURN:
・void* 指定された構成オブジェクトのアドレス.
指定のオブジェクトを取得できない場合 NULL.
ACCIDENT:
・component_array に Object* 型以外の変数が void* にキャスト
されて収録されている場合.
void* Get_component(char* c_name, char* o_name, int o_num);
Back to the top of Sub_system
void* Get_component(char* o_name, int o_num);
void* Get_component(char* o_name, int o_num);
Back to the top of Sub_system
Boolean Connect(void* my_p, void* r, char* rp_c_name, char* rp_name, int rp_num);
Boolean Connect(void* my_p, void* r, char* rp_c_name, char* rp_name, int rp_num);
Back to the top of Sub_system
Boolean Connect(void* s, char* sp_c_name, char* sp_name, int sp_num, void* r, char* rp_c_name, char* rp_name, int rp_num);
Back to the top of Sub_system
Boolean Connect(void* s, char* sp_c_name, char* sp_name, int sp_num, void* my_p);
Boolean Connect(void* s, char* sp_c_name, char* sp_name, int sp_num, void* my_p);
Back to the top of Sub_system
Boolean Connect(void* my_p, void* r, char* rp_name, int rp_num);
Boolean Connect(void* my_p, void* r, char* rp_name, int rp_num);
Back to the top of Sub_system
Boolean Connect(void* s, char* sp_name, int sp_num, void* r, char* rp_name, int rp_num);
Boolean Connect(void* s, char* sp_name, int sp_num, void* r, char* rp_name, int rp_num);
Back to the top of Sub_system
Boolean Connect(void* s, char* sp_name, int sp_num, void* my_p);
Boolean Connect(void* s, char* sp_name, int sp_num, void* my_p);
Back to the top of Sub_system
Boolean Connect(void* my_sp, void* my_rp);
Boolean Connect(void* my_sp, void* my_rp);
Back to the top of Sub_system
void Connect_ports(void) ;
virtual void Connect_ports(void) = NULL;
Back to the top of Sub_system
EXAMPLE
void Connect_components(void) {
a.Register(&b, 0);
b.Register(&a, 0);
a.Register(&c, 1);
c.Register(&a, 0);
}
END
ここで, a, b, c は, この部分系のデータメンバです。これにより, 要素
a の object_array[0] に要素 b のアドレスが格納され, 要素 a の
object_array[1] に要素 c のアドレスが格納されることになります。要素
b の object_array[0] に要素 a のアドレスが格納されます。要素 c の
object_array[0] に要素 a のアドレスが格納されます。
純粋仮想関数なので, 派生クラスで必ず定義して下さい.
void Connect_components(void) ;
virtual void Connect_components(void) = NULL;
Back to the top of Sub_system
Construct では, まず object_list が NULL であることを確認します.
NULL でない場合は object_list が使用中と判断し, エラーメッセージ
を表示後 return します.
次に, 以下の手続きに従います.
RETURN:
Boolean Construct(void);
Boolean Construct(void);
Back to the top of Sub_system
部分系モデル内部に存在する全端子に Switch (virtual) を実行させま
す.
Relay_port では receiver_array が作成されます.
Send_port では, receiver_array が作成され, buffer_list がデータパ
ック収録用に作成されます.
まず Element::Switch を実行し, この戻り値が NO の場合, エラーメッ
セージを表示後 NO を返します.
次に, 構成オブジェクトに Switch (virtual) を実行させます.
ここで戻り値が NO の構成オブジェクトが存在する場合は, 全構成オブ
ジェクトに Switch を実行させた後, エラーメッセージを表示して NO
を返します.
Boolean Switch(void);
RETURN:
・YES 部分系モデル内部の全端子を正常に転換できた場合.
・NO 部分系モデル内部の端子の内, 正常に転換できないものが
存在する場合.
Boolean Switch(void);
Back to the top of Sub_system
この関数の戻り値が YES ならば, Sub_system は計算を開始できます.
まず Element::Are_you_ready を用いて, 所有受信側中継端子, 所有送
信側中継端子に対して計算前の確認作業を行います.
この戻り値が NO の場合, エラーメッセージを表示後 NO を返します.
次に, 全構成オブジェクトに Are_you_ready (virtual) を用いて計算前
の確認作業を行います.
ここで戻り値が NO のオブジェクトが存在する場合, 全構成オブジェク
トを Are_you_redy で確認後, エラーメッセージを表示して NO を返し
ます.
Boolean Are_you_ready(void);
RETURN:
・YES 計算開始可.
・NO 計算開始不可.
Boolean Are_you_ready(void);
Back to the top of Sub_system
void Clear_data_string(void);
void Clear_data_string(void);
Back to the top of Sub_system
void Set_parameter(FILE*) ;
void Set_parameter(FILE*) ;
Function is currently defined inline.
Back to the top of Sub_system
void Parameter(FILE* fp, char*& buffer, int buflen, Boolean& stock_p);
void Parameter(FILE* fp, char*& buffer, int buflen, Boolean& stock_p);
Back to the top of Sub_system
current_time を読み込みます。読み込んだ値が 0 なら,current_time
を変更しません。
Boolean Initial_time(time_t i_time);
Boolean Initial_time(time_t i_time);
Back to the top of Sub_system
void Set_initial_state(FILE* fp);
void Set_initial_state(FILE* fp);
Back to the top of Sub_system
void Initial_state(FILE* fp, char*& buffer, int buflen, Boolean& stock_p);
void Initial_state(FILE* fp, char*& buffer, int buflen, Boolean& stock_p);
Back to the top of Sub_system
void Save_terminal_state(FILE* fp) ;
virtual void Save_terminal_state(FILE* fp) ;
Function is currently defined inline.
Back to the top of Sub_system
Sub_system::Terminal_state(FILE* fp) は,構成要素に最終状態を書
き出すように指令を送ります。
void Terminal_state(FILE* fp);
virtual void Terminal_state(FILE* fp);
Back to the top of Sub_system
void Save_send_port_stock(FILE* fp);
virtual void Save_send_port_stock(FILE* fp);
Back to the top of Sub_system
void Print_components(FILE* fp , char* head );
void Print_components(FILE* fp = stderr, char* head = " ");
Back to the top of Sub_system
Boolean Initial_output(void) ;
Boolean Initial_output(void) ;
Function is currently defined inline.
Back to the top of Sub_system
Boolean Initial_work(void) ;
Function is currently defined inline.
Back to the top of Sub_system
time_t Necessary_time_from(void* rp);
virtual time_t Necessary_time_from(void* rp);
Back to the top of Sub_system
time_t Necessary_time_to(void* rp);
virtual time_t Necessary_time_to(void* rp);
Back to the top of Sub_system
Boolean Can_you_calculate(void) ;
Boolean Can_you_calculate(void) ;
Function is currently defined inline.
Back to the top of Sub_system
time_t Calculate_time_step(void) ;
time_t Calculate_time_step(void) ;
Function is currently defined inline.
Back to the top of Sub_system
Boolean Calculate(void) ;
Boolean Calculate(void) ;
Function is currently defined inline.
Back to the top of Sub_system
Boolean Do_you_reach_target_time(int num);
Boolean Do_you_reach_target_time(int num);
Back to the top of Sub_system
Boolean Do_you_converge(int num);
Boolean Do_you_converge(int num);
Back to the top of Sub_system
component_array に登録されている要素のcurrent_time および
iterator_array に登録されている要素の fixed_time のうち、最も遅れて
いるものを自分の current_time とする。
Boolean Renew_current_time(void);
Boolean Renew_current_time(void);
Back to the top of Sub_system
void Rewind_current_time(int num);
void Rewind_current_time(int num);
Back to the top of Sub_system
void Flush_data(int num);
Back to the top of Sub_system
void Renew_fixed_time(int num);
void Renew_fixed_time(int num);
Back to the top of Sub_system
void Renew_target_time(int num, time_t itrs);
void Renew_target_time(int num, time_t itrs);
Back to the top of Sub_system
void Initialize_target_time(void);
void Initialize_target_time(void);
Back to the top of Sub_system
time_t Calculate_iteration_step(int num);
time_t Calculate_iteration_step(int num);
Back to the top of Sub_system
Boolean Work(void);
Boolean Work(void);
Back to the top of Sub_system
Boolean Init(char* o_name, int o_num, int num_of_objs , int num_of_itr , char* p_line );
Boolean Init(char* o_name, int o_num, int num_of_objs = 0, int num_of_itr = 0, char* p_line = NULL);
Back to the top of Sub_system
Boolean Init(char* o_name, int o_num, int num_of_objs , char* p_line );
Boolean Init(char* o_name, int o_num, int num_of_objs = 0, char* p_line = NULL);
Back to the top of Sub_system
Sub_system(char* o_name, int o_num, int num_of_objs , int num_of_itr , char* p_line );
Sub_system(char* o_name, int o_num, int num_of_objs = 0, int num_of_itr = 0, char* p_line = NULL);
Back to the top of Sub_system
Sub_system(char* o_name, int o_num, int num_of_objs , char* p_line );
・class_name : "Sub_system"
・object_name : o_name
・object_number : o_num
・owner : NULL
・object_list : NULL
・receive_port_array : NULL
・number_of_receive_ports : -1
・send_port_array : NULL
・number_of_send_ports : -1
・element_array : NULL
・number_of_elements : -1
・data_string : NULL
・current_time : 0
・time_step : -1
・componemt_array : NULL
・number_of_components : -1
Sub_system(char* o_name, int o_num, int num_of_objs = 0, char* p_line = NULL);
Back to the top of Sub_system
Sub_system(char* o_name, int o_num, char* p_line);
Sub_system(char* o_name, int o_num, char* p_line);
Back to the top of Sub_system
その他のメンバに対する処理は, 引数つきコンストラクタと同じです.
この場合, Sub_system::Init を用いてメンバを初期化して下さい.
Sub_system(void);
・object_name : NULL
・object_number : -1
Sub_system(void);
Back to the top of Sub_system
~Sub_system(void);
~Sub_system(void);
Back to the top of Sub_system
Back to the top of Sub_system
Back to the top of Sub_system
Back to the top of Sub_system
Report problems to jkotula@stratasys.com