全球FlexSim系统仿真中文论坛

搜索
查看: 2050|回复: 1
打印 上一主题 下一主题

FlexSim新技术主题4_任务序列概念说明3

[复制链接]
跳转到指定楼层
1#
Clay666 发表于 2019-7-8 10:25:04 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
备注说明:
此部分文档截止到此就全部翻译完成,主要是在概念上解释了任务序列的相关含义,自FlexSim2017版本开始,软件厂家更倾向于使用PF模块来实现任务序列,而不是代码。
相较于代码实现,PF模块实现更加简单直观。
7 @8 {( O! o+ c* _7 R6 r7 I

: j" X  ]9 W% z( w6 K
1.    Coordinated Task Sequences
Coordinated task sequences are used for operations which requiresophisticated coordination between two or more task executers. These tasksequences implement concepts like allocation and de-allocation of taskexecuters, as well as synchronizing several operations being done in parallel.
协调任务序列用于需要两个或多个任务执行器之间的复杂协调的操作。 这些任务序列实现了诸如任务执行器的分配和解除分配之类的概念,以及同步并行完成的若干操作。
Commands
Coordinated task sequences are built anddispatched using a set of commands which are mutually exclusive from thedefault task sequence commands. The commands for coordinated task sequences areas follows.
使用一组与默认任务序列命令互斥的命令构建和分派协调任务序列。 协调任务序列的命令如下。
createcoordinatedtasksequence()
insertallocatetask()
insertdeallocatetask()
insertsynctask()
insertproxytask()
dispatchcoordinatedtasksequence()
createcoordinatedtasksequence
The createcoordinatedtasksequence commandtakes one parameter, namely a reference to an object. This object is designatedas the task coordinator who holds the task sequence, as well as coordinates thetasks. The task coordinator can also be one of the objects that is allocatedwithin the task sequence. It can be any dispatcher or task executer object.Note that selecting a task coordinator doesn't mean allocating that taskcoordinator. A task coordinator can be coordinating any number of coordinatedtask sequences at any one time. Also, unlike regular task sequences,coordinated task sequences are not queued up. The task coordinator will startexecuting the coordinated task sequence immediately when you dispatch it, nomatter how many other coordinated task sequences it is coordinating.
创建协同任务序列只包含一个参数,即对对象的引用。这个对象被指定为任务协调员来安排任务序列。它可以使任何一个任务分配器或者任务执行器对象。注意选择一个任务协调员并不一位置分配改任务协调员。一个任务协调员同时能协调任意数量的协同任务。同时,与常规的任务序列不同,协同任务不能进入任务池排队。无论协调多少其他协调任务序列,任务协调员在你分配给他任务时立即执行。
insertallocatetask
The insertallocatetask command takes fourparameters. The first is the task sequence. Second is the task executer ordispatcher to give an allocated task to. When the task coordinator gets to anallocate task, it will actually create a separate task sequence with anallocated task in it, and pass that task sequence to the specified taskexecuter or dispatcher. In the case that it is a dispatcher, meaning you wantto allocate any one of several task executers, then you can use the returnvalue of this command as a key to reference the specific one that getsallocated, since you don't know exactly which one it is at the time that youbuild the task sequence. The third and fourth parameters are the priority andpreempting values of the separate task sequence that will be created. The fifthparameter is optional, and specifies whether the task is blocking. By default(0), the task is blocking. If 1 is passed in, then the task will not beblocking.
insertallocatetask命令有四个参数。 第一个是任务序列。 其次是任务执行者或调度员给予分配的任务。 当任务协调器进入分配任务时,它实际上将创建一个单独的任务序列,其中包含已分配的任务,并将该任务序列传递给指定的任务执行者或任务分配器。如果它是一个调度程序,意味着您要分配多个任务执行程序中的任何一个,那么您可以使用此命令的返回值作为键来引用已分配的特定执行程序,因为您不完全确切知道在构建任务序列时它是哪一个。第三个和第四个参数是将要创建的单独任务序列的优先级和抢占值。第五个参数是可选的,指定任务是否阻塞。默认情况下(0),任务阻塞。如果传入1,则任务不会阻塞。
insertproxytask
The insertproxytask command is similar tothe inserttask command, with one parameter, the second, added. The secondparameter specifies which allocated object you want to do the task. As the taskcoordinator is the one actually executing the task sequence, once he gets to aproxy task, he will instruct the allocated object to do the task by proxy.Notice that for involved1 and involved2, you can either pass in a key or astraight reference to an object.
insertproxytask命令类似于inserttask命令,添加了一个参数,第二个参数。 第二个参数指定要执行任务的分配对象。 由于任务协调器是实际执行任务序列的任务协调器,一旦他到达代理任务,他将指示分配的对象通过代理执行任务。 请注意,对于involved1和involved2,您可以将键或直接引用传递给对象。
insertsynctask
The insertsync task halts execution of thetask sequence until a specified task, referenced by its key, is finished. Ittakes two parameters: the task sequence, and a key value of a given proxy task.It is important to note that proxy tasks which are specified for different taskexecuters, by default, will be done in parallel, unless a sync task is specified,whereas proxy tasks given to the same task executer will automatically be donein sequential order, without the need for a sync task.
insertsync任务停止执行任务序列,直到完成由其键引用的指定任务。 它需要两个参数:任务序列和给定代理任务的键值。 重要的是要注意,默认情况下,为不同的任务执行程序指定的代理任务将并行完成,除非指定了同步任务,而给予同一任务执行程序的代理任务将按顺序自动完成, 并不需要同步任务。

: [) V9 O. y( y7 z! q& E
& }/ R* @. p  l8 ]5 t9 B: g) x% J

