public void Dispose() { _deathStartedAt = null; _killedBy = null; _owner.OnCollision -= collision; _owner = null; ; }
public void CycleIsCollidingInBounds() { var gameConfig = new GameConfiguration(new CycleConfiguration(), new MapConfiguration()); var map = new Map(gameConfig.MapConfig); var startPosition = new Vector3(0, gameConfig.CycleConfig.Y_OFFSET, 0); var cycle = new Cycle(1, startPosition, new Vector3(1, 0, 0), Math.PI + Math.PI * .5, 0xff0000, map, gameConfig); var cycle2 = new Cycle(2, startPosition, new Vector3(1, 0, 0), Math.PI + Math.PI * .5, 0xff0000, map, gameConfig); var collisionChecker = new CollisionChecker(map); var startLocation = map.Utilities.ToMapLocation(startPosition); var cycles = new ConcurrentDictionary<long, Cycle>(); cycles.TryAdd(cycle.ID, cycle); cycles.TryAdd(cycle2.ID, cycle2); map.RegisterCycles(cycles); map[startLocation] = 2; collisionChecker.ValidateCollision(cycle); Assert.True(cycle.Colliding); map.Clear(); cycle.Colliding = false; map[startLocation] = -cycle.ID; collisionChecker.ValidateCollision(cycle); Assert.False(cycle.Colliding); map.Clear(); cycle.Colliding = false; map[startLocation] = 0; collisionChecker.ValidateCollision(cycle); Assert.False(cycle.Colliding); }
public void ValidateRequestedPosition(Cycle cycle) { var requestedLocation = _utilities.ToMapLocation(cycle.MovementController.RequestedPosition); // We only want to run logic against the cycle if it's potential new MovementController.HeadLocation has changed. if (!cycle.MovementController.HeadLocation.SameAs(requestedLocation)) { var newLocation = validateOutOfBounds(cycle.MovementController.HeadLocation, _utilities.ToMapLocation(cycle.MovementController.RequestedPosition)); newLocation = validateCycleCollisions(cycle.MovementController.HeadLocation, newLocation); // If our new location is now different from our request location, we need to change the confirmation, // otherwise we need to convert the newLocation to a position and confirm it that way. if (requestedLocation.SameAs(newLocation)) { cycle.MovementController.ConfirmPositionRequest(); } else { cycle.MovementController.ConfirmPositionRequest(_utilities.ToPosition(newLocation, cycle.MovementController.Position.y)); } } else { // If our position request has not differed from our current head location then just confirm it cycle.MovementController.ConfirmPositionRequest(); } }
public MapLocation GetCycleMapLocation(Cycle cycle) { // Normalize to the quadrant in which the cycle lies MapLocation quadrant = ToMapLocation(cycle.MovementController.GetLinePosition(cycle.MovementController.Position)); return quadrant; }
public static object[] BuildDeathPayload(Cycle cycle) { var payload = new DeathPayload { ID = cycle.ID, DiedAt = cycle.MovementController.Position, }; return _compressor.Compress(payload); }
public object[] Compress(Cycle cycle) { object[] result = new object[10]; setCollidableContractMembers(result, cycle); result[_cycleCompressionContract.TrailColor] = cycle.TrailColor; return result; }
public static object[] BuildCollisionPayload(Cycle cycle) { CollisionPayload payload = new CollisionPayload { ID = cycle.ID, CollidedAt = cycle.MovementController.Position }; return _compressor.Compress(payload); }
public void CyclePositionedCorrectlyInBounds() { var gameConfig = new GameConfiguration(new CycleConfiguration(), new MapConfiguration()); var map = new Map(gameConfig.MapConfig); var startPosition = new Vector3(0, gameConfig.CycleConfig.Y_OFFSET, 0); var cycle = new Cycle(1, startPosition, new Vector3(1, 0, 0), Math.PI + Math.PI * .5, 0xff0000, map, gameConfig); var requestValidator = new RequestValidator(map); cycle.MovementController.RequestedPosition = new Vector3(gameConfig.MapConfig.MAP_SIZE.Width * .5 + gameConfig.MapConfig.FLOOR_TILE_SIZE.Width * 10, gameConfig.CycleConfig.Y_OFFSET, 0); cycle.MovementController.HeadLocation = map.Utilities.ToMapLocation(cycle.MovementController.Position); requestValidator.ValidateRequestedPosition(cycle); Assert.True(cycle.MovementController.Position.SameAs(new Vector3(4950, gameConfig.CycleConfig.Y_OFFSET, 0))); Assert.True(map.Utilities.ToMapLocation(cycle.MovementController.Position).SameAs(new MapLocation(100, 199))); cycle.MovementController.Position = startPosition; cycle.MovementController.RequestedPosition = new Vector3(-gameConfig.MapConfig.MAP_SIZE.Width * .5 - gameConfig.MapConfig.FLOOR_TILE_SIZE.Width * 10, gameConfig.CycleConfig.Y_OFFSET, 0); cycle.MovementController.Velocity = new Vector3(-1, 0, 0); cycle.MovementController.HeadLocation = map.Utilities.ToMapLocation(cycle.MovementController.Position); cycle.MovementController.Rotation = Math.PI * .5; requestValidator.ValidateRequestedPosition(cycle); Assert.True(cycle.MovementController.Position.SameAs(new Vector3(-5000, gameConfig.CycleConfig.Y_OFFSET, 0))); Assert.True(map.Utilities.ToMapLocation(cycle.MovementController.Position).SameAs(new MapLocation(100, 0))); cycle.MovementController.Position = startPosition; cycle.MovementController.RequestedPosition = new Vector3(-gameConfig.MapConfig.MAP_SIZE.Width * .5, gameConfig.CycleConfig.Y_OFFSET, 0); var expected = cycle.MovementController.RequestedPosition.Clone(); cycle.MovementController.Velocity = new Vector3(-1, 0, 0); cycle.MovementController.HeadLocation = map.Utilities.ToMapLocation(cycle.MovementController.Position); cycle.MovementController.Rotation = Math.PI * .5; requestValidator.ValidateRequestedPosition(cycle); Assert.True(cycle.MovementController.Position.SameAs(expected)); Assert.True(map.Utilities.ToMapLocation(cycle.MovementController.Position).SameAs(new MapLocation(100, 0))); cycle.MovementController.Position = startPosition; cycle.MovementController.RequestedPosition = new Vector3(gameConfig.MapConfig.MAP_SIZE.Width * .25, gameConfig.CycleConfig.Y_OFFSET, 0); expected = cycle.MovementController.RequestedPosition.Clone(); cycle.MovementController.Velocity = new Vector3(1, 0, 0); cycle.MovementController.HeadLocation = map.Utilities.ToMapLocation(cycle.MovementController.Position); cycle.MovementController.Rotation = Math.PI + Math.PI * .5; requestValidator.ValidateRequestedPosition(cycle); Assert.True(cycle.MovementController.Position.SameAs(expected)); Assert.True(map.Utilities.ToMapLocation(cycle.MovementController.Position).SameAs(new MapLocation(100, 150))); cycle.MovementController.Position = startPosition; cycle.MovementController.RequestedPosition = startPosition; cycle.MovementController.HeadLocation = map.Utilities.ToMapLocation(cycle.MovementController.Position); requestValidator.ValidateRequestedPosition(cycle); Assert.True(cycle.MovementController.Position.SameAs(startPosition)); Assert.True(map.Utilities.ToMapLocation(cycle.MovementController.Position).SameAs(map.Utilities.ToMapLocation(startPosition))); }
public static object[] BuildMovementPayload(Cycle cycle, MovementFlag direction) { var payload = new MovementPayload { ID = cycle.ID, Direction = direction, Position = cycle.MovementController.Position }; return _compressor.Compress(payload); }
public void Dispose() { PendingMovement garbage; _owner = null; while (!_pendingMovements.IsEmpty) { _pendingMovements.TryDequeue(out garbage); } _pendingMovements = null; }
public void CycleIsCollidingOutOfBounds() { var gameConfig = new GameConfiguration(new CycleConfiguration(), new MapConfiguration()); var map = new Map(gameConfig.MapConfig); var startPosition = new Vector3(gameConfig.MapConfig.MAP_SIZE.Width * .5 + gameConfig.MapConfig.FLOOR_TILE_SIZE.Width * 10, gameConfig.CycleConfig.Y_OFFSET, 0); var cycle = new Cycle(1, startPosition, new Vector3(1, 0, 0), Math.PI + Math.PI * .5, 0xff0000, map, gameConfig); var collisionChecker = new CollisionChecker(map); collisionChecker.ValidateCollision(cycle); Assert.True(cycle.Colliding); cycle.Colliding = false; cycle.MovementController.Position = new Vector3(); collisionChecker.ValidateCollision(cycle); Assert.False(cycle.Colliding); }
public void CyclePositionedCorrectlyInBoundsAndColliding() { var gameConfig = new GameConfiguration(new CycleConfiguration(), new MapConfiguration()); var map = new Map(gameConfig.MapConfig); var startPosition = new Vector3(0, gameConfig.CycleConfig.Y_OFFSET, 0); var cycle = new Cycle(1, startPosition, new Vector3(1, 0, 0), Math.PI + Math.PI * .5, 0xff0000, map, gameConfig); var requestValidator = new RequestValidator(map); var collision = startPosition.Clone(); collision.x = gameConfig.MapConfig.MAP_SIZE.Width * .5 - gameConfig.MapConfig.FLOOR_TILE_SIZE.Width * 3; cycle.MovementController.RequestedPosition = new Vector3(gameConfig.MapConfig.MAP_SIZE.Width * .5 + gameConfig.MapConfig.FLOOR_TILE_SIZE.Width * 10, gameConfig.CycleConfig.Y_OFFSET, 0); cycle.MovementController.HeadLocation = map.Utilities.ToMapLocation(cycle.MovementController.Position); map[map.Utilities.ToMapLocation(startPosition)] = -cycle.ID; map[map.Utilities.ToMapLocation(collision)] = 5; requestValidator.ValidateRequestedPosition(cycle); Assert.True(cycle.MovementController.Position.SameAs(collision)); }
public void ValidateCollision(Cycle cycle) { var cycleLocation = _utilities.ToMapLocation(cycle.MovementController); // Check if we're out of bounds if (_utilities.OutOfBounds(cycleLocation)) { cycle.HandleCollisionWith(null); return; } long occupiedById = _map[cycleLocation]; if (occupiedById != 0 && occupiedById != -cycle.ID) // Check if we're colliding with something other than our head location { Cycle occupiedBy = _map.GetCycle(Math.Abs(occupiedById)); cycle.HandleCollisionWith(occupiedBy); } }
public void PushDataTo(CycleDataSet cycleDataSet) { CycleData cycleData; Cycle[] cycles; CycleDataGroup[] cycleDataGroups; cycleDataGroups = new CycleDataGroup[] { VA, VB, VC, IA, IB, IC }; cycles = new Cycle[cycleDataGroups.Length]; for (int i = 0; i < VA.ToDataGroup().Samples; i++) { cycleData = new CycleData(); cycles[0] = cycleData.AN.V; cycles[1] = cycleData.BN.V; cycles[2] = cycleData.CN.V; cycles[3] = cycleData.AN.I; cycles[4] = cycleData.BN.I; cycles[5] = cycleData.CN.I; for (int j = 0; j < cycles.Length; j++) { if (cycleDataGroups[j] == null) { continue; } cycles[j].RMS = cycleDataGroups[j].RMS[i].Value; cycles[j].Phase = cycleDataGroups[j].Phase[i].Value; cycles[j].Peak = cycleDataGroups[j].Peak[i].Value; cycles[j].Error = cycleDataGroups[j].Error[i].Value; } cycleDataSet[i] = cycleData; } }
public ActionResult MyCycles(int?id) { if ((Session["Logged"].Equals(true))) { int userId = (int)Session["UserId"]; User user = db.Users.Where(u => u.UserId == userId).Include(u => u.Requests).First(); //update session whether user still has an active request (request wasnt completed while logged in) if ((bool)Session["HasActiveRequest"]) { if (!db.Requests.Where(r => (r.UserId == user.UserId && r.State == 0)).Any()) { Session["HasActiveRequest"] = false; } } //go through usercycles, collect the cycle ids of the usercycles with same userid as this user List <int> cycleIds; cycleIds = db.UserCycles.Where(uc => uc.UserId == userId).Select(uc => uc.CycleId).ToList(); List <Cycle> cycles = db.Cycles.Where(c => cycleIds.Contains(c.CycleId)).ToList(); List <User> hosts = new List <User>(); if (Session["LockedInCycleID"] != null && Session["LockedInCycleID"].ToString() != "") { Cycle lockedCycle = db.Cycles.Find(Int32.Parse(Session["LockedInCycleID"].ToString())); cycles.Remove(lockedCycle); CyclesForUser userCycles = new CyclesForUser(user, cycles, lockedCycle); return(View(userCycles)); } else { CyclesForUser userCycles = new CyclesForUser(user, cycles, null); return(View(userCycles)); } } return(RedirectToAction("Error")); }
public void ProcessSections() { AcquistionStateChanged = false; ExtractTimeZone(); foreach (string[] s in Data[SecondaryTag.MULTIPLICITY]) { if (dataIndices.totalChannels == 0) { DoDataHeader(s); } else { Cycle c = Cycle.Parse(s, dataIndices, _TZ); MaxBins = Math.Max(MaxBins, c.BinLen); Cycles.Add(c); } } Data[SecondaryTag.MULTIPLICITY] = new List <string[]>(); // clear the majority of the file content from memory int seqnum = -1; foreach (string[] s in Sequences[SecondaryTag.MULTIPLICITY]) { if (seqnum < 0) { seqnum = 0; } else { Plateaux.Add(Plateau.Parse(s, Cycles)); } } if (Plateaux.Count > 0) { SetCurrentAcquireStateFromZFile(); } }
public async Task AddLimitInCustomerComplex() { //arrange var random = new Random(); var customer = LimitCustomer.Create($"ACESSO", $"document{random.Next(1000, 10000)}"); var limitLevel = LimitLevel.Create(LevelType.Card, 1000, 30); var cycle = Cycle.Create(CycleType.Transaction); cycle.AddLimitLevel(limitLevel); var limit = Limit.Create(LimitType.CashIn, FeatureType.TED); limit.AddCycle(cycle); var limitLevel2 = LimitLevel.Create(LevelType.Document, 1000, 30); var cycle2 = Cycle.Create(CycleType.Transaction); cycle2.AddLimitLevel(limitLevel2); var limit2 = Limit.Create(LimitType.CashIn, FeatureType.DOC); limit2.AddCycle(cycle2); customer.AddLimit(limit); await _repositoryCommand.SaveAsync(customer); //act customer.AddLimit(limit2); await _repositoryCommand.SaveAsync(customer); var customerFound = await _repositoryQuery.GetAsync(customer.Id); //assert Assert.NotNull(customerFound); Assert.Equal(customer.Id, customerFound.Id); Assert.True(customerFound.Limits.Count == 2); }
protected void LateUpdate() { #if UNITY_EDITOR Cycle.CheckRange(); Atmosphere.CheckRange(); Stars.CheckRange(); Day.CheckRange(); Night.CheckRange(); Sun.CheckRange(); Moon.CheckRange(); Light.CheckRange(); Clouds.CheckRange(); World.CheckRange(); Fog.CheckRange(); Ambient.CheckRange(); Reflection.CheckRange(); #endif SetupQualitySettings(); SetupSunAndMoon(); SetupScattering(); SetupRenderSettings(); SetupShaderProperties(); }
/// <summary> /// Evento al pulsar el botón modificar ciclo: /// Se instancia el formulario para modificar los datos /// del ciclo seleccionado. /// Si al cerrarse se ha modificado el ciclo, /// se actualiza el ciclo en la lista y en la tabla. /// </summary> private void ButtonModifyCycle_Click(object sender, EventArgs e) { if (this.dgvCycles.SelectedRows[0].Cells[0].Value != null) { //Recupera el Id del ciclo seleccionado int selectedId = int .Parse(this.dgvCycles.SelectedRows[0].Cells[0].Value .ToString()); //Recupera el ciclo Cycle cycle = this.cycles.FirstOrDefault(c => c.Id == selectedId); this.selectedCycle = cycle; ModifyCycleForm form = new ModifyCycleForm(cycle); form.OnCycleUpdatedDelegate += OnCycleUpdatedCallback; form.ShowDialog(); } else { new CustomErrorMessageWindow("Debes seleccionar un ciclo formativo antes.") .ShowDialog(); } }
unsafe static void RunValuesToResults(run_rec_ext run, Cycle cycle, Multiplicity key, MultiplicityCountingRes mcr) { cycle.seq = run.run_number; cycle.TS = TimeSpan.FromSeconds(run.run_count_time); // is not always whole seconds hn 10-1. cycle.Totals = (ulong)run.run_singles; cycle.SinglesRate = run.run_singles / run.run_count_time; // table lookup on the strings, so test status is correct string s = TransferUtils.str(run.run_tests, INCC.MAX_RUN_TESTS_LENGTH); QCTestStatus qcts = QCTestStatusExtensions.FromString(s); cycle.SetQCStatus(key, qcts); // creates entry if not found mcr.Totals = cycle.Totals; mcr.TS = cycle.TS; mcr.DeadtimeCorrectedSinglesRate.v = run.run_singles_rate; mcr.DeadtimeCorrectedDoublesRate.v = run.run_doubles_rate; mcr.DeadtimeCorrectedTriplesRate.v = run.run_triples_rate; mcr.RASum = (ulong)run.run_reals_plus_acc; mcr.ASum = (ulong)run.run_acc; mcr.efficiency = run.run_multiplicity_efficiency; mcr.mass = run.run_mass; mcr.multiAlpha = run.run_multiplicity_alpha; mcr.multiplication = run.run_multiplicity_mult; cycle.HighVoltage = run.run_high_voltage; // assign the hits to a single channel (0) cycle.HitsPerChannel[0] = run.run_singles; mcr.RawSinglesRate.v = run.run_singles_rate; mcr.RawDoublesRate.v = run.run_doubles_rate; mcr.RawTriplesRate.v = run.run_triples_rate; mcr.Scaler1.v = run.run_scaler1; mcr.Scaler2.v = run.run_scaler2; mcr.Scaler1Rate.v = run.run_scaler1_rate; mcr.Scaler2Rate.v = run.run_scaler2_rate; long index = 0; for (ulong i = 0; i < INCC.SR_EX_MAX_MULT; i++) { if (run.run_mult_acc[i] > 0 || run.run_mult_reals_plus_acc[i] > 0) { index = (long)i; } } mcr.MaxBins = (ulong)index + 1; mcr.MinBins = (ulong)index + 1; mcr.NormedAMult = new ulong[mcr.MaxBins]; mcr.RAMult = new ulong[mcr.MaxBins]; mcr.UnAMult = new ulong[mcr.MaxBins]; // was not setting these to the right values hn 10-2 for (ulong i = 0; i < (ulong)mcr.MaxBins; i++) { mcr.RAMult[i] = (ulong)run.run_mult_reals_plus_acc[i]; mcr.NormedAMult[i] = (ulong)run.run_mult_acc[i]; } mcr.RASum = run.run_reals_plus_acc; mcr.ASum = run.run_acc; mcr.AB.Resize((int)mcr.MaxBins); }
private void OKBtn_Click(object sender, EventArgs e) { ClipboardMonitor.OnClipboardChange -= new ClipboardMonitor.OnClipboardChangeEventHandler(ClipboardMonitor_OnClipboardChange); ClipboardMonitor.Stop(); // do not forget to stop ClearMeasCycles(); CycleList newCycles = new CycleList(); // NEXT: manual entry needs more work to get it completed, but you have a good start here Multiplicity key = new Multiplicity(ah.det.MultiplicityParams); // APluralityOfMultiplicityAnalyzers: expand in some logical manner, e.g. enable user to select the analyzer and related results for manual entry and assignment for (int i = 0; i < MAX_MANUAL_ENTRIES; i++) // hard-coded limits are ... lame { DataGridViewRow r = cyclesGridView.Rows[i]; if (r.Cells == null || (r.Cells[1].Value == null) || r.Cells[1].Value.ToString() == string.Empty) { break; } Cycle cycle = new Cycle(m_log); ulong tots = 0, r_acc = 0, acc = 0; ulong.TryParse(r.Cells[1].Value.ToString(), out tots); ulong.TryParse((string)r.Cells[2].FormattedValue, out r_acc); // FormattedValue gives "" instead of the null checked for in the conditional above ulong.TryParse((string)r.Cells[3].FormattedValue, out acc); newCycles.Add(cycle); cycle.Totals = tots; cycle.TS = new TimeSpan(0, 0, 0, 0, (int)(1000 * m_counttime)); // milliseconds permitted for LM and future cycle.SinglesRate = tots / m_counttime; cycle.SetQCStatus(key, QCTestStatus.Pass); cycle.seq = i + 1; MultiplicityCountingRes mcr = new MultiplicityCountingRes(key.FA, cycle.seq); cycle.CountingAnalysisResults.Add(key, mcr); mcr.Totals = cycle.Totals; mcr.TS = cycle.TS; mcr.ASum = acc; mcr.RASum = r_acc; // assign the hits to a single channel (0) cycle.HitsPerChannel[0] = tots; mcr.RawSinglesRate.v = cycle.SinglesRate; // no alpha-beta, mult bins, HV, doubles, triples, raw nor corrected } int seq = 0; foreach (Cycle cycle in newCycles) // add the necessary meta-data to the cycle identifier instance { seq++; cycle.UpdateDataSourceId(ConstructedSource.Manual, ah.det.Id.SRType, new DateTimeOffset(m_refDate.AddTicks(cycle.TS.Ticks * cycle.seq)), string.Empty); } NC.App.Opstate.Measurement.Add(newCycles); if (newCycles.Count > 0) { DialogResult = DialogResult.OK; } Close(); }
public void turnOff() { state = Cycle.Off; }
public void Put(int id, [FromBody] Cycle value) { var pesticide = service.Put <CycleValidator>(value); }
public Round(Cycle cycle) { this.cycle = cycle; }
public void DeletCycleByMonth(int Year, int Month, int CourtId, Cycle cycleId) { CycleReposotry.DeleteCycleByMonth(Year, Month, CourtId, cycleId); }
public CycleDeathHandler(Cycle owner) { _owner = owner; _deathStartedAt = null; _owner.OnCollision += collision; }
public Cycle(Cycle other) { CycleScore = other.CycleScore; Repeats = other.Repeats; MinDistance = other.MinDistance; _windows = new int[other._windows.Length]; other._windows.CopyTo(_windows, 0); _windowsPerScan = other._windowsPerScan; _pairingHistory = other._pairingHistory; // Copy shares PairingHistory with other. }
public PendingMovementManager(Cycle owner) { _owner = owner; _pendingMovements = new ConcurrentQueue<PendingMovement>(); }
public async Task Cycle(ISelector selector, Mix mix) { Cycle api = new Cycle(this.Identity); await api.Set(selector, mix); }
public void CyclePositionedCorrectlyWithCollisions() { var gameConfig = new GameConfiguration(new CycleConfiguration(), new MapConfiguration()); var map = new Map(gameConfig.MapConfig); var startPosition = new Vector3(0, gameConfig.CycleConfig.Y_OFFSET, 0); var cycle = new Cycle(1, startPosition, new Vector3(1, 0, 0), Math.PI + Math.PI * .5, 0xff0000, map, gameConfig); var requestValidator = new RequestValidator(map); var newPosition = startPosition.Clone(); var collision = startPosition.Clone(); newPosition.x += gameConfig.MapConfig.FLOOR_TILE_SIZE.Width * 5; collision.x += gameConfig.MapConfig.FLOOR_TILE_SIZE.Width * 3; cycle.MovementController.RequestedPosition = newPosition; cycle.MovementController.HeadLocation = map.Utilities.ToMapLocation(cycle.MovementController.Position); map[map.Utilities.ToMapLocation(cycle.MovementController)] = -cycle.ID; map[map.Utilities.ToMapLocation(collision)] = 5; requestValidator.ValidateRequestedPosition(cycle); Assert.True(cycle.MovementController.Position.SameAs(collision)); map.Clear(); newPosition = startPosition.Clone(); newPosition.x += gameConfig.MapConfig.FLOOR_TILE_SIZE.Width; cycle.MovementController.Position = startPosition; cycle.MovementController.RequestedPosition = newPosition; map[map.Utilities.ToMapLocation(startPosition)] = -cycle.ID; map[map.Utilities.ToMapLocation(newPosition)] = 5; requestValidator.ValidateRequestedPosition(cycle); Assert.True(cycle.MovementController.Position.SameAs(newPosition)); map.Clear(); newPosition = startPosition.Clone(); newPosition.x += gameConfig.MapConfig.FLOOR_TILE_SIZE.Width; cycle.MovementController.Position = startPosition; cycle.MovementController.RequestedPosition = newPosition; map[map.Utilities.ToMapLocation(startPosition)] = -cycle.ID; map[map.Utilities.ToMapLocation(newPosition)] = 5; newPosition.x += gameConfig.MapConfig.FLOOR_TILE_SIZE.Width; map[map.Utilities.ToMapLocation(newPosition)] = 5; newPosition.x -= gameConfig.MapConfig.FLOOR_TILE_SIZE.Width; requestValidator.ValidateRequestedPosition(cycle); Assert.True(cycle.MovementController.Position.SameAs(newPosition)); map.Clear(); newPosition = map.Utilities.ToPosition(new MapLocation(23, 173),gameConfig.CycleConfig.Y_OFFSET); cycle.MovementController.Position = map.Utilities.ToPosition(new MapLocation(25, 173), gameConfig.CycleConfig.Y_OFFSET); cycle.MovementController.RequestedPosition = newPosition; cycle.MovementController.HeadLocation = map.Utilities.ToMapLocation(cycle.MovementController.Position); cycle.MovementController.Velocity = new Vector3(0, 0, -1); cycle.MovementController.Rotation = 0; map[map.Utilities.ToMapLocation(startPosition)] = -cycle.ID; map[new MapLocation(24,173)] = 5; requestValidator.ValidateRequestedPosition(cycle); Assert.True(cycle.MovementController.Position.SameAs(map.Utilities.ToPosition(new MapLocation(24, 173), gameConfig.CycleConfig.Y_OFFSET))); }
public bool ReadyToMove(Cycle owner) { return !CurrentMapLocation.SameAs(owner.MovementController.HeadLocation) || owner.MovementController.Velocity.IsZero(); }
public void AddCycle(List <DateTime> list, Cycle caseType, int CourtId) { CycleReposotry.AddCycle(list, caseType, CourtId); }
/// <summary> /// Generate an isolation list containing multiplexed windows, attempting to minimize the number /// and frequency of repeated window pairings within each scan. /// </summary> /// <param name="writer">writer to write results</param> /// <param name="windowsPerScan">how many windows are contained in each scan</param> /// <param name="progressMonitor">progress monitor</param> private void WriteMultiplexedWindows(TextWriter writer, int windowsPerScan, IProgressMonitor progressMonitor) { int maxInstrumentWindows = Assume.Value(_maxInstrumentWindows); int windowCount = IsolationScheme.PrespecifiedIsolationWindows.Count; int cycleCount = maxInstrumentWindows / windowCount; double totalScore = 0.0; // Prepare to generate the best isolation list possible within the given time limit. var startTime = DateTime.Now; var cycle = new Cycle(windowCount, windowsPerScan); int cyclesGenerated = 0; ProgressStatus status = new ProgressStatus(Resources.AbstractDiaExporter_WriteMultiplexedWindows_Exporting_Isolation_List); progressMonitor.UpdateProgress(status); // Generate each cycle. for (int cycleNumber = 1; cycleNumber <= cycleCount; cycleNumber++) { // Update status. if (progressMonitor.IsCanceled) return; progressMonitor.UpdateProgress(status.ChangePercentComplete( (int) (DateTime.Now - startTime).TotalSeconds*100/CalculationTime).ChangeMessage( string.Format(Resources.AbstractDiaExporter_WriteMultiplexedWindows_Exporting_Isolation_List__0__cycles_out_of__1__, cycleNumber - 1, cycleCount))); double secondsRemaining = CalculationTime - (DateTime.Now - startTime).TotalSeconds; double secondsPerCycle = secondsRemaining / (cycleCount - cycleNumber + 1); var endTime = DateTime.Now.AddSeconds(secondsPerCycle); Cycle bestCycle = null; do { // Generate a bunch of cycles, looking for one with the lowest score. const int attemptCount = 50; for (int i = 0; i < attemptCount; i++) { cycle.Generate(cycleNumber); if (bestCycle == null || bestCycle.CycleScore > cycle.CycleScore) { bestCycle = new Cycle(cycle); if (bestCycle.CycleScore == 0.0) { cyclesGenerated += i + 1 - attemptCount; endTime = DateTime.Now; // Break outer loop. break; } } } cyclesGenerated += attemptCount; } while (DateTime.Now < endTime); // ReSharper disable PossibleNullReferenceException totalScore += bestCycle.CycleScore; WriteCycle(writer, bestCycle, cycleNumber); WriteCycleInfo(bestCycle, cycleNumber, cyclesGenerated, startTime); // ReSharper restore PossibleNullReferenceException } WriteTotalScore(totalScore); // Show 100% in the wait dialog. progressMonitor.UpdateProgress(status.ChangePercentComplete(100).ChangeMessage( string.Format(Resources.AbstractDiaExporter_WriteMultiplexedWindows_Exporting_Isolation_List__0__cycles_out_of__0__, cycleCount))); }
public IQueryable <DateTime> GetCycleDatesQuery(int courtID, Cycle cycle) { return(CycleReposotry.GetCycleDates(courtID, cycle)); }
public override void StartCycle(Cycle cycle, object param = null) { state.StartCycle(cycle); }
public bool Start() { if (Players.Count < 3) return false; GameSystem gameSystem = GameSystem.Instance; List<Type> roleTypes = gameSystem.GetRoleTypes(); //Assign roles AssignRoles(roleTypes); //Initialize game RoundCounter++; MyCycle = Cycle.Day; IsInProgress = true; //Iterate again after roles are finalized to setup the players and notify them. foreach (Player p in Players) { Role r = p.Role; string body = FlavorText.GetStartGameMessage(); body += FlavorText.Divider + "You have been assigned the role of <b>" + r.Name + "</b> and are on the <b>" + r.Team.Name + "</b> team.<br />"; body += r.Description + "<br />"; string teammates = ListTeammates(p); body += FlavorText.Divider + this.Help(p); body += FlavorText.Divider + this.Status(); p.Reset(); Gmail.MessagePlayer(p, this, body); } Summary.NewCycle(this); return true; }
/// <summary> /// Creates a new instance of the <see cref="Conductor"/> class. /// </summary> public Conductor() { V = new Cycle(); I = new Cycle(); }
public void Post([FromBody] Cycle value) { var pesticide = service.Post <CycleValidator>(value); }
// For debugging... private void WriteCycleInfo(Cycle cycle, int cycleNumber, int cyclesGenerated, DateTime startTime) { if (!DebugCycles) return; if (cycle.Repeats > 0) Console.WriteLine("Cycle {0}: score {1:0.00}, repeats {2}, minDistance {3}, at iteration {4}, {5:0.00} seconds", // Not L10N cycleNumber, cycle.CycleScore, cycle.Repeats, cycle.MinDistance, cyclesGenerated, (DateTime.Now - startTime).TotalSeconds); else Console.WriteLine("Cycle {0}: score {1:0.00}, at iteration {2}, {3:0.00} seconds", // Not L10N cycleNumber, cycle.CycleScore, cyclesGenerated, (DateTime.Now - startTime).TotalSeconds); }
private void Btn_start_Click_1(object sender, EventArgs e) { double mutationProbability = Convert.ToDouble(txb_mut_prob.Text, CultureInfo.InvariantCulture); int popCount = Convert.ToInt32(txb_pop_size.Text, CultureInfo.InvariantCulture); int iterations = Convert.ToInt32(txb_iter_count.Text, CultureInfo.InvariantCulture); var pop = new Population(popCount, Vertices.Count); int[][][] matrices = new int[functions][][]; for (int i = 0; i < functions; i++) { matrices[i] = MakePermutationsMatrix(i); } List <Cycle> pareto = new List <Cycle>(); Cycle[] bestCycles = new Cycle[functions]; ListViewItem[][] sums = new ListViewItem[functions][]; for (int k = 0; k < functions; k++) { pareto.Add(pop.GetBest(matrices[k])); bestCycles[k] = pop.GetBest(matrices[k]); sums[k] = new ListViewItem[iterations + 1]; sums[k][0] = new ListViewItem(); sums[k][0].Text = pop.Cycles.Sum(x => x.GetCost(matrices[k])).ToString(); } for (int i = 1; i <= iterations; i++) { pop = GeneticIteration.Next(pop, functions, matrices, mutationProbability); UpdatePareto(pareto, pop, matrices); for (int k = 0; k < functions; k++) { Cycle currentBest; if ((currentBest = pop.GetBest(matrices[k])).GetCost(matrices[k]) < bestCycles[k].GetCost(matrices[k])) { bestCycles[k] = currentBest; } sums[k][i] = new ListViewItem(); sums[k][i].Text = pop.Cycles.Sum(x => x.GetCost(matrices[k])).ToString(); } } List <ListViewCycle> paretoItems = new List <ListViewCycle>(); foreach (var item in pareto) { paretoItems.Add(new ListViewCycle() { Cycle = item, Text = $"{item.GetCyclesString()} : {item.GetCost(matrices[0])};{item.GetCost(matrices[1])};{item.GetCost(matrices[2])}" }); } listView4.Items.Clear(); listView4.Items.AddRange(paretoItems.ToArray()); label2.Text = bestCycles[0].GetCyclesString(); label3.Text = bestCycles[0].GetCost(matrices[0]).ToString(); label4.Text = bestCycles[1].GetCyclesString(); label5.Text = bestCycles[1].GetCost(matrices[1]).ToString(); label6.Text = bestCycles[2].GetCyclesString(); label7.Text = bestCycles[2].GetCost(matrices[2]).ToString(); listView1.Items.Clear(); listView1.Items.AddRange(sums[0]); listView2.Items.Clear(); listView2.Items.AddRange(sums[1]); listView3.Items.Clear(); listView3.Items.AddRange(sums[2]); }
/// <summary> /// Loop that reads the next bunch of scheduled tasks from the task service and processes them. /// </summary> /// <param name="state"></param> private void TaskProcessingOuterLoop(object state) { _Log.Debug("TaskProcessingOuterLoop entered"); int requeued = RequeuePendingMessages(_TaskManagerID); int schedulerDelay = 0; var refreshDelay = new Cycle(10, 9, delegate { ConfigUtils.RefreshAppSettings(); // get new settings from disk every 10 cycles schedulerDelay = Math.Max(20, ConfigUtils.GetInt("TaskSchedulerDelay", 2000)); }); var lateTaskDelay = new DelayCycle(ConfigUtils.GetTimeSpan("CheckForLateTasks", TimeSpan.FromHours(3)), CheckForLateTasks, true); if (requeued < 0) { _Log.ErrorFormat("Attention: Application service call via Task Service to ScheduledTask table failed. Task scheduler is not running!" + " Stop app service, restart gateway and then start app service."); } else { _Log.InfoFormat("Requeued " + requeued + " ScheduledTasks"); while (true) { try { refreshDelay.Notify(); int n = TaskProcessingInnerLoop(); int total = _QueueCache.Total(); _Log.DebugFormat("Enqueued {0} tasks => total {1}, sleep {2}ms", n, total, schedulerDelay); Thread.Sleep(schedulerDelay); lateTaskDelay.Notify(); } catch (Exception e) { ErrorHandler.HandleInternal(e); _Log.Error("Error - " + (e.InnerException != null ? e.InnerException.Message : e.Message)); Thread.Sleep(5000); } } } }
public void reset() { state = Cycle.Init; }
private static AnalogSection ParseAnalogSection(DateTime eventTime, string[] lines, ref int index) { const string CycleHeader = @"^\[\d+\]$"; AnalogSection analogSection = new AnalogSection(); int headerLineIndex; int firstDataLineIndex; int dataLineIndex; int triggerLineIndex; string[] headers = null; string[] fields = null; int analogEndIndex = -1; double[] analogs; double analog = 0.0; Cycle<DateTime> currentTimeCycle = null; List<Cycle<double>> currentCycles = null; string currentLine; int sampleCount = 0; int eventSample = -1; int firstCycleCount; long timePerSample; // Scan forward to the first line of data firstDataLineIndex = index; while (firstDataLineIndex < lines.Length) { fields = Regex.Split(lines[firstDataLineIndex], @"\s|>|\*").Where(s => s != string.Empty).ToArray(); if (fields.Length > 0 && double.TryParse(fields[0], out analog)) break; firstDataLineIndex++; } if (firstDataLineIndex >= lines.Length) return analogSection; // Scan backward to find the header line headerLineIndex = firstDataLineIndex - 1; while (headerLineIndex >= index) { headers = lines[headerLineIndex].Split((char[])null, StringSplitOptions.RemoveEmptyEntries); if (headers.Length == fields.Length) break; headerLineIndex--; } if (headerLineIndex < index) return analogSection; // Scan forward to either the trigger or the // largest current, whichever comes first, // and use it to determine the analogEndIndex triggerLineIndex = firstDataLineIndex; while (firstDataLineIndex < lines.Length) { currentLine = lines[triggerLineIndex++]; // If the current line is empty or it matches the cycle header, skip it if (string.IsNullOrWhiteSpace(currentLine) || Regex.IsMatch(currentLine, CycleHeader)) continue; // If the length of the current line is not within one character // of the length of the first data line, assume we have reached // the end of the section and stop scanning lines if (Math.Abs(currentLine.Length - lines[firstDataLineIndex].Length) > 1) break; // Check if this is the trigger row analogEndIndex = currentLine.IndexOf('>'); if (analogEndIndex >= 0) break; // Check if this is the largest current row analogEndIndex = currentLine.IndexOf('*'); if (analogEndIndex >= 0) break; } // If analogEndIndex is valid, parse the header row again if (analogEndIndex >= 0 && analogEndIndex < lines[headerLineIndex].Length) headers = lines[headerLineIndex].Remove(analogEndIndex).Split((char[])null, StringSplitOptions.RemoveEmptyEntries); // Generate analog channels from header row analogSection.AnalogChannels = headers .Select(header => new Channel<double>() { Name = header }) .ToList(); // Scan through the lines of data dataLineIndex = firstDataLineIndex; while (dataLineIndex < lines.Length) { currentLine = lines[dataLineIndex++]; // Empty lines or cycle headers indicate start of next cycle if (string.IsNullOrWhiteSpace(currentLine) || Regex.IsMatch(currentLine, CycleHeader)) { // Two empty lines in a row indicates the end of the section if ((object)currentCycles == null) break; currentCycles = null; continue; } // If the line does not indicate the start of a cycle, // check the length to make sure we are still in the analog section if (Math.Abs(currentLine.Length - lines[firstDataLineIndex].Length) > 1) break; // Parse this line as a line of data if (analogEndIndex >= 0 && analogEndIndex < currentLine.Length) currentLine = currentLine.Remove(analogEndIndex); analogs = currentLine .Split((char[])null, StringSplitOptions.RemoveEmptyEntries) .TakeWhile(field => double.TryParse(field, out analog)) .Select(field => analog) .ToArray(); // Remove analog channels whose values cannot be parsed as doubles while (analogSection.AnalogChannels.Count > analogs.Length) analogSection.AnalogChannels.RemoveAt(analogSection.AnalogChannels.Count - 1); // Ensure the existence of a list of cycles to hold the analog values if ((object)currentCycles == null) { currentCycles = analogSection.AnalogChannels.Select(channel => new Cycle<double>()).ToList(); for (int i = 0; i < currentCycles.Count; i++) analogSection.AnalogChannels[i].Cycles.Add(currentCycles[i]); } // Add the analogs to their respective cycles for (int i = 0; i < analogs.Length && i < currentCycles.Count; i++) currentCycles[i].Samples.Add(analogs[i]); // Determine whether this line represents the sample that triggered the event if (currentLine.Contains('>') || (eventSample == -1 && currentLine.Contains('*'))) eventSample = sampleCount; sampleCount++; index = dataLineIndex; } // If we did not find any samples marked with the // event time, assume it is the first sample if (eventSample < 0) eventSample = 0; // Determine the time per sample, in ticks firstCycleCount = analogSection.AnalogChannels.First().Cycles.First().Samples.Count; timePerSample = TimeSpan.TicksPerSecond / (60L * firstCycleCount); for (int i = 0; i < sampleCount; i++) { if ((i % firstCycleCount) == 0) { currentTimeCycle = new Cycle<DateTime>(); analogSection.TimeChannel.Cycles.Add(currentTimeCycle); } // Null reference not possible since 0 % firstCycleCount is 0 currentTimeCycle.Samples.Add(eventTime + TimeSpan.FromTicks(timePerSample * (i - eventSample))); } return analogSection; }
/// <summary> /// Callback cuando se crea un nuevo ciclo /// </summary> /// <param name="cycle"></param> private void OnCycleCreatedCallback(Cycle cycle) { this.cycles.Add(cycle); this.SortTable(); this.SelectLastCreatedCycle(cycle.Id); }
public RtpVersionModel() { Cycle = new Cycle(); }
/// <summary> /// Callback cuando se modifica un ciclo, actualiza el ciclo y la tabla /// </summary> /// <param name="cycle"></param> private void OnCycleUpdatedCallback(Cycle updatedCycle) { this.selectedCycle = updatedCycle; this.dgvCycles.SelectedRows[0].Cells[1].Value = updatedCycle.Name; this.dgvCycles.SelectedRows[0].Cells[2].Value = updatedCycle.Shift.Description; }
public void AddOrder(OrderToSave model) { var paintColorId = AddPaintColorToOrder <PaintColor>(model.PaintColorId, model.CustomColor); var artworkBeltGuardId = AddArtworkToOrder <ArtworkBeltGuard>(model.ArtworkBeltGuardId, model.ArtworkBeltGuardColor, model.ArtworkBeltGuardImageUrl); var artworkFlywheelId = AddArtworkToOrder <ArtworkFlywheel>(model.ArtworkFlywheelId, model.ArtworkFlywheelColor, model.ArtworkFlywheelImageUrl); var artworkFrameForkId = AddArtworkToOrder <ArtworkFrameFork>(model.ArtworkFrameForkId, model.ArtworkFrameForkColor, model.ArtworkFrameForkImageUrl); var IsChecked = false; var detail = new OrderDetail() { GrossPrice = model.GrossPrice, Discount = model.Discount, NetPrice = model.NetPrice, Comment = model.Comment, CustomerName = model.CustomerName, CreateSalesOrder = IsChecked, DateTimeAdded = DateTime.Now }; _orderDetailRepository.Create(detail); var cycle = new Cycle() { ModelId = GetIdByModelType(model.ModelType), HandlebarTypeId = model.HandlebarTypeId, PlasticsColorTypeId = model.PlasticsColorTypeId, SprintShiftTypeId = model.SprintShiftTypeId, PowerMeterTypeId = model.PowerMeterTypeId, PedalTypeId = model.PedalTypeId, ConsoleTypeId = model.ConsoleTypeId, SeatTypeId = model.SeatTypeId, PaintColorId = paintColorId, ArtworkBeltGuardId = artworkBeltGuardId.Value, ArtworkFlywheelId = artworkFlywheelId, ArtworkFrameForkId = artworkFrameForkId.Value }; _cycleRepository.Create(cycle); var order = new Order() { TabletHolderId = model.TabletHolderId, TabletHolderQuantity = model.TabletHolderQuantity, PhoneHolderId = model.PhoneHolderId, PhoneHolderQuantity = model.PhoneHolderQuantity, MediaShelfId = model.MediaShelfId, MediaShelfQuantity = model.MediaShelfQuantity, SeatPostId = model.SeatPostId, SeatPostQuantity = model.SeatPostQuantity, HandlebarPostId = model.HandlebarPostId, HandlebarPostQuantity = model.HandlebarPostQuantity, StagesDumbbellHolderId = model.StagesDumbbellHolderId, StagesDumbbellHolderQuantity = model.StagesDumbbellHolderQuantity, ApplicationUserId = System.Web.HttpContext.Current.User.Identity.GetUserId(), AerobarQuantity = model.AerobarQuantity, AerobarId = model.AerobarId, PlatesOneToSixtyId = model.PlatesOneToSixtyId, PlatesOneToSixtyQuntity = model.PlatesOneToSixtyQuntity, PlatesSixtyOneToHundredId = model.PlatesSixtyOneToHundredId, PlatesSixtyOneToHundredQuantity = model.PlatesSixtyOneToHundredQuantity, PlatesOneToEightyId = model.PlatesOneToEightyId, PlatesOneToEightyQuantity = model.PlatesOneToEightyQuantity, PlatesFiftyPeacesId = model.PlatesFiftyPeacesId, PlatesFiftyPeacesQuantity = model.PlatesFiftyPeacesQuantity, PlatesOneToThirtyId = model.PlatesOneToThirtyId, PlatesOneToThirtyQuantity = model.PlatesOneToThirtyQuantity, CycleQuantity = model.CycleQuantity }; _orderRepository.Create(order); _unitOfWork.Save(); }
private void Awake() { animator = GetComponent <Animator>(); Cycle = Cycle.Idle; AnimateAccordingToCycle(); }
public void Remove(Cycle cycle) { cycles.Remove(cycle);//base sur Cycle.Equals redefini Save(); }
public List <DateTime> GetCycleDates(int courtId, Cycle cycleId) { return(CycleReposotry.GetCycleDates(courtId, cycleId).ToList()); }
void AddTestDataCycle(int run, uint run_seconds, double run_count_time, Measurement meas, TestDataFile td, string pivot = "", int cfindex = -1) { Cycle cycle = new Cycle(datalog); try { cycle.UpdateDataSourceId(ConstructedSource.CycleFile, meas.Detector.Id.SRType, td.DTO.AddSeconds(run_seconds), td.Filename); cycle.seq = run; cycle.TS = TimeSpan.FromSeconds(run_count_time); // dev note: check if this is always only in seconds, or fractions of a second // hn -- 9/4/14 -- not integer for count time. Convert from double seconds here. // Joe still has force to int. bleck! /* init run tests */ cycle.SetQCStatus(meas.Detector.MultiplicityParams, QCTestStatus.None); // APluralityOfMultiplicityAnalyzers: creates entry if not found, expand from the single mult key from detector here meas.Add(cycle, cfindex); /* singles, reals + accidentals, accidentals */ string l = td.reader.ReadLine(); string[] zorks = l.Split((char[])null, StringSplitOptions.RemoveEmptyEntries); double[] v = new double[5]; for (int z = 0; z < 5; z++) { double d; bool b = double.TryParse(zorks[z], out d); if (b) { v[z] = d; } } cycle.Totals = (ulong)v[0]; MultiplicityCountingRes mcr = new MultiplicityCountingRes(meas.Detector.MultiplicityParams.FA, cycle.seq); // APluralityOfMultiplicityAnalyzers: expand when detector has multiple analyzers cycle.CountingAnalysisResults.Add(meas.Detector.MultiplicityParams, mcr); // APluralityOfMultiplicityAnalyzers: expand when detector has multiple analyzers mcr.AB.TransferIntermediates(meas.Detector.AB); // copy alpha beta onto the cycle's results mcr.Totals = cycle.Totals; mcr.TS = cycle.TS; mcr.ASum = v[4]; mcr.RASum = v[3]; mcr.Scaler1.v = v[1]; mcr.Scaler2.v = v[2]; cycle.SinglesRate = v[0] / run_count_time; // assign the hits to a single channel (0) cycle.HitsPerChannel[0] = cycle.Totals; mcr.RawSinglesRate.v = cycle.SinglesRate; /* number of multiplicity values */ string mv = td.reader.ReadLine(); ushort k = 0; ushort.TryParse(mv, out k); if (k == 0) // test data files require an entry with 1 bin set 0s for the absence of multiplicity, go figure { ctrllog.TraceEvent(LogLevels.Error, 440, "This" + pivot + " cycle " + run.ToString() + " has no good multiplicity data."); return; } mcr.MinBins = mcr.MaxBins = k; mcr.RAMult = new ulong[k]; mcr.NormedAMult = new ulong[k]; mcr.UnAMult = new ulong[k]; // todo: compute this /* multiplicity values */ for (ushort j = 0; j < k; j++) { string ra = td.reader.ReadLine(); string[] blorks = ra.Split((char[])null, StringSplitOptions.RemoveEmptyEntries); double[] ve = new double[2]; for (int z = 0; z < 2; z++) { double d; bool b = double.TryParse(blorks[z], out d); if (b) { ve[z] = d; } } mcr.RAMult[j] = (ulong)ve[0]; mcr.NormedAMult[j] = (ulong)ve[1]; } ctrllog.TraceEvent(LogLevels.Verbose, 5439, "Cycle " + cycle.seq.ToString() + pivot + ((mcr.RAMult[0] + mcr.NormedAMult[0]) > 0 ? " max:" + mcr.MaxBins.ToString() : " *")); } catch (Exception e) { ctrllog.TraceEvent(LogLevels.Warning, 33085, pivot + "cycle processing error {0} {1} {2}", run, e.Message, pivot); } }
public void DeletCycle(int Year, int CourtId, Cycle cycleId) { CycleReposotry.DeleteCycle(Year, CourtId, cycleId); }
public string VisitCycle(Cycle cycle) => $"{Tab}while {cycle.Condition.AcceptVisitor(this)} " + $"{cycle.Body.AcceptVisitor(this)}";
/// <summary> /// Creates a new instance of the <see cref="Conductor"/> class. /// </summary> /// <param name="cycleIndex">The index of the cycle to be calculated.</param> /// <param name="sampleRateDivisor">The value to divide from the sample rate to determine the starting location of the cycle.</param> /// <param name="frequency">The frequency of the sine wave during this cycle.</param> /// <param name="voltageData">The voltage data points.</param> /// <param name="currentData">The current data points.</param> public Conductor(int cycleIndex, int sampleRateDivisor, double frequency, MeasurementData voltageData, MeasurementData currentData) { int vStart = cycleIndex * (voltageData.SampleRate / sampleRateDivisor); int iStart = cycleIndex * (currentData.SampleRate / sampleRateDivisor); V = new Cycle(vStart, frequency, voltageData); I = new Cycle(iStart, frequency, currentData); }
private void NextCycle() { Summary.EndCycle(); if (ActiveCycle == Cycle.Day) { MyCycle = Cycle.Night; } else { MyCycle = Cycle.Day; RoundCounter++; Gmail.MessageAllPlayers(this, CycleTitle + " has begun, don't forget to vote for the player you want cast out, or vote no one."); } //Reset players foreach (Player p in Players) { p.Reset(); } Summary.NewCycle(this); }
public override void StartCycle(Cycle cycle, object param = null) { base.StartCycle(cycle, param); ResetProcessingCounters(); }
private static void dotest(int n, int expected) { Console.WriteLine("n: {0}, expected: {1}", n, expected); Assert.AreEqual(expected, Cycle.Running(n)); }
// ReSharper restore LocalizableElement private void WriteCycle(TextWriter writer, Cycle cycle, int cycleNumber) { // Record window pairing in this cycle. cycle.Commit(cycleNumber); foreach (int window in cycle) { WriteIsolationWindow(writer, IsolationScheme.PrespecifiedIsolationWindows[window]); } }