示例#1
0
def main():
	
	f0=1.0e4
	
	machine = Machine(name='machine', dt=5.0e-8, pushed=True);
	
	machine.AddCircuit(type='waver',name='osc', amp=1, freq=f0+4, pushed=True)
	machine.AddCircuit(type="Machine",name='pll', assembly=aPLL, filters=[10000,5000,2000],
		gain=600.0, f0=f0, Kp=0.5, Ki=800, pushed=True)
	
  	
	machine.Connect("osc.cos","pll.signal1")
	machine.Connect("pll.sin","pll.signal2")
	
	
	out1 = machine.AddCircuit(type='output',name='output',file='test_apll.log', dump=200)
	out1.Register('global.time', 'pll.signal1', 'pll.signal2', 'pll.df')
	
	machine.Wait(0.01)
	machine.circuits['osc'].I['freq'].Set(f0+14)
	machine.Wait(0.01)
	machine.circuits['osc'].I['freq'].Set(f0-100)
	machine.Wait(0.01)
	machine.circuits['osc'].I['freq'].Set(f0-300)
	machine.Wait(0.01)
示例#2
0
def main():

    #main machine
    machine = Machine(name='machine', dt=0.00005, pushed=True)

    # wave generator
    machine.AddCircuit(type='waver', name='wave', amp=1, pushed=True)

    machine.AddCircuit(type='RCLP',
                       name='sklp',
                       fcut=100,
                       order=1,
                       pushed=True)
    #amplitude detector for the filter
    machine.AddCircuit(type='minmax', name='asklp', CheckTime=0.2, pushed=True)

    machine.AddCircuit(type='RCHP',
                       name='skhp',
                       fcut=100,
                       order=1,
                       pushed=True)
    #amplitude detector for the filter
    machine.AddCircuit(type='minmax', name='askhp', CheckTime=0.2, pushed=True)

    machine.AddCircuit(type='SKBP', name='skbp', fc=100, band=60, pushed=True)
    #amplitude detector for the filter
    machine.AddCircuit(type='minmax', name='askbp', CheckTime=0.2, pushed=True)

    #connect oscillator to the filters
    machine.Connect("wave.sin", "sklp.signal", "skhp.signal", "skbp.signal")
    machine.Connect("sklp.out", "asklp.signal")  #filter -> amplitude detector
    machine.Connect("skhp.out", "askhp.signal")  #filter -> amplitude detector
    machine.Connect("skbp.out", "askbp.signal")  #filter -> amplitude detector

    #output to file - dump=0 means only manual dump
    out1 = machine.AddCircuit(type='output',
                              name='output',
                              file='test_filters2.log',
                              dump=0)
    out1.Register('wave.freq', 'asklp.amp', 'askhp.amp', 'askbp.amp')

    #set the frequency and relax the filter
    freq = 5
    machine.SetInput(channel="wave.freq", value=freq)
    machine.Wait(1)

    while freq < 6000:

        #assign the frequency to the oscillator
        machine.SetInput(channel="wave.freq", value=freq)

        #wait some time to charge the capacitors in the filters
        machine.Wait(0.5)

        out1.Dump()  #output to file
        freq *= 1.5  #ramp the frequency
