MCS Automation ques...
 
Notifications
Clear all

MCS Automation question

17 Posts
2 Users
0 Likes
34.7 K Views
 auto
(@auto)
Active Member
Joined: 11 years ago
Posts: 16
Topic starter  

Hi,

I am using the Spectran HF-60105 V4 X to collect spectrum data.
I want to be able to automate the process using code and scripts but I have been stuck using Aaronia's SDK on Windows. I am prepared to switch over to Linux (Debian) because I was having compatibility issues in Windows.
In Linux, is it possible to automate the data collecting process by writing scripts for the MCS software directly without using the SDK?
Thank you. I would greatly appreciate your help.


   
Quote
(@mm_dev)
Reputable Member Admin
Joined: 13 years ago
Posts: 330
 

The MCS itself doesn't have any scripting functions. However the Linux version ships with a commandline tool that implements the basic control protocol of the Spectran, maybe that's enough for you?


   
ReplyQuote
 auto
(@auto)
Active Member
Joined: 11 years ago
Posts: 16
Topic starter  

I have already installed Debian along with the MCS software.
How do I access the command line tool?

What I want to be able to do is, for example, sweep one range for about 1 minute, then automatically switch to another range, sweep for another minute while automatically saving the data. How would I be able to do this?

I read a post by the user PeterSz on April 14, 2012 and he asked:

Hi,

I am kindly asking for documentation about the script run_spectran_console.sh.
In particular, for further information about how to write runfile for automatically changing the sweep range.

Best regards
PeterSz

The reply was:

The "runfile" contains simply a list of commands, nothing special, e.g.

followed by some example code.
The code was basically what I want to be able to do but I also want to be able to change the resolution bandwidth and sample time, etc.
What script was PeterSz referring to and where in the Debian file system can I find it?


   
ReplyQuote
(@mm_dev)
Reputable Member Admin
Joined: 13 years ago
Posts: 330
 

The commandline tool is (usually) installed at /opt/aaronia/bin/spectran. If invoked without arguments it will provide a list of valid commands and their syntax, that should be mostly self-explanatory. Note that the tool is basically a direct interface to the Spectran protocol, for example it doesn't do any variable translation, you need to check the API documentation for valid variable values (esp. RBW and VBW).
The mentioned run_spectran_console.sh script belongs to our commercial RSA-EMF software, but it's basically just a fancy wrapper script around the spectran commandline tool.


   
ReplyQuote
 auto
(@auto)
Active Member
Joined: 11 years ago
Posts: 16
Topic starter  

I have found the tool but how do I open the program? How do I invoke it?
Also, will I be able to execute a script that I have written using the environment variables from the API documentation in the commandline tool?


   
ReplyQuote
 auto
(@auto)
Active Member
Joined: 11 years ago
Posts: 16
Topic starter  

I have figured out how to invoke the command line tool and have been able to learn about the syntax and environment variables.
However, I'm having trouble using list-dev or getting/connecting the device.
When I connect the device and pass in the list-dev argument, I get the following error:

Object::connect: No such slot AConsoleCommand::deleteLater()
Object::connect: No such slot AConsoleCommand::deleteLater()
Object::connect: No such slot AConsoleCommand::deleteLater()
Object::connect: No such slot AConsoleCommand::deleteLater()
Object::connect: No such slot AConsoleCommand::deleteLater()
Object::connect: No such slot AConsoleCommand::deleteLater()

What does the usbproxy command do? Is this necessary for connecting the device?
And once I do get sweep data, how do I convert it into .csv format and save it?
Also I just want to note that I think a command is missing in the help screen, right before "-$rec sets the recording backend: 'value' (default) or 'freqvalue'"


   
ReplyQuote
(@mm_dev)
Reputable Member Admin
Joined: 13 years ago
Posts: 330
 

However, I'm having trouble using list-dev or getting/connecting the device.
When I connect the device and pass in the list-dev argument, I get the following error:

Object::connect: No such slot AConsoleCommand::deleteLater()

Hmm no idea. Just tested it locally and worked fine, and checking the code that error isn't possible (the class definitely has the slot).

