HomeInterfacesRecipesChangelogFAQ
Log In
Interfaces

Port Flow Examples

Port with Outgoing Bins to Conveyor Belt

//Create a prepare queue for atleast 30 minutes of operation, maintain this queue at all times

//Build port queues for atleast 10-15 minutes of operation, maintain this queue at all times

//Open the port for picking
binApi.openPort(port_id);

//Call as soon as possible as a robot will drive to
//the port with the next bin in the port queue
portApi.portCellAllocate(port_id, xPos, yPos);

//Do this as long as we are taking out bins
while (takingOutBins)
{
    //Open bin, we are not using any parameters so
    //AutoStore picks the next bin in the port queue
    var selectedBin = binApi.openBin(port_id).parameters.bin_id;

    //When there is physical space for the bin to be
    //delivered to port cell call this method as soon as possible
    //so that the robot can put down the bin into the cell
    portApi.portLocationReady(port_id, xPos, yPos);

    do
    {
        //For this example i am using a query, it is recommended to
        //use LogPublisher to monitor bin states and locations. 
        var binStateResponse = binApi.getBinState(selectedBin);
    }
    //Wait til the bin is delivered to correct port
    while (!(binStateResponse.parameters.bins.bin[0].bin_mode == "P"
    && binStateResponse.parameters.bins.bin[0].port_id == port_id));

    //Call as soon as possible as a robot will drive to
    //the port with the next bin in the port queue
    portApi.portCellAllocate(port_id, xPos, yPos);

    //Remove the bin from the grid when bin is
    //removed from the port cell(outside of the AutoStore)
    binApi.removeBin(port_id, selectedBin);

    //Replenish the port queue with a new bin to keep the pool sizable and stable
    binApi.appendToPortQueue(port_id, new List<int>() { preparedBinId });
}

//Close port when we finish taking out bins
binApi.closePort(port_id);
//Create taskgroups for atleast 30 minutes of operation and give 30 minutes to prepare, maintain this queue at all times

//Open the port in the category you want to pick from
taskApi.openPort(port_id, null, new List<int>() { category });

//Call as soon as possible as a robot will drive to
//the port with the next bin in the internal queue
portApi.portCellAllocate(port_id, xPos, yPos);

//Do this as long as we are taking out bins
while (takingOutBins)
{
    //Open bin, we are not using any parameters so AutoStore
    //decides what empty bin to bring from the empty bin content code
    var openBinResponse = taskApi.openBin(port_id);

    //When there is physical space for the bin to be
    //delivered call this method as soon as possible
    //so that the robot can put down the bin into the cell
    portApi.portLocationReady(port_id, xPos, yPos);

    do
    {
        //For this example i am using a query, it is recommended to
        //use LogPublisher to monitor bin states and more. 
        var binStateResponse = taskApi.getBinState(openBinResponse.parameters.bin_id);
    }
    //Wait til the bin is delivered to correct port
    while (!(binStateResponse.parameters.bins.bin[0].bin_mode == "P"
    && binStateResponse.parameters.bins.bin[0].port_id == port_id));

    //Call as soon as possible as a robot will drive to
    //the port with the next bin in the internal queue
    portApi.portCellAllocate(port_id, xPos, yPos);

    //Remove the bin from the grid when bin is
    //removed from the port cell(outside of the AutoStore)
    taskApi.removeBin(port_id, openBinResponse.parameters.bin_id, openBinResponse.parameters.task_id);

    //Replenish a taskgroup if we have finished what we worked on
    if (taskgroupEnd)
    {
        taskApi.createTaskgroup(taskgroup_id, category, DateTime.Now.AddMinutes(30),
        priority, new List<task>() { new task(task_id, bin_id) });
    }
}

//Close port when we finish taking out bins
taskApi.closePort(port_id);

Port with Outgoing Bins to Conveyor Belt (mode AUTO)

//Create a prepare queue for atleast 30 minutes of operation, maintain this queue at all times

