public Client(Credentials credentials, IEnvironment env = null) { if (credentials == null) { throw new ArgumentNullException(nameof(credentials)); } environment = env ?? Environments.Production; requester = new Requester(credentials, environment, null, this.apiVersion); Account = new AccountResource(requester); Balance = new BalanceResource(requester); Charges = new ChargeResource(requester); Customers = new CustomerResource(requester); Disputes = new DisputeResource(requester); Events = new EventResource(requester); Forex = new ForexResource(requester); Links = new LinkResource(requester); Occurrences = new OccurrenceResource(requester); Sources = new PaymentSourceResource(requester); Receipts = new ReceiptResource(requester); Recipients = new RecipientResource(requester); Refunds = new RefundResource(requester); Schedules = new ScheduleResource(requester); Tokens = new TokenResource(requester); Transactions = new TransactionResource(requester); Transfers = new TransferResource(requester); }
// Assumed predictions are up to date and therefore overwrite schedule's data public void UpdateIfPrediction(DepartureResponse departureData, ScheduleResource schedule, HashSet <PredictionResource> predictions) { // In schedules and predictions it looked like the tripId was the only unique id in both (should only be 1 returned) var scheduleTripId = schedule.relationships.trip.data.id; var prediction = predictions.FirstOrDefault(x => x.relationships.trip.data.id == scheduleTripId); if (prediction == null) { return; } // If train is not on time and has null departure time then departure time is set to "TBD" in the model if (!string.IsNullOrEmpty(prediction.attributes.status) && prediction.attributes.status != ON_TIME_STATUS && prediction.attributes.departure_time == null) { departureData.DepartureTime = "TBD"; } else if (prediction.attributes.departure_time != null) { departureData.DepartureTime = prediction.attributes.departure_time; } if (!string.IsNullOrEmpty(prediction.attributes.status)) { departureData.Status = prediction.attributes.status; } departureData.TrackNumber = ConvertStopIdToTrackNumber(prediction.relationships.stop.data.id); departureData.DirectionId = prediction.attributes.direction_id; }
public List<byte> TryApplyRes(ScheduleResource res, int RbNum, bool isEdgeUser) { if (isEdgeUser) { return this.TryApplyResEdgeUser(res, RbNum); } return this.TryApplyResCenterUser(res, RbNum); }
public byte GetNonFreqSelUserBeginSbIndex(IUlScheduleUser user, ScheduleResource res) { if (user.IsEdgeUser) {//ÈôÊDZßÑØÓû§Ôò¡¤¡¤¡¤ return this.GetFirstEdgeIndex(user, res); } return this.GetFirstCenterIndex(res); }
private List<byte> TryApplyResCenterUser(ScheduleResource res, int RbNum) { if (res.RbLists[0].Count >= RbNum) { return this.AssignCenterRes(res, RbNum); } return this.ReaveEdgeRes(res, RbNum); }
private byte GetSelCenterBeginSbIndex(ScheduleResource res, IUlSchuduleCarrier carrier) { if (res.RbLists[0].Count > 0) { return this.FindBeginRBIndex(res.RbLists[0], carrier); } return this.FindBeginRBIndex(res.RbLists[1], carrier); }
private List<byte> AssignEdgeRes(ScheduleResource res, int RbNum) { List<byte> list = new List<byte>(); for (int i = 0; i < RbNum; i++) { list.Add(res.RbLists[1][i].Index); } return list; }
protected override void InitRbList(ScheduleResource scheduleResourceIn, byte bandwidthRbNum, byte puschRbNumEdge, LteAlgParam algParameter) { List<RBData> centerRbDataList = new List<RBData>(); List<RBData> edgeRbDataList = new List<RBData>(); byte puschStartRbIndex = 0; byte puschEndRbIndex = Convert.ToByte((int)((puschStartRbIndex + (bandwidthRbNum - algParameter.UlPucchRbs)) - 1)); this.InitEdgeRbRes(puschStartRbIndex, puschRbNumEdge, edgeRbDataList); this.InitCenterRbRes(puschStartRbIndex, puschRbNumEdge, puschEndRbIndex, centerRbDataList); scheduleResourceIn.RbLists.Add(centerRbDataList); scheduleResourceIn.RbLists.Add(edgeRbDataList); }
private List<byte> ReaveEdgeRes(ScheduleResource res, int RbNum) { List<byte> indexList = new List<byte>(); int count = res.RbLists[1].Count; int num2 = RbNum - res.RbLists[0].Count; if (count >= num2) { this.AddLastNumsOfRbIndexToList(num2, res.RbLists[1], indexList); this.AddAllOfRbIndexToList(res.RbLists[0], indexList); } return indexList; }
public List<byte> TryApplyRes(ScheduleResource res, int RbNum, bool isEdgeUser) { List<byte> list = new List<byte>(); if (res.RbLists[0].Count >= RbNum) { for (int i = 0; i < RbNum; i++) { list.Add(res.RbLists[0][i].Index); } } return list; }
public byte GetFreqSelUserBeginSbIndex(IUlScheduleUser user, ScheduleResource res, IUlSchuduleCarrier carrier) { if (user.IsSameSiteEdgeUser) { return this.GetSelSSiteEdgeBeginRbIndex(res, carrier); } if (user.IsEdgeUser) { return this.GetSelDSiteEdgeBeginRbIndex(res, carrier); } return this.GetSelCenterBeginSbIndex(res, carrier); }
public static UlResAssignOutput FreqUserExpandRB(IUlScheduleUser user, IUlSchuduleCarrier carrier, ScheduleResource res, byte beginRbIndex, int userMaxRbNum, int tti) { List<byte> rbs = new List<byte>(); List<byte> centerRbs = new List<byte>(); List<byte> edgeRbs = new List<byte>(); res.RbLists[0].ForEach(delegate (RBData rb) { centerRbs.Add(rb.Index); }); res.RbLists[1].ForEach(delegate (RBData rb) { edgeRbs.Add(rb.Index); }); rbs.AddRange(centerRbs); rbs.AddRange(edgeRbs); rbs.Sort(); List<byte> list2 = new List<byte>(); list2.Add(beginRbIndex); res.RemoveRbRes(beginRbIndex); int idxLeft = rbs.FindIndex(delegate (byte rbIndex) { return rbIndex == beginRbIndex; }); int idxRight = idxLeft; bool flag = list2.Count < userMaxRbNum; bool canLeftExpand = true; bool canRightExpand = true; while (flag) { float maxValue = float.MaxValue; float inRight = float.MaxValue; canLeftExpand = (canLeftExpand && (idxLeft >= 1)) && (Math.Abs((int) (rbs[idxLeft - 1] - rbs[idxLeft])) == 1); if (canLeftExpand) { maxValue = carrier.UlRbInterferenceNoiseList[rbs[idxLeft - 1]]; } canRightExpand = (canRightExpand && (idxRight <= (rbs.Count - 2))) && (Math.Abs((int) (rbs[idxRight + 1] - rbs[idxRight])) == 1); if (canRightExpand) { inRight = carrier.UlRbInterferenceNoiseList[rbs[idxRight + 1]]; } byte num5 = GetExpandRbIndex(canLeftExpand, canRightExpand, ref idxLeft, ref idxRight, maxValue, inRight, rbs); if (num5 == 0xff) { break; } res.RemoveRbRes(num5); list2.Add(num5); flag = list2.Count < userMaxRbNum; } UlResAssignOutput output = new UlResAssignOutput(); output.RbIndexs = list2; return output; }
private byte GetFirstCenterIndex(ScheduleResource res) { byte index = 0; if (res.RbLists[0].Count > 0) { return res.RbLists[0][0].Index; } if (res.RbLists[1].Count > 0) { int count = res.RbLists[1].Count; index = res.RbLists[1][count - 1].Index; } return index; }
private byte GetFirstEdgeIndex(IUlScheduleUser user, ScheduleResource res) { byte num = 0; if (res.RbLists[1].Count > 0) { return res.RbLists[1][0].Index; } if (res.RbLists[0].Count <= 0) { return num; } int count = res.RbLists[0].Count; ISimulationCarrier sfSbStroNbr = user.SfSbStroNbr; if (this.ResConflict(user, sfSbStroNbr)) { return res.RbLists[0][0].Index; } return res.RbLists[0][count - 1].Index; }
// Get resource (branches or resources like projector/laptop/demo-tablet etc for a given branch) public JsonResult GetResources(string resourceView) { if (resourceView == null) { resourceView = "employees"; } var resourceData = new List <ScheduleResource>(); testHarness = utils.Load <TestHarness>(utils.GetTestFileLocation()); if (resourceView.ToLower() == "employees") { foreach (var branch in testHarness.Branches) { var res = new ScheduleResource(); res.id = branch.BranchOfficeID; res.title = branch.Name; foreach (var employee in branch.Employees) { var employeeRes = new ScheduleResource(); employeeRes.id = employee.EmployeeID; employeeRes.title = employee.FullName; res.children.Add(employeeRes); } resourceData.Add(res); } } else if (resourceView.ToLower() == "equipment") { foreach (var equipment in testHarness.Equipment) { var res = new ScheduleResource(); res.id = equipment.id; res.title = equipment.title; resourceData.Add(res); } } return(Json(resourceData, JsonRequestBehavior.AllowGet)); }
public Client(Credentials credentials) { if (credentials == null) { throw new ArgumentNullException(nameof(credentials)); } requester = new Requester(credentials); Account = new AccountResource(requester); Balance = new BalanceResource(requester); Charges = new ChargeResource(requester); Customers = new CustomerResource(requester); Disputes = new DisputeResource(requester); Events = new EventResource(requester); Links = new LinkResource(requester); Occurrences = new OccurrenceResource(requester); Recipients = new RecipientResource(requester); Refunds = new RefundResource(requester); Schedules = new ScheduleResource(requester); Tokens = new TokenResource(requester); Transactions = new TransactionResource(requester); Transfers = new TransferResource(requester); }
public static List<byte> AssignRBLocation(IUlScheduleUser user, ScheduleResource res, byte beginIndex, int userMaxRbNumM) { int num2; int num3; List<RBData> list = new List<RBData>(res.RbLists[1]); list.Reverse(); list.InsertRange(0, res.RbLists[0]); List<byte> list2 = new List<byte>(); int num = 1; list2.Add(beginIndex); if (list[0].Index == beginIndex) { num2 = 0; num3 = 1; } else { num2 = list.Count - 1; num3 = -1; } res.RemoveRbRes(beginIndex); for (num = 2; num <= userMaxRbNumM; num++) { if ((((num2 + num3) >= 0) && ((num2 + num3) < list.Count)) && (((list[num2].Index + 1) == list[num2 + num3].Index) || ((list[num2].Index - 1) == list[num2 + num3].Index))) { num2 += num3; byte index = list[num2].Index; list2.Add(index); res.RemoveRbRes(index); } else { return list2; } } return list2; }
public static UlResAssignOutput NonFreqUserExpandRB(IUlScheduleUser user, ScheduleResource res, byte beginIndex, int userMaxRbNumM, int TTI, float mcsEff, float userAvgSinr) { float num = UlScheduleTools.CalcTBSAvailable(user, TTI); UlResAssignOutput output = new UlResAssignOutput(); if ((userMaxRbNumM >= 1) && (mcsEff > 0f)) { output.RbIndexs = AssignRBLocation(user, res, beginIndex, userMaxRbNumM); } float num2 = UlScheduleTools.calBETBS(user, mcsEff, (float) output.RbIndexs.Count, user.MIMOClutterGain); output.realTBS = Math.Min(num2, num); output.RBNum = output.RbIndexs.Count; if (user.IsSinrAdjusted) { output.FinalSinr = userAvgSinr; } else { output.FinalSinr = userAvgSinr + user.RandomSinr; } output.MeasureSinr = userAvgSinr; output.TBSAvailable = num; return output; }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // instantiate storage objects schoolschedule = new ScheduleResource(); departments = new List <Department>(4); // instantiate forms mainForm = new frmMain(); splashForm = new frmSplash(); AddClassForm = new frmAddClass(); UpdateClassForm = new form_UpdateClass(); configurationForm = new form_ConfigureConnection(); // Run program based on decision if (Properties.Settings.Default.ip_address != ".") { _CONTROL_form = splashForm; try { // Instantiate other objects. // Check whether user has custom sql server authentication details (userid and password). // If true, use the custom user id and password. if (File.Exists(string.Concat(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "ACRACS-Schedule"), @"\config.dbc"))) { // Create a new sqlConnection object with the specified instance name. if (File.Exists(string.Concat(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "ACRACS-Schedule"), @"\config_instance.dbc"))) { dbConnection = new SqlConnection(string.Concat(@"Data Source=", ACRACS___Schedule.Properties.Settings.Default.ip_address, @"\", File.ReadAllText(string.Concat(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "ACRACS-Schedule"), @"\config_instance.dbc")), ",1433;Network Library=DBMSSOCN;Initial Catalog=db_ACRACS;User ID=", File.ReadAllText(string.Concat(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "ACRACS-Schedule"), @"\config.dbc")).Split('\t')[0], ";Password="******"ACRACS-Schedule"), @"\config.dbc")).Split('\t')[1])); } // Create a new sqlConnection object with the default sql server name. else { dbConnection = new SqlConnection(string.Concat(@"Data Source=", ACRACS___Schedule.Properties.Settings.Default.ip_address, @",1433;Network Library=DBMSSOCN;Initial Catalog=db_ACRACS;User ID=", File.ReadAllText(string.Concat(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "ACRACS-Schedule"), @"\config.dbc")).Split('\t')[0], ";Password="******"ACRACS-Schedule"), @"\config.dbc")).Split('\t')[1])); } } // If false, use the default user id and password (userId: sa, password: pass). else { // Create a new sqlConnection object with the specified instance name & with the default user id and password. if (File.Exists(string.Concat(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "ACRACS-Schedule"), @"\config_instance.dbc"))) { dbConnection = new SqlConnection(string.Concat(@"Data Source=", ACRACS___Schedule.Properties.Settings.Default.ip_address, @"\", File.ReadAllText(string.Concat(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "ACRACS-Schedule"), @"\config_instance.dbc")), ",1433;Network Library=DBMSSOCN;Initial Catalog=db_ACRACS;User ID=sa;Password=admin")); } // Create a new sqlConnection object with the default sql server name & with the default user id and password. else { dbConnection = new SqlConnection(string.Concat(@"Data Source=", ACRACS___Schedule.Properties.Settings.Default.ip_address, ",1433;Network Library=DBMSSOCN;Initial Catalog=db_ACRACS;User ID=sa;Password=admin")); } } // // Retrieve departments // departments.Clear(); using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = dbConnection; cmd.CommandText = "SELECT * FROM tbl_Department"; cmd.Connection.Open(); dr = cmd.ExecuteReader(); while (dr.Read()) { departments.Add(new Department(dr[0].ToString(), dr[1].ToString())); } dr.Close(); dr.Dispose(); cmd.Connection.Close(); } } catch (Exception ex) { MessageBox.Show(string.Concat("An unexpected error has occured:\n\n", ex.Message, "\n\nPlease recheck your database configuration."), "Error occured", MessageBoxButtons.OK, MessageBoxIcon.Error); LogError(ex, new Form()); _CONTROL_form = configurationForm; configurationForm.isControlForm = true; if (dr != null) { if (!dr.IsClosed) { dr.Close(); } } dbConnection.Close(); } } else { _CONTROL_form = configurationForm; configurationForm.isControlForm = true; } Application.Run(_CONTROL_form); }
private byte GetBeginSbIndex(IUlScheduleUser user, ScheduleResource res, IUlSchuduleCarrier carrier, bool isFreqSelUser) { if (isFreqSelUser) {//若是频选用户则··· return this.m_UserBeginSbApplyer.GetFreqSelUserBeginSbIndex(user, base.ScheduleRes, base.SimulationCarrier); } return this.m_UserBeginSbApplyer.GetNonFreqSelUserBeginSbIndex(user, base.ScheduleRes); }
/// <summary> /// 上行频域资源调度 /// </summary> /// <param name="curTTI"></param> public void Process(short curTTI) { this.m_TTI = curTTI; int ulTargetLoadRb = this.m_UlTargetLoadRb; //小区资源初始化,中心频点开始有56个Rb用于资源传输 this.m_ScheduleRes = this.m_ResBuilder.InitRes(this.m_ResourceTemplate, this.SimulationCarrier); this.InitUsers(); this.InitDicInfo(); this.InitUserSinrThresh(this.m_SimulationCarrier.UlDataWaitUserList); BuilderOut userQueues = this.BuildScheduleSemiPersistQueue(ulTargetLoadRb); //语音业务用户调度 this.m_SemiPersistScheduler.DoSchedule(ref ulTargetLoadRb, userQueues); UlScheduleTools.UpdatePriorityGene(this.m_SimulationCarrier.SchedulePolicy, this.m_SimulationCarrier.UlDataWaitUserList, this.TTI); BuilderOut out2 = this.BuildScheduleBEQueue(ulTargetLoadRb); //数据业务用户调度 this.m_BEScheduler.DoSchedule(ref ulTargetLoadRb, out2); //计算此时调度完小区的负载,根据Rb资源来计算 float num2 = ((float) ((this.m_UlTargetLoadRb - ulTargetLoadRb) + this.m_SimulationCarrier.AlgParameter.UlPucchRbs)) / ((float) this.m_SimulationCarrier.BandWidthRbNum); this.m_SimulationCarrier.UlActualLoad = num2; this.m_SimulationCarrier.UlActualUsedRbNum = (this.m_UlTargetLoadRb - ulTargetLoadRb) + this.m_SimulationCarrier.AlgParameter.UlPucchRbs; this.m_ScheduleRes = null; }
private void InitResourceTemplate(Dictionary<string, ScheduleResource> resourceTemplateDic) { string key = string.Format("{0}-{1}-{2}-{3}", new object[] { this.m_SimulationCarrier.BandWidthRbNum, this.m_SimulationCarrier.AlgParameter.UlPucchRbs, this.m_SimulationCarrier.AlgParameter.UlEdgeUserFreNum, this.m_SimulationCarrier.IsUlIcicOn }); if (!resourceTemplateDic.TryGetValue(key, out this.m_ResourceTemplate)) { this.m_ResourceTemplate = this.m_ResBuilder.InitResTemplet(this.m_SimulationCarrier.BandWidthRbNum, this.m_SimulationCarrier.AlgParameter); resourceTemplateDic.Add(key, this.m_ResourceTemplate); } }
private byte GetSelSSiteEdgeBeginRbIndex(ScheduleResource res, IUlSchuduleCarrier carrier) { List<RBData> resList = new List<RBData>(); resList.AddRange(res.RbLists[0]); resList.AddRange(res.RbLists[1]); return this.FindBeginRBIndex(resList, carrier); }
public static ScheduleResourceAddRequestBuilder Add(ScheduleResource scheduleResource) { return(new ScheduleResourceAddRequestBuilder(scheduleResource)); }
public static ScheduleResourceUpdateRequestBuilder Update(int scheduleResourceId, ScheduleResource scheduleResource) { return(new ScheduleResourceUpdateRequestBuilder(scheduleResourceId, scheduleResource)); }