Commit 7757709c authored by hammad zafar's avatar hammad zafar
Browse files

resolve minor bugs in meep-vis-traffic-mgr package

parent 32a6da76
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -824,7 +824,8 @@ func (tm *TrafficMgr) PredictQosPerTrafficLoad(hour int32, inRsrp int32, inRsrq
	var predictedUserTraffic int32

	var rows *sql.Rows
	rows, err = tm.db.Query(`SELECT "` + timeRange + `" FROM ` + TrafficTable + ` WHERE poa_name = '` + poaName + `'`)
	log.Debug("Collecting traffic load pattern for the time range: " + timeRange)
	rows, err = tm.db.Query(`SELECT "` + timeRange + `" FROM ` + TrafficTable + ` WHERE poa_name = ($1)` + poaName)
	if err != nil {
		log.Error(err)
	}
@@ -890,12 +891,17 @@ func inTimeRange(hour int32) (key string) {
// It will be extended to contain average user load for all active cells and those calculations will be used in further refining the algorithm
func findReducedSignalStrength(inRsrp int32, inRsrq int32, users int32, averageLoad int32) (redRsrp int32, redRsrq int32, err error) {

	var propConstant float32

	// case: crowded area
	if users > averageLoad {
		log.Debug("The number of users: " + string(users) + "exceeds the overall average " + string(averageLoad) + "for this POA")
		diff := users - averageLoad
		propConstant := int32(1 / diff)
		redRsrp = propConstant * inRsrp
		redRsrq = propConstant * inRsrq
		propConstant = 1 / float32(diff)
		log.Debug("The original values of RSRP and RSRQ are %v and %v respectively", inRsrp, inRsrq)
		log.Debug("Reducing the values of RSRP and RSRQ with a factor of %v", propConstant)
		redRsrp = int32(propConstant * float32(inRsrp))
		redRsrq = int32(propConstant * float32(inRsrq))

		return redRsrp, redRsrq, nil