Moku model: Go
Operating system: Windows, Matlab API
Software version:
Bug or support request description:
When periodically fetching data from the Datalogger stream over a longer period of time (hours), the execution time of the get_stream_data() command behaves very strangely and increases over time (see picture below), which limits long-term measurements. The code used to record this can be found below. The reason we are performing the measurement in this way is that we are simultaneously sweeping a different parameter on a different instrument and we need to correlate that parameter with the data from the Datalogger - of course, if you have a better suggestion, we are more than happy to try it out.
Used code (cleaned up slightly)
Connect to instruments
dl = MokuDatalogger('192.168.203.5',force_connect=true);
sgen=SMA100B_initialize('TCPIP0::192.168.203.3::inst0::INSTR')
Instrument configuration
fstart=50e6; %start of freq sweep
fend=90e6; %end of freq sweep
step=0.25e6;
freqs = linspace(fstart,fend, (fend-fstart)/step);
...
%Moku stream
stream_duration=200*length(freqs);
Measurement
SMA100B_setfrq(sgen,freqs(1));
dl.start_streaming('duration', stream_duration);
pause(1)
on_Res_x_av=zeros(length(freqs),1);
on_Res_y_av=zeros(length(freqs),1);
tfreqav=[];
tdatav=[];
tmeanav=[];
tplotav=[];
tavgav=[];
ttot=[];
for j = 1:ave
tstart=tic;
tfreq=[];
tdat=[];
tmean=[];
tplot=[];
tavg=[];
for i = 1:length(freqs)
tic
SMA100B_setfrq(sgen,freqs(i)); %sweeping frequencies
pause(t_settle);
tfreq(end+1)=toc;
tic
data = dl.get_stream_data();
tdat(end+1)=toc;
tic
onRes_x(i) = mean(data.ch1);
tmean(end+1)=toc;
tic
plot(freqs(1:i)/1e6, onRes_x(1:i))
title(strcat('Raw data'))
xlabel('MW frequency / MHz ')
ylabel('Ch1 / V')
tplot(end+1)=toc;
end
tic
on_Res_x_av=on_Res_x_av(:,1)+onRes_x(:,1);
on_Res_x_av=on_Res_x_av(:,1)/2;
tavg(end+1)=toc;
tfreqav(end+1)=mean(tfreq);
tdatav(end+1)=mean(tdat);
tmeanav(end+1)=mean(tmean);
tplotav(end+1)=mean(tplot);
tavgav(end+1)=mean(tavg);
ttot(end+1)=toc(tstart);
fprintf('%f\n sweep took %f\n',j ,ttot(end))
end
plot(freqs/1e6, on_Res_x_av)
dl.stop_streaming();