@SuppressWarnings("unchecked")
    public double valueAt(ICollection iCollection, long thisTime, Unit<?> requiredUnits) {
      Measurable<Quantity> res;
      if (iCollection.isQuantity()) {
        IQuantityCollection<?> iQ = (IQuantityCollection<?>) iCollection;

        if (iCollection.isTemporal()) {
          TemporalQuantityCollection<?> tQ = (TemporalQuantityCollection<?>) iCollection;
          res = (Measurable<Quantity>) tQ.interpolateValue(thisTime, InterpMethod.Linear);
        } else {
          IQuantityCollection<?> qC = (IQuantityCollection<?>) iCollection;
          res = (Measurable<Quantity>) qC.getValues().iterator().next();
        }

        if (res != null) {
          UnitConverter converter = iQ.getUnits().getConverterTo(requiredUnits);
          Unit<?> sourceUnits = iQ.getUnits();
          double doubleValue = res.doubleValue((Unit<Quantity>) sourceUnits);
          double result = converter.convert(doubleValue);
          return result;
        } else {
          return 0;
        }
      } else {
        throw new RuntimeException("Tried to get value of non quantity data type");
      }
    }
    @Override
    protected void recalculate() {
      // clear out the lists, first
      Iterator<IStoreItem> iter = getOutputs().iterator();
      while (iter.hasNext()) {
        IQuantityCollection<?> qC = (IQuantityCollection<?>) iter.next();
        qC.getValues().clear();
      }

      // update the results
      performCalc(getOutputs());
    }