Analog Series (i)--digital circuit

Source: Internet
Author: User

Requirements

The operating process of the digital circuit is briefly simulated, and the potential (simplified to L and h) is realized by C # WinForm.

Logical part of thinking
    1. The circuit is a graph structure, based on C # characteristics, Design node Class (node) and wire Class (Wired), and is generic.
    2. Because the circuit element can contain multiple node, the Super class unit (inherited from node, management node) is designed.
    3. The state of the circuit device has the status of L and H, so there is a state change and calculation, so the status Class (state) and the Mutable class (the original state and the new state) are designed.
    4. Each Circuit object (node, unit, wire) has a unique number, so design the Markable class (based on UUID).
    5. Nodes and units can handle events (click, Draw, and so on), adding interactive interface iinteractive and emulation interface isimuate.
    6. Design nodes and units to gain focus and lose focus events, triggered by onstateupdated and onvalueupdated.
    7. Constructing a new component can be overridden by deriving node and overloading it.
Interface section
    1. Using Directui idea to draw, API uses GDI + 's graphics, constructs the primitive method to refer to from @vczh C + + GUI Library/gaclib.
    2. Constructs the renderer factory graphicsrendererfactory and the entity factory Graphicselementfactory, the renderer holds the drawing handle (for GDI + does not need to hold the handle, and the GDI + object has a caching mechanism), and the entity holds the properties of the graphic.
    3. Each component has a separate Igraphicselement entity drawing interface collection to draw the image.
Core algorithms

Adopt state update mechanism, similar state machine, parallel optimization. (This algorithm is still defective and has a cyclic refresh problem)

 Public Virtual void Update ()        {            = = a.active). AsParallel (). ForAll (A = a.activate (activatetype.filterunit));             = a.active). AsParallel (). ForAll (A = a.advance (advancetype.nodetowire));             = a.active). AsParallel (). ForAll (A = a.advance (advancetype.nodetowire));             = a.active). AsParallel (). ForAll (A = a.advance (advancetype.wiretonode));             = a.active). AsParallel (). ForAll (A = a.advance (advancetype.wiretonode));        }
Test

Source

Https://github.com/bajdcc/SimuCircult

Class Library: Simucircult

Interface: WINSC

Analog Series (i)--digital circuit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.