|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑
& q- l, f. s5 R6 I
9 w* \2 S; t& n5 v! G* a$ ?5 d2 K! FFlexsim可以通过isclasstype函数判断实体类型。
5 h7 ]" Z8 P# z/ qisclasstype (obj object, num/str classtype)
7 `& ]- v5 e; _1 t( [
s+ J) x' F/ @9 {' @Compares the object to classtype, returns 1 for yes, 0 for no% Y) L( Q8 V2 x$ @9 r" F: H `
Description
" v8 R2 `7 \# w2 f. t! P1 l. JReturns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:! r4 I, ~! H) j+ f: O7 }
CLASSTYPE_FLEXSIMOBJECT
6 H: n8 S' ~+ ECLASSTYPE_FIXEDRESOURCE
8 r- a' s o4 @, i& OCLASSTYPE_TASKEXECUTER
' s) d! O8 i% sCLASSTYPE_NETWORKNODE- P2 S1 @2 a3 x. J
etc.
+ L7 e& e% l! Q! E0 b8 U! X0 N+ o2 s* _% L
Example
+ \1 P: ] P k% @isclasstype(current, CLASSTYPE_DISPATCHER);
j* L$ V e: r( X5 ^9 I; M) j1 Y0 K" o
+ |3 r8 F7 f& g3 [1 f! D- |
: q# s: q. t3 u Q
Flexism有以下实体类型:3 H/ D/ q/ [% ]( s! T. n( S
- isclasstype(current,CLASSTYPE_CONVEYOR);6 h: k7 z( A8 a
- isclasstype(current,CLASSTYPE_DISPATCHER);, j; y& j3 i4 c- r
- isclasstype(current,CLASSTYPE_FIXEDRESOURCE);
7 v3 r1 V% F& u8 q9 s - isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);: E" ^* A) N* t5 E5 t- Z8 B
- isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);$ o! q- u5 A5 H$ G' l: D& |
- isclasstype(current,CLASSTYPE_FLUIDOBJECT);
. K& d) b0 F1 |( @8 D8 m3 I - isclasstype(current,CLASSTYPE_FLUIDOBJECT2);/ v6 n! Z! p3 u$ a$ {* P% d
- isclasstype(current,CLASSTYPE_LINECONTROLLER);
% ?) I2 i; N2 d; _ - isclasstype(current,CLASSTYPE_MERGESORT);# u3 b8 d$ w$ t& i
- isclasstype(current,CLASSTYPE_MTBFMTTR);9 p1 I: `2 E7 ~. ?
- isclasstype(current,CLASSTYPE_NAVIGATOR);& A" b C* y: ?
- isclasstype(current,CLASSTYPE_NETWORKNODE);
9 `; }9 ]9 d" t: D" J; g - isclasstype(current,CLASSTYPE_ODT);. F1 T `, o3 E+ {& m
- isclasstype(current,CLASSTYPE_OWNERDRAWN);' V6 D, ]" b/ H. W: {2 s D
- isclasstype(current,CLASSTYPE_PROCESSOR);/ |* I6 C2 s9 e
- isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);- ?6 z! Y( g q( ]$ K
- isclasstype(current,CLASSTYPE_TASKEXECUTER);
" B& l& r7 _9 R i1 R o - isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);
n& j |4 C# y2 h. x. s0 l - isclasstype(current,CLASSTYPE_VISUALTOOL);! ~& }- J" ?( N9 n9 U+ p
- isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码
" F5 |0 p) @& I8 Y2 P- }) {; \- y0 U' F$ L3 M- I _
isclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者$ h2 a, S$ p1 U1 |
1 s; g5 u1 v d0 y9 |" J) N
在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。. l8 y) g; y+ ?& c/ L& g: B X
Flexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。
* Q+ g4 k' w8 S! S! _3 U5 D$ p, D [
, Z0 L# g c6 M9 ^2 C) @
0 b+ U6 a8 N U& W% V) L% \- }% i |
|