Click here to Skip to main content
15,879,844 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Wanting to build a low-voltage simulator, and need a way I can simulate a piece of wire. For example if I draw a wire and I add +12 volts DC at the beginning of the wire, it would know that there is +12 volts at the other end. Also, if this end connects to a device, the device need to be able to detect the presence of the +12 Volts?

I can see this working in my mind, but I can't figure out how to do it in code.

What I have tried:

I thought of making the wire (Line) an object with properties like, Gauge, Length, Insertion Loss and Voltage. Then scan the area where the wire (line) starts for another object that the wire connects too. If that object is outputting a voltage, then add that voltage to this object...... and so on down to the device.
Updated 2-Mar-23 6:05am
[no name] 2-Mar-23 12:07pm    
A "Slider" can function as a voltage source or a resistor (ranges and values); among other things. Its event handlers (value changes) can pass values to other (software) components. That's (MS) WPF or UWP. Windows Forms may have something similar.
PIEBALDconsult 2-Mar-23 14:25pm    
I have dabbled in simulating electric relays in code (C#) a couple of times, using events to connect components together. I was able to form logic gates and adders and such from them, but I didn't get much beyond that. My events are boolean, but I suppose you could use floating-point voltage levels instead and each component could reduce the value by some amount based on its properties.

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900