示例#3
0
def main():

	machine = Machine(machine=None, name='machine', dt=5.0e-8)
	canti = machine.AddCircuit(type='Cantilever',name='canti', 
		Q=20000, k=26.4, f0=150000, startingz=1, pushed=True)

	#machine.AddCircuit(type='waver',name='wave',freq=150000,amp=1)

	machine.AddCircuit(type="Machine",name='amp', fcut=10000, assembly=aAMPD, 
		pushed=True)
	
	machine.AddCircuit(type="PI",name='agc', Ki=2.1, Kp=0.1, set=10, pushed=True)
	machine.AddCircuit(type="limiter",name='agclim', min=0,max=10, pushed=True)
	
	machine.AddCircuit(type="Machine",name='pll', fcut=1000, assembly=aPLL, 
		filters=[10000,5000,2000], gain=600.0, f0=150000, Kp=0.5, Ki=700, 
		pushed=True)
	
	machine.AddCircuit(type='opMul',name='pllinv',in2=-1, pushed=True)
	machine.AddCircuit(type='opMul',name='exc', pushed=True)
	
	machine.Connect('canti.ztip','amp.signal')
	machine.Connect('amp.amp','agc.signal')
	machine.Connect('amp.norm','pll.signal1')
	#machine.Connect('wave.cos','pll.signal1')
	machine.Connect('pll.cos','pll.signal2')
	
	machine.Connect('agc.out','agclim.signal')
	machine.Connect('agclim.out','exc.in1')
	machine.Connect('pll.cos','pllinv.in1')
	machine.Connect('pllinv.out','exc.in2')
	
	machine.Connect('exc.out','canti.exciter')
	
	#Outputs
	out1 = machine.AddCircuit(type='output',name='output',file='testafm.out', dump=2)
	out1.Register('global.time', 'canti.zabs','amp.norm','pll.cos','pll.sin','exc.in2')
	#out1.Register('global.time', 'wave.cos','pll.cos','pll.sin','exc.in2')
	out1.Stop()

	out2 = machine.AddCircuit(type='output',name='output2',file='testafm2.out', dump=100)
	out2.Register('global.time', 'amp.amp','agc.out','pll.df')

	machine.Wait(0.01)
	out1.Start()
	machine.Wait(0.001)
	out1.Stop()
	machine.Wait(0.05)
	out1.Start()
	machine.Wait(0.001)
示例#4
0
def main():

    #main machine
    machine = Machine(name='machine', dt=0.0005, pushed=True)

    # wave generator
    machine.AddCircuit(type='waver', name='wave', amp=1, freq=2, pushed=True)

    machine.AddCircuit(type='Equal', name='eq', pushed=True)
    machine.AddCircuit(type='LessOrEqual', name='leq', pushed=True)
    machine.AddCircuit(type='GreaterOrEqual', name='geq', pushed=True)

    #connect oscillator to the filters
    machine.Connect("wave.cos", "eq.in1", "leq.in1", "geq.in1")
    machine.Connect("wave.sin", "eq.in2", "leq.in2", "geq.in2")

    #output to file
    out1 = machine.AddCircuit(type='output',
                              name='output',
                              file='test_comparison.out',
                              dump=1)
    out1.Register('global.time', 'wave.cos', 'wave.sin', 'eq.out', 'leq.out',
                  'geq.out')

    machine.Wait(1)
示例#5
0
def main():

    f0 = 1.0e5

    machine = Machine(name='machine', dt=1.0e-8, pushed=True)

    machine.AddCircuit(type='waver',
                       name='osc',
                       amp=1,
                       freq=f0 + 1.3,
                       pushed=True)
    machine.AddCircuit(type='waver', name='vco', amp=1, freq=f0, pushed=True)
    machine.AddCircuit(type="Machine",
                       name='pfd',
                       assembly=dPFD,
                       gain=1000.0,
                       fcut=500,
                       KI=1.0,
                       KP=0.30,
                       pushed=True)

    machine.AddCircuit(type='opAdd', name='frq', in2=f0, pushed=True)

    machine.Connect("osc.cos", "pfd.ref")
    machine.Connect("vco.cos", "pfd.vco")
    machine.Connect('pfd.df', 'frq.in1')
    machine.Connect('frq.out', 'vco.freq')

    out1 = machine.AddCircuit(type='output',
                              name='output',
                              file='test_dpfd.out',
                              dump=100)
    out1.Register('global.time', 'pfd.ref', 'pfd.vco', 'pfd.df')

    machine.Wait(0.1)
示例#6
0
def main():

    #main machine
    machine = Machine(name='machine', dt=0.0001, pushed=True)

    # wave generator
    machine.AddCircuit(type='waver',
                       name='wave',
                       amp=1,
                       freq=2,
                       phi=1,
                       offset=2.0,
                       pushed=True)
    machine.AddCircuit(type='square',
                       name='sqw',
                       amp=1.5,
                       freq=2,
                       offset=0.0,
                       duty=0.2,
                       pushed=True)

    #output to file - dump=0 means only manual dump
    out1 = machine.AddCircuit(type='output',
                              name='output',
                              file='test_wavers.out',
                              dump=1)
    out1.Register('global.time', 'wave.sin', 'wave.cos', 'wave.saw', 'sqw.out')

    machine.Wait(1)
