Forum
Please or Register to create posts and topics.

How to use the SPECTRAN V6 via Matlab

PreviousPage 8 of 9Next

Hi,

 

I connect a Spectran V6 Sweep Zoom block to a Spectran V6, and try to control the parameters for the Spectran V6 Sweep Zoom block (center frequency, span, etc.) in MatLab. I try to use the AaroniaHTTP.m, but it seems to communicate to the Spectran V6 block only. I am wondering what the blockName is for the Spectran V6 Sweep Zoom? Or maybe the AaroniaHTTP.m talks to Spectran V6 only, and I need other kind of MatLab code for controlling Spectran V6 Sweep Zoom?

Uploaded files:
  • mission.png

Have a look in the related Block configuration, in the section Block you will find the Block API Name. Or check the remoteconfig response as described in post #5

Hi Igore and all,

we will add a queued input option to the HTTP Server, so it will be possible to adjust the buffer size for the data packets in the HTTP Server block. This might be helpful to get continous timeslices with higher data rates the system normally can handle in a realtime stream.

It has not the highest priority at the moment, I will make a post if it is implemented.

Quote from DevSF on 10/08/2023, 09:25

Have a look in the related Block configuration, in the section Block you will find the Block API Name. Or check the remoteconfig response as described in post #5

Hi,

 

I couldn't find the block API name as you mentioned. Could you indicate where I can find it (my file is attached)? Or perhaps you can just tell me the block API name of Spectran V6 Sweep Zoom block?

Uploaded files:
Quote from CYW on 10/08/2023, 18:13

I couldn't find the block API name as you mentioned. Could you indicate where I can find it (my file is attached)? Or perhaps you can just tell me the block API name of Spectran V6 Sweep Zoom block?

Block API name

If that field is not shown in your RTSA version (it is a relatively recent addition), you can also use the "Block Graph Explorer" package to see all internal block- and configuration-names.

The RTSA I have doesn't show the "Block API Name" row. Thank you for showing me the block API name.

However, even I use that block API name, I still fail to communicate to the Spectran V6 Sweep Zoom block. When I run the the following MatLab code, as I change the center frequency f, the center frequency of the Spectran V6 changes, while the center frequency of the Spectran V6 Sweep Zoom remains the same, even though the block API name I use is "Block_Spectran_V6_Sweep_Zoom_0".

The mission I run is attached in post #74 (file) and post #71 (work flow). For such a mission, how can I communicate and set parameters for the Spectran V6 Sweep Zoom block in MatLab?

 

import matlab.net.*
import matlab.net.http.*

address = 'http://localhost:54664/';

blockName = 'Block_Spectran_V6_Sweep_Zoom_0';
RTSASuite = AaroniaHTTP(address);

f = 2.1e9

%Get the Blockgraph configuration attached to the HTTP Server block
[remoteConfig, statusCode] = RTSASuite.getRemoteConfig();

%Set Spectran V6 paramater
[response, statusCode] = RTSASuite.setValueParameter( ...
blockName ,'main', 'float', 'centerfreq',f);

Ah, seems that the V6 Sweep Zoom block does not support the Remote Config protocol. If you only need to control the frequency parameter you can use the /control endpoint though. This is not supported by the Aaronia.m matlab module, you'll have to handle the HTTP request and response yourself. In python it would look like this (values are in Hz):

r=request.Request("http://localhost:54664/control", method="PUT", data=b'{"frequencyStart": 987654321, "frequencyEnd": 1234567890, "type": "capture"}')

Hi,

I try to use AaroniaHTTP with the following code, and get an error message of "Dot indexing is not supported for variables of this type" for the last command (spectrum = resp.Body.Data.samples;) How can I resolve this error?

The mission file I use is attached.

 

import matlab.net.*
import matlab.net.http.*

address = 'http://localhost:54664/';

blockName = 'Block_Spectran_V6B_0';
RTSASuite = AaroniaHTTP(address);

%Get the Blockgraph configuration attached to the HTTP Server block
[remoteConfig, statusCode] = RTSASuite.getRemoteConfig();
% disp(jsonencode(remoteConfig));

%ask for the health status
[healthstatus, statusCode] = RTSASuite.getHealthStatus();
% disp(jsonencode(healthstatus))

f = 1.2e9

%Set Spectran V6 paramater
[response, statusCode] = RTSASuite.setValueParameter( ...
blockName ,'main', 'float', 'centerfreq',f);

RTSASuite.setEnumParameter( blockName ,'calibration', 'preamp'...
,5 , 'Disabled,Auto,None,Amp,Preamp,Both');

RTSASuite.setEnumParameter( blockName ,'main', 'decimation'...
,1 , '1 / 512');

%start the measurement and wait for it running
RTSASuite.startStreaming();
pause(0.5);

% Get Spectra data
r = RequestMessage;
resp = send(r,URI(append(address , 'sample')));
disp( resp.Body.Data );
spectrum = resp.Body.Data.samples;

Uploaded files:

That question would be more suitable for a matlab forum. Can't comment on that anyway without knowing what type resp.Body.Data actually is (the send() function can return different types).

The exact same Matlab code works perfectly if the "HTTP Server" block connects to the "IQ Power Spectrum" block, as shown in the mission file attached in this post. In other words, the code works for the mission attached in post # 80 but show the error message for the mission attached in post# 78. Therefore, it seems to me that somehow the output of the "IQ Power Spectrum" block is different from the output of the "Spectrum" block, and hence it is an issue about the data type of these 2 blocks.

How can I fix the code so that it works for the mission attached in post# 78?

Uploaded files:
PreviousPage 8 of 9Next