|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑
7 p9 d9 Q( k( \8 w1 s0 e) Q5 S& S# {9 f1 w( e1 ]! G/ `0 j$ f
Flexsim可以通过isclasstype函数判断实体类型。
) L0 V" r- f( D4 J; xisclasstype (obj object, num/str classtype)3 E0 W, s( ]5 f3 O9 ?
$ N1 p, p- S( |
Compares the object to classtype, returns 1 for yes, 0 for no: w% }& {7 ^; z% N$ h
Description- K; [& f# d" k K7 R* u
Returns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:5 H+ ] c8 C5 m+ S
CLASSTYPE_FLEXSIMOBJECT. e" } L8 ?; p' ]1 j4 B1 C
CLASSTYPE_FIXEDRESOURCE! B5 C* N' `7 l6 ]1 t/ g% @# N
CLASSTYPE_TASKEXECUTER0 h+ ~; j! j# u/ ]& |
CLASSTYPE_NETWORKNODE
! t9 h. w7 Q, Y; ^9 W7 Xetc.
$ L) G9 j- p* @3 v4 x( _9 L# Y
- U: B: ^% e5 D; }+ Q, HExample
0 U$ A+ ]5 ?9 [( z ]/ b# J3 _isclasstype(current, CLASSTYPE_DISPATCHER);
) j$ `/ W% }- C' f6 p4 O
; R1 Y; v7 g% e& l, b) G& U
9 L( {: v, f1 o: t X& V; x3 o, p; E5 A. `) x" O7 c
Flexism有以下实体类型:1 U$ O4 l/ B/ X1 I$ F' c, a' Y
- isclasstype(current,CLASSTYPE_CONVEYOR);3 k! [3 \$ o* w) Z, i
- isclasstype(current,CLASSTYPE_DISPATCHER);" u8 W! v. \) A, o2 s) s" R
- isclasstype(current,CLASSTYPE_FIXEDRESOURCE);- b! }* }+ u, x* O; |. Y. q0 b
- isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);; ?7 d( C( S. \! K, j! a* {
- isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);# k! p( P$ G, V2 r- `
- isclasstype(current,CLASSTYPE_FLUIDOBJECT);, S7 w u0 m9 k& @* q
- isclasstype(current,CLASSTYPE_FLUIDOBJECT2);7 H+ N& a' a0 U! K, y
- isclasstype(current,CLASSTYPE_LINECONTROLLER);
/ Y2 r3 i2 c" D - isclasstype(current,CLASSTYPE_MERGESORT);. c) b/ m8 a$ [: C0 \9 H) v
- isclasstype(current,CLASSTYPE_MTBFMTTR);5 p2 Y* x W1 z; |) k) n
- isclasstype(current,CLASSTYPE_NAVIGATOR);+ x! z& u) f7 g+ \7 J6 Y* E
- isclasstype(current,CLASSTYPE_NETWORKNODE);
* v7 R6 I+ m/ F# m5 v3 g - isclasstype(current,CLASSTYPE_ODT);
7 Q3 K; n0 O: T3 A. Y; R - isclasstype(current,CLASSTYPE_OWNERDRAWN);) O' {3 c" s) D2 G) E0 M
- isclasstype(current,CLASSTYPE_PROCESSOR);/ N7 D6 g2 O C0 k% i6 B
- isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);$ m4 i+ A! ~" Q! ~4 ]
- isclasstype(current,CLASSTYPE_TASKEXECUTER);
9 F/ @8 e9 J! e8 A - isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);9 u7 N3 H0 A) r- b. j
- isclasstype(current,CLASSTYPE_VISUALTOOL);; V' H! X* D: N; w
- isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码
& l t: x# y+ J1 Z7 X& @$ g5 p" V3 ]# K' P( k1 b: [
isclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者
; _& z! ?( g# c4 l4 ~; I9 S9 [$ t1 K4 X% e, O5 n
在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。
' l) f6 F2 G- H! M' V: {0 cFlexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。
0 a W9 a2 X0 X6 b; v1 ^" b( X
9 S$ h( Y6 X( f# z9 C2 A/ q" X3 A/ D% J
4 l+ F7 x; b. S5 b/ T) W1 P |
|