示例#7
0
def main():

    machine = Machine(machine=None, name='machine', dt=0.01, pushed=False)

    #Add Circuits
    machine.AddCircuit(type='waver',
                       name='wave',
                       amp=0.5,
                       freq=10,
                       pushed=False)
    machine.AddCircuit(type='opAdd', name='add', pushed=False)

    #Connections
    machine.Connect("wave.sin", "add.in1")
    machine.Connect("wave.cos", "add.in2")

    #Outputs
    out1 = machine.AddCircuit(type='output',
                              name='output',
                              file='log.dat',
                              dump=1)
    out1.Register('global.time', 'wave.sin', 'wave.sin', 'add.out')
    out1.Plot(sizex=5, sizey=3, RealTime=True)

    machine.Wait(2)
示例#8
0
def main():

    machine = Machine(name='machine', dt=0.01, pushed=True)

    #Add Circuits

    osc = machine.AddCircuit(type='waver',
                             name='osc',
                             amp=1,
                             freq=1,
                             pushed=True)

    compo1 = machine.AddCircuit(type='Machine',
                                name='compo1',
                                assembly=ADC,
                                pushed=True)

    out1 = machine.AddCircuit(type='output',
                              name='output',
                              file='example_composite.log',
                              dump=1)
    out1.Register('global.time', 'osc.sin', 'osc.cos', 'compo1.out')

    machine.Connect("osc.sin", "compo1.signal1")
    machine.Connect("osc.cos", "compo1.signal2")

    machine.Wait(10)
示例#9
0
def main():
	
	#main machine
	machine = Machine(name='machine', dt=0.01, pushed=True);
	
	# wave generator
	machine.AddCircuit(type='waver',name='wave', amp=1, freq=2, phi=0, offset=0, pushed=True)
	machine.AddCircuit(type='square',name='sqw', amp=0.7, freq=10, offset=0.0, duty=0.5, pushed=True )

	machine.AddCircuit(type='SRFlipFlop', name='SR', pushed=True)
	machine.AddCircuit(type='JKFlipFlop', name='JK', pushed=True)
	machine.AddCircuit(type='DFlipFlop', name='D', pushed=True)
	machine.AddCircuit(type='DRFlipFlop', name='DR', pushed=True)



	#output to file - dump=0 means only manual dump
	out1 = machine.AddCircuit(type='output',name='output',file='flipflops.dat', dump=1)
	out1.Register('global.time', 'wave.sin', 'wave.cos', 'sqw.out', 'D.Q')
	


	machine.Connect('wave.sin','D.D')
	machine.Connect('wave.cos','JK.K')
	machine.Connect('sqw.out','D.clock')
	
	machine.Wait(1)
示例#10
0
def main():

    machine = Machine(machine=None, name='machine', dt=0.01)

    inter = machine.AddCircuit(type='i4Dlin',
                               name='inter',
                               components=1,
                               pushed=True)

    machine.Wait(1)
示例#11
0
def main():
	
	machine = Machine(name='machine', dt=0.01, pushed=True);
	
	#Add the circuits	
  	machine.AddCircuit(type='waver',name='osc', amp=1, freq=1.3, pushed=True )
	machine.AddCircuit(type='limiter', name='lim', max=0.7, min=-0.3, pushed=True)
	
	machine.Connect("osc.sin","lim.signal")

	out1 = machine.AddCircuit(type='output',name='output',file='test_limiter.out', dump=1)
	out1.Register('global.time', "osc.sin","lim.out")
	
	machine.Wait(5)
