|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑
* P% H1 K) K' U) Z% i9 r/ v, ]( ?4 U9 S5 ?3 I3 F
Flexsim可以通过isclasstype函数判断实体类型。
6 R4 y0 r! s0 g: N4 pisclasstype (obj object, num/str classtype)' J1 t1 d2 r$ o$ Q
# H1 Y$ w: G. }1 H4 sCompares the object to classtype, returns 1 for yes, 0 for no
3 s4 k- |3 X, e: i4 c4 `3 IDescription- ^5 z/ \3 x6 g j2 i' @7 {8 Y
Returns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:' ^# l2 B. S# |" D6 Y1 M
CLASSTYPE_FLEXSIMOBJECT
/ |( Y( y9 l2 {6 ]2 C0 WCLASSTYPE_FIXEDRESOURCE4 q" v" n. x8 R! L9 r0 k
CLASSTYPE_TASKEXECUTER% t" m' V" F% F: k
CLASSTYPE_NETWORKNODE1 R0 b' ]+ v- \$ p9 B9 m+ |
etc.+ p4 V h x* c9 K3 d! N, C- o5 @$ j
9 K6 G# J; b8 Y' X" A
Example
9 z/ K) r7 S% i+ h& Nisclasstype(current, CLASSTYPE_DISPATCHER);
& m$ z9 a/ H$ i( a
: Z' V0 x! ^7 q
* K8 c) [& ^ p% c/ t7 z) I
: `! M" i0 s% D5 r/ t BFlexism有以下实体类型:
# q5 n8 W, @3 v2 B, t- isclasstype(current,CLASSTYPE_CONVEYOR);
7 |0 u |! j7 K8 j5 U1 D; @ F - isclasstype(current,CLASSTYPE_DISPATCHER);0 B5 O3 P- }0 ^! F: \( C
- isclasstype(current,CLASSTYPE_FIXEDRESOURCE);: M+ S: w" S) K+ ]9 ^' d
- isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);* c" j$ `8 `$ Z' P j1 U- ^
- isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);# ]. x) ?: m7 G! x2 h$ r1 m
- isclasstype(current,CLASSTYPE_FLUIDOBJECT);
8 V) |) E0 {) R* `4 h3 `$ y - isclasstype(current,CLASSTYPE_FLUIDOBJECT2);5 N/ {1 F+ D' h
- isclasstype(current,CLASSTYPE_LINECONTROLLER);
' T8 `' S$ e" L( B - isclasstype(current,CLASSTYPE_MERGESORT);4 o5 J% x* E2 W( e9 i# J) D
- isclasstype(current,CLASSTYPE_MTBFMTTR);# \ U4 J) W4 q7 M, |& P
- isclasstype(current,CLASSTYPE_NAVIGATOR);0 L0 P' C1 I2 u+ t4 C4 }
- isclasstype(current,CLASSTYPE_NETWORKNODE);" |8 u# P: `& u) ]
- isclasstype(current,CLASSTYPE_ODT);! [ V7 h. X9 E: S0 Z
- isclasstype(current,CLASSTYPE_OWNERDRAWN);5 ~% O0 x. z0 C* n. c6 ?
- isclasstype(current,CLASSTYPE_PROCESSOR);" E& K1 d6 n% [% V
- isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);
( T9 U z: V2 b$ y" F; [" _- Y7 i - isclasstype(current,CLASSTYPE_TASKEXECUTER);
' Q, P8 A4 N# m - isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);. W% I( R, c0 X+ u
- isclasstype(current,CLASSTYPE_VISUALTOOL);
/ C* n3 _1 N7 G1 o2 y% s1 J( z - isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码
% E: {- L6 @+ v3 C) C& ^7 W! k$ w* \6 N0 E" p* r( ^
isclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者
7 T4 e3 s- ~. t# _/ j1 G! O% E# O- A+ R+ W3 q& O( S- B4 M
在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。) z/ U: f/ k; E
Flexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。* [+ Q3 r# E) T( g
3 K" L9 x. @. n0 ?& @! @8 z& [* p: ]( [$ r& f% T2 F# i, Y
/ F T2 D# Z6 N) @0 R2 X5 J
|
|