|
|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑
0 O9 o" W V" l, S o' m, L$ f d( }% }/ `6 c; P$ L; ]
Flexsim可以通过isclasstype函数判断实体类型。+ r" _7 U! b5 X- ^
isclasstype (obj object, num/str classtype)
" M6 k8 k1 `0 U& n+ j9 C
7 Z( [& {2 H9 N2 U/ h/ FCompares the object to classtype, returns 1 for yes, 0 for no
. n$ R! i6 \5 a3 [: L& NDescription7 B+ ~8 Y2 H- F, w
Returns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:
; l6 r( I( @0 q8 s) UCLASSTYPE_FLEXSIMOBJECT2 i1 x9 c! u, ^+ c& k7 \( X
CLASSTYPE_FIXEDRESOURCE
. E s2 \3 Y$ P+ w/ WCLASSTYPE_TASKEXECUTER
* `; a6 Z2 q( \2 Y: @9 M$ hCLASSTYPE_NETWORKNODE; o: n0 k q5 Z
etc. s5 ?4 s0 Q, u* P5 O# c
* p# q! W1 {8 n! a/ {Example2 L/ \( N* H" S) |1 v7 `
isclasstype(current, CLASSTYPE_DISPATCHER);8 x" w2 f& x8 k$ m; f9 |# W
3 W! a" |& |- Y6 ?6 K8 T0 K- P" `
/ l: {' @$ X/ } r5 A9 Z' C% t* F( V/ _' Z3 x; n h. o* G, e
Flexism有以下实体类型:
. H: I4 N+ p J5 F; |. Y! W- isclasstype(current,CLASSTYPE_CONVEYOR);
2 S2 I% x# f, F - isclasstype(current,CLASSTYPE_DISPATCHER);
X# ?) `$ P7 s- k m* [ - isclasstype(current,CLASSTYPE_FIXEDRESOURCE);
$ H1 v; J; Z) h$ s2 D) W1 r6 ^5 I - isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);: ^9 U6 R6 p4 A5 w; \) F- W0 W6 Y. q
- isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);
9 N, v1 d: J& B& v, |- H - isclasstype(current,CLASSTYPE_FLUIDOBJECT);% b, p) s+ X' w- k( `
- isclasstype(current,CLASSTYPE_FLUIDOBJECT2);) w6 Q8 r' u7 v
- isclasstype(current,CLASSTYPE_LINECONTROLLER);7 i6 ~, k! Y& B& m
- isclasstype(current,CLASSTYPE_MERGESORT);" d$ E G9 l$ a
- isclasstype(current,CLASSTYPE_MTBFMTTR);
* n8 T0 U0 Y1 H1 b9 Y1 E( m - isclasstype(current,CLASSTYPE_NAVIGATOR);& z1 F' ~+ h) v! y. P2 }
- isclasstype(current,CLASSTYPE_NETWORKNODE);
& ~0 [( f* f2 m6 p5 g& X; w2 Q - isclasstype(current,CLASSTYPE_ODT);3 ^$ e. @6 A# O7 [- |
- isclasstype(current,CLASSTYPE_OWNERDRAWN);, j. _" V6 A" v5 s4 w
- isclasstype(current,CLASSTYPE_PROCESSOR);" I: j1 c6 e1 v) t
- isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);4 k" J1 Y) x* w& V
- isclasstype(current,CLASSTYPE_TASKEXECUTER);3 ? ~6 ?2 W& E1 m
- isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);
+ X, v1 N5 ?8 L8 {! d - isclasstype(current,CLASSTYPE_VISUALTOOL);
2 S' }8 W: C" Y+ N - isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码 $ ]/ O) D1 z4 G
8 o" j/ N7 O4 f' Lisclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者
0 \# X9 `- W; |
0 ~/ V4 o/ [$ Z) L在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。
, U) X9 x U# r4 u3 [: qFlexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。8 X* e6 t5 \+ u; G7 E
- O) q6 @. C2 c6 i9 s
; t: x+ }0 D* ?$ ~8 f* T2 [1 J2 h$ F* b& _+ q- X: Q+ j6 V5 V
|
|