use of com.att.aro.core.packetanalysis.pojo.RrcStateMachine3G 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.RrcStateMachine3G in project VideoOptimzer by attdevsupport.
the class RrcStateMachineFactoryImplTest method create_T3GStateIsPROMO_FACH_DCH.
@Test
public void create_T3GStateIsPROMO_FACH_DCH() {
List<PacketInfo> packetlist1 = new ArrayList<PacketInfo>();
when(profilefactory.energy3G(any(double.class), any(double.class), any(RRCState.class), any(Profile3G.class))).thenReturn(100.0);
Profile3G profile15 = mock(Profile3G.class);
when(profile15.getProfileType()).thenReturn(ProfileType.T3G);
List<RrcStateRange> staterangelist = new ArrayList<RrcStateRange>();
RrcStateRange[] rrcStateRangeArray = new RrcStateRange[5];
for (int i = 0; i < 5; i++) {
rrcStateRangeArray[i] = mock(RrcStateRange.class);
when(rrcStateRangeArray[i].getState()).thenReturn(RRCState.PROMO_FACH_DCH);
when(rrcStateRangeArray[i].getBeginTime()).thenReturn((double) date.getTime() + 2 * i * 500);
when(rrcStateRangeArray[i].getEndTime()).thenReturn((double) date.getTime() + (2 * i + 1) * 500.0);
}
for (int i = 0; i < 5; i++) {
staterangelist.add(rrcStateRangeArray[i]);
}
when(staterange.create(any(ArrayList.class), any(Profile.class), any(double.class))).thenReturn(staterangelist);
RrcStateMachine3G rrcStateMachine3G = (RrcStateMachine3G) machineFactoryimpl.create(packetlist1, profile15, packetDuration, traceDuration, totalBytes * 100, null);
assertEquals(50.0, rrcStateMachine3G.getJoulesPerKilobyte(), 0.0);
assertEquals(5, rrcStateMachine3G.getFachToDch(), 0.0);
assertEquals(2500, rrcStateMachine3G.getFachToDchTime(), 0.0);
assertEquals(500, rrcStateMachine3G.getFachToDchEnergy(), 0.0);
}
use of com.att.aro.core.packetanalysis.pojo.RrcStateMachine3G in project VideoOptimzer by attdevsupport.
the class RrcStateMachineFactoryImplTest method create_T3GStateIsSTATE_DCH.
@Test
public void create_T3GStateIsSTATE_DCH() {
List<PacketInfo> packetlist1 = new ArrayList<PacketInfo>();
when(profilefactory.energy3G(any(double.class), any(double.class), any(RRCState.class), any(Profile3G.class))).thenReturn(100.0);
Profile3G profile11 = mock(Profile3G.class);
when(profile11.getProfileType()).thenReturn(ProfileType.T3G);
List<RrcStateRange> staterangelist = new ArrayList<RrcStateRange>();
RrcStateRange[] rrcStateRangeArray = new RrcStateRange[5];
for (int i = 0; i < 5; i++) {
rrcStateRangeArray[i] = mock(RrcStateRange.class);
when(rrcStateRangeArray[i].getState()).thenReturn(RRCState.STATE_DCH);
when(rrcStateRangeArray[i].getBeginTime()).thenReturn((double) date.getTime() + 2 * i * 500);
when(rrcStateRangeArray[i].getEndTime()).thenReturn((double) date.getTime() + (2 * i + 1) * 500.0);
}
for (int i = 0; i < 5; i++) {
staterangelist.add(rrcStateRangeArray[i]);
}
when(staterange.create(any(ArrayList.class), any(Profile.class), any(double.class))).thenReturn(staterangelist);
RrcStateMachine3G rrcStateMachine3G = (RrcStateMachine3G) machineFactoryimpl.create(packetlist1, profile11, packetDuration, traceDuration, totalBytes * 100, null);
assertEquals(50.0, rrcStateMachine3G.getJoulesPerKilobyte(), 0.0);
assertEquals(2500, rrcStateMachine3G.getDchTime(), 0.0);
assertEquals(500, rrcStateMachine3G.getDchEnergy(), 0.0);
}
use of com.att.aro.core.packetanalysis.pojo.RrcStateMachine3G in project VideoOptimzer by attdevsupport.
the class RRCStateMachineSimulationPanel3G method refresh.
@Override
public void refresh(AROTraceData model) {
RrcStateMachine3G stateMachine = (RrcStateMachine3G) model.getAnalyzerResult().getStatemachine();
String stringFormat = "%1.2f";
tabPanelCommon.setText(LabelKeys.rrc_dch, tabPanelCommon.getText(LabelKeys.rrc_valueAndPct, getRatioPercentString(stateMachine.getDchTailEnergy(), stateMachine.getDchTailRatio())));
tabPanelCommon.setText(LabelKeys.rrc_fach, tabPanelCommon.getText(LabelKeys.rrc_valueAndPct, getRatioPercentString(stateMachine.getFachTailEnergy(), stateMachine.getFachTailRatio())));
tabPanelCommon.setText(LabelKeys.rrc_idle, tabPanelCommon.getText(LabelKeys.rrc_valueAndPct, getRatioPercentString(stateMachine.getIdleTime(), stateMachine.getIdleTimeRatio())));
tabPanelCommon.setText(LabelKeys.rrc_idle2dch, tabPanelCommon.getText(LabelKeys.rrc_valueAndPct, getRatioPercentString(stateMachine.getIdleToDchTime(), stateMachine.getIdleToDchTimeRatio())));
tabPanelCommon.setText(LabelKeys.rrc_fach2dch, tabPanelCommon.getText(LabelKeys.rrc_valueAndPct, getRatioPercentString(stateMachine.getFachToDchTime(), stateMachine.getFachToDchTimeRatio())));
tabPanelCommon.setText(LabelKeys.rrc_dchTailRatio, String.format(stringFormat, stateMachine.getDchTailRatio()));
tabPanelCommon.setText(LabelKeys.rrc_fachTailRatio, String.format(stringFormat, stateMachine.getFachTailRatio()));
tabPanelCommon.setText(LabelKeys.rrc_promotionRatio, String.format(stringFormat, stateMachine.getPromotionRatio()));
}
use of com.att.aro.core.packetanalysis.pojo.RrcStateMachine3G in project VideoOptimzer by attdevsupport.
the class EnergyEfficiencySimulation3G method getRrcStateMachineValue.
private String[] getRrcStateMachineValue(PacketAnalyzerResult analyzerResult, LabelKeys labelKey, String[] valueString) {
RrcStateMachine3G rrcStateMachine = (RrcStateMachine3G) analyzerResult.getStatemachine();
Double originalValue = null;
valueString[0] = "";
switch(analyzerResult.getStatemachine().getType()) {
case Type3G:
switch(labelKey) {
case energy_dch:
originalValue = rrcStateMachine.getDchEnergy();
break;
case energy_fach:
originalValue = rrcStateMachine.getFachEnergy();
break;
case energy_idle:
originalValue = rrcStateMachine.getIdleEnergy();
break;
case energy_idle2dch:
originalValue = rrcStateMachine.getIdleToDchEnergy();
break;
case energy_fach2dch:
originalValue = rrcStateMachine.getFachToDchEnergy();
break;
case energy_dchTail:
originalValue = rrcStateMachine.getDchTailEnergy();
break;
case energy_fachTail:
originalValue = rrcStateMachine.getFachTailEnergy();
break;
case energy_rrcTotal:
originalValue = rrcStateMachine.getTotalRRCEnergy();
break;
case energy_jpkb:
originalValue = rrcStateMachine.getJoulesPerKilobyte();
break;
default:
break;
}
break;
default:
throw new AROUIPanelException("Bad rrc state machine machine type " + analyzerResult.getStatemachine().getType() + " for expected type of 3G");
}
if (originalValue != null) {
valueString[0] = String.format("%1.2f", originalValue);
}
return valueString;
}
Aggregations