What does the usbproxy command do? Is this necessary for connecting the device?

Nope, it's just a TCP/IP wrapper for the USB driver.

And once I do get sweep data, how do I convert it into .csv format and save it?

Well, saving the output of 'sweep' is just a matter of using redirecting stdout, e.g. 'spectran sweep 10m > /path/to/file'

Also I just want to note that I think a command is missing in the help screen, right before "-$rec sets the recording backend: 'value' (default) or 'freqvalue'"

Nope, that line refers to the last parameter of the two 'sweep' commands.


   
ReplyQuote
 auto
(@auto)
Active Member
Joined: 11 years ago
Posts: 16
Topic starter  

So I successfully connected the device.
When I call list-dev, I get this output:

Object::connect: No such slot AConsoleCommand::deleteLater()
Object::connect: No such slot AConsoleCommand::deleteLater()
Object::connect: No such slot AConsoleCommand::deleteLater()
Object::connect: No such slot AConsoleCommand::deleteLater()
Object::connect: No such slot AConsoleCommand::deleteLater()
Object::connect: No such slot AConsoleCommand::deleteLater()
0          Unit1          (Aaronia SPECTRAN HF-60105 X)      [0x0403,0xe8d8]

I tried calling other commands but I keep getting the syntax wrong.
Can you give me some example code using right syntax? (especially for commands that require the device as an argument)
Also, how would I use these commands in a script/batch file?


   
ReplyQuote
(@mm_dev)
Reputable Member Admin
Joined: 13 years ago
Posts: 330
 

By default all commands use the first device found, so it's never a required argument unless you have multiple Aaronia devices connected at the same time. In that case the first field of the list-dev command output (0 in your example) would be the argument to the -d parameter. Anyway, some example commands (lines starting with # are comments, lines with $ are commands entered, other lines are output):

# List available devices:
$ spectran list-dev
0         UnWMT07Z (Aaronia SPECTRAN HF-4060 Analyzer) [0x0403, 0xe8d8]

# Read current start, stop and span frequency and RBW index
$ spectran get StartFrequency StopFrequency SpanFrequency ResolutionBandwidth
StartFrequency            = 150.000000
StopFrequency             = 200.000000
SpanFrequency             = 50.000000
ResolutionBandwidth       = 1.000000

# Change frequency parameters
$ spectran set StartFrequency=100 StopFrequency=500
StartFrequency            = 100.000000
StopFrequency             = 500.000000

# Perform a single sweep (following lines starting with # are actual output of the command with key=value pairs)
$ spectran sweep 1
# DeviceClass=AHFSpectranDevice
# DeviceFeatures=0000000000001001
# DeviceInfo_0=2025E
...
# Variable_StartFrequency=150.000000
# Variable_StopFrequency=200.000000
# Variable_SweepTime=100.000000
# Variable_VideoBandwidth=1.000000
# Version=2

# SweepFrequencies=51
150000000;151000000;152000000;153000000;154000000;155000000;156000000;157000000;158000000;159000000;160000000;161000000;162000000;163000000;164000000;165000000;166000000;167000000;168000000;169000000;170000000;171000000;172000000;173000000;174000000;175000000;176000000;177000000;178000000;179000000;180000000;181000000;182000000;183000000;184000000;185000000;186000000;187000000;188000000;189000000;190000000;191000000;192000000;193000000;194000000;195000000;196000000;197000000;198000000;199000000;200000000;

# SweepStart=2013-06-24T10:54:06.957
# SweepStop=2013-06-24T10:54:07.710
# SweepPoints=51
-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;-90;

# FinalSweepCount=1

Nothing special about using this in scripts.


   
ReplyQuote
 auto
(@auto)
Active Member
Joined: 11 years ago
Posts: 16
Topic starter  

Can you explain how to use the convert command?
I am getting output that is similar to the ones in your example code, but I want to use the data in matlab.
How do I use "convert" to save the data the way that the MCS software does with its .csv format?

