Class DispenseAssembly

java.lang.Object
com.tccc.kos.core.service.assembly.Assembly
com.tccc.kos.ext.dispense.DispenseAssembly
All Implemented Interfaces:
com.tccc.kos.commons.core.service.handle.HandleAware, com.tccc.kos.commons.util.json.JsonDescriptorAware, com.tccc.kos.core.util.Loadable, PumpOpLimitAware

public abstract class DispenseAssembly extends com.tccc.kos.core.service.assembly.Assembly implements PumpOpLimitAware
Assembly that tracks dispense related objects. This is optional to use but offers the convenience of tracking various dispense related objects automatically.

This implements PumpOpLimitAware which enforces a simple limit grant count algorithm which can be enabled by setting pumpOpGrantLimit to the max number of concurrent pumps that can be used. If not set, no limit is enforced. Override checkPumpOpLimits() to implement a different algorithm if needed.

Since:
1.0
Version:
2023-10-16
  • Constructor Details

    • DispenseAssembly

      public DispenseAssembly(String name, com.tccc.kos.commons.util.json.JsonDescriptor descriptor)
      Create a new assembly with the specified name.
      Parameters:
      name - name of the assembly
  • Method Details

    • addNozzle

      public void addNozzle(Nozzle nozzle)
      Add a nozzle to the assembly.
    • getNozzle

      public Nozzle getNozzle(String name)
      Return a nozzle by nozzle name.
      Parameters:
      name - the name of the nozzle to return
    • addHolder

      public void addHolder(Holder holder, String group)
      Add a holder to the assembly with the specified group name.
      Parameters:
      holder - the holder to add
      group - the group the holder is part of
    • getDefaultHolders

      public List<Holder> getDefaultHolders()
      Return holders from the default group. This will include holders that were added without a group.
    • getHoldersByGroup

      public List<Holder> getHoldersByGroup(String group)
      Return holders in the specified group.
      Parameters:
      group - the group to return
    • getHolder

      public Holder getHolder(String name)
      Return the holder with the specified name.
      Parameters:
      name - the name of the holder to return
    • getAllHolders

      public Collection<Holder> getAllHolders()
      Return all holders.
    • checkPumpOpLimits

      public boolean checkPumpOpLimits(List<String> requests)
      Description copied from interface: PumpOpLimitAware
      Check the list of requests and return true if they are all allowed to run concurrently. A request is a string which may be null or a name. By default, tpour and vpour have limit grants with no request type so they will appear as null entries in the list. This can be used for simple count logic. If there is a need to limit based on other criteria such as power or pump types, the limit grant can include that information as the grant value and those values will be the strings in the request list. This allows developers to create very complex limit policies without needing to create a new type of grant.
      Specified by:
      checkPumpOpLimits in interface PumpOpLimitAware
      Parameters:
      requests - the grant requests to check
    • getPumpOpGrantLimit

      public int getPumpOpGrantLimit()
    • setPumpOpGrantLimit

      public void setPumpOpGrantLimit(int pumpOpGrantLimit)