def createAllCEVars(scenario): allCEVarList = [] ceLength = len(scenario.cm.ceList) ceIdList = MiscUtil.range_exclusive(0, ceLength) channelList = MiscUtil.range_inclusive(1, 13) for ceId in ceIdList: strCEId = str(ceId) for channel in channelList: strChannel = str(channel) potencyList = MiscUtil.range_inclusive( 1, int(scenario.cm.ceList[ceId].maxPotency), 1) for potency in potencyList: strPotency = str(potency) varName = "CE_" + strCEId + "_" + strChannel + "_" + strPotency varDescription = "CE com id=" + strCEId + " usando canal=" + strChannel + " com potência=" + strPotency ceVar = DataStructures.LPVar(varName, varDescription) allCEVarList.append(ceVar) return allCEVarList
def createAllCEByChannelVars(scenario, allCEVarList): ceByChannelVarList = [] ceByChannelVarNameList = [] for ceVar in allCEVarList: ceVarNameSplit = ceVar.name.split('_') ceVarName = "CEs_NO_CANAL_" + ceVarNameSplit[2] if (ceVarName not in ceByChannelVarNameList): ceByChannelVarNameList.append(ceVarName) for ceVarName in ceByChannelVarNameList: ceByChannelVarList.append( DataStructures.LPVar( ceVarName, "Quantide de CEs no canal=" + ceVarName.split('_')[3])) return ceByChannelVarList