use of com.att.aro.core.packetanalysis.pojo.RrcStateRange in project VideoOptimzer by attdevsupport.
the class RrcStateMachineFactoryImpl method runWiFiRRcStatistics.
private RrcStateMachineWiFi runWiFiRRcStatistics(List<RrcStateRange> staterangelist, ProfileWiFi prof, double totalBytes, double packetDuration, double traceDuration) {
double totalRRCEnergy = 0, wifiActiveTime = 0, wifiActiveEnergy = 0, wifiTailTime = 0;
double wifiTailEnergy = 0, wifiIdleTime = 0, wifiIdleEnergy = 0;
for (RrcStateRange rrc : staterangelist) {
double rrcTimeDiff = rrc.getEndTime() - rrc.getBeginTime();
double energy = profilefactory.energyWiFi(rrc.getBeginTime(), rrc.getEndTime(), rrc.getState(), prof);
totalRRCEnergy += energy;
switch(rrc.getState()) {
case WIFI_ACTIVE:
wifiActiveTime += rrcTimeDiff;
wifiActiveEnergy += energy;
break;
case WIFI_TAIL:
// wifiActiveTime += rrcTimeDiff;
wifiActiveEnergy += energy;
wifiTailTime += rrcTimeDiff;
wifiTailEnergy += energy;
break;
case WIFI_IDLE:
wifiIdleTime += rrcTimeDiff;
wifiIdleEnergy += energy;
break;
default:
break;
}
}
double bytes = totalBytes;
double joulesPerKilobyte = bytes != 0 ? totalRRCEnergy / (bytes / 1000.0) : 0.0;
RrcStateMachineWiFi stmachine = new RrcStateMachineWiFi();
stmachine.setJoulesPerKilobyte(joulesPerKilobyte);
stmachine.setPacketsDuration(packetDuration);
stmachine.setTotalRRCEnergy(totalRRCEnergy);
stmachine.setTraceDuration(traceDuration);
stmachine.setWifiActiveEnergy(wifiActiveEnergy);
stmachine.setWifiActiveTime(wifiActiveTime);
stmachine.setWifiIdleEnergy(wifiIdleEnergy);
stmachine.setWifiIdleTime(wifiIdleTime);
stmachine.setWifiTailTime(wifiTailTime);
stmachine.setWifiTailEnergy(wifiTailEnergy);
return stmachine;
}
use of com.att.aro.core.packetanalysis.pojo.RrcStateRange in project VideoOptimzer by attdevsupport.
the class RrcStateMachineFactoryImpl method run3GRRcStatistics.
/**
* 3G RRC state time modification.
*/
private RrcStateMachine3G run3GRRcStatistics(List<RrcStateRange> staterangelist, Profile3G prof3g, double totalBytes, double packetsDuration, double traceDuration) {
double idleTime = 0, idleEnergy = 0, dchTime = 0, dchEnergy = 0, dchTailTime = 0, dchTailEnergy = 0;
double fachTime = 0, fachEnergy = 0, fachTailTime = 0;
double fachTailEnergy = 0, idleToDch = 0, idleToDchTime = 0, idleToDchEnergy = 0, fachToDch = 0;
double fachToDchTime = 0, fachToDchEnergy = 0;
RrcStateMachine3G statemachine = new RrcStateMachine3G();
for (RrcStateRange rrc : staterangelist) {
double energy = profilefactory.energy3G(rrc.getBeginTime(), rrc.getEndTime(), rrc.getState(), prof3g);
double duration = rrc.getEndTime() - rrc.getBeginTime();
switch(rrc.getState()) {
case STATE_IDLE:
idleTime += duration;
idleEnergy += energy;
break;
case STATE_DCH:
dchTime += duration;
dchEnergy += energy;
break;
case TAIL_DCH:
// dchTime += duration;
dchTailTime += duration;
dchEnergy += energy;
dchTailEnergy += energy;
break;
case STATE_FACH:
fachTime += duration;
fachEnergy += energy;
break;
case TAIL_FACH:
fachTime += duration;
fachTailTime += duration;
fachTailEnergy += energy;
fachEnergy += energy;
break;
case PROMO_IDLE_DCH:
idleToDch++;
idleToDchTime += duration;
idleToDchEnergy += energy;
break;
case PROMO_FACH_DCH:
fachToDch++;
fachToDchTime += duration;
fachToDchEnergy += energy;
break;
default:
break;
}
}
double totalRRCEnergy = fachEnergy + dchEnergy + fachToDchEnergy + idleToDchEnergy + idleEnergy;
double bytes = totalBytes;
double joulesPerKilobyte = bytes != 0 ? totalRRCEnergy / (bytes / 1000.0) : 0.0;
statemachine.setDchEnergy(dchEnergy);
statemachine.setDchTailEnergy(dchTailEnergy);
statemachine.setDchTailTime(dchTailTime);
statemachine.setDchTime(dchTime);
statemachine.setFachEnergy(fachEnergy);
statemachine.setFachTailEnergy(fachTailEnergy);
statemachine.setFachTailTime(fachTailTime);
statemachine.setFachTime(fachTime);
statemachine.setFachToDch(fachToDch);
statemachine.setFachToDchEnergy(fachToDchEnergy);
statemachine.setFachToDchTime(fachToDchTime);
statemachine.setIdleEnergy(idleEnergy);
statemachine.setIdleTime(idleTime);
statemachine.setIdleToDch(idleToDch);
statemachine.setIdleToDchEnergy(idleToDchEnergy);
statemachine.setIdleToDchTime(idleToDchTime);
statemachine.setJoulesPerKilobyte(joulesPerKilobyte);
statemachine.setPacketsDuration(packetsDuration);
statemachine.setTotalRRCEnergy(totalRRCEnergy);
statemachine.setTraceDuration(traceDuration);
return statemachine;
}
use of com.att.aro.core.packetanalysis.pojo.RrcStateRange in project VideoOptimzer by attdevsupport.
the class RrcStateMachineFactoryImpl method getRRCStatesForTheTimeRange.
private List<RrcStateRange> getRRCStatesForTheTimeRange(List<RrcStateRange> rrcRanges, double beginTime, double endTime) {
List<RrcStateRange> filteredRRCStates = new ArrayList<RrcStateRange>();
boolean stateAdded = false;
for (RrcStateRange rrcRange : rrcRanges) {
if (rrcRange.getBeginTime() >= beginTime && rrcRange.getEndTime() <= endTime) {
filteredRRCStates.add(rrcRange);
} else if (rrcRange.getBeginTime() <= beginTime && rrcRange.getEndTime() <= endTime && rrcRange.getEndTime() > beginTime) {
filteredRRCStates.add(new RrcStateRange(beginTime, rrcRange.getEndTime(), rrcRange.getState()));
} else if (rrcRange.getBeginTime() <= beginTime && rrcRange.getEndTime() >= endTime) {
filteredRRCStates.add(new RrcStateRange(beginTime, endTime, rrcRange.getState()));
} else if (rrcRange.getBeginTime() >= beginTime && rrcRange.getBeginTime() < endTime && rrcRange.getEndTime() >= endTime && !stateAdded) {
filteredRRCStates.add(new RrcStateRange(rrcRange.getBeginTime(), endTime, rrcRange.getState()));
stateAdded = true;
}
}
return filteredRRCStates;
}
use of com.att.aro.core.packetanalysis.pojo.RrcStateRange in project VideoOptimzer by attdevsupport.
the class RrcStateMachineFactoryImpl method runLTERRcStatistics.
/**
* LTE RRC state time modification.
*/
private RrcStateMachineLTE runLTERRcStatistics(List<RrcStateRange> staterangelist, ProfileLTE profile, List<PacketInfo> packets, double totalBytes, double packetsDuration, double traceDuration) {
double totalRRCEnergy = 0, lteIdleTime = 0, lteIdleEnergy = 0, lteIdleToCRPromotionTime = 0;
double lteIdleToCRPromotionEnergy = 0, lteCrTime = 0, lteCrEnergy = 0, lteCrTailTime = 0;
double lteCrTailEnergy = 0, lteDrxShortTime = 0, lteDrxShortEnergy = 0, lteDrxLongTime = 0;
double lteDrxLongEnergy = 0;
for (RrcStateRange rrc : staterangelist) {
double duration = rrc.getEndTime() - rrc.getBeginTime();
double energy = profilefactory.energyLTE(rrc.getBeginTime(), rrc.getEndTime(), rrc.getState(), profile, packets);
totalRRCEnergy += energy;
switch(rrc.getState()) {
case LTE_IDLE:
lteIdleTime += duration;
lteIdleEnergy += energy;
break;
case LTE_PROMOTION:
lteIdleToCRPromotionTime += duration;
lteIdleToCRPromotionEnergy += energy;
break;
case LTE_CONTINUOUS:
lteCrTime += duration;
lteCrEnergy += energy;
break;
case LTE_CR_TAIL:
lteCrTime += duration;
lteCrTailTime += duration;
lteCrEnergy += energy;
lteCrTailEnergy += energy;
break;
case LTE_DRX_SHORT:
lteDrxShortTime += duration;
lteDrxShortEnergy += energy;
break;
case LTE_DRX_LONG:
lteDrxLongTime += duration;
lteDrxLongEnergy += energy;
break;
default:
break;
}
rrc.setEnergy(energy);
}
double bytes = totalBytes;
double joulesPerKilobyte = bytes != 0 ? totalRRCEnergy / (bytes / 1000.0) : 0.0;
RrcStateMachineLTE stmachine = new RrcStateMachineLTE();
stmachine.setJoulesPerKilobyte(joulesPerKilobyte);
stmachine.setLteCrEnergy(lteCrEnergy);
stmachine.setLteCrTailEnergy(lteCrTailEnergy);
stmachine.setLteCrTailTime(lteCrTailTime);
stmachine.setLteCrTime(lteCrTime);
stmachine.setLteDrxLongEnergy(lteDrxLongEnergy);
stmachine.setLteDrxLongTime(lteDrxLongTime);
stmachine.setLteDrxShortEnergy(lteDrxShortEnergy);
stmachine.setLteDrxShortTime(lteDrxShortTime);
stmachine.setLteIdleEnergy(lteIdleEnergy);
stmachine.setLteIdleTime(lteIdleTime);
stmachine.setLteIdleToCRPromotionEnergy(lteIdleToCRPromotionEnergy);
stmachine.setLteIdleToCRPromotionTime(lteIdleToCRPromotionTime);
stmachine.setPacketsDuration(packetsDuration);
stmachine.setTotalRRCEnergy(totalRRCEnergy);
stmachine.setTraceDuration(traceDuration);
return stmachine;
}
use of com.att.aro.core.packetanalysis.pojo.RrcStateRange in project VideoOptimzer by attdevsupport.
the class RrcStateRangeFactoryImplTest method Create3G_test8.
@Test
public void Create3G_test8() {
Profile3G profile3g = mock(Profile3G.class);
when(profile3g.getProfileType()).thenReturn(ProfileType.T3G);
when(profile3g.getIdleDchPromoAvg()).thenReturn(12000.0);
when(profile3g.getIdleDchPromoMin()).thenReturn(1000.0);
when(profile3g.getIdleDchPromoMax()).thenReturn(20000.0);
when(profile3g.getFachDchPromoAvg()).thenReturn(1000.0);
when(profile3g.getFachDchPromoMin()).thenReturn(2500.0);
when(profile3g.getFachDchPromoMax()).thenReturn(6000.0);
when(profile3g.getDchFachTimer()).thenReturn(5000.0);
when(profile3g.getFachIdleTimer()).thenReturn(10000.0);
double traceDuration = 2000.0;
List<PacketInfo> packetlist = new ArrayList<PacketInfo>();
when(pktInfoArray[0].getTimeStamp()).thenReturn(date.getTime() - 7500.0);
when(pktInfoArray[0].getDir()).thenReturn(PacketDirection.DOWNLINK);
when(pktInfoArray[0].getLen()).thenReturn(1000);
when(pktInfoArray[0].getStateMachine()).thenReturn(RRCState.PROMO_FACH_DCH);
packetlist.add(pktInfoArray[0]);
when(pktInfoArray[1].getTimeStamp()).thenReturn(date.getTime() + 10000.0);
when(pktInfoArray[1].getDir()).thenReturn(PacketDirection.DOWNLINK);
when(pktInfoArray[1].getLen()).thenReturn(1000);
when(pktInfoArray[1].getStateMachine()).thenReturn(RRCState.PROMO_IDLE_DCH);
packetlist.add(pktInfoArray[1]);
when(pktInfoArray[2].getTimeStamp()).thenReturn(date.getTime() + 15000.0);
when(pktInfoArray[2].getDir()).thenReturn(PacketDirection.DOWNLINK);
when(pktInfoArray[2].getLen()).thenReturn(1000);
when(pktInfoArray[2].getStateMachine()).thenReturn(RRCState.PROMO_IDLE_DCH);
packetlist.add(pktInfoArray[2]);
List<RrcStateRange> testList = rrcStateRangeFactory.create(packetlist, profile3g, traceDuration);
assertEquals(1, testList.size());
}
Aggregations