示例#12
0
def main():
	
	machine = Machine(name='machine', dt=0.01, pushed=True);
	
	#Add Circuits
  	machine.AddCircuit(type='waver',name='osc', amp=1, freq=1, pushed=True )
	machine.AddCircuit(type='derivative', name='der', pushed=True)
	machine.AddCircuit(type='integral', name='int', pushed=True)
	
	machine.Connect("osc.sin","der.signal","int.signal")

	out1 = machine.AddCircuit(type='output',name='output',file='test_derint.out', dump=2)
	out1.Register('global.time', 'osc.sin', 'osc.cos','der.out','int.out')
	
	machine.Wait(10)
示例#13
0
def main():

    machine = Machine(name='machine', dt=0.01, pushed=True)

    #Add Circuits
    machine.AddCircuit(type='waver', name='osc', amp=1, freq=1, pushed=True)
    machine.AddCircuit(type='delay', name='lag', DelayTime=0.2, pushed=True)

    machine.Connect("osc.sin", "lag.signal")

    out1 = machine.AddCircuit(type='output',
                              name='output',
                              file='test_delay.out',
                              dump=1)
    out1.Register('global.time', 'osc.sin', 'lag.out')

    machine.Wait(5)
示例#14
0
def main():
	
	
	machine = Machine(name='machine', dt=0.01, pushed=True);
	
	#Add Circuits
  	machine.AddCircuit(type='waver',name='w1', amp=0.2, freq=1, pushed=True )
  	machine.AddCircuit(type='waver',name='w2', amp=0.2, freq=1.15, pushed=True )
	machine.AddCircuit(type='phasor', name='lag', up=True, pushed=True)
	
	machine.Connect("w1.sin","lag.in1")
	machine.Connect("w2.cos","lag.in2")

	out1 = machine.AddCircuit(type='output',name='output',file='test_phasor.out', dump=5)
	out1.Register('global.time', "w1.sin","w2.cos","lag.tick","lag.delay")
	
	machine.Wait(10)
示例#15
0
def main():

    #main machine
    machine = Machine(name='machine', dt=0.01, pushed=True)

    # wave generator
    machine.AddCircuit(type='square',
                       name='a',
                       amp=1,
                       freq=2,
                       offset=0.0,
                       duty=0.1,
                       pushed=True)
    machine.AddCircuit(type='square',
                       name='b',
                       amp=1,
                       freq=1.1,
                       offset=0.0,
                       duty=0.5,
                       pushed=True)
    machine.AddCircuit(type='square',
                       name='clock',
                       amp=0.7,
                       freq=10,
                       offset=0.0,
                       duty=0.5,
                       pushed=True)

    machine.AddCircuit(type='SRFlipFlop', name='SR', pushed=True)
    machine.AddCircuit(type='JKFlipFlop', name='JK', pushed=True)
    machine.AddCircuit(type='DFlipFlop', name='D', pushed=True)
    machine.AddCircuit(type='DRFlipFlop', name='DR', pushed=True)

    machine.Connect('clock.out', 'SR.clock', 'JK.clock', 'D.clock', 'DR.clock')
    machine.Connect('a.out', 'JK.J', 'SR.S', 'D.D', 'DR.D')
    machine.Connect('b.out', 'JK.K', 'SR.R', 'DR.R')

    #output to file - dump=0 means only manual dump
    out1 = machine.AddCircuit(type='output',
                              name='output',
                              file='test_flipflops.out',
                              dump=1)
    out1.Register('global.time', 'a.out', 'b.out', 'clock.out', 'SR.Q', 'JK.Q',
                  'D.Q', 'DR.Q')

    machine.Wait(2)