//Build port queues for atleast 10-15 minutes of operation, maintain this queue at all times

//Open the port in mode AUTO
binApi.openPort(port_id, "AUTO");

//Call as soon as possible as a robot will drive to
//the port with the next bin in the internal queue
portApi.portCellAllocate(port_id, xPos, yPos);

//Do this as long as we are taking out bins
while (takingOutBins)
{
    //When there is physical space for the bin to be
    //delivered call this method as soon as possible
    //so that the robot can put down the bin into the cell
    portApi.portLocationReady(port_id, xPos, yPos);

    do
    {
        //For this example i am using a query, it is recommended to
        //use LogPublisher to monitor bin states and locations. 
        var binStateResponse = binApi.getBinState(firstBinInPortQueue);
    }
    //Wait til the bin is delivered to correct port
    while (!(binStateResponse.parameters.bins.bin[0].bin_mode == "P"
    && binStateResponse.parameters.bins.bin[0].port_id == port_id));

    //Call as soon as possible as a robot will drive to
    //the port with the next bin in the internal queue
    portApi.portCellAllocate(port_id, xPos, yPos);

    //Replenish the port queue with a new bin to keep the pool sizable and stable
    binApi.appendToPortQueue(port_id, new List<int>() { preparedBinId });
}

//Close port when we finish taking out bins
binApi.closePort(port_id);

Port with Incoming Bins from Conveyor Belt

//Open the port in mode INSERT
binApi.openPort(port_id, "INSERT");

//Call as soon as possible as a robot will drive to
//the port and wait for a bin to pickup
portApi.portCellAllocate(port_id, xPos, yPos, true);

//Do this as long as we are inserting bins
while (insertingBins)
{
    //Call when the bin is in position to be picked up for a robot,
    //the robot will then pick up the bin
    portApi.portBinReady(port_id, xPos, yPos, binIdToPickUp);

    do
    {
        //For this example i am using a query, it is recommended to
        //use LogPublisher to monitor bin states and locations. 
        var response = binApi.getBinState(binIdToPickUp);
    }
    //Wait til the bin is picked up by a robot
    while (!(response.parameters.bins.bin[0].xpos != xPos &&
    response.parameters.bins.bin[0].ypos != yPos));

    //Call as soon as possible as a robot will drive to
    //the port and wait for a bin to pickup
    portApi.portCellAllocate(port_id, xPos, yPos, true);
}

//Close port when we finish inserting bins
binApi.closePort(port_id);
//Open the port in mode INSERT
taskApi.openPort(port_id, null, null, null, "INSERT");

//Call as soon as possible as a robot will drive to
//the port and wait for a bin to pickup
portApi.portCellAllocate(port_id, xPos, yPos, true);

//Do this as long as we are inserting bins
while (insertingBins)
{
    //Call when the bin is in position to be picked up for a robot,
    //the robot will then pick up the bin
    portApi.portBinReady(port_id, xPos, yPos, binIdToPickUp);

    do
    {
        //For this example i am using a query, it is recommended to
        //use LogPublisher to monitor bin states and locations. 
        var response = taskApi.getBinState(binIdToPickUp);
    }
    //Wait til the bin is picked up by a robot
    while (!(response.parameters.bins.bin[0].xpos != xPos &&
    response.parameters.bins.bin[0].ypos != yPos));

    //Call as soon as possible as a robot will drive to
    //the port and wait for a bin to pickup
    portApi.portCellAllocate(port_id, xPos, yPos, true);
}

//Close port when we finish inserting bins
taskApi.closePort(port_id);

Port Exchange Bins to and from Grid (Bi-Directional / Single Cell Loop)

Starting with an Empty Port

//Create a prepare queue for atleast 30 minutes of operation, maintain this queue at all times

//Build port queues for atleast 10-15 minutes of operation, maintain this queue at all times

//Open the port for picking
binApi.openPort(port_id);

while(isPicking)
{
  //Call as soon as possible as a robot will drive to
  //the port with the next bin in the port queue
  portApi.portCellAllocate(port_id, xPos, yPos);

  //Open bin, we are not using any parameters so
  //AutoStore picks the next bin in the port queue
  var binResponse = binApi.openBin(port_id);

  //When there is physical space for the bin to be
  //delivered to port cell call this method as soon as possible
  //so that the robot can put down the bin into the cell
  portApi.portLocationReady(port_id, xPos, yPos);

  do
  {
    //Check the state of the bin
    //For this example i am using a query, it is recommended to
    //use LogPublisher to monitor bin states and locations. 
    var binStateResponse = binApi.getBinState(binResponse.parameters.bin_id);
  }
  //Wait til the bin is delivered to correct port
  while (!(binStateResponse.parameters.bins.bin[0].bin_mode == "P"
           && binStateResponse.parameters.bins.bin[0].port_id == port_id));

  //Change bin mode to OPEN when bin is already outside of the port cell
  portApi.portBinMode(port_id, binResponse.parameters.bin_id, "OPEN");

  //Call as soon as possible as a robot will drive to
  //the port with the next bin in the port queue
  portApi.portCellAllocate(port_id, xPos, yPos);

  //Bin exchanged with new bin
  //Close Bin
  binApi.closeBin(port_id, binResponse.parameters.bin_id);

  //Change bin mode to CLOSED
  portApi.portBinMode(port_id, binResponse.parameters.bin_id, "CLOSED", 1);

  //Open next bin, we are not using any parameters so
  //AutoStore picks the next bin in the port queue
  var nextBinResponse = binApi.openBin(port_id);

  //When there is physical space for the bin to be
  //delivered to port cell call this method as soon as possible
  //so that the robot can put down the bin into the cell
  //Get bin is true because you want to get the previous bin (exchange)
  portApi.portLocationReady(port_id, xPos, yPos,true);

  do
  {
    //Check the state of the next bin
    //For this example i am using a query, it is recommended to
    //use LogPublisher to monitor bin states and locations. 
    var nextBinStateResponse = binApi.getBinState(nextBinResponse.parameters.bin_id);
  }
  //Wait til the bin is delivered to correct port
  while (!(nextBinStateResponse.parameters.bins.bin[0].bin_mode == "P"
           && nextBinStateResponse.parameters.bins.bin[0].port_id == port_id));

  //Change bin mode to OPEN
  portApi.portBinMode(port_id, nextBinResponse.parameters.bin_id, "OPEN");

  //Call when the bin is in position to be picked up for a robot,
  //the robot will then pick up the bin
  portApi.portBinReady(port_id, xPos, yPos, binResponse.parameters.bin_id);

  do
  {
    //Check the state of the bin
    var binStateResponse = binApi.getBinState(binResponse.parameters.bin_id);
  }
  //Wait until the bin is no longer in the port
  while (!(binStateResponse.parameters.bins.bin[0].xpos != xPos &&
           binStateResponse.parameters.bins.bin[0].ypos != yPos));

  //Call as soon as possible as a robot will drive to
  //the port with the next bin in the port queue
  portApi.portCellAllocate(port_id, xPos, yPos);

  //closing the last bin in the process
  binApi.closeBin(port_id, binResponse.parameters.bin_id);

  //confirm bin closed to LP
  portApi.portBinMode(port_id, binResponse.parameters.bin_id, "CLOSED", 1);
}

//always close port when done
binApi.closePort(port_id);
//Create a prepare queue for atleast 30 minutes of operation, maintain this queue at all times

//Build port queues for atleast 10-15 minutes of operation, maintain this queue at all times

//Open the port for picking
taskApi.openPort(port_id);

