Search in sources :

Example 1 with RrcStateMachine3G

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;
}
Also used : RrcStateMachine3G(com.att.aro.core.packetanalysis.pojo.RrcStateMachine3G) RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange)

Example 2 with RrcStateMachine3G

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);
}
Also used : RrcStateMachine3G(com.att.aro.core.packetanalysis.pojo.RrcStateMachine3G) RRCState(com.att.aro.core.packetanalysis.pojo.RRCState) ArrayList(java.util.ArrayList) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) Profile3G(com.att.aro.core.configuration.pojo.Profile3G) RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange) Profile(com.att.aro.core.configuration.pojo.Profile) BaseTest(com.att.aro.core.BaseTest) Test(org.junit.Test)

Example 3 with RrcStateMachine3G

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);
}
Also used : RrcStateMachine3G(com.att.aro.core.packetanalysis.pojo.RrcStateMachine3G) RRCState(com.att.aro.core.packetanalysis.pojo.RRCState) ArrayList(java.util.ArrayList) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) Profile3G(com.att.aro.core.configuration.pojo.Profile3G) RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange) Profile(com.att.aro.core.configuration.pojo.Profile) BaseTest(com.att.aro.core.BaseTest) Test(org.junit.Test)

Example 4 with RrcStateMachine3G

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()));
}
Also used : RrcStateMachine3G(com.att.aro.core.packetanalysis.pojo.RrcStateMachine3G)

Example 5 with RrcStateMachine3G

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;
}
Also used : RrcStateMachine3G(com.att.aro.core.packetanalysis.pojo.RrcStateMachine3G) AROUIPanelException(com.att.aro.ui.exception.AROUIPanelException)

Aggregations

RrcStateMachine3G (com.att.aro.core.packetanalysis.pojo.RrcStateMachine3G)13 RrcStateRange (com.att.aro.core.packetanalysis.pojo.RrcStateRange)9 BaseTest (com.att.aro.core.BaseTest)8 Profile (com.att.aro.core.configuration.pojo.Profile)8 Profile3G (com.att.aro.core.configuration.pojo.Profile3G)8 PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)8 ArrayList (java.util.ArrayList)8 Test (org.junit.Test)8 RRCState (com.att.aro.core.packetanalysis.pojo.RRCState)7 RrcStateMachineLTE (com.att.aro.core.packetanalysis.pojo.RrcStateMachineLTE)1 RrcStateMachineWiFi (com.att.aro.core.packetanalysis.pojo.RrcStateMachineWiFi)1 AROUIPanelException (com.att.aro.ui.exception.AROUIPanelException)1 TraceBenchmarkInfo (com.att.aro.ui.model.overview.TraceBenchmarkInfo)1