|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑 8 f2 D/ b! p/ F0 n, U
: \) j9 n, G9 D9 Q2 yFlexsim可以通过isclasstype函数判断实体类型。, ^3 ~- `, ?3 A. x0 G3 p0 d
isclasstype (obj object, num/str classtype)
! L2 c" B* {3 I$ |" |. n
6 k# {; E7 _# @, t/ s6 fCompares the object to classtype, returns 1 for yes, 0 for no
3 P3 ^/ M8 H4 D1 [" H2 v aDescription
; a2 l! R1 b [0 DReturns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:
) n: t5 c/ H5 i5 sCLASSTYPE_FLEXSIMOBJECT
3 X! p, v6 G7 m/ S/ _9 U9 WCLASSTYPE_FIXEDRESOURCE
1 \" R+ V" [& d8 T# E1 S5 g' x. sCLASSTYPE_TASKEXECUTER
- g, O' h) |4 {: xCLASSTYPE_NETWORKNODE
) ^5 }/ H4 G+ Zetc.
8 J# F. b$ r: H8 d1 r
5 C' r5 i4 a2 s7 H! y8 Z$ aExample
% D$ O% i; Z' }5 [- E2 }isclasstype(current, CLASSTYPE_DISPATCHER);0 p% q/ I. ~( @2 G
8 [6 V, a0 j, r, q) Z5 f0 `. Y$ D$ C6 r" p
4 R1 ?( {; ~8 Y, W% WFlexism有以下实体类型:
0 ^/ [+ i2 r' v* E L3 Q/ p- isclasstype(current,CLASSTYPE_CONVEYOR);
% ]9 B7 E# n: Z K' m" v$ r - isclasstype(current,CLASSTYPE_DISPATCHER);
" a1 s6 Q1 G5 m! } - isclasstype(current,CLASSTYPE_FIXEDRESOURCE);/ T" Q! f$ x |* n. O1 }3 f
- isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);/ O$ _2 J3 A, S
- isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);/ H. T1 M1 y* A, m4 t
- isclasstype(current,CLASSTYPE_FLUIDOBJECT);
# @- ^$ H/ ?5 b- b7 s0 N% @) j - isclasstype(current,CLASSTYPE_FLUIDOBJECT2);
+ c1 M" g+ ]. R - isclasstype(current,CLASSTYPE_LINECONTROLLER);- r/ c; w! U# Y! ?
- isclasstype(current,CLASSTYPE_MERGESORT);; [/ D+ ]: M; c
- isclasstype(current,CLASSTYPE_MTBFMTTR); _. T/ d' E6 Y) E/ G
- isclasstype(current,CLASSTYPE_NAVIGATOR);
. `: W& A& @: b/ R( `9 g - isclasstype(current,CLASSTYPE_NETWORKNODE);8 F; L) Y6 J% A( E9 ]0 G
- isclasstype(current,CLASSTYPE_ODT);. n8 U$ i- z) z9 O5 A
- isclasstype(current,CLASSTYPE_OWNERDRAWN);/ d# L" L, u/ N9 N
- isclasstype(current,CLASSTYPE_PROCESSOR);/ o- V3 ]2 m) d" f
- isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);, j; P: x4 l( p! O2 W4 X$ @! w
- isclasstype(current,CLASSTYPE_TASKEXECUTER);
5 S% h3 \3 I- T; t - isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);
# y$ Z1 F7 l' ^4 G } - isclasstype(current,CLASSTYPE_VISUALTOOL);
. M2 P) L% [2 `/ [ - isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码
' R. Z& n6 W( x" v8 _2 ^5 c8 ?6 e1 ^9 C' _& q! D) c% C9 U( y
isclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者
1 {9 D6 B+ X. p0 m, i8 z: g
$ Q0 |# H+ }1 \/ B3 g0 k4 Y在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。( ^8 u# M/ i3 I4 N& y! K0 V6 D
Flexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。
" N3 g3 v C2 `# U3 C$ q% N+ Z
0 j5 f! V7 k8 x# J' q
8 q! q2 i* Y5 J
4 o0 i, E+ b( @& u! n; P |
|