Important API classes

Zoltan Padrah edited this page Aug 25, 2012 · 1 revision
Clone this wiki locally

If you want descriptions of any other classes not listed here, then add a section with the name of that class, and I'll write about it. If you want any descriptions expanded on, then write a comment to that effect.

Table of Contents

Node, ECNode, FPNode

ECNode ("Electronic Component Node") and FPNode ("FlowPart? Node") both inherit from Node, and are the visual representations of the component pins and flowpart arrows respectively. They handle drawing themselves, keeping track of where they are, etc, as well as what connectors are attached to them, and in the case of ECNode, what Pins they contain.


The most important of the three visible base objects in the work area (the others being Nodes and Connectors). Components, FlowParts? and DrawParts? (e.g. arrows and lines) all inherit from Item. It keeps track of internal properties (e.g. what value of resistance the user has selected for a resistor, or the colour of an LED). It can contain "child" items. It knows about its size and shape (which can be a basic rectangle or a complex polygon) - the size and shape are used internally for repainting changed areas of the work area and for determining what Items have been selected when the user draws a select-rectangle.

CNItem (inherits from Item)

"Connector-Node" Item - an Item with extra functions for handling nodes and connectors (e.g. keeping track of them, telling the work area where the item is so that connectors can route around the Item, etc). It also has the ability to have various objects attached to the item (e.g. gui widgets and text), as well as functions for keeping the attached objects in sync with the item (e.g. the function updateAttachedPositioning() will update the positions and orientations of attached objects according to the Item's current position).


Normally, an ECNode will contain one Pin object - this is what the simulator uses (not the graphical ECNode part). The Pin class is abstracted from the ECNode class as one ECNode may contain several Pins (such as in the Bus component). In the future (the KTechlab API is not ready for this just yet), the Pin class will also be able to have a separate existence from ECNodes, allowing embedding of circuits in Components.

Component (inherits from CNItem)

This is the visual drawing of an electronic component. It has convenience functionality useful for components (such as creating several pins spread out over one side of the component, or creating a Dual-Inline-Package), and specifies how the Elements that it contains are connected up.


See Electronic Simulation. This is the simulation part of a component - the mathematical model behind electronic properties (like resistance or "diodeness"). Each component will connect together one or more Elements between the components pins to make a fully functioning component. The Element is connected to one or more Pins (e.g. the Resistance element is connected to two pins and the BJT element is connected to three pins).

CNode, CBranch

See Electronic Simulation.

  • Areas of the circuit that are directly connected (e.g. pins connected with wires and switches) have the same voltage level, and are assigned a number (and a CNode - "Circuit Node" - object) for getting the previously calculated voltage (in iterative calculations or in setting the voltage level on wires, pins, etc that are associated with the CNode).
  • Voltage sources also have a Branch (an artifact of the mathematical circuit model). When solving the circuit equations, the current through each branch is calculated.


This is the visual representation of a connection (either a wire between ECNodes or connection between FPNodes). It has a start and end (necessary for calculating current direction in circuits, and for the direction of the linkage in flowcode). When used in a circuit, the Connector contains one or more Wires.


A Wire is to a Connector as a Pin is to an ECNode. It is the non-visual part of an electronic connection. It is abstracted from the Connector class to allow several electronic connections in the same Connector, such as between Bus components. It defines how the pins are connected up.


This class is somewhere between a Wire and an Element. It can be treated as an Element (for example, a Push-to-Make? will add a Switch between its pins in the same way that a Resistor will add a Resistance element between its pins). But, the simulator treats it as a wire when it is in the closed position.