标签:
简要模拟数字电路的运行过程,及电位(简化为L和H),用C# WinForm实现。
采用状态更新机制,类似状态机,并行优化。(此算法仍存在缺陷,有循环刷新问题)
public virtual void Update() { _units.Values.Where(a => a.Active).AsParallel().ForAll(a => a.Activate(ActivateType.FilterUnit)); _nodes.Values.Where(a => a.Active).AsParallel().ForAll(a => a.Advance(AdvanceType.NodeToWire)); _wires.Values.Where(a => a.Active).AsParallel().ForAll(a => a.Advance(AdvanceType.NodeToWire)); _nodes.Values.Where(a => a.Active).AsParallel().ForAll(a => a.Advance(AdvanceType.WireToNode)); _wires.Values.Where(a => a.Active).AsParallel().ForAll(a => a.Advance(AdvanceType.WireToNode)); }
https://github.com/bajdcc/SimuCircult
类库:SimuCircult
界面:WinSC
标签:
原文地址:http://www.cnblogs.com/bajdcc/p/4766208.html