Detailed Description
This is the main virtual machine object. It can also be used as a conventional circuit , acting as a circuit container. Every Machine circuit has one default output channel 'time', but other input/output channels can be added.
Initialisation parameters:
- dt = timestep (only for main machine)
- assembly = constructor function (only for composites)
- pushed = True|False push the output buffer immediately if True
Input channels:
- custom inputs (only for composites)
Output channels:
- time = global simulation time
- custom outputs (only for composites)
Example:
Inherits Circuit.
Public Member Functions | |
def | __init__ (self, machine=None, name="machine", keys) |
Class contructor. More... | |
def | Assemble (self) |
Fabricator function. More... | |
def | AddInput (self, name) |
Create an input channel with the given name. More... | |
def | AddOutput (self, name) |
Create an output channel with the given name. More... | |
def | SetInput |
Set the value of an input channel. More... | |
def | Wait (self, dtime) |
Integrate the machine. More... | |
def | WaitSteps (self, nsteps) |
Integrate the machine. More... | |
Public Attributes | |
circuits | |
Ordered dictionary of the circuits in the setup. More... | |
dt | |
Integration timestep. | |
![]() | |
name | |
Name of the circuit. More... | |
enabled | |
if it is working... More... | |
machine | |
Reference to the virtual machine to which this circuit belongs. More... | |
pushed | |
Push output buffer at the end of Update. More... | |
I | |
Dictionary of input channels. | |
O | |
Dictionary of output channels. | |
cCoreID | |
index of circuit in cCore | |
Constructor & Destructor Documentation
def __init__ | ( | self, | |
machine = None , |
|||
name = "machine" , |
|||
keys | |||
) |
Member Function Documentation
def AddInput | ( | self, | |
name | |||
) |
Add a global input channel to the machine. This is done when the machine is intended to be used as a composite circuit inside another machine, and thus it needs to communicate with other circuits.
- Parameters
-
name Name of the new input channel.
Example:
def AddOutput | ( | self, | |
name | |||
) |
Add a global output channel to the machine. This is done when the machine is intended to be used as a composite circuit inside another machine, and thus it needs to communicate with other circuits.
- Parameters
-
name Name of the new output channel.
Example:
def Assemble | ( | self | ) |
This function is called when the machine is instantiated, only if the "assembly" parameter was given among initialisation arguments. The function is originally left unimplemented, so the user can build the setup after the machine is instantiated.
Example:
Assembly function definition:
Main script:
def SetInput | ( | self, | |
channel = None , |
|||
value = None |
|||
) |
def Wait | ( | self, | |
dtime | |||
) |
Calls the update routine of each circuit in the setup for a given amount of time.
def WaitSteps | ( | self, | |
nsteps | |||
) |
Calls the update routine of each circuit in the setup for a given amount of steps.