|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑
' O7 z8 a% F4 ?1 A: y6 o8 G5 w' U, |/ J" L
Flexsim可以通过isclasstype函数判断实体类型。1 B" A0 O+ o% P T) a0 J' o
isclasstype (obj object, num/str classtype)) p& l) O% N7 g) W" _+ A% u8 I
8 p, q2 i% F9 w5 |4 V) v2 \4 p. yCompares the object to classtype, returns 1 for yes, 0 for no# Z1 c2 r: Y0 e& C; }
Description" ~. O$ S6 C- b* `6 e; B Y- Z4 f
Returns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:
& {% `3 m* j4 y4 D9 [* yCLASSTYPE_FLEXSIMOBJECT
" O9 \9 S3 @+ Q ]' D& T7 ?, BCLASSTYPE_FIXEDRESOURCE
8 B' C# n1 F J( s" }CLASSTYPE_TASKEXECUTER% O+ }1 a& K" L7 y. w
CLASSTYPE_NETWORKNODE
, @- F0 N I. u \& R* Retc.
+ N2 f% _% k; Q& T/ M8 Y; ]8 T% t* N% W
Example
6 M6 l. y* [1 p( J' `% d8 Z. p8 visclasstype(current, CLASSTYPE_DISPATCHER);
( H8 d4 {! |& `) d) Q! m" k0 v7 d z
l2 {+ ]* x8 c% N% X
7 L }' ]9 o: a& t( h& RFlexism有以下实体类型:2 _! x0 t5 K/ x- s# T0 F
- isclasstype(current,CLASSTYPE_CONVEYOR);
6 A% B, s2 R0 ?) r4 y* O0 v' `7 N4 y - isclasstype(current,CLASSTYPE_DISPATCHER);
+ b0 ]; e" ]6 P - isclasstype(current,CLASSTYPE_FIXEDRESOURCE);$ f/ O' C L' c, _# P+ r+ M# [
- isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);
; f: D: y- I" x) ]+ K! o! S - isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);
: q9 f" J5 r/ c8 W2 D - isclasstype(current,CLASSTYPE_FLUIDOBJECT);$ w$ {+ s# `$ S* e" _6 B
- isclasstype(current,CLASSTYPE_FLUIDOBJECT2);3 h8 a2 @' c9 K* O$ F8 Y: H
- isclasstype(current,CLASSTYPE_LINECONTROLLER);
- H3 D: k% c, r4 j. G - isclasstype(current,CLASSTYPE_MERGESORT);9 s5 i5 A0 h. `3 O/ k6 g
- isclasstype(current,CLASSTYPE_MTBFMTTR);/ O$ b0 a0 f# T$ w* Y$ o ?* U
- isclasstype(current,CLASSTYPE_NAVIGATOR);+ F% o% V( H5 g6 w- d
- isclasstype(current,CLASSTYPE_NETWORKNODE);
- o: D+ H. o2 j/ O2 j - isclasstype(current,CLASSTYPE_ODT);
. W8 `4 ]+ s- e4 ] - isclasstype(current,CLASSTYPE_OWNERDRAWN);
8 q; S, S! _$ i! k; h$ H' Y2 U$ x - isclasstype(current,CLASSTYPE_PROCESSOR);
9 p& U" S) m4 e3 j' y9 b - isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);
8 H1 A% H; W& x& N, C- J - isclasstype(current,CLASSTYPE_TASKEXECUTER);
/ Q- @9 y2 i# M: ^+ E - isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);
( g: e/ o& L( }, w+ b, |' Y8 Y - isclasstype(current,CLASSTYPE_VISUALTOOL);
( O, M \9 E2 B. Q - isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码 8 p) [7 n. V. L& `6 {: d
/ c5 |' P5 k7 Tisclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者
: c5 d6 a4 C F/ Z. ^9 y, e0 m
4 R5 p7 h8 r7 }* i, [在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。
6 |& G1 v- Z0 s+ q b( {* w5 N, ZFlexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。
7 f1 V# Y2 Z# V! I) ]+ f" N9 T, k: E7 W
: V3 D* U8 W @
) t) |2 `! z6 q" F9 z
|
|