|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑 4 }- b8 g% q: [
, C3 l* @( z9 V0 K9 J8 d
Flexsim可以通过isclasstype函数判断实体类型。$ M3 s5 K/ W2 b3 |. o% [+ z% O( B
isclasstype (obj object, num/str classtype)
) _# G v r* ?9 K, E; e& o5 _2 a% x% \" _5 r
Compares the object to classtype, returns 1 for yes, 0 for no3 s. R& u2 H! v3 R
Description m [* o+ b) M5 F+ R! H
Returns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:* y+ v. g2 X, R, M2 H% x* `/ V( C
CLASSTYPE_FLEXSIMOBJECT ~9 D0 m+ T. n* L
CLASSTYPE_FIXEDRESOURCE
% r- h* H6 }, g; }6 l, y3 qCLASSTYPE_TASKEXECUTER
U* L6 f7 W* sCLASSTYPE_NETWORKNODE/ G/ S# ^" X g+ X' I8 {
etc.
2 b+ l# [- ]; U/ B& T F/ j; P! z- q
Example k9 ~8 B- w0 ?; D
isclasstype(current, CLASSTYPE_DISPATCHER);
7 P7 Z: D" W2 S6 C+ i$ q7 d! N4 S& {' [4 S0 K# j! T
$ D& f0 O- Y3 M% d
' k( }7 {& x! M4 TFlexism有以下实体类型:
: w, v. d( Z) J+ p4 M# F$ n9 ~- isclasstype(current,CLASSTYPE_CONVEYOR);
b& v! c2 p: c2 e& O - isclasstype(current,CLASSTYPE_DISPATCHER);# c3 b, a' S. r3 C* m
- isclasstype(current,CLASSTYPE_FIXEDRESOURCE);
" d( C9 Z% ~) F6 e4 J - isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);
1 f( L$ }+ H8 ? - isclasstype(current,CLASSTYPE_FLEXSIMOBJECT); D9 s' T2 @! A+ G
- isclasstype(current,CLASSTYPE_FLUIDOBJECT);2 G- a% v) k( Z% O& b" R9 g
- isclasstype(current,CLASSTYPE_FLUIDOBJECT2);
3 {! a0 M5 _) n+ | - isclasstype(current,CLASSTYPE_LINECONTROLLER);$ p4 P3 W" e5 S# q! A" f$ r
- isclasstype(current,CLASSTYPE_MERGESORT);% y, A: s, x& N, a
- isclasstype(current,CLASSTYPE_MTBFMTTR);/ o! X% E% a7 e) s! H
- isclasstype(current,CLASSTYPE_NAVIGATOR);
- p2 Z1 f$ X3 H" D, V- d+ x, C - isclasstype(current,CLASSTYPE_NETWORKNODE); S7 F* T: Y4 `
- isclasstype(current,CLASSTYPE_ODT);
o0 D0 Q) C" @3 N2 u2 a - isclasstype(current,CLASSTYPE_OWNERDRAWN);8 z3 q( a$ ]- x% x1 r1 t! {: O
- isclasstype(current,CLASSTYPE_PROCESSOR);. N7 z1 I) `2 x
- isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);! e( ^" D( i* s7 z. W$ a4 {
- isclasstype(current,CLASSTYPE_TASKEXECUTER);
$ i6 O7 l' N; l( U8 B - isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);
; g, V) M$ f9 A( G% H - isclasstype(current,CLASSTYPE_VISUALTOOL);5 `' o6 b5 O5 g, A0 y
- isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码 5 C( u* [$ Y3 U, l: M& X; m; k
. J0 I6 i! w- a' [# ^% iisclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者
* h# W, q! O1 l) `6 k
2 a9 W5 Q! K4 j- z0 ^在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。
! d! s- w; _1 T3 O+ iFlexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。
- O6 t8 @7 Y+ {, D2 e
8 A+ R! {) Y) Y) d. a* E: X1 x
' S$ r. c. U" J5 c* u
|
|