Plant Simulation MultiPortalCrane Store 小案例
一个天车从库区移动商品到指定地点的案例
- 库区商品:库区上随机位置摆放商品,在源上绑定方法(应该也可以直接在库区上生成,我这里是使用源可以改变生成多少个商品)
// 源的self.OnExit var Store : object := 存储 var XDim : integer := Store.XDim var YDim : integer := Store.YDim var X, Y : integer var found : boolean := falsewhile not foundX := 1 + floor(z_uniform(0,1) * XDim)Y := 1 + floor(z_uniform(0,1) * YDim)if Store[X, Y].cont = void@.move(Store[X,Y])found := trueend end
2. Store绑定方法
// Store的self.OnExit
//@.move -- Remove this, if the exit control is rear triggered!
var portal = MultiPortalCrane.portal1
if 存储.numMU > 0wait 1waituntil portal.state ="waiting" or portal.state="idle"dispatch()//存储.cont.move(上料口)
end
// 方法1
if @.~.numMU = 200dispatch()
end
3. 天车调度:dispatch方法
// dispatchvar portal = MultiPortalCrane.portal1
print portal
var startTime = sysDate
waituntil portal.state ="waiting" or portal.state="idle"
if portal.cont = VOIDvar o: object := 存储.findPart("零件")portal.moveToObject(o)
end
waituntil portal.state ="waiting" or portal.state="idle"
portal.moveHook(4.5)waituntil portal.state ="waiting" or portal.state="idle"
存储.cont.move(portal)wait 3
waituntil portal.state ="waiting" or portal.state="idle"
portal.moveHook(2)waituntil portal.state ="waiting" or portal.state="idle"
portal.moveToObject(上料口)wait 3
waituntil portal.state ="waiting" or portal.state="idle"
portal.moveHook(4.5)waituntil portal.state ="waiting" or portal.state="idle"
wait 3
if portal.cont /= VOIDportal.cont.move(上料口)portal.moveHook(2)
endwaituntil portal.state ="waiting" or portal.state="idle"
portal.endSequence
var endTime:=sysDatevar spendTime=endTime - startTime
// 天车,起点库位,终点库位,时间,耗时
调度表.appendRow(portal, startTime,endTime,o,上料口,spendTime)
4. 数据表定义(列索引,注意数据类型设置)