|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑
* Q9 c. O4 S" s# J% w( K! H5 ~- [% b3 I/ v7 O3 g0 N' c
Flexsim可以通过isclasstype函数判断实体类型。
+ u1 I. q H. ?) o0 Eisclasstype (obj object, num/str classtype)
- S- d" j# R6 M* X
^0 r- B g7 DCompares the object to classtype, returns 1 for yes, 0 for no/ X% D, k$ |* J* ~! ~/ s0 k
Description1 |" }7 Y/ _6 N
Returns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:1 F! J# B' c8 a5 @# ?4 v
CLASSTYPE_FLEXSIMOBJECT2 |( x' C% A8 C
CLASSTYPE_FIXEDRESOURCE
5 Y, f; T0 t! H* b, W8 ^CLASSTYPE_TASKEXECUTER
5 \; j2 M/ V. G0 H; ~( O/ A% hCLASSTYPE_NETWORKNODE
% W$ c% O4 p# x2 A2 c+ T$ u- R& Cetc.
/ G. S) ^& h1 k) G9 q; V0 [! B
/ i( U9 Z! u* z9 kExample5 H! i/ D1 C2 W- ^4 u' x8 ?* M1 v
isclasstype(current, CLASSTYPE_DISPATCHER);: S! @' u: X. |$ H8 O
' O( R8 G' }* }7 \
* Z/ k2 }& q; ~; T6 J
: B: Y4 s2 ?8 i2 a& @5 k
Flexism有以下实体类型:7 W+ s1 N z2 D8 w# r
- isclasstype(current,CLASSTYPE_CONVEYOR);
k& [! w- w# d( L( L4 V* j - isclasstype(current,CLASSTYPE_DISPATCHER);5 Z/ ^& u& b% S2 o O2 U* a
- isclasstype(current,CLASSTYPE_FIXEDRESOURCE); [# w) Z2 U* R/ w0 M) |
- isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);
; l* m: `6 E4 L3 a h& e; l - isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);
5 O$ s* x4 C3 H - isclasstype(current,CLASSTYPE_FLUIDOBJECT);' _4 }0 n i: @. t
- isclasstype(current,CLASSTYPE_FLUIDOBJECT2);
$ ]6 s3 O* N3 Y - isclasstype(current,CLASSTYPE_LINECONTROLLER);
: \( ]/ C( n0 ? - isclasstype(current,CLASSTYPE_MERGESORT);/ ^4 g8 j1 D/ D* |6 N+ ]" p
- isclasstype(current,CLASSTYPE_MTBFMTTR);
# W# ^; b U9 q! L, a1 | - isclasstype(current,CLASSTYPE_NAVIGATOR);
9 G* T3 K' q, c% |4 \ - isclasstype(current,CLASSTYPE_NETWORKNODE);& r$ t/ T) b& t8 t$ S
- isclasstype(current,CLASSTYPE_ODT);
7 `. Z+ @4 L' w4 G6 L- {* W - isclasstype(current,CLASSTYPE_OWNERDRAWN); y$ U4 m. C Y. g
- isclasstype(current,CLASSTYPE_PROCESSOR);" t2 U! i# \2 v* [! d' P) A# e
- isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);) R$ [) z7 u- h2 `' A2 \
- isclasstype(current,CLASSTYPE_TASKEXECUTER);
3 H2 z' F! h, |. Q3 L& h: ` - isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);' s: N2 P6 n4 T1 c7 h
- isclasstype(current,CLASSTYPE_VISUALTOOL);
7 o) C3 j! M! M( r+ q! n' c - isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码
( V0 W9 O4 n5 M+ Q1 ^ [. i, k7 h$ b+ l) ~- S0 U
isclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者0 a, c. h7 S4 M' u
/ e" R1 \( M1 S# B) G在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。
8 |2 g7 O7 b: A) z4 X3 c5 l% QFlexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。
2 a3 c$ u& F7 m7 K, z4 D# A: L% n. A5 u& t, [
2 G9 j' U& f6 f: \( O4 F% b, c0 c- C1 r* w# m! E0 T* a
|
|