|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑 4 O5 |' L; L1 N* l
. P, P) x3 P, o* s3 X7 n
Flexsim可以通过isclasstype函数判断实体类型。( |* m$ V, r- [4 \4 l
isclasstype (obj object, num/str classtype)5 i1 O! _- D1 ^: f1 `0 L& F
( ?, z( ]2 C* y+ L1 u- H- W, zCompares the object to classtype, returns 1 for yes, 0 for no
9 D( J- s4 g# m$ ODescription' y& [% u* R+ ~/ [
Returns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:
5 D* ~8 B6 S) p, ]' i: CCLASSTYPE_FLEXSIMOBJECT
3 }0 N4 t" }( z8 v2 w: |CLASSTYPE_FIXEDRESOURCE7 z9 t1 F; M( c- B
CLASSTYPE_TASKEXECUTER) b- K( |" |, k5 e1 w q" Y
CLASSTYPE_NETWORKNODE
$ h3 f) ], a8 u) h8 Setc.
$ Z3 ]& N% A* d8 u# n/ g" Z& y: d2 b9 V$ h3 B
Example O6 s8 ^1 C$ x, s
isclasstype(current, CLASSTYPE_DISPATCHER);7 ?5 P$ |6 m* |2 g% v. U
. K- U7 D& `- V3 V, k! y; V8 d. L0 s( ~4 U/ A% c
, n3 }! |: P" V3 `
Flexism有以下实体类型:9 M) D! S7 z5 x+ X
- isclasstype(current,CLASSTYPE_CONVEYOR);
& f7 G$ y: P. V - isclasstype(current,CLASSTYPE_DISPATCHER);
5 |8 ^& v# }; _: A - isclasstype(current,CLASSTYPE_FIXEDRESOURCE);% A5 M$ x" Z; v0 _/ `: C
- isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);% D4 l! ^ ^/ W: W
- isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);' z( O+ v$ K$ h& n
- isclasstype(current,CLASSTYPE_FLUIDOBJECT);
2 \, y5 A) g4 z) H* T# \0 Z: q; Z - isclasstype(current,CLASSTYPE_FLUIDOBJECT2); n/ P% `- _" {% U3 W
- isclasstype(current,CLASSTYPE_LINECONTROLLER);
4 N- N, I/ h& S& J5 e: U - isclasstype(current,CLASSTYPE_MERGESORT);! R( P* Q+ u) s( W9 G% [+ f
- isclasstype(current,CLASSTYPE_MTBFMTTR);
S# v* \- T' a c* }& Y - isclasstype(current,CLASSTYPE_NAVIGATOR);
4 c/ M: F3 Q8 y* I3 ]( Z+ Y - isclasstype(current,CLASSTYPE_NETWORKNODE);9 G+ r8 f6 p! Z" ^6 {$ Z! l
- isclasstype(current,CLASSTYPE_ODT);
7 \! M- o t* @2 l7 w$ ]: U' ^7 q - isclasstype(current,CLASSTYPE_OWNERDRAWN);9 v! C1 z) b/ Y
- isclasstype(current,CLASSTYPE_PROCESSOR);2 F0 _) `" z5 k7 a0 B( P; m
- isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);% v( q+ H8 z9 D+ v. H6 n5 @
- isclasstype(current,CLASSTYPE_TASKEXECUTER);
! L" S, d( _% y1 r- ]5 H - isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);0 n+ o" K! z2 a9 D
- isclasstype(current,CLASSTYPE_VISUALTOOL);8 ]# S% H& L, x: O5 N& B/ k" A+ O
- isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码 6 B7 R' Y7 s3 f6 Z+ b
( U1 N% ?0 S/ z8 e* B8 disclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者
* m. b% Y" [& l: }* M1 q8 I" n
在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。% \% T6 z- F6 h8 m' m. A. o. K( Z
Flexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。0 c1 {- k% @% f( Q' ]; ~
! P( T- p1 Z S" W* r9 w4 K7 D
+ } {0 f( e- S9 s" U2 j
0 I1 x. t& I4 { |
|