Designing circuits

This section describes how a circuit is designed in this software. As said before, the user interface for this software is spreadsheets saved as Comma Separated Value (.csv) files. To repeat a snapshot of the circuit in the previous section:

By designing a circuit the way shown above, I avoid the use of a graphical interface but at the same time make it reasonably convenient for the user as they can more or less "draw" the circuit in a spreadsheet. The other option would be to provide a netlist describing the connectivity between nodes which is not feasible for larger circuits. The following components are available to the user as of now:
  1. wire : this is a zero impedance connector between components.
  2. Resistor: a constant value resistor. Initial value = 100 ohm.
  3. VariableResistor: a resistor whose value is a control input and thus can be changed from control code. Initial value = 100 ohm.
  4. Inductor: a constant value inductor: Initial value = 1 millihenry.
  5. VariableInductor: an inductor whose value is a control input and thus can be changed from control code. Initial value = 1 millihenry.
  6. Capacitor: a constant value capacitor. This component has a polarity. Initial value = 10 microfarad.
  7. VoltageSource: a constant value voltage source. This component has a polarity. Initial value - Peak = 120 V, Frequency = 60 Hz, Phase = 0 degrees, Dc offset = 0 V.
  8. Ammeter: measures current. The output is the current through it and it is plotted in the output data file. This component has a polarity.
  9. Voltmeter: measures voltage. The output is the voltage across it and it is plotted in the output data file. This component has a polarity.
  10. CurrentSource: a current source. This is actually a voltage in series with a resistance. The voltage is adjusted so that the current is as desired. This component has a polarity. Initial values - Peak = 5 Amps, Frequency = 60 Hz, Phase = 0 degrees, Dc offset = 0 Amps.
  11. ControlledVoltageSource: a controlled voltage source. The voltage generated is a control input that can be controlled from control code. The value can be anything set by the control code and can change at any rate. This component has a polarity.
  12. Diode: a normal diode. This component has a polarity. The diode turns on when the voltage across it is around 1 V, and turns off when the current reverses. Initial values - Voltage rating = 120 V. This voltage rating is to ensure that in a circuit with that voltage, the leakage current drawn by the diode when off is negligible (around 1 microampere).
  13. Switch: an ideal switch. This has a control input which is the gate signal. A zero gate signal turns it off and a gate signal of 1 turns it on. The control input is initially zero, and can be changed through control code. This component has a polarity. Initial values - Voltage level = 120 V, Name of control = Control. The name of the control should be changed to a unique value the way the user wishes to name the gate signal.
More components may be added as needed. Now that all the components that can be used have been listed, how do you use them? A component as shown in the figure above has two parts - the component type (one of those listed above) and the name of the component separated by an underscore. In the above example, in VoltageSource_V1, the first part is the type which is VoltageSource while the second part is the name which is V1. The underscore is a reserved character, do not use it in anywhere in a circuit description. Everywhere else, like in the control functions, you can use underscore as will be shown later, but never use it in the circuit schematic. The only rule in naming components is that two components of the same type cannot have the same name. Which means there cannot be two VoltageSource components with the name V1. In the above example, VoltageSource and Voltmeter have names V1. That is acceptable. Different component types can have the same name.

Though it is not a component, there is a jump connector. The reason is that sometimes wires will cross each other and it is unavoidable. The way the simulator works, if it sees two or more components in adjacent cells, it forms a physical connection. The way to use a jump connection is shown with this circuit.

The above circuit of a single-phase diode bridge rectifier fed by a voltage source cannot be designed without a jumper. The labels jump1 at cell positions 16E and 11K are jump connections. When the simulator encounters a jump connection, it looks for another jump connection with the same name and continues the branch from that connection. There are a few rules for using jump connections:

  1. The first four letters of a jump connection have to be "jump". After that everything else is a label. Though label is matched as is, it is advisable not to use special characters. Letters and numbers are preferred for jump labels.
  2. Jump labels must occur in pairs. Anything else is a violation. A jump label is merely a continuation of a branch.
  3. Two jump labels cannot be next to each other.
  4. A jump label must be the extreme end of a branch segment. Which means a jump label must have a component or wire in only one of its adjacent cells.
  5. A jump cannot form a node or be immediately adjacent to a node.