Also, when I run the sweep commands, it takes a long time to show the output.
For example, when I run it for one sweep, it prints everything up to
#Version= 2
immediately. But everything after that displays only after the monitor display has powered down.
Is there a way to fix this? Thanks.


   
ReplyQuote
(@mm_dev)
Reputable Member Admin
Joined: 13 years ago
Posts: 330
 

Actually that format is already CSV (using semicolons as delimiters just as the MCS does), just has some minor differences the the CSV generated by the MCS:
- frequencies are not marked as a comment
- timestamps are marked as comments
- measurement unit isn't explicitly stated
These differences exist because the tool was intended for our RSA EMF software. A direct conversion to the MCS CSV format isn't implemented, if you really need that you can use the convert command to transform the data into the MCS MDR format, and then use the MCS to convert it into CSV again.

spectran sweep 1m | spectran convert -of mdr -i /dev/stdin -o /path/to/data.mdr

As for the "delay", my guess is that you have configured a long/slow sweep, and you will only see data when the sweep is finished.


   
ReplyQuote
 auto
(@auto)
Active Member
Joined: 11 years ago
Posts: 16
Topic starter  

Is there a maximum sample size when using the commandline tool?
For MCS, it was 1280. So I set:

StartFrequency=100
StopFrequency=1380
CenterFrequency=740
ResolutionBandwidth=1
VideoBandwidth=1

When I executed spectran.exe sweep 1, I get this output:

# DeviceClass=AHFV4SpectranDevice
# DeviceFeatures=0000000000000000
# DeviceInfo_0=60105X
# DeviceInfo_1=4
# DeviceInfo_2=27
# DeviceInfo_3=none
# DeviceInfo_4=Beta 41
# DeviceInfo_5=26.09.2012
# DeviceInfo_6=16435
# DeviceInfo_7=T. Adams
# DeviceInfo_8= 
# DeviceModel=60105X
# DeviceSerial=16435
# MeasureDuration=0
# MeasureUnit=0
# Recorder=AValueList
# Resolution=3000000
# SamplePoints=0
# SampleTime=5
# StartDate=2013-06-25T14:21:31
# StartFreq=100000000
# StopFreq=1380000000
# SweepCount=1
# Variable_AntennaType=-1.000000
# Variable_AttenuationFactor=-10.000000
# Variable_BackgroundBBDetector=0.000000
# Variable_CableType=-1.000000
# Variable_CenterFrequency=740.000000
# Variable_DemodulatorMode=0.000000
# Variable_DetectorMode=0.000000
# Variable_DisableDisplay=0.000000
# Variable_EnableCache=0.000000
# Variable_Preamplifier=0.000000
# Variable_ReceiverConfiguration=0.000000
# Variable_ResolutionBandwidth=1.000000
# Variable_SpanFrequency=1279.999878
# Variable_SpeakerVolume=0.500000
# Variable_SpectrumDisplayMode=1.000000
# Variable_StartFrequency=100.000000
# Variable_StopFrequency=1380.000000
# Variable_SweepFrequencyPoints=0.000000
# Variable_SweepTime=5.000000
# Variable_VideoBandwidth=1.000000
# Version=2

# SweepFrequencies=158
100000000;101500000;103000000;104500000;106000000;107500000;109000000;110500000;112000000;113500000;115000000;116500000;118000000;119500000;121000000;122500000;124000000;125500000;127000000;128500000;130000000;131500000;133000000;134500000;136000000;137500000;139000000;140500000;142000000;143500000;145000000;146500000;148000000;149500000;151000000;152500000;154000000;155500000;157000000;158500000;160000000;161500000;163000000;164500000;166000000;167500000;169000000;170500000;172000000;173500000;175000000;176500000;178000000;179500000;181000000;182500000;184000000;185500000;187000000;188500000;190000000;191500000;193000000;194500000;196000000;197500000;199000000;200500000;202000000;203500000;205000000;206500000;208000000;209500000;211000000;212500000;214000000;215500000;217000000;218500000;220000000;221500000;223000000;224500000;226000000;227500000;229000000;230500000;232000000;233500000;235000000;236500000;238000000;239500000;241000000;242500000;244000000;245500000;247000000;248500000;250000000;251500000;253000000;254500000;256000000;257500000;259000000;260500000;262000000;263500000;265000000;266500000;268000000;269500000;271000000;272500000;274000000;275500000;277000000;278500000;280000000;281500000;283000000;284500000;286000000;287500000;289000000;290500000;292000000;293500000;295000000;296500000;298000000;299500000;301000000;302500000;304000000;305500000;307000000;308500000;310000000;311500000;313000000;314500000;316000000;317500000;319000000;320500000;322000000;323500000;325000000;326500000;328000000;329500000;331000000;332500000;334000000;335500000;

