Plugins and customizations

Simulation of dismantling and waste processing activities may vary from country to country, due to various reasons like, e.g., type of the project, availability of waste processing technologies, structure of existing inventory database, different national regulations, practices for the development of unit factors or availability of the input data for the simulation and cost estimation.

AquilaCosting's simulation and cost estimation process can be fully customized by your own custom plugins. With the concept of plugins, custom cost estimation procedures or waste management technologies can be easily implemented to comply with your local circumstances.

Thanks to this feature, the AquilaCosting can also be understood as a widely customizable platform for decommissioning costing.

The development of plugins does not require much software development skills. Below is an example of the sorter which compares a specific data from the inventory database (the 'contaminationCategory') and based on its value, it directs the waste for further processing.

Our consultants can provide you necessary trainings and workshops in order to fully understand this process.

In case of not having enough resources or experience in your team to develop your own plugins, our experienced software developers are ready to help.

Sample implementation of a custom sorter

<?php

namespace AquilaCostingAppPlugins\Calculation\WasteManagement\Sorter;

/*
 * Sample implementation of the custom sorter.
 *
 * The sorter compares the 'contaminationCategory' stored in the inventory item
 * with the 'contaminationCategory' configured in the limit.
 *
 * When a limit with the same 'contaminationCategory' as in the inventory item
 * from which the waste is originally generated is found, the sorter creates
 * an output waste that will be further processed by a technology linked to that
 * limit.
 *
 */

class MyCustomSorter extends \AquilaCostingApp\Calculation\WasteManagement\Loader {

  /* processInputWaste()
   * This is the only method that has to be implemented in the custom sorter
   */
  public function processInputWaste() {
    $limitSatisfied = false;

    // Prepare the required set of data for the output waste
    $outputWaste = $this->prepareOutputWaste();

    // Do some logging for better debugging
    $this->logger->write(
      "Sorting waste from {$this->originatingInventory['number']} {$this->originatingInventory['name']}, "
      . "previously generated by ".($this->previousTechnology['name'] ?: $this->originatingIsdcNode['isdcNumber']) . "."
    );

    // Extract the contaminationCategory from the originating inventory item
    $inventoryJson = $this->inventory['jsonParameters'];
    $inventoryContaminationCategory = (int) ($inventoryJson['contaminationCategory'] ?? 0);

    // Iterate all outputs configured for this sorter and compare limits for each output.
    // If the suitable limit is found, the output waste is created.
    foreach ($this->outputs as $output) {

      // Extract the contaminationCategory from the limit
      $sorterLimit = $output['sorterLimit'];
      $sorterLimitJsonParameters = @json_decode($sorterLimit['jsonParameters'], TRUE);
      $sorterLimitContaminationCategory = (int) ($sorterLimitJsonParameters['contaminationCategory'] ?? 0);

      // Compare to contaminationCategories
      if ((int) $sorterLimitContaminationCategory === (int) $inventoryContaminationCategory) {

        // Do some logging for better debugging
        $this->logger->write("Limit '{$sorterLimit['name']}' was satisfied.");

        // Assign a limit and a material to the output waste
        $outputWaste = $this->updateOutputWaste($outputWaste, "idLimitSatisfied", $sorterLimit['id']);
        $outputWaste = $this->updateOutputWaste($outputWaste, "idMaterial", $output['material']['id']);

        // Create the output waste. It will be further processed in the next iteration of the simulation.
        $this->createOutputWaste("sorter", $outputWaste, $output);

        $limitSatisfied = true;
        break;
      }
    }

    // Do some WARNING logging for better debugging
    if (!$limitSatisfied) {
      $this->logger->warning("No limit has been satisfied.");
    }

  }

}