|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑
7 @0 Q- h) E+ g. d
% e% i! h+ r5 g6 H; ~Flexsim可以通过isclasstype函数判断实体类型。8 [7 E. E) o: L8 V
isclasstype (obj object, num/str classtype)
8 _2 R$ i; B8 p: x. Y! U6 t8 }7 H- E" h7 J- `
Compares the object to classtype, returns 1 for yes, 0 for no9 E" V/ ?3 f; R9 L
Description
j* u8 S, n8 s1 H* mReturns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:
, [5 o q- O8 |6 t0 z5 N# WCLASSTYPE_FLEXSIMOBJECT. o) ^) x' F! _ ^ K' \8 X
CLASSTYPE_FIXEDRESOURCE' R) \ G* g/ {8 ~5 ]
CLASSTYPE_TASKEXECUTER
g$ S8 j4 n+ }9 [1 P0 t( wCLASSTYPE_NETWORKNODE: d- |( @0 o$ a o" i* w( O
etc., D. _' |7 d7 U
/ p* ^0 c3 W1 Y( t
Example3 F7 N4 [+ u3 M; _6 A
isclasstype(current, CLASSTYPE_DISPATCHER);) L! r' v7 D. U# I* _# m
d' l( W" _7 x, R1 n+ B( D; J: R3 O2 E* i& C- X- {' q& K f: ~
: T( y' L( f. J- ^2 ?Flexism有以下实体类型:7 t$ H9 k* O" F- [* s
- isclasstype(current,CLASSTYPE_CONVEYOR);9 {8 X; I0 b6 i* X, G9 U2 v) D
- isclasstype(current,CLASSTYPE_DISPATCHER);" u' f; ^9 Y7 e# i8 c; `! E
- isclasstype(current,CLASSTYPE_FIXEDRESOURCE);
c$ F( T0 Y+ d5 r# V$ L - isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);
8 r# H7 {$ Y7 c3 L - isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);
& t* m/ J4 s' z - isclasstype(current,CLASSTYPE_FLUIDOBJECT);- a+ b J* U3 b6 C5 ?
- isclasstype(current,CLASSTYPE_FLUIDOBJECT2);: M( W) {0 }1 L3 B6 l
- isclasstype(current,CLASSTYPE_LINECONTROLLER);1 b1 [2 W$ @) H: A% T
- isclasstype(current,CLASSTYPE_MERGESORT);; `3 C T4 J7 r; K
- isclasstype(current,CLASSTYPE_MTBFMTTR);: }) s: U! ~! x+ y8 i' u
- isclasstype(current,CLASSTYPE_NAVIGATOR);! W6 K2 k9 Q' o) {* d; l7 X9 z
- isclasstype(current,CLASSTYPE_NETWORKNODE);
' A X, i5 s& Z - isclasstype(current,CLASSTYPE_ODT);
t4 J# h, g& | - isclasstype(current,CLASSTYPE_OWNERDRAWN);- Z' [- Z) l W7 }9 y
- isclasstype(current,CLASSTYPE_PROCESSOR);( B3 _, E1 y0 h5 r5 \2 U
- isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);0 l* H3 ~$ ~- T% [# w8 } x7 `
- isclasstype(current,CLASSTYPE_TASKEXECUTER);: E9 C, }- b; a# r1 H
- isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);. X+ v" P" P9 K: a" Y4 s
- isclasstype(current,CLASSTYPE_VISUALTOOL);
4 ?' g" o7 j8 o; ]: Y A. V% V! M0 b - isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码
, Z. A; c8 v$ [% Y% P7 _. m
; F0 c. b' x, m3 z6 C1 g# O) ?isclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者) ?/ @5 x& g) R1 m
/ N" U! g" o6 }( N, |" ^
在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。
8 ~- P# P% f' c5 r) uFlexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。& ?4 X1 Z$ |2 V# U
8 D+ }) H2 r; q6 d' J9 x
: Z3 i3 v* }, O5 h0 ?2 l" p! M. R! ^2 `$ M/ a+ s* E
|
|