# SweepStart=2013-06-25T14:29:53.929
# SweepStop=2013-06-25T14:29:54.101
# SweepPoints=158
-58.1639;-61.2121;-61.1529;-62.2891;-61.3759;-62.1178;-62.2028;-68.1187;-67.104;-67.472;-67.0623;-66.5113;-67.0587;-64.9813;-69.3914;-68.5654;-68.6379;-70.3768;-69.2704;-69.5507;-68.1939;-71.5128;-70.2138;-70.0545;-71.2151;-70.315;-69.4268;-68.729;-71.4477;-70.6522;-71.0131;-71.0599;-70.248;-72.0948;-70.0935;-69.6663;-71.4246;-71.8689;-72.6379;-72.6748;-69.9687;-71.3603;-72.3657;-70.9333;-71.7457;-71.7337;-70.6828;-71.9709;-73.4797;-70.365;-69.8307;-70.2554;-70.4954;-60.9605;-64.2575;-71.2657;-67.3873;-72.1724;-70.9851;-71.6226;-70.6795;-71.2826;-72.2691;-68.3825;-72.7317;-70.5009;-58.3647;-53.1327;-71.8517;-73.8831;-73.2546;-72.8747;-74.8129;-73.4769;-73.6492;-72.2076;-70.4562;-74.8771;-74.229;-71.3948;-60.7415;-71.935;-74.7843;-68.3402;-74.5647;-74.8227;-75.8376;-73.7221;-71.7768;-75.5793;-75.1745;-77.2071;-76.1386;-59.6543;-63.5678;-76.9816;-70.7671;-77.0849;-75.6245;-77.535;-75.013;-78.7579;-77.5488;-71.9763;-76.5251;-72.5735;-64.7725;-62.0017;-73.3661;-73.8737;-73.6635;-74.5938;-76.1464;-74.4026;-73.5036;-78.09;-69.7178;-76.9147;-76.026;-59.4972;-44.9626;-59.3857;-75.679;-69.124;-77.4017;-74.7485;-76.578;-75.684;-71.9729;-74.6757;-75.3603;-74.9531;-75.9126;-51.5601;-55.7958;-73.8925;-72.9511;-75.0116;-74.8263;-73.3216;-73.5863;-74.8125;-77.639;-71.4114;-77.451;-75.3376;-61.7483;-56.6381;-76.4408;-77.5064;-77.0339;-77.2698;-78.3941;-76.7349;-72.8564;-75.1464;-68.6439;-75.064;

# FinalSweepCount=1

Why don't I get all the frequencies?


   
ReplyQuote
(@mm_dev)
Reputable Member Admin
Joined: 13 years ago
Posts: 330
 

Hmm, that shouln't happen, I have no problem getting large sweeps here (the 1280 in the MCS is just the maximum value for the SweepFrequencyPoints variable btw, it's possible to get much larger sweeps when using large span and small filter).
I noticed you mentioned spectan.exe, the Windows version always had some problems, quite possible this is one of them.


   
ReplyQuote
 auto
(@auto)
Active Member
Joined: 11 years ago
Posts: 16
Topic starter  

For the sweep for a certain duration command, what is the syntax for hours, minutes, and seconds?
Is it just h for hours, m for minutes, and s for seconds?


   
ReplyQuote
(@mm_dev)
Reputable Member Admin
Joined: 13 years ago
Posts: 330
 

For the sweep for a certain duration command, what is the syntax for hours, minutes, and seconds?
Is it just h for hours, m for minutes, and s for seconds?

yes


   
ReplyQuote
Page 1 / 2
Share: