ACTS (6) – How could it work – The bridge-cranes task …

ek.skirl

Active member
Any CCR has only one task do realise: Transporting a CON from one CST to an other. Here are some very simplified codesnippets, that illustrate this:

crane.moveContainerToStack(CONID, destinationCSTID) {
sourceStack = self.getContainerStackFromContainerID(CONID);​
destinationStack = self.getContainerStackFromStackID(destinationCSTID);
self.moveToPosition(sourceStack);
self.takeContainer(CONID); // inclusive rearranging a not-on-top container
self.moveToStack(destinationStack);
self.settleContainer(destinationStack); // inclusive checking the current floor​
}

crane.getContainerStackFromContainerID(CONID)
{
foreach dump in self.CDU_List
foreach stack in dump.CST_list
foreach cont in stack.CON_List​
if cont.ID=CONID then return stack;​
return nil;​
}

crane.getContainerStackFromStackID(stackID)
{
foreach dump in self.CDU_List​
foreach stack in dump.CST_list​
if stack.ID= stackID then return stack;​
return nil;​
}

crane.getContainerDumpFromStackID(stackID)
{
foreach dump in self.CDU_List​
foreach stack in dump.CST_list​
foreach cont in stack.CON_List​
if cont.ID=CONID then return dump;​
return nil;​
}

crane.moveToStack(stack)
{
self.calculatePosition(stack);​
self.moveToPosition(position);​
}

crane.calculatePosition(stack)
{
trolley = self.getTrolley();
trolleyPosition = trolley.getPositon();
gear = trolly.getGear();
gearPosition = gear.getPosition;
dump = self.getContainerDumpFromStackID(stack.ID)
dump.position = dump.getPosition
cranePosition = self.getPosition;
stackPosition = stack.getPosition();
stackFloor = stack.getFloor();

return position;​
}

This’s more than incomplete, but it shows a little bit the thingsto do. One of the main tasks for scripting is to decide, whichmethods and attributes should lay in which script-class andasset-script.
 
Back
Top