A Rack is a grid of cells where each cell can contain multiple Products. The dimensions and number of cells can be configured.
ProductCount is a Read-Only value for the current number of Products stored in the entire Rack that can be used to easily check the current capacity without having to count each cell.
Note that ProductCount is only updated with the MoveProduct function, manually deleting Product from a cell does not update ProductCount.
Name | Type | Description |
Width | Number | Gets/Sets the Width of the Rack in metres (default 3) |
Length | Number | Gets/Sets the Length of the Rack in metres (default 50) |
Height | Number | Gets/Sets the Height of the Rack in metres (default 50) |
CellGap | Number | Gets/Sets the cell spacing (wall) in metres (default 0.05) |
NumCellH | Integer | Gets/Sets the number of horizontal cells in the Rack (default 25) |
NumCellV | Integer | Gets/Sets the number of vertical cells of the Rack (default 25) |
ProductCount | Integer | Gets the total number of Products in the Rack |
Color | String | New in V7.0. Gets/Sets the name of the color of the equipment |
Visible | Boolean | New in V7.0. Gets/Sets the visibility of the equipment |
Array GetProductsFromCell(indexX: integre, indexY: integer)
Called to get an array of ‘Product’ objects in the Cell at grid reference indexX, indexY of the Rack, the Return array will be null if no Product is found.
Parameter Name | Type | Description |
indexX | Integer | The zero based column number for the cell |
indexY | Integer | The zero based row number for the cell |
To get a count of the number of Products in a cell, use the GetProductsFromCell function and return Array.length. e.g. The find the number of Products in cell 1,1;
aProd = oRack.GetProductsFromCell(1,1) if (aProd != null && aProd.length > 0 ...
None
To move Product into a Rack using a variant of the MoveProduct function. e.g.
MoveProduct(product, rackname, indexX, indexY);
where indexX and indexY are the cell co-ordinates.
You can not specify a position in which to place the Product, they are all placed at the same position in the cell.
To move Product out of a Rack use the MoveProduct function. e.g.
MoveProduct(product, target, distance);
Simulation script for Rack sample project
var oRack = GetComponentByNameAndType("MyRack02", "Rack"); var oConv1 = GetComponentByNameAndType("MyConveyor1", "Conveyor"); var oConv2 = GetComponentByNameAndType("MyConveyor2", "Conveyor"); var aProd = new Array(); function OnSimulationStart() { LogDebug("OnSimulationStart called"); SubscribeToEvent("OnProductBlocking","PESensor1", "PE Sensor", "load"); SetTimerEx(42, 1000, "unload", null); } function OnSimulationStop() { LogDebug("OnSimulationStop called"); } function load(sender, product) { MoveProduct(product, oRack.Name, 1, 1); LogDebug("Load into " + oRack.Name + " cell(1,1)"); LogDebug("Rack product count=" + oRack.ProductCount); } function unload() { aProd = oRack.GetProductsFromCell(1,1); if (aProd!=null && aProd.length>0) { MoveProduct(aProd[0],oConv2.Name,0); LogDebug("Unload from " + oRack.Name + "cell(1,1) onto " + oConv2.Name); LogDebug("Rack product count=" + oRack.ProductCount); } SetTimerEx(42,1000,"unload",null); }