while(isPicking)
{
  //Call as soon as possible as a robot will drive to
  //the port with the next bin in the port queue
  portApi.portCellAllocate(port_id, xPos, yPos);

  //Open bin, we are not using any parameters so
  //AutoStore picks the next bin in the port queue
  var binResponse = taskApi.openBin(port_id);

  //When there is physical space for the bin to be
  //delivered to port cell call this method as soon as possible
  //so that the robot can put down the bin into the cell
  portApi.portLocationReady(port_id, xPos, yPos);

  do
  {
    //Check the state of the bin
    //For this example i am using a query, it is recommended to
    //use LogPublisher to monitor bin states and locations. 
    var binStateResponse = taskApi.getBinState(binResponse.parameters.bin_id);
  }
  //Wait til the bin is delivered to correct port
  while (!(binStateResponse.parameters.bins.bin[0].bin_mode == "P"
           && binStateResponse.parameters.bins.bin[0].port_id == port_id));

  //Change bin mode to OPEN
  portApi.portBinMode(port_id, binResponse.parameters.bin_id, "OPEN");

  //Call as soon as possible as a robot will drive to
  //the port with the next bin in the port queue
  portApi.portCellAllocate(port_id, xPos, yPos);

  //Bin exchanged with new bin
  //Close Bin
  taskApi.closeBin(port_id, binResponse.parameters.bin_id);

  //Change bin mode to CLOSED
  portApi.portBinMode(port_id, binResponse.parameters.bin_id, "CLOSED", 1);

  //Open next bin, we are not using any parameters so
  //AutoStore picks the next bin in the port queue
  var nextBinResponse = taskApi.openBin(port_id);

  //When there is physical space for the bin to be
  //delivered to port cell call this method as soon as possible
  //so that the robot can put down the bin into the cell
  //Get bin is true because you want to get the previous bin (exchange)
  portApi.portLocationReady(port_id, xPos, yPos,true);

  do
  {
    //Check the state of the next bin
    //For this example i am using a query, it is recommended to
    //use LogPublisher to monitor bin states and locations. 
    var nextBinStateResponse = taskApi.getBinState(nextBinResponse.parameters.bin_id);
  }
  //Wait til the bin is delivered to correct port
  while (!(nextBinStateResponse.parameters.bins.bin[0].bin_mode == "P"
           && nextBinStateResponse.parameters.bins.bin[0].port_id == port_id));

  //Change bin mode to OPEN when bin is already outside of the port cell
  portApi.portBinMode(port_id, nextBinResponse.parameters.bin_id, "OPEN");

  //Call when the bin is in position to be picked up for a robot,
  //the robot will then pick up the bin
  portApi.portBinReady(port_id, xPos, yPos, binResponse.parameters.bin_id);

  do
  {
    //Check the state of the bin
    var binStateResponse = taskApi.getBinState(binResponse.parameters.bin_id);
  }
  //Wait until the bin is no longer in the port
  while (!(binStateResponse.parameters.bins.bin[0].xpos != xPos &&
           binStateResponse.parameters.bins.bin[0].ypos != yPos));

  //Call as soon as possible as a robot will drive to
  //the port with the next bin in the port queue
  portApi.portCellAllocate(port_id, xPos, yPos);

  //closing the last bin in the process
  taskApi.closeBin(port_id, binResponse.parameters.bin_id,binResponse.parameters.task_id,true);

  //confirm bin closed to LP
  portApi.portBinMode(port_id, binResponse.parameters.bin_id, "CLOSED", 1);
}
//always close port when done
taskApi.closePort(port_id);

Repeated Bin (if next openbin same as previous closebin)

No need to relinquish control of the port cell via portlocationready

//Open bin, we are not using any parameters so
//AutoStore picks the next bin in the port queue
var binResponse = binApi.openBin(port_id);

//Change bin mode to OPEN
portApi.portBinMode(port_id, binResponse.parameters.bin_id, "OPEN");

//Close Bin
binApi.closeBin(port_id, binResponse.parameters.bin_id);

//Change bin mode to CLOSED
portApi.portBinMode(port_id, binResponse.parameters.bin_id, "CLOSED");
//Open bin, we are not using any parameters so
//AutoStore picks the next bin in the port queue
var binResponse = taskApi.openBin(port_id);

