|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑 : Q$ A1 v" {" U, e# {, T8 D
+ ~9 P& {. `5 Q, n I) q' C( s6 Q1 e$ D
Flexsim可以通过isclasstype函数判断实体类型。
1 n' X/ w4 m* O7 b0 aisclasstype (obj object, num/str classtype)
6 w. m# b1 n" m1 K
% I$ l+ n7 Q/ f& @0 A* @$ I) tCompares the object to classtype, returns 1 for yes, 0 for no
3 I; Q2 {0 ]% @# K% V2 z3 QDescription: B, ^! B+ K! `4 r2 ~
Returns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:
0 ~- c+ }: `: jCLASSTYPE_FLEXSIMOBJECT, e2 }/ q8 @- O4 F! B. j
CLASSTYPE_FIXEDRESOURCE0 _6 m& |! m4 o [7 F
CLASSTYPE_TASKEXECUTER' G5 j3 o7 { ^3 V! a
CLASSTYPE_NETWORKNODE/ g7 C( O1 P2 p' W- q9 T
etc.2 S1 Z( n$ Z/ y" N8 |0 j
0 g0 F- k# O, BExample
, n( r6 \" O& `isclasstype(current, CLASSTYPE_DISPATCHER);$ a7 p# X: d- K, Z% y
' w) f9 m! J. }$ g* u# l0 g2 q% p+ d7 o- h7 K
1 }3 S+ i* G! [6 d
Flexism有以下实体类型:( R! R. T/ H$ y9 t7 v( K9 p; n
- isclasstype(current,CLASSTYPE_CONVEYOR);
. r' E& O/ P; u" z, I7 g! P - isclasstype(current,CLASSTYPE_DISPATCHER);
. X6 ?/ R4 {5 A - isclasstype(current,CLASSTYPE_FIXEDRESOURCE);' x2 T" T' w% A
- isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);
1 J$ K8 x @- y; T- m' ?* R - isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);
+ i, z2 U- d4 }5 s1 C7 ?3 p - isclasstype(current,CLASSTYPE_FLUIDOBJECT);
J' v- t4 G3 t - isclasstype(current,CLASSTYPE_FLUIDOBJECT2);/ F0 B" ~1 \% U5 t3 w
- isclasstype(current,CLASSTYPE_LINECONTROLLER);- \: c% D$ W2 J. p0 Q
- isclasstype(current,CLASSTYPE_MERGESORT);
1 l" [( s5 v4 z - isclasstype(current,CLASSTYPE_MTBFMTTR);
1 P$ i! E4 Z0 P! g: m3 B - isclasstype(current,CLASSTYPE_NAVIGATOR); n2 D1 A: b( J
- isclasstype(current,CLASSTYPE_NETWORKNODE);
1 x3 v1 i9 B- R4 T3 r% ] n% ? - isclasstype(current,CLASSTYPE_ODT);
4 n u" l+ X+ F - isclasstype(current,CLASSTYPE_OWNERDRAWN);
3 e" f' |9 Z) Y1 A# q, ` - isclasstype(current,CLASSTYPE_PROCESSOR);
3 A" v/ F, t2 P, A2 [* i5 E6 q7 U - isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);
5 z' ?6 p" Z* I o - isclasstype(current,CLASSTYPE_TASKEXECUTER);
" x& f* b g2 U' \ - isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);. a$ I4 p/ Z9 K5 R
- isclasstype(current,CLASSTYPE_VISUALTOOL);! y, t) G+ e8 \- d5 E3 s
- isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码
7 U) M) C% x' x! G1 ?
" c; U; g/ h/ R/ k5 z- [! \isclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者- l1 v8 t# p G R9 s) R. q
# G; r2 l* f5 Y, ^8 N在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。
8 f. a" H3 E- l% VFlexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。
4 l+ H( N2 b9 c1 K. F `+ ^7 o1 C/ R! o) a; @
; V8 L0 J) W- m6 t& v2 V
6 S$ i# a7 j, H( ^6 a |
|