This week I have been working on implementing the cranes. There are two types of cranes in the original system: The QC (Quay Crane) and the ASC (Automated Stacking Crane). Both use spreaders to pick up containers. The QC moves containers from the ship to the QC transfer point. From there the containers get picked up by a straddle carrier and moved to an ASC pick up location. The ASC then moves those containers to the stack for temporary storage.
I started with separating the ASC controller logic and the movement code found in the original codebase. In my design I separated hardware-like code from the controller logic in the TOS. This was not so difficult as the original code had a similar separation with workers and simulators. Unfortunately, this separation was not enforced. There is simulation logic being handled in the controller and controller logic in the simulation.
This simplified diagram shows the interaction between the TOS and simulation with the boundary between them. The framework is a custom library that routes the data calls to the appropriate data services.
I needed the AreaControl and Scheduling implementation as the vehicles depended on them. So, I implemented those modules in the MonoTOS. (MonoTOS is an intermediate step to get the simulation / TOS separation working. Later, this will be microservice based) The implementation went quite smoothly as the AreaControl and Scheduling were already quite isolated.
I realized that to properly test the ASC I needed to have containers at the ASC pickup location and jobs registered in the scheduler. To achieve this, I could either write temporary code to test this functionality or have the QC and SC working before testing the ASC. I decided to go with the second option and implement the QC first.
The QC implementation was simpler than the ASC as I already had the different dependencies implemented. After some work and some issues, I managed to get the Qc working. It can pick up containers form the ship and move them on the QCTP.
Short demo of the QC picking up containers and placing them on the QCTP.