//Change bin mode to OPEN
portApi.portBinMode(port_id, binResponse.parameters.bin_id, "OPEN");

//Close Bin
taskApi.closeBin(port_id, binResponse.parameters.bin_id,binResponse.parameters.task_id,true);

//Change bin mode to CLOSED
portApi.portBinMode(port_id, binResponse.parameters.bin_id, "CLOSED");

Starting with a Bin In Port

For this example we assume bin id 1200 is in port.

//Create a prepare queue for atleast 30 minutes of operation, maintain this queue at all times

//Build port queues for atleast 10-15 minutes of operation, maintain this queue at all times

//Open the port for picking
binApi.openPort(port_id);

while(isPicking)
{
  //Call as soon as possible as a robot will drive to
  //the port with the next bin in the port queue
  portApi.portCellAllocate(port_id, xPos, yPos);

  //Open bin, we are not using any parameters so
  //AutoStore picks the next bin in the port queue
  var binResponse = binApi.openBin(port_id);

  //When there is physical space for the bin to be
  //delivered to port cell call this method as soon as possible
  //so that the robot can put down the bin into the cell
  portApi.portLocationReady(port_id, xPos, yPos,true);

  do
  {
    //Check the state of the bin
    //For this example i am using a query, it is recommended to
    //use LogPublisher to monitor bin states and locations. 
    var binStateResponse = binApi.getBinState(binResponse.parameters.bin_id);
  }
  //Wait until the bin is delivered to correct port
  while (!(binStateResponse.parameters.bins.bin[0].bin_mode == "P"
           && binStateResponse.parameters.bins.bin[0].port_id == port_id));

  //Change bin mode to OPEN
  portApi.portBinMode(port_id, binResponse.parameters.bin_id, "OPEN");

  //Call when the bin is in position to be picked up for a robot,
  //the robot will then pick up the bin
  portApi.portBinReady(port_id, xPos, yPos, 1200);

  //Call as soon as possible as a robot will drive to
  //the port with the next bin in the port queue
  portApi.portCellAllocate(port_id, xPos, yPos);

  //continue exchanging bins
}

//always close port when done
binApi.closePort(port_id);
//Create a prepare queue for atleast 30 minutes of operation, maintain this queue at all times

//Build port queues for atleast 10-15 minutes of operation, maintain this queue at all times

//Open the port for picking
taskApi.openPort(port_id);

while(isPicking)
{
  //Call as soon as possible as a robot will drive to
  //the port with the next bin in the port queue
  portApi.portCellAllocate(port_id, xPos, yPos);

  //Open bin, we are not using any parameters so
  //AutoStore picks the next bin in the port queue
  var binResponse = taskApi.openBin(port_id);

  //When there is physical space for the bin to be
  //delivered to port cell call this method as soon as possible
  //so that the robot can put down the bin into the cell
  portApi.portLocationReady(port_id, xPos, yPos,true);

  do
  {
    //Check the state of the bin
    //For this example i am using a query, it is recommended to
    //use LogPublisher to monitor bin states and locations. 
    var binStateResponse = taskApi.getBinState(binResponse.parameters.bin_id);
  }
  //Wait until the bin is delivered to correct port
  while (!(binStateResponse.parameters.bins.bin[0].bin_mode == "P"
           && binStateResponse.parameters.bins.bin[0].port_id == port_id));

  //Change bin mode to OPEN
  portApi.portBinMode(port_id, binResponse.parameters.bin_id, "OPEN");

  //Call when the bin is in position to be picked up for a robot,
  //the robot will then pick up the bin
  portApi.portBinReady(port_id, xPos, yPos, 1200);

  //Call as soon as possible as a robot will drive to
  //the port with the next bin in the port queue
  portApi.portCellAllocate(port_id, xPos, yPos);

  //continue exchanging bins
}

//always close port when done
taskApi.closePort(port_id);