/** * Calculate bandwidth demand from rate & data size * * @param pci Port connection instance * @return */ protected double calcBandwidthKBytesps(ConnectionInstanceEnd cie) { double res = 0; // TODO-LW add other cases if (cie instanceof FeatureInstance) { FeatureInstance fi = (FeatureInstance) cie; double datasize = GetProperties.getSourceDataSize(fi, GetProperties.getKBUnitLiteral(fi)); double srcRate = getDataRate(fi, 0.0); if (srcRate == 0) { double period = GetProperties.getPeriodInSeconds(fi.getContainingComponentInstance(), 0); if (period == 0) return res; srcRate = 1 / GetProperties.getPeriodInSeconds(fi.getContainingComponentInstance(), 1); } res = datasize * srcRate; EList fil = fi.getFeatureInstances(); if (fil.size() > 0) { double subres = 0; for (Iterator it = fil.iterator(); it.hasNext(); ) { FeatureInstance sfi = (FeatureInstance) it.next(); subres = subres + calcBandwidthKBytesps(sfi); } if (subres > res) { if (res > 0) { errManager.warningSummary( fi, null, "Bandwidth of feature group ports " + subres + " exceeds feature group bandwidth " + res); } res = subres; } } } return res; }
@Override protected String getFeatureLocalIdentifier(FeatureInstance fi) { return GenerationUtilsC.getGenerationCIdentifier( fi.getComponentInstance().getName() + "_" + fi.getName()); }