示例#16
0
def main():

    machine = Machine(name='machine', dt=0.01, pushed=True)

    wave = machine.AddCircuit(type='waver',
                              name='wave',
                              amp=1,
                              freq=1,
                              pushed=True)
    adder = machine.AddCircuit(type='opAdd', name='add', pushed=True)
    compo = machine.AddCircuit(type='Machine',
                               name='compo',
                               assembly=compomaker,
                               pushed=True)

    outer = machine.AddCircuit(type='output',
                               name='outer',
                               file='test_cCore.log',
                               dump=1)

    outer.Register('global.time', 'wave.cos', 'wave.sin', 'add.out')

    #print wave.cCoreID
    #print machine.cCoreID
    #machine.cCore.DebugCircuit(machine.cCoreID)
    #print wave.cCoreID
    #print machine.cCoreO

    machine.cCore.DebugCircuit(wave.cCoreID)

    machine.cCore.DebugCircuit(adder.cCoreID)
    machine.Connect('wave.cos', 'add.in1')
    machine.Connect('wave.sin', 'add.in2')

    machine.cCore.DebugCircuit(adder.cCoreID)
    #machine.cCore.DebugCircuit(1)
    #machine.cCore.DebugCircuit(2)

    #for i in range(len(wave.I)):
    #    print i,wave.I.values()[i].signal.cCoreFEED

    machine.Wait(1.03)

    machine.cCore.DebugCircuit(wave.cCoreID)
    """
示例#17
0
def main():

    machine = Machine(name='machine', dt=0.01, pushed=True)

    wave = machine.AddCircuit(type='waver',
                              name='wave',
                              amp=1,
                              freq=2,
                              pushed=True)
    outer = machine.AddCircuit(type='output',
                               name='outer',
                               file='test_output.out',
                               dump=0)
    outer.Register('global.time', 'wave.sin')

    machine.Connect('wave.sin', 'outer.record')

    machine.Wait(1)
def main():

    machine = Machine(name='machine', dt=0.02, pushed=True)
    f0 = 100.0

    #Add Circuits
    canti = machine.AddCircuit(type='AdvancedCantilever',
                               name='canti',
                               NumberOfModesV=2,
                               NumberOfModesL=1,
                               pushed=True)
    scanner = machine.AddCircuit(type='Scanner', name='scan', pushed=True)

    machine.AddCircuit(type='waver',
                       name='wave',
                       amp=10,
                       freq=1,
                       phi=1,
                       offset=0,
                       pushed=True)

    canti.AddMode(Vertical=True, k=1, Q=100, M=1, f0=1)
    canti.AddMode(Vertical=True, k=1, Q=100, M=1, f0=1)
    canti.AddMode(Vertical=False, k=1, Q=100, M=1, f0=1)
    canti.StartingPos(0, 3, 5)
    canti.CantileverReady()

    machine.Connect("scan.x", "canti.Holderx")
    machine.Connect("scan.y", "canti.Holdery")
    machine.Connect("scan.z", "canti.Holderz")
    #	machine.Connect("wave.cos","canti.ForceV")
    #	machine.Connect("wave.cos","canti.ForceL")

    #debug output
    out1 = machine.AddCircuit(type='output',
                              name='output',
                              file='AdvCantilever.dat',
                              dump=1)
    out1.Register("global.time", "canti.zPos", "canti.yPos", "canti.xABS",
                  "canti.yABS", "canti.zABS", "canti.zV1", "canti.zV2")

    scanner.Place(x=1, y=1, z=1)
    machine.Wait(15)
示例#19
0
def main():

    machine = Machine(name='machine', dt=0.01, pushed=True)

    machine.AddCircuit(type='Perlin',
                       name='noise',
                       octaves=2,
                       persist=0.5,
                       amp=1,
                       period=0.1,
                       pushed=True)

    #debug output
    out1 = machine.AddCircuit(type='output',
                              name='output',
                              file='test_perlin.out',
                              dump=1)
    out1.Register("global.time", "noise.out")

    machine.Wait(1)
示例#20
0
def main():

    machine = Machine(name='machine', pushed=True, dt=0.001)

    #Add Circuits
    canti = machine.AddCircuit(type='Cantilever',
                               name='canti',
                               startingz=5,
                               Q=300,
                               k=1,
                               f0=50,
                               pushed=True)

    out1 = machine.AddCircuit(type='output',
                              name='output',
                              file='cantilever.dat',
                              dump=1)
    out1.Register("global.time", "canti.ztip")

    machine.Wait(2)
示例#21
0
def main():

    machine = Machine(name='machine', dt=0.01, pushed=True)

    #Add Circuits

    machine.AddCircuit(type='waver', name='wave', amp=1, freq=1, pushed=True)
    pyc = machine.AddCircuit(type='myCirc',
                             name='pytest',
                             in2=1.1,
                             pushed=True)

    machine.Connect("wave.sin", "pytest.in1")

    out1 = machine.AddCircuit(type='output',
                              name='output',
                              file='test_pycircuit.out',
                              dump=1)
    out1.Register('global.time', 'wave.sin', 'pytest.out')

    machine.Wait(1)
示例#22
0
def main():

    machine = Machine(name='machine', dt=0.01, pushed=True)

    #Add Circuits
    machine.AddCircuit(type='waver', name='osc', amp=1, freq=1, pushed=True)
    machine.AddCircuit(type='avg', name='avg', time=10, pushed=True)
    machine.AddCircuit(type='avg',
                       name='avg2',
                       time=1,
                       moving=True,
                       pushed=True)

    machine.Connect("osc.sin", "avg.signal", "avg2.signal")

    out1 = machine.AddCircuit(type='output',
                              name='output',
                              file='test_avg.out',
                              dump=2)
    out1.Register('global.time', 'osc.sin', 'avg.out', 'avg2.out')

    machine.Wait(10)
示例#23
0
def main():

    machine = Machine(name='machine', dt=0.01, pushed=True)

    #Add Circuits
    machine.AddCircuit(type='waver',
                       name='osc',
                       amp=0.2,
                       freq=1.3,
                       pushed=True)
    machine.AddCircuit(type='peaker', name='pkd', up=True, pushed=True)

    machine.Connect("osc.sin", "pkd.signal")

    out1 = machine.AddCircuit(type='output',
                              name='output',
                              file='test_peaker.out',
                              dump=1)
    out1.Register('global.time', "osc.sin", "pkd.tick", "pkd.peak",
                  "pkd.delay")

    machine.Wait(5)
示例#24
0
def main():

    machine = Machine(name='machine', dt=0.01, pushed=True)

    machine.AddCircuit(type='waver', name='osc', freq=1, pushed=True)
    machine.AddCircuit(type='opAbs', name='abs', pushed=True)
    machine.AddCircuit(type='SKLP', name='lp', fcut=0.04, pushed=True)

    pi = machine.AddCircuit(type='PI', name='pi', set=1, Kp=1.5, Ki=0.2)
    #pid = machine.AddCircuit(type='PID', name='pi', set=1,Kp=1.5,Ki=0.2,Kd=0.1)

    machine.Connect("osc.sin", "abs.signal")
    machine.Connect("abs.out", "lp.signal")

    machine.Connect("lp.out", "pi.signal")
    machine.Connect("pi.out", "osc.amp")

    out1 = machine.AddCircuit(type='output',
                              name='output',
                              file='test_pi.out',
                              dump=5)
    out1.Register('global.time', 'osc.sin', 'lp.out', 'pi.out')

    machine.Wait(100)
示例#25
0
def main():

    machine = Machine(name='machine', dt=1e-3, pushed=True)

    #Add Circuits
    scanner = machine.AddCircuit(type='Scanner', name='scan', pushed=True)

    #debug output
    out1 = machine.AddCircuit(type='output',
                              name='output',
                              file='test_scanner.out',
                              dump=0)
    out1.Register('global.time', "scan.x", "scan.y", "scan.z")

    #machine.Connect("scan.record","output.record")

    #scanner.Place(x=1,y=0,z=0)
    #scanner.Move(x=1,y=0,z=0,v=1)
    #machine.Wait(1)
    #scanner.MoveTo(x=3,y=0,z=0,v=1)
    #machine.Wait(1)
    scanner.MoveRecord(x=2, y=0, z=0, v=1, points=10)

    machine.Wait(1)
示例#26
0
def main():

    machine = Machine(name='machine', dt=0.01, pushed=True)

    #Add Circuits
    machine.AddCircuit(type='square',
                       name='s1',
                       amp=1,
                       freq=1,
                       duty=0.5,
                       pushed=True)
    machine.AddCircuit(type='square',
                       name='s2',
                       amp=1,
                       freq=2.5,
                       duty=0.2,
                       pushed=True)

    machine.AddCircuit(type='NOT', name='not', pushed=True)
    machine.AddCircuit(type='AND', name='and', pushed=True)
    machine.AddCircuit(type='OR', name='or', pushed=True)
    machine.AddCircuit(type='XOR', name='xor', pushed=True)
    machine.AddCircuit(type='NOR', name='nor', pushed=True)

    machine.Connect("s1.out", "not.signal")
    machine.Connect("s1.out", "and.in1", "or.in1", "xor.in1", "nor.in1")
    machine.Connect("s2.out", "and.in2", "or.in2", "xor.in2", "nor.in2")

    out1 = machine.AddCircuit(type='output',
                              name='output',
                              file='test_logic.out',
                              dump=1)
    out1.Register('global.time', 's1.out', 's2.out', 'not.out', 'and.out',
                  'or.out', 'xor.out', 'nor.out')

    machine.Wait(10)
示例#27
0
def main():

    machine = Machine(machine=None, name='machine', dt=5.0e-8)
    #	canti = machine.AddCircuit(type='Cantilever',name='canti',
    #		Q=20000, k=26.4, f0=150000, startingz=1, pushed=True)

    canti = machine.AddCircuit(type='Cantilever',
                               name='canti',
                               startingz=1,
                               Q=10000,
                               k=167.0,
                               f0=15000,
                               pushed=True)

    machine.AddCircuit(type='waver', name='wave', freq=15000, amp=1)

    machine.AddCircuit(type="Machine",
                       name='amp',
                       fcut=10000,
                       assembly=aAMPD,
                       pushed=True)

    #	machine.AddCircuit(type="PI",name='agc', Ki=2.1, Kp=0.1, set=0.1, pushed=True)
    machine.AddCircuit(type='PI',
                       name='agc',
                       Kp=1.1,
                       Ki=800,
                       set=1,
                       pushed=True)
    machine.AddCircuit(type="limiter",
                       name='agclim',
                       min=0,
                       max=10,
                       pushed=True)

    machine.AddCircuit(type="Machine",
                       name='pll',
                       fcut=1000,
                       assembly=aPLL,
                       filters=[10000, 5000, 2000],
                       gain=600.0,
                       f0=15000,
                       Kp=0.5,
                       Ki=700,
                       pushed=True)

    machine.AddCircuit(type='opMul', name='pllinv', in2=-1, pushed=True)
    machine.AddCircuit(type='opMul', name='exc', pushed=True)

    scanner = machine.AddCircuit(type='Scanner',
                                 name='scan',
                                 Process=machine,
                                 pushed=True)

    inter = machine.AddCircuit(type='i3Dlin',
                               name='inter',
                               components=3,
                               pushed=True)
    inter.Configure(steps=[0.705, 0.705, 0.1], npoints=[8, 8, 201])
    inter.Configure(pbc=[True, True, False])
    inter.Configure(ForceMultiplier=1e10)
    inter.ReadData('NaClforces.dat')

    #Outputs
    out1 = machine.AddCircuit(type='output',
                              name='output',
                              file='testafm.out',
                              dump=2)
    out1.Register('global.time', 'canti.zabs', 'amp.norm', 'pll.cos',
                  'pll.sin', 'exc.in2')
    #out1.Register('global.time', 'wave.cos','pll.cos','pll.sin','exc.in2')
    out1.Stop()

    out2 = machine.AddCircuit(type='output',
                              name='output2',
                              file='testafm2.out',
                              dump=100)
    out2.Register('global.time', 'canti.ztip', 'agc.out', 'pll.df', "canti.fz")
    #out2.Stop()

    #Imaging output
    imager = machine.AddCircuit(type='output',
                                name='image',
                                file='NaCl.dat',
                                dump=0)
    imager.Register("scan.x", "scan.y", "pll.df")

    #feed x and y to interpolation
    machine.Connect("scan.x", "inter.x")
    machine.Connect("scan.y", "inter.y")
    machine.Connect("scan.z", "canti.holderz")
    machine.Connect("canti.zabs", "inter.z")

    #Force
    machine.Connect("inter.F3", "canti.fz")

    machine.Connect('canti.ztip', 'amp.signal')
    machine.Connect('amp.amp', 'agc.signal')
    machine.Connect('amp.norm', 'pll.signal1')
    #machine.Connect('wave.cos','pll.signal1')
    machine.Connect('pll.sin', 'pll.signal2')

    machine.Connect('agc.out', 'agclim.signal')
    machine.Connect('agclim.out', 'exc.in1')
    machine.Connect('pll.sin', 'pllinv.in1')
    machine.Connect('pllinv.out', 'exc.in2')

    machine.Connect('exc.out', 'canti.exciter')

    machine.Connect("scan.record", "image.record")
    '''
	machine.Wait(0.01)
	out1.Start()
	machine.Wait(0.001)
	out1.Stop()
	machine.Wait(0.05)
	out1.Start()
	machine.Wait(0.001)
	'''
    #plot testafm.out 1:3 (canti) 1:4 (pll reference) 1:6 (the exciter)
    #u should see 3 distinct waves, canti peaks are in the middle between the other 2

    scanner.Place(x=0, y=0, z=15)
    machine.Wait(0.2)

    scanner.Move(x=0, y=0, z=-11)
    machine.Wait(1)

    #machine.SetInput(channel="output.record", value=1)
    scanner.Recorder = imager
    scanner.BlankLines = True
    #resolution of the image [# points per line, # lines]
    scanner.Resolution = [64, 64]
    scanner.ImageArea(11.28, 11.28)
    #scan
    scanner.ScanArea()
示例#28
0
	
machine.Connect('canti.ztip','amp.signal')
machine.Connect('amp.amp','agc.signal')
machine.Connect('amp.norm','pll.signal1')
machine.Connect('pll.cos','pll.signal2')
	
machine.Connect('agc.out','agclim.signal')
machine.Connect('agclim.out','exc.in1')
machine.Connect('pll.cos','pllinv.in1')
machine.Connect('pllinv.out','exc.in2')
	
machine.Connect('exc.out','canti.exciter')

machine.Connect("scan.record","image.record")	
	



scanner.Place(x=0,y=0,z=15)
machine.Wait(0.5)	

scanner.Move(x=0,y=0,z=-11)
machine.Wait(1)	

scanner.Recorder = imager
scanner.BlankLines = True 
#resolution of the image [# points per line, # lines]
scanner.Resolution = [64,64]
scanner.ImageArea(11.28,11.28)        
#scan
scanner.ScanArea()
示例#29
0
from vafmcircuits import Machine

machine = Machine(name='machine', dt=0.01)

machine.AddCircuit(type='waver', name='osc', freq=1.2, amp=1)

machine.AddCircuit(type='opAdd', name='adder', factors=2)

machine.Connect('osc.sin', 'adder.in1')
machine.Connect('osc.cos', 'adder.in2')

logger = machine.AddCircuit(type='output',
                            name='logger',
                            file='tutorial_basic.out',
                            dump=1)
logger.Register('global.time', 'osc.sin', 'osc.cos', 'adder.out')

machine.Wait(3)
示例#30
0

machine.Connect('canti.ztip','amp.signal')
machine.Connect('amp.amp','agc.signal')
machine.Connect('amp.norm','pll.ref')
machine.Connect('pll.cos','pll.vco')
	
machine.Connect('agc.out','agclim.signal')
machine.Connect('agclim.out','exc.in1')
machine.Connect('pll.sin','pllinv.in1')
machine.Connect('pllinv.out','exc.in2')
	
machine.Connect('exc.out','canti.exciter')
	

out3 = machine.AddCircuit(type='output',name='output3',file='tut4.dat', dump=0)
out3.Register("scan.z", "pll.df")
out3.Stop()	


machine.Connect("scan.record","output3.record")	


scanner.Place(x=0,y=0,z=15)
scanner.Move(x=0,y=0,z=-1)	
machine.Wait(1)

out3.Start()
scanner.MoveRecord(x=0,y=0,z=-9.5,v=1,points=200)