Multi-instrument not for moku pro

Moku model: Moku Pro
Operating system: Ubuntu 22
Software version: 587

Bug or support request description:

So I have an issue with multi-instruments whenever I try generating signals with Python. I cannot see the signal. For example, I’m trying to generate two signals, a square wave and a sine wave using ArbitraryWavegenerator and Wavegenerator instruments. i have connected the Output1 and Output2 ports of the Moku Pro to an external oscilloscope and I cannot see the signal when multi-instrument mode is enabled. When using only the Wavegenerator instrument, then I’m able to see both signals.

this is my code for multi-instrument mode:

from moku.instruments import MultiInstrument
from moku.instruments import Oscilloscope, WaveformGenerator,ArbitraryWaveformGenerator

m = MultiInstrument('192.168.73.1', platform_id=4,force_connect=True)
try:
    wg = m.set_instrument(1, ArbitraryWaveformGenerator)
    wg1=m.set_instrument(2, WaveformGenerator)
    osc = m.set_instrument(3, Oscilloscope)
    

    connections = [dict(source="Input1", destination="Slot1InA"),
                      dict(source="Slot1OutA", destination="Slot3InA"),
                      dict(source="Slot3OutA", destination="Output1"),
                      dict(source="Input2", destination="Slot2InA"),
                      dict(source="Slot2OutA", destination="Slot3InB"),
                      dict(source="Slot3OutB", destination="Output2")]
       

    print(m.set_connections(connections=connections))

    wg.generate_waveform(channel=1, sample_rate='Auto',
                        lut_data=list(m_sequence_output[1]), frequency=100e6,
                        amplitude=1)
    wg1.generate_waveform(channel=2, type="Sine",amplitude=1.0,frequency=80e6)
    osc.set_timebase(-5e-8, 5e-8, strict=False)  #this has to be set well to work.
    # osc.set_source(channel=1, source='Output2')
    data = osc.get_data(timeout=60, wait_reacquire=False, wait_complete=True)

And this is the code for Wavegenerator only:

import numpy as np
from moku.instruments import ArbitraryWaveformGenerator,WaveformGenerator

from Msequence import msequence,repeat_bits

polynomial_coefficients = [4,3]
m_sequence_output = msequence(polynomial_coefficients)

i=WaveformGenerator('192.168.73.1', force_connect=True)

t=np.linspace(0,1,100)
not_sq=np.zeros(len(t))
for h in np.arange(1,15,2):
    not_sq += (4/(np.pi*h)) * np.cos(2*np.pi*h*t)

not_sq=not_sq/max(abs(not_sq))

i.generate_waveform(channel=1, type="Sine",amplitude=1.0,frequency=100e6)
i.generate_waveform(channel=2, type="Square",amplitude=1.0,frequency=80e6,duty=50)

Any idea why I’m having this issue?

Hi @bonhardt ,
It looks like the output assignments for Output1 and Output2 are coming from the Oscilloscope in slot 3. That would be associated with the embedded waveform generator in the Oscilloscope. If you want the output of the AWG to go to Output1 and the output of the WG to go to Output2 try changing the connections to the following

connections = [dict(source="Input1", destination="Slot1InA"),
                      dict(source="Slot1OutA", destination="Slot3InA"),
                      dict(source="Slot1OutA", destination="Output1"),
                      dict(source="Input2", destination="Slot2InA"),
                      dict(source="Slot2OutA", destination="Slot3InB"),
                      dict(source="Slot2OutA", destination="Output2")]

Now the AWG and WG output should go to their respective output channels and the Oscilloscope in slot 3.

Please give that a try and let us know if that fixes the issue.
Thanks,
Steve

Hi Steve!
I tried your proposal but it didn’t work. The signal at output2 is still flat according to the external oscilloscope.

Hi Steve,

I would greatly appreciate your help with this. Suppose I have two external signals, which I want to feed into the Moku Pro through input3 and input4 (for example, signals from two photodiodes). I plan to process these signals by multiplying them by some phase. However, I’m confused about how to route these processed signals to the outputs of the Moku, specifically output3 and output4.

Thanks.

Hi @bonhardt

“I tried your proposal but it didn’t work. The signal at output2 is still flat according to the external oscilloscope.”

The issue here is related to

wg1.generate_waveform(channel=2, type="Sine",amplitude=1.0,frequency=80e6)

Change channel=2, to channel=1. In the connections sections we have Slot2OutA routed to Output2, OutA means channel 1 and OutB means channel 2

HI @bonhardt
Regarding routing Input3 and Input4… we always suggest getting things working using the Moku app first and then duplicating the routing and setup in Python. For example, here I use the app and add a Phasemeter to slot 4. Input3 and Input4 are routed to InputA and InputB of the Phasemeter. The Phasemeter outputs A and B are then routed to Output3 and Output4. Below is a screen shot


The phasemeter allows us to create an output Sine wave that is phase locked to our input signal. You can then add a phase shift to the output signal.

In Python the MiM settup would now need to add
from moku.instruments import Oscilloscope, WaveformGenerator, ArbitraryWaveformGenerator, Phasemeter

pm = m.set_instrument(4, Phasemeter)

And then the connection routing would look something like the following

connections = [dict(source="Input1", destination="Slot1InA"),
                      dict(source="Slot1OutA", destination="Slot3InA"),
                      dict(source="Slot1OutA", destination="Output1"),
                      dict(source="Input2", destination="Slot2InA"),
                      dict(source="Slot2OutA", destination="Slot3InB"),
                      dict(source="Slot2OutA", destination="Output2"),
                      dict(source="Input3", destination="Slot4InA"),
                      dict(source="Input4", destination="Slot4InB"),
                      dict(source="Slot4OutA", destination="Output3"),
                      dict(source="Slot4OutB", destination="Output4")]

Hopefully this helps give you a better sense of the signal routing in Multi-instrument Mode.
Thanks,
Steve

1 Like

Thanks a lot for this.