use of com.att.aro.core.packetanalysis.pojo.RrcStateRange in project VideoOptimzer by attdevsupport.
the class BurstCollectionAnalysisImpl method computeBurstEnergyRadioResource.
/**
* Computes the total burst energy.
* @return
*/
private double computeBurstEnergyRadioResource(List<RrcStateRange> rrcstaterangelist, List<Burst> burstCollection, Profile profile) {
List<RrcStateRange> rrcCollection = rrcstaterangelist;
int rrcCount = rrcCollection.size();
if (rrcCount == 0) {
return 0;
}
int pCount = 0;
double time2 = -1;
double totalEnergy = 0.0f;
Iterator<Burst> iter = burstCollection.iterator();
Burst currentBurst = iter.next();
double time1 = rrcCollection.get(0).getBeginTime();
while (true) {
Burst nextBurst = iter.hasNext() ? iter.next() : null;
time2 = nextBurst != null ? nextBurst.getBeginTime() : rrcCollection.get(rrcCount - 1).getEndTime();
double energy = 0.0f;
double activeTime = 0.0f;
while (pCount < rrcCount) {
RrcStateRange rrCntrl = rrcCollection.get(pCount);
if (rrCntrl.getEndTime() < time1) {
pCount++;
} else {
if (time2 > rrCntrl.getEndTime()) {
if (profile.getProfileType() == ProfileType.T3G) {
energy += profilefactory.energy3G(time1, rrCntrl.getEndTime(), rrCntrl.getState(), (Profile3G) profile);
} else if (profile.getProfileType() == ProfileType.LTE) {
energy += rrCntrl.getEnergy();
} else if (profile.getProfileType() == ProfileType.WIFI) {
energy += profilefactory.energyWiFi(time1, rrCntrl.getEndTime(), rrCntrl.getState(), (ProfileWiFi) profile);
}
if ((rrCntrl.getState() == RRCState.STATE_DCH || rrCntrl.getState() == RRCState.TAIL_DCH) || (rrCntrl.getState() == RRCState.LTE_CONTINUOUS || rrCntrl.getState() == RRCState.LTE_CR_TAIL) || (rrCntrl.getState() == RRCState.WIFI_ACTIVE || rrCntrl.getState() == RRCState.WIFI_TAIL)) {
activeTime += rrCntrl.getEndTime() - time1;
}
pCount++;
}
break;
}
}
while (pCount < rrcCount) {
RrcStateRange rrCntrl = rrcCollection.get(pCount);
if (rrCntrl.getEndTime() < time2) {
if (profile.getProfileType() == ProfileType.T3G) {
energy += profilefactory.energy3G(Math.max(rrCntrl.getBeginTime(), time1), rrCntrl.getEndTime(), rrCntrl.getState(), (Profile3G) profile);
} else if (profile.getProfileType() == ProfileType.LTE) {
energy += rrCntrl.getEnergy();
} else if (profile.getProfileType() == ProfileType.WIFI) {
energy += profilefactory.energyWiFi(Math.max(rrCntrl.getBeginTime(), time1), rrCntrl.getEndTime(), rrCntrl.getState(), (ProfileWiFi) profile);
}
if ((rrCntrl.getState() == RRCState.STATE_DCH || rrCntrl.getState() == RRCState.TAIL_DCH) || (rrCntrl.getState() == RRCState.LTE_CONTINUOUS || rrCntrl.getState() == RRCState.LTE_CR_TAIL) || (rrCntrl.getState() == RRCState.WIFI_ACTIVE || rrCntrl.getState() == RRCState.WIFI_TAIL)) {
activeTime += rrCntrl.getEndTime() - Math.max(rrCntrl.getBeginTime(), time1);
}
pCount++;
} else {
if (profile.getProfileType() == ProfileType.T3G) {
energy += profilefactory.energy3G(Math.max(rrCntrl.getBeginTime(), time1), time2, rrCntrl.getState(), (Profile3G) profile);
} else if (profile.getProfileType() == ProfileType.LTE) {
energy += rrCntrl.getEnergy();
} else if (profile.getProfileType() == ProfileType.WIFI) {
energy += profilefactory.energyWiFi(Math.max(rrCntrl.getBeginTime(), time1), time2, rrCntrl.getState(), (ProfileWiFi) profile);
}
if ((rrCntrl.getState() == RRCState.STATE_DCH || rrCntrl.getState() == RRCState.TAIL_DCH) || (rrCntrl.getState() == RRCState.LTE_CONTINUOUS || rrCntrl.getState() == RRCState.LTE_CR_TAIL) || (rrCntrl.getState() == RRCState.WIFI_ACTIVE || rrCntrl.getState() == RRCState.WIFI_TAIL)) {
activeTime += time2 - Math.max(rrCntrl.getBeginTime(), time1);
}
break;
}
}
currentBurst.setEnergy(energy);
totalEnergy += energy;
currentBurst.setActiveTime(activeTime);
time1 = time2;
if (nextBurst != null) {
currentBurst = nextBurst;
} else {
break;
}
}
return totalEnergy;
}
use of com.att.aro.core.packetanalysis.pojo.RrcStateRange in project VideoOptimzer by attdevsupport.
the class BurstCollectionAnalysisImpl method normalizeCore.
/**
* Method orginally found in whatif.cpp
*
* @param packets
* returns timestampList - List of doubles
*/
private Map<PacketInfo, Double> normalizeCore(List<PacketInfo> packets, List<RrcStateRange> rrcstaterangelist) {
// Step 1: Identify Promotions
List<RrcStateRange> promoDelays = new ArrayList<RrcStateRange>();
for (RrcStateRange rrc : rrcstaterangelist) {
RRCState state = rrc.getState();
if ((state == RRCState.PROMO_FACH_DCH) || (state == RRCState.PROMO_IDLE_DCH)) {
promoDelays.add(rrc);
}
}
Collections.sort(promoDelays);
PacketTimestamp[] timeStampList = new PacketTimestamp[packets.size()];
for (int i = 0; i < packets.size(); i++) {
timeStampList[i] = new PacketTimestamp(packets.get(i));
}
// Step 2: Remove all promo delays
int pdSize = promoDelays.size();
double timeStampShift = 0.0f;
int pdKey = 0;
// "in-the-middle" position
int pdMiddlePosKey = -1;
// How to initialize??
double middlePos = 0;
for (int i = 0; i < timeStampList.length; i++) {
double timeStamp = timeStampList[i].timestamp;
while (pdKey < pdSize && timeStamp >= promoDelays.get(pdKey).getEndTime() - EPS) {
if (pdMiddlePosKey != -1) {
// assert (pdMiddlePosKey == pdKey && i > 0 && promoDelays.get(pdKey).getEndTime() >= middlePos);
timeStampShift += promoDelays.get(pdKey).getEndTime() - middlePos;
pdMiddlePosKey = -1;
} else {
timeStampShift += promoDelays.get(pdKey).getEndTime() - promoDelays.get(pdKey).getBeginTime();
}
pdKey++;
}
if (pdKey < pdSize && (promoDelays.get(pdKey).getBeginTime() - EPS) < timeStamp && timeStamp < (promoDelays.get(pdKey).getEndTime() + EPS)) {
if (pdMiddlePosKey == -1) {
timeStampShift += timeStamp - promoDelays.get(pdKey).getBeginTime();
middlePos = timeStamp;
pdMiddlePosKey = pdKey;
} else {
// assert (pdMiddlePosKey == pdKey && i > 0);
// assert (timeStamp >= middlePos);
timeStampShift += timeStamp - middlePos;
middlePos = timeStamp;
}
}
timeStampList[i].timestamp = timeStampList[i].timestamp - timeStampShift;
// assert (i == 0 || timeStampList[i].timestamp >= timeStampList[i - 1].timestamp);
}
Map<PacketInfo, Double> result = new LinkedHashMap<PacketInfo, Double>(timeStampList.length);
for (int i = 0; i < timeStampList.length; ++i) {
result.put(timeStampList[i].packet, timeStampList[i].timestamp);
}
return result;
}
use of com.att.aro.core.packetanalysis.pojo.RrcStateRange in project VideoOptimzer by attdevsupport.
the class RrcStateMachineFactoryImpl method create.
@Override
public AbstractRrcStateMachine create(List<PacketInfo> packetlist, Profile profile, double packetDuration, double traceDuration, double totalBytes, TimeRange timerange) {
List<RrcStateRange> staterangelist = staterange.create(packetlist, profile, traceDuration);
if (timerange != null) {
staterangelist = this.getRRCStatesForTheTimeRange(staterangelist, timerange.getBeginTime(), timerange.getEndTime());
}
AbstractRrcStateMachine data = null;
if (profile.getProfileType() == ProfileType.T3G) {
data = run3GRRcStatistics(staterangelist, (Profile3G) profile, totalBytes, packetDuration, traceDuration);
} else if (profile.getProfileType() == ProfileType.LTE) {
data = runLTERRcStatistics(staterangelist, (ProfileLTE) profile, packetlist, totalBytes, packetDuration, traceDuration);
} else if (profile.getProfileType() == ProfileType.WIFI) {
data = runWiFiRRcStatistics(staterangelist, (ProfileWiFi) profile, totalBytes, packetDuration, traceDuration);
}
if (data != null) {
data.setStaterangelist(staterangelist);
}
return data;
}
use of com.att.aro.core.packetanalysis.pojo.RrcStateRange in project VideoOptimzer by attdevsupport.
the class RrcStateRangeFactoryImpl method create3G.
/**
* This method contains the main algorithm for creating the List of
* RrcStateRange for a 3G profile
*
* @param analysisData
* Analysis data
* @param profile
* 3G profile
* @return list of RRC State range values.
*/
private List<RrcStateRange> create3G(List<PacketInfo> packetlist, Profile3G profile, double traceDuration) {
List<PacketInfo> packetInfos = packetlist;
List<RrcStateRange> result = new ArrayList<RrcStateRange>();
if (packetInfos != null && !packetInfos.isEmpty()) {
// Get important profile info
double idleDchPromoAvg = profile.getIdleDchPromoAvg();
double idleDchPromoMin = profile.getIdleDchPromoMin();
double idleDchPromoMax = profile.getIdleDchPromoMax();
double fachDchPromoAvg = profile.getFachDchPromoAvg();
double fachDchPromoMin = profile.getFachDchPromoMin();
double fachDchPromoMax = profile.getFachDchPromoMax();
double dchFachTimer = profile.getDchFachTimer();
double fachIdleTimer = profile.getFachIdleTimer();
double timer = 0;
DchDemotionQueue dchDemotionQueue = new DchDemotionQueue(profile);
FachQueue fachQueue = new FachQueue(profile);
// Set up initial packet
PacketInfo prevPacket = packetInfos.get(0);
double currTimeStamp = prevPacket.getTimeStamp();
prevPacket.setStateMachine(RRCState.PROMO_IDLE_DCH);
// Add initial idle state
addStateRangeEx(result, 0, Double.MAX_VALUE, RRCState.STATE_IDLE, currTimeStamp);
for (int i = 1; i <= packetInfos.size(); ++i) {
PacketInfo packet;
PacketDirection dir;
int currLen;
if (i >= packetInfos.size()) {
// The last iteration of this loop
packet = null;
dir = PacketDirection.UPLINK;
currTimeStamp = Double.MAX_VALUE;
currLen = 0;
} else {
// Iteration on a packet
packet = packetInfos.get(i);
dir = packet.getDir();
currTimeStamp = packet.getTimeStamp();
currLen = packet.getLen();
}
double prevTimeStamp = (prevPacket == null ? 0.0 : prevPacket.getTimeStamp());
double deltaTime = currTimeStamp - prevTimeStamp;
// the next state to be determined
RRCState state = null;
RRCState promoState = (prevPacket == null ? RRCState.STATE_IDLE : prevPacket.getStateMachine());
if (promoState == RRCState.PROMO_IDLE_DCH || promoState == RRCState.PROMO_FACH_DCH) {
double promoAvg, promoMin, promoMax;
if (promoState == RRCState.PROMO_IDLE_DCH) {
promoAvg = idleDchPromoAvg;
promoMin = idleDchPromoMin;
promoMax = idleDchPromoMax;
} else {
promoAvg = fachDchPromoAvg;
promoMin = fachDchPromoMin;
promoMax = fachDchPromoMax;
}
if (dir == PacketDirection.UPLINK && timer + deltaTime <= promoMin) {
// Case
// 1
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, promoState, currTimeStamp);
state = promoState;
timer += deltaTime;
} else if (dir == PacketDirection.DOWNLINK && timer + deltaTime <= promoMin) {
// TODO: handle an error situation here: a DOWNLINK DCH
// packet follows "immediately" after a packet on
// FACH/IDLE
// promotion
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, promoState, currTimeStamp);
state = promoState;
timer += deltaTime;
} else if (timer + deltaTime <= promoMax) {
// Case 2
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, promoState, currTimeStamp);
state = RRCState.STATE_DCH;
dchDemotionQueue.init(currTimeStamp, currLen, dir);
} else if (timer + deltaTime <= promoAvg + dchFachTimer) {
// Case
// 3
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, promoAvg - timer, promoState, currTimeStamp);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.STATE_DCH, currTimeStamp);
state = RRCState.STATE_DCH;
dchDemotionQueue.init(currTimeStamp, currLen, dir);
} else if (timer + deltaTime <= promoAvg + dchFachTimer + fachIdleTimer) {
// 4
if (dir == PacketDirection.DOWNLINK) {
fachQueue.init();
if (fachQueue.simFACH(currTimeStamp, dir, currLen)) {
// FACH->DCH
double tMax0 = currTimeStamp - fachDchPromoAvg;
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, promoAvg - timer, promoState, tMax0);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, dchFachTimer, RRCState.TAIL_DCH, tMax0);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.STATE_FACH, tMax0);
// promoTime = tMax - tt;
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.PROMO_FACH_DCH, currTimeStamp);
state = RRCState.STATE_DCH;
dchDemotionQueue.init(currTimeStamp, currLen, dir);
} else {
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, promoAvg - timer, promoState, currTimeStamp);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, dchFachTimer, RRCState.TAIL_DCH, currTimeStamp);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.STATE_FACH, currTimeStamp);
state = RRCState.STATE_FACH;
}
} else {
// downlink
fachQueue.init();
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, promoAvg - timer, promoState, currTimeStamp);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, dchFachTimer, RRCState.TAIL_DCH, currTimeStamp);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.STATE_FACH, currTimeStamp);
if (fachQueue.simFACH(currTimeStamp, dir, currLen)) {
state = RRCState.PROMO_FACH_DCH;
timer = 0;
} else {
state = RRCState.STATE_FACH;
}
}
} else {
// case 5
if (dir == PacketDirection.UPLINK) {
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, promoAvg - timer, promoState, currTimeStamp);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, dchFachTimer, RRCState.TAIL_DCH, currTimeStamp);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, fachIdleTimer, RRCState.TAIL_FACH, currTimeStamp);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.STATE_IDLE, currTimeStamp);
state = RRCState.PROMO_IDLE_DCH;
timer = 0;
} else {
// downlink
double tMax0 = currTimeStamp - idleDchPromoAvg;
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, promoAvg - timer, promoState, tMax0);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, dchFachTimer, RRCState.TAIL_DCH, tMax0);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, fachIdleTimer, RRCState.TAIL_FACH, tMax0);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.STATE_IDLE, tMax0);
// promoTime = tMax - tt;
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.PROMO_IDLE_DCH, currTimeStamp);
state = RRCState.STATE_DCH;
dchDemotionQueue.init(currTimeStamp, currLen, dir);
}
}
// break;
} else if (promoState == RRCState.STATE_DCH) {
// ***
double dchTail = dchDemotionQueue.getDCHTail(currTimeStamp);
if (deltaTime <= dchTail + 1e-5) {
// DCH Case 1
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.STATE_DCH, currTimeStamp);
state = RRCState.STATE_DCH;
dchDemotionQueue.update(currTimeStamp, currLen, dir);
} else if (deltaTime <= dchTail + fachIdleTimer) {
// 2
if (dir == PacketDirection.DOWNLINK) {
// downlink
fachQueue.init();
if (fachQueue.simFACH(currTimeStamp, dir, currLen)) {
double tMax0 = currTimeStamp - fachDchPromoAvg;
changeStateRangeBack(result, dchFachTimer - dchTail, RRCState.TAIL_DCH);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, dchTail, RRCState.TAIL_DCH, tMax0);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.STATE_FACH, tMax0);
// promoTime = tMax - tt;
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.PROMO_FACH_DCH, currTimeStamp);
state = RRCState.STATE_DCH;
dchDemotionQueue.init(currTimeStamp, currLen, dir);
} else {
changeStateRangeBack(result, dchFachTimer - dchTail, RRCState.TAIL_DCH);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, dchTail, RRCState.TAIL_DCH, currTimeStamp);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.STATE_FACH, currTimeStamp);
state = RRCState.STATE_FACH;
}
} else {
// uplink
fachQueue.init();
changeStateRangeBack(result, dchFachTimer - dchTail, RRCState.TAIL_DCH);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, dchTail, RRCState.TAIL_DCH, currTimeStamp);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.STATE_FACH, currTimeStamp);
if (fachQueue.simFACH(currTimeStamp, dir, currLen)) {
state = RRCState.PROMO_FACH_DCH;
timer = 0;
} else {
state = RRCState.STATE_FACH;
}
}
} else {
// DCH Case 3
if (dir == PacketDirection.UPLINK) {
// uplink
changeStateRangeBack(result, dchFachTimer - dchTail, RRCState.TAIL_DCH);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, dchTail, RRCState.TAIL_DCH, currTimeStamp);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, fachIdleTimer, RRCState.TAIL_FACH, currTimeStamp);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.STATE_IDLE, currTimeStamp);
state = RRCState.PROMO_IDLE_DCH;
timer = 0;
} else {
// downlink
double tMax0 = currTimeStamp - idleDchPromoAvg;
changeStateRangeBack(result, dchFachTimer - dchTail, RRCState.TAIL_DCH);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, dchTail, RRCState.TAIL_DCH, tMax0);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, fachIdleTimer, RRCState.TAIL_FACH, tMax0);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.STATE_IDLE, tMax0);
// promoTime = tMax - tt;
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.PROMO_IDLE_DCH, currTimeStamp);
state = RRCState.STATE_DCH;
dchDemotionQueue.init(currTimeStamp, currLen, dir);
}
}
// break;
} else if (promoState == RRCState.STATE_FACH) {
if (deltaTime <= fachIdleTimer) {
if (dir == PacketDirection.UPLINK) {
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.STATE_FACH, currTimeStamp);
if (fachQueue.simFACH(currTimeStamp, dir, currLen)) {
state = RRCState.PROMO_FACH_DCH;
timer = 0;
} else {
state = RRCState.STATE_FACH;
}
} else {
// downlink
if (fachQueue.simFACH(currTimeStamp, dir, currLen)) {
double tMax0 = currTimeStamp - fachDchPromoAvg;
/*
* TODO: ( diff ) handle the case where promo
* delay is 0 ( for what - if )
*/
if (tMax0 > prevTimeStamp || fachDchPromoAvg < 1e-6) {
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.STATE_FACH, tMax0);
// promoTime = tMax - tt;
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.PROMO_FACH_DCH, currTimeStamp);
} else {
// *** handle an error situation here: a
// DOWNLINK DCH packet follows "immediately"
// after a packet on FACH
// try
tMax0 = currTimeStamp - fachDchPromoMin;
// y?
if (tMax0 > prevTimeStamp) {
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.STATE_FACH, tMax0);
// promoTime = tMax - tt;
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.PROMO_FACH_DCH, currTimeStamp);
} else {
// still not working - try to
// insert a
// promotion after some previous
// packet
boolean bFixed = false;
for (int ii = i - 1; ii > 0; ii--) {
PacketInfo earlierPacket = packetInfos.get(ii);
if (earlierPacket.getStateMachine() == RRCState.STATE_FACH) {
// FACH-DCH promo: from
// packets[ii].ts to
// packets[ii].ts+y
// DCH: from packets[ii].ts+y to
// tMax
double piTimeStamp = packetInfos.get(ii).getTimeStamp();
if (earlierPacket.getDir() == PacketDirection.UPLINK && currTimeStamp >= piTimeStamp + fachDchPromoMin) {
int resultSize = result.size() - 1;
// boolean bDone = false;
for (int jj = resultSize; jj > 0; jj--) {
// double EPS = 1e-4;
if (result.get(jj).getBeginTime() == piTimeStamp) {
for (int k = 0; k < resultSize - jj + 1; k++) {
result.remove(result.size() - 1);
}
double avgDchPromo;
if (currTimeStamp >= piTimeStamp + fachDchPromoAvg) {
avgDchPromo = fachDchPromoAvg;
} else {
avgDchPromo = fachDchPromoMin;
}
result.add(new RrcStateRange(piTimeStamp, piTimeStamp + avgDchPromo, RRCState.PROMO_FACH_DCH));
result.add(new RrcStateRange(piTimeStamp + avgDchPromo, prevTimeStamp, RRCState.STATE_DCH));
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.STATE_DCH, currTimeStamp);
break;
}
// #undef EPS
}
bFixed = true;
break;
}
} else {
break;
}
}
if (!bFixed) {
// still not working - force it on
// FACH
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.STATE_FACH, currTimeStamp);
state = RRCState.STATE_FACH;
fachQueue.init();
}
}
}
// finish handling the error case
state = RRCState.STATE_DCH;
dchDemotionQueue.init(currTimeStamp, currLen, dir);
} else {
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.STATE_FACH, currTimeStamp);
state = RRCState.STATE_FACH;
}
}
} else {
if (dir == PacketDirection.UPLINK) {
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, fachIdleTimer, RRCState.TAIL_FACH, currTimeStamp);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.STATE_IDLE, currTimeStamp);
state = RRCState.PROMO_IDLE_DCH;
timer = 0;
} else {
// downlink
double tMax0 = currTimeStamp - idleDchPromoAvg;
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, fachIdleTimer, RRCState.TAIL_FACH, tMax0);
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.STATE_IDLE, tMax0);
// promoTime = tMax - tt;
prevTimeStamp = addStateRangeEx(result, prevTimeStamp, Double.MAX_VALUE, RRCState.PROMO_IDLE_DCH, currTimeStamp);
state = RRCState.STATE_DCH;
dchDemotionQueue.init(currTimeStamp, currLen, dir);
}
}
}
if (packet != null) {
packet.setStateMachine(state);
}
prevPacket = packet;
}
}
result = compressStateRanges(result);
// Truncate state ranges at end of trace
Iterator<RrcStateRange> iter = result.iterator();
double prevTimeStamp = 0.0;
while (iter.hasNext()) {
RrcStateRange rrc = iter.next();
if (rrc.getBeginTime() >= traceDuration) {
iter.remove();
}
if (rrc.getEndTime() > traceDuration) {
rrc.setEndTime(traceDuration);
}
prevTimeStamp = rrc.getEndTime();
}
if (prevTimeStamp < traceDuration) {
// Add idle time to end of trace
result.add(new RrcStateRange(prevTimeStamp, traceDuration, RRCState.STATE_IDLE));
}
return result;
}
use of com.att.aro.core.packetanalysis.pojo.RrcStateRange in project VideoOptimzer by attdevsupport.
the class RrcStateRangeFactoryImpl method tailLTE.
/**
* Utility method that creates RRC state ranges for an LTE tail sequence.
*
* @param result
* List where state ranges will be added
* @param timer
* Time at which first packet was received for LTE continuous
* reception
* @param start
* Time at which last packet was received for LTE continuous
* reception and the tail sequence begins
* @param end
* Time at which tail sequence is stopped (either by new
* continuous reception state or end of trace).
* @param profile
* LTE profile being used to model state ranges
* @return The time at which the tail sequence was completed or stopped
*/
private static double tailLTE(List<RrcStateRange> result, double timer, double start, double end, ProfileLTE profile) {
double tailTime = timer;
double startTime = start;
// Add the continuous reception time
result.add(new RrcStateRange(tailTime, startTime, RRCState.LTE_CONTINUOUS));
// Check for CR tail time
tailTime = Math.min(startTime + profile.getInactivityTimer(), end);
if (tailTime > startTime) {
result.add(new RrcStateRange(startTime, tailTime, RRCState.LTE_CR_TAIL));
startTime = tailTime;
}
// Check for DRX short tail time
tailTime = Math.min(startTime + profile.getDrxShortTime(), end);
if (tailTime > startTime) {
result.add(new RrcStateRange(startTime, tailTime, RRCState.LTE_DRX_SHORT));
startTime = tailTime;
}
// Check for DRX long tail time
tailTime = Math.min(startTime + profile.getDrxLongTime(), end);
if (tailTime > startTime) {
result.add(new RrcStateRange(startTime, tailTime, RRCState.LTE_DRX_LONG));
startTime = tailTime;
}
return tailTime;
}
Aggregations