|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑 ' f4 X0 V8 b2 v. d+ P# T' R: j
! U1 J9 e) ]8 v) \
Flexsim可以通过isclasstype函数判断实体类型。% J N A5 a* c
isclasstype (obj object, num/str classtype)7 }6 h' |9 V1 b$ V W5 {
* k! M1 @: x, r& B( N! [
Compares the object to classtype, returns 1 for yes, 0 for no" l0 n0 y: ^2 X/ P; X( h: n
Description
& J4 [0 @0 O& d- C1 UReturns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:
7 p0 C; G" {0 u# a% O1 w4 Z RCLASSTYPE_FLEXSIMOBJECT
* A: g3 O% Q9 }+ c/ ACLASSTYPE_FIXEDRESOURCE4 I1 D7 ?1 ?5 r; {$ ]6 p- K
CLASSTYPE_TASKEXECUTER
! b0 v2 z& O4 y5 ]+ R# pCLASSTYPE_NETWORKNODE5 P+ [! J7 W) G& _3 h
etc.
1 V. } Q6 `5 u: V* E6 j$ |2 A' o& {' g
Example) ~" I7 F- r- C
isclasstype(current, CLASSTYPE_DISPATCHER);/ @+ k& ] ?$ E. e7 u d0 C+ V
& s+ c# U( g6 \/ Z' Y
/ {% P7 c( a/ X9 x3 c2 B+ R
* [6 }5 N7 H" T3 B6 kFlexism有以下实体类型:
1 Y, z' b, ^, W- v3 B& L3 X# F$ y: P- isclasstype(current,CLASSTYPE_CONVEYOR);
8 ~5 F- J/ k5 `; _ - isclasstype(current,CLASSTYPE_DISPATCHER);
, q! ~( l; j. ]+ q+ @- z - isclasstype(current,CLASSTYPE_FIXEDRESOURCE);
1 Y: J+ t, O2 a4 F4 @! ]0 Q: t2 w - isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER); J! ^1 h5 W/ W0 S9 t
- isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);, H0 [: m) y% I
- isclasstype(current,CLASSTYPE_FLUIDOBJECT);
7 a$ H4 a2 g9 P) E4 V - isclasstype(current,CLASSTYPE_FLUIDOBJECT2);
2 |, f$ h: A5 I - isclasstype(current,CLASSTYPE_LINECONTROLLER);3 D1 p6 z- P3 V* ?' @2 Q/ n6 u
- isclasstype(current,CLASSTYPE_MERGESORT);
4 G" `% ~; O1 _. m5 T; E4 b$ q - isclasstype(current,CLASSTYPE_MTBFMTTR);/ a/ i3 |. Y& b! n5 _) e
- isclasstype(current,CLASSTYPE_NAVIGATOR);
8 O# U' S! G8 t% Z - isclasstype(current,CLASSTYPE_NETWORKNODE);, r0 D* A2 A6 F3 Y
- isclasstype(current,CLASSTYPE_ODT);; Z! u2 {8 }5 ^% {
- isclasstype(current,CLASSTYPE_OWNERDRAWN);
. U) N B- Q3 w) F" L2 O T - isclasstype(current,CLASSTYPE_PROCESSOR);
2 O. w6 z/ w) Z2 h' V - isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);8 y6 P- H$ c _4 d) I
- isclasstype(current,CLASSTYPE_TASKEXECUTER);
0 x! u. X# W3 Q$ r! @' D - isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);
8 v6 Q. T1 C# L8 p3 c! \$ b - isclasstype(current,CLASSTYPE_VISUALTOOL);
g: X+ X' d, f& C - isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码
- w/ u) N0 u$ Y, Q! \! E
! t/ Y# ~' n: L7 Z- `isclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者
9 ]7 ~! B2 N" S" U8 ?3 _4 u: t$ I% ^2 F0 m5 H" A
在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。
) N, [* Z* b7 AFlexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。
5 T6 F- J6 R- X7 _) Y# w
2 N6 X: A# A& G) T2 H/ [& ]. r$ q' q* }7 R& i
6 h! G! g5 v: f
|
|