货架内放置代码
货架内放置代码
实际应用中,经常需要将多个货物放在货架的同一个货格里面,FlexSim自身有一个货格内部堆放的逻辑(即依次向后排),此逻辑可能不适用于所有场景,因此需要我们自定义设置item在货架内的位置,那么今天就为大家简单的介绍一下,将货物在货架上呈2乘2的方式排列,并在移动的时候不会改变其他货物的排列位置。
In practical applications, it is often necessary to put multiple goods in the same compartment on the shelf. FlexSim itself has a logic for stacking inside the compartment (that is, to row backwards in sequence). This logic may not be suitable for all scenarios, so we need us Customize the position of the item in the shelf, so today I will give you a brief introduction, arrange the goods on the shelf in a 2-by-2 manner, and will not change the arrangement position of other goods when moving.
首先我们简单的建立这个模型如下,货架可以设置的简单的一点为5层10列,由叉车搬运货物实体。
First of all, we simply set up this model as follows, the simple point that the shelf can be set up is 5 layers and 10 rows, and the cargo entity is moved by a forklift.
然后对货架进行简单的设置,选择放置到随机可用层,随机可用列,并设置其货格容量为4,满足2乘2的建模要求
Then simply set the shelf, choose to place it on the random available layer, randomly available column, and set its cargo compartment capacity to 4, which meets the 2×2 modeling requirements
那么这个时候我们运行模型的话,便会出现不停向后累加的结果,并没有满足每个货格放置四个,可能会不停的向后积累,远远超于四个,这是因为我们的货架容量设的相对较高,而随机放置到可用列当超过满足后,便会系统随机放置到随机列随机层中去,便会出现这样的情况。
So when we run the model at this time, the result of continuous backward accumulation will appear. It does not meet the requirement of placing four in each compartment. It may continue to accumulate backwards, far more than four. This is because we The shelf capacity of is set to be relatively high, and when it is randomly placed in the available column, when it exceeds the satisfaction, the system will be randomly placed in the random column and random layer. This will happen.
当我们将容量恰好设置到不超过最大需求量时,便会出现如下情况
When we set the capacity exactly to not exceed the maximum demand, the following situation will occur
因此为了满足2乘2的摆放方式,就必须从实体坐标位置出发,寻找突破点,当我们改变实体位置的时候,便会发现实体的坐标位置也会跟着变化,旋转角度等都会随之变化,而且实体属性中也会有坐标位置,并且两个位置存在一定的差别,这是因为两个采用的坐标系不相同,为了更加方便的进行,我们可以将其改成相同的坐标系,将坐标改为空间坐标。
Therefore, in order to satisfy the 2x2 placement method, we must start from the physical coordinate position and find the breakthrough point. When we change the physical position, we will find that the physical coordinate position will also change, and the rotation angle will change accordingly. , And there will be coordinate positions in the entity properties, and there is a certain difference between the two positions. This is because the two coordinate systems used are not the same. For more convenience, we can change it to the same coordinate system. The coordinates are changed to spatial coordinates.
现在我们知道实体坐标值之后,就需要将其调整为2乘2 的模式,也就是到达货格的奇数尽量靠左一点,偶数靠右一点,后两个的Y坐标靠后一点,并保持一致。那么我们就需要在货架的进入触发中进行代码编写。
Now that we know the coordinates of the entity, we need to adjust it to a 2-by-2 mode, which means that the odd numbers of the goods compartment should be left as far as possible, the even numbers should be a little bit to the right, and the Y coordinates of the last two should be a little bit behind and keep the same. . Then we need to write code in the triggering of the shelf entry.
进行如下代码编写其中
Write the following code
获得的结果如下
The results obtained are as follows
那么我们也会发现,货物最后还是会乱跑,打乱所编写的格式,所以接下来我们便要设置货物移动后不改变其他货物实体的位置
Then we will also find that the goods will still run around in the end, disrupting the written format, so next we have to set the position of other goods entities not to change after the goods are moved.
在离开触发中编写如下代码
Write the following code in the leave trigger
如上便完成了此次建模任务。赶快去尝试一下吧
The modeling task was completed as above. Hurry up and try it.
参考资料:腾讯课堂
英文翻译:Google翻译
本文由LearningYard学苑原创,部分来源于网络,若有侵权,请联系删除。