public static SimulationResult Simulate(Topology.Topology topology, int maxSimulationSteps) { var state = InitState(topology); var stateList = new List <SchemeState>(); for (var i = 0; i < maxSimulationSteps; i++) { state = Step(state, false); stateList.Add(state); } return(new SimulationResult(stateList)); }
private void сохранитьToolStripMenuItem_Click(object sender, EventArgs e) { try { Topology.Topology topology = topologyBuilder.ToTopology(); TopologySaverAndLoader.Save(fullFilePath, topology); MessageBox.Show("Топология сохраненена в\n" + fullFilePath); } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void сохранитьКакToolStripMenuItem_Click(object sender, EventArgs e) { SaveFileDialog sfd = new SaveFileDialog { DefaultExt = TopologySaverAndLoader.DotExt, Filter = TopologySaverAndLoader.Filter }; if (sfd.ShowDialog() == DialogResult.OK) { fullFilePath = sfd.FileName; Topology.Topology topology = topologyBuilder.ToTopology(); TopologySaverAndLoader.Save(fullFilePath, topology); } }
internal static MappedTopology MapTopology(ModelingForm modelingForm, Topology.Topology topology, TrafficFlow trafficFlow) { _modelingForm = modelingForm; _topology = topology; ModelSettings.SetUpModelSettings(trafficFlow); _mappedTopology = new MappedTopology(); ElementPictureBoxProducer.SetUpElementPictureBoxProducer(modelingForm, _mappedTopology); SetupPlaygroundPanel(); SetupServiceArea(); DestinationPointsDefiner.DefineElementsPoints(_mappedTopology); return(_mappedTopology); }
public SchemeState(Topology.Topology topology) { Gates = topology.Gates.ToDictionary(x => x, x => new GateState(x, false)); Nodes = topology.Nodes.ToDictionary(x => x, x => new NodeState(x, false)); InputPins = topology.Pins.Where(x => !x.IsOutputPin).ToArray(); OutputPins = topology.Pins.Where(x => x.IsOutputPin).ToArray(); PinNodes = topology.Pins.ToDictionary( p => p, p => (IReadOnlyList <SchemeNode>)topology.Nodes.Where(n => n.Pins.Contains(p)).ToArray()); InputPinStates = InputPins.ToDictionary(x => x, x => new PinState(x, false, x.ValuesFunction.Begin(topology.ValuesFunctions))); OutputPinStates = OutputPins.ToDictionary(x => x, x => new PinState(x, false, x.ValuesFunction.Begin(topology.ValuesFunctions))); GeneratedOutputPinsStates = OutputPins.ToDictionary(x => x, _ => false); }
public Constructor(string fullFilePath, Topology.Topology topology) { this.fullFilePath = fullFilePath ?? throw new NullReferenceException(); if (topology == null) { throw new NullReferenceException(); } InitializeComponent(); connection = ConnectionHelpers.OpenConnection(); crudHelper = new CrudHelper(connection); SetupSettings(); topologyBuilder = new TopologyBuilder(dgvField, topology); }
public ModelingForm(Topology.Topology topology, TrafficFlow trafficFlow) { InitializeComponent(); RemoveUnusedControls(); DefineProperties(); LocateFormElements(); SetUpModelingTimeManager(timerModeling); ElementSizeDefiner.TopologyCellSize = 50; ClickEventProvider.SetUpClickEventProvider(this); pictureBoxPauseAndPlay.MouseClick += ClickEventProvider.PictureBoxPauseAndPlay_Click; _mappedTopology = TopologyMapper.MapTopology(this, topology, trafficFlow); ModelingProcessor.SetUpModelingProcessor(this, _mappedTopology); // not implemented labelTotalTime.Hide(); labelTotalTimeValue.Hide(); // /not implemented }
public static SchemeState InitState(Topology.Topology topology) { var state = new SchemeState(topology); return(Step(state, true)); // ensuring gates in the right states }