|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑
& X# b3 ^% V* i
. U8 J/ z( I8 A( `Flexsim可以通过isclasstype函数判断实体类型。2 i& [* v' G. q3 M" o5 D
isclasstype (obj object, num/str classtype), ~. `) S9 p& c( ?
& n5 p2 Z( M6 M8 V) L0 X
Compares the object to classtype, returns 1 for yes, 0 for no, M: A# W( ~9 f
Description
' y2 Y0 d" v A# F8 H% P% WReturns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:7 J1 i& Y$ D1 ]# z* B
CLASSTYPE_FLEXSIMOBJECT" ?+ J$ a) h9 i, P" Y0 \
CLASSTYPE_FIXEDRESOURCE
( o9 o. H4 s L) ICLASSTYPE_TASKEXECUTER: J1 F( E2 i# ^+ {8 q y1 B) x# e% z& B
CLASSTYPE_NETWORKNODE7 R1 p) F4 p( G' d- r, K
etc.- H7 z: w' i. Y4 E, n3 G) T5 [
. T3 I! ?, c4 w) _& I% L1 e6 y$ D
Example
* [5 N9 l2 z g0 Pisclasstype(current, CLASSTYPE_DISPATCHER);" l, e" \$ O8 p0 p
( |% T) h/ J* }* y6 f2 z
, N! o9 [- G$ b1 _+ {' S
8 Y1 s6 ]+ L: d/ T, cFlexism有以下实体类型:" z% i A8 B3 K
- isclasstype(current,CLASSTYPE_CONVEYOR);
/ P) g; `+ T- H& G# t5 ? - isclasstype(current,CLASSTYPE_DISPATCHER);
/ M6 S2 Q4 I4 ^; v5 n# b - isclasstype(current,CLASSTYPE_FIXEDRESOURCE);
* r1 F1 P& S; r0 }4 e) w# n; k - isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);
/ X4 E5 h) X2 u4 Y - isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);0 a9 H" A4 ?( f. k$ n& E1 x
- isclasstype(current,CLASSTYPE_FLUIDOBJECT);
$ {# i" @4 M& [& K' C# {4 i5 S4 ]% C - isclasstype(current,CLASSTYPE_FLUIDOBJECT2);. f# I9 Y# n( \2 i# E% C
- isclasstype(current,CLASSTYPE_LINECONTROLLER);6 }# f8 A( G2 `! R9 s
- isclasstype(current,CLASSTYPE_MERGESORT);0 _1 J& L2 ^ p% ]" r2 P" P
- isclasstype(current,CLASSTYPE_MTBFMTTR);$ m- r, M$ |% W+ q( }
- isclasstype(current,CLASSTYPE_NAVIGATOR);
7 v3 T9 w$ A8 j4 N - isclasstype(current,CLASSTYPE_NETWORKNODE);7 b# x+ U6 F# d7 {4 t
- isclasstype(current,CLASSTYPE_ODT);
# y: N& `$ z6 P! R" Z2 O - isclasstype(current,CLASSTYPE_OWNERDRAWN);
8 X& P2 @$ i9 K. _ - isclasstype(current,CLASSTYPE_PROCESSOR);" v9 }& J1 C& s. c4 n" M
- isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);9 X4 U, A; [. f& u% v8 @$ Y1 x3 X
- isclasstype(current,CLASSTYPE_TASKEXECUTER);
* I b9 C, g8 p, _ - isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);
6 y; R: ? m) v: i9 I) `4 M - isclasstype(current,CLASSTYPE_VISUALTOOL);
$ r! N$ P2 Q! f$ X0 P' M3 {5 F - isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码
( q6 t% X f* w6 A! N8 i4 S1 w& I( z0 l: B, X, E" C
isclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者3 i5 N( E7 w0 E5 O* z
2 r$ m# t1 _' v5 G
在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。! I9 k2 V3 O8 l Z! ~2 Q# c
Flexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。
4 \& z& l! R5 P. i) i+ \& Q: j2 n0 ~9 w' ?( n
6 e8 h- b, z: D, J, ^. K
) k9 ?& L# N& ? |
|