' W0 Y: ~, A, z+ G0 e; s% g- r, L3 k$ a4 u6 x& y, u

" a; B: L& K& A/ Y& ^7 _7 {/ d
7 _( N) M6 x, k' x) `
2#
 楼主| Clay666 发表于 2019-7-8 10:25:20 | 只看该作者
insertdeallocatetask% A+ p: u/ X9 X! \
5 ^0 x1 f/ e  R, R- X1 X4 v; k
The insertdeallocatetask command de-allocates a specific task executer, referenced by its key. The first parameter references the coordinated task sequence. The second parameter is the allocation key for the resource you want to de-allocate. The third parameter is optional, and specifies whether the task is blocking. By default (0), the task is blocking. If 1 is passed in, then the task will not be blocking./ z0 [! f( o- J2 B
8 k+ D7 ~! M( }3 r, F# k3 I) M7 ]
The above code creates a coordinated task sequence that organizes the two task sequences, as shown in the diagram below.
9 r& @1 h( \, M. W: D$ k5 u" E5 _2 D' ?7 B
insertdeallocatetask命令取消分配由其键引用的特定任务执行器。 第一个参数引用协调的任务序列。 第二个参数是要取消分配的资源的分配键。 第三个参数是可选的,指定任务是否阻塞。 默认情况下(0),任务阻塞。 如果传入1,则任务不会阻塞。- w+ G+ w' |. P" a

: P1 y& I6 N, _# x# A9 p; F 8 p; u& c4 }9 n3 `6 B* \
) H& s( z) |) X
Coordinated Task Sequence实例6 E; H! V9 r7 z7 m6 H' R
7 b) ]  O, j1 d9 I( O, M

6 \( c: t' _. p& W% P( Z" \6 `' S, d  _6 H. ]

2 O1 Y5 e1 I* }  k) ^
+ u- Q) f9 v  A' v+ }treenode ts = createcoordinatedtasksequence(operatorteam);
+ \. P0 j" U( `9 U( B4 k( K& ?8 P5 B% \( G. m! P$ ~! i) v5 ~
int opkey = insertallocatetask(ts, operatorteam, 0, 0);. K5 D; Q/ N- t; s& P

* d) d: m: D0 n" O& p% b& _  |int forkliftkey = insertallocatetask(ts, forkliftteam, 0,0);
) X7 d& S. }; }: I9 o, o2 G
; F& ?9 J9 q0 a0 o. Q) B. wint traveltask = insertproxytask(ts, opkey, TASKTYPE_TRAVEL, forkliftkey, NULL);
  w: P" c  `0 j) W2 X
2 i. ?# m0 ^* P# a& h! tinsertsynctask(ts, traveltask);& A. c2 a' q8 ?7 y
6 b) j2 Y. M" u& H! F
insertproxytask(ts, forkliftkey, TASKTYPE_MOVEOBJECT, opkey, forkliftkey);
4 E2 ~2 K: T% _8 ?0 G* m
% R( @! @; ?5 s2 qinsertproxytask(ts, forkliftkey, TASKTYPE_TRAVEL, loadstation, NULL);( s' q& f: C% M& _+ {( D& J
7 F/ m# v9 Z# [5 N
insertproxytask(ts, forkliftkey, TASKTYPE_LOAD, item, loadstation);
0 @- j7 `; j) V$ t
; g# t( r( t2 f/ E/ ^) r% ginsertproxytask(ts, forkliftkey, TASKTYPE_TRAVEL, unloadstation, NULL);2 }0 U! ^2 |  N: K
+ X0 |2 B- h7 h; P- W
insertproxytask(ts, forkliftkey, TASKTYPE_UNLOAD, item, unloadstation);& t3 [# |8 {# ]+ ?1 o% Y
4 w0 H6 |! N5 T- q! a
insertproxytask(ts, forkliftkey, TASKTYPE_TRAVEL, forkliftteam, NULL);
6 _# ~8 T! n/ h+ }8 l0 f
, B  \  w, b+ v% w5 linsertproxytask(ts, forkliftkey, TASKTYPE_MOVEOBJECT, opkey, model());- A) x% z5 g8 V) H1 J

# k& y$ L8 \# Kinsertdeallocatetask(ts, forkliftkey);
4 P! I7 s1 l# o9 `3 t  {( h; R! m9 d$ K. Z  N& S9 u
insertdeallocatetask(ts, opkey);
2 G& y: L4 S" S2 V& P! Y4 v, K/ ]# k# p! T% ?4 j6 }+ v
dispatchcoordinatedtasksequence(ts);
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|全球FlexSim系统仿真中文论坛 ( 京ICP备14043114号-2 )

GMT+8, 2024-4-27 04:35 , Processed in 0.070431 second(s), 13 queries .

Powered by Discuz! X3.3© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表