BCI2000 Automation Remote IP/Port Error?

Forum for software developers to discuss BCI2000 software development
Post Reply
Posts: 5
Joined: 30 Jun 2015, 14:40

BCI2000 Automation Remote IP/Port Error?

Post by chrishunt » 13 Jul 2015, 11:12

Hello all,

I'm using the BCI2000 Automation Remote to instantiate and configure a session using a MATLAB script, however, I'm running into a fairly odd error. Whenever I run the script, I generate the following error:

Error: [module1] NIDAQ_mx_Source: Next module's IP/Port parameters not available.
Error: [module2] DummySignalProcessing: Next module's IP/Port parameters not available.
Error: [module3] DummyApplication: Next module's IP/Port parameters not available.

The really odd part about this is that if I simply start the session using the BCI2000Launcher, I do not run into the same error. This is using the same parameter files and everything. This leads me to believe that the issue is with my script, specifically. I've attached the MATLAB script as reference. Any help would be greatly appreciated.

Christopher Hunt

Code: Select all

%BCI2000 Interfacing with MATLAB
sensorFlags = [1 0 0]; %determines what is being collected
                       %(1) EMG, (2) CyberGlove, (3) IMU
maxTime = 5; %record data for how long
hand = 0; %hand being recorded (0 = right, 1 = left)

%data formatting variables
subject = 'TEST'; %subject name
session = '001'; %session number
run = 'R01'; %run number
%dataStore = 'E:/thakor_phd_research/Matlab/Agarwal_Hunt - Finger Decoding'; %directory where the data is to be stored

bci = actxserver('BCI2000Automation.BCI2000Remote'); %instantiates a BCI2000 remote
    bci.WindowVisible = 0; %hide the window
    ok = bci.Connect; %connect to operator module
    if ~ok
    signalModule = 'NIDAQ_mx_Source'; %always collect EMG data
    if sensorFlags(2) %if collecting CyberGlove
        handFlag = sprintf(' --CyberGloveHand=%d', hand);
        signalModule = strcat(signalModule, ' --LogCyberGlove=1', handFlag);
    if sensorFlags(3) %if collecting IMU
        signalModule = strcat(signalModule, ' --LogIMU=1');
    %add more as hardware becomes supported
    totalModules = {signalModule, 'DummySignalProcessing', 'DummyApplication'};
    ok = bci.StartupModules(totalModules); %loading data acquisition
    if ~ok
    ok = bci.LoadParametersRemote('../data/testNIDAQ.prm'); %load config parameters
    if ~ok
    bci.SubjectID = subject; %overwrite subject name
    bci.SessionID = session; %overwrite session number
    %bci.DataDirectory = dataStore; %overwrite where to store data
    bciState = 'Running';
    imuOutput = zeros(12, 1, 'double'); %will hold BCI2000 state data
    ok = bci.Start(); %start recording
    if ~ok
    tstart = tic;
    while ok && strcmp(state, 'Running') && toc(tstart) < maxTime
        %allow data to be collected
        for i = 1:12
            bci.GetStateVariable(sprintf('IMUData%02d', i), imuOutput(i));
        disp(imuOutput); %show IMU data
        [ok, state] = bci.GetSystemState(state); %check if running still
    if ~ok
    ok = bci.Stop(); %stop recording, not deleting anything
    if ~ok
catch exception
    %delete the BCI2000 remote if error
bci.delete; %delete the remote to shut down the operator module
%load produced data file to view data offline
loadOutput = strcat('load ', subject, session, run, '.dat');

Posts: 344
Joined: 17 Sep 2010, 12:43

Re: BCI2000 Automation Remote IP/Port Error?

Post by pbrunner » 15 Jul 2015, 09:36


do further isolate your problem, can you please provide a link to a minimum working binary package of your problem that uses SignalGenerator, DummySignalProcessing and DummyApplication?

Regards, Peter

Posts: 7
Joined: 31 Aug 2015, 17:56

Re: BCI2000 Automation Remote IP/Port Error?

Post by jburnison » 03 Nov 2015, 17:33

I've had the same errors using python bindings for the BCI2000Remote. I start the operator with command line option --Telnet 'IP:port'
Then connect() via another computer, load in modules and parameter files just fine. Then once sending the SetConfig() command I see the same errors.

I've used the example script from the PythonBCI2000Remote wiki page and get this error. If I then click Config on the Operator window and close it. I can then hit SetConfig in the operator window or do the SetConfig() function from python and everything is fine... ?

My only guess is that because I need to set the --Telnet IP to an external IP address to remotely connect in the first place it isn't setting the Operator IP to and this is freaking out the other modules... That's not a very technical description I know and apologize but hopefully that makes sense. I don't know enough to investigate this... Maybe If I were to set the other IP addresses of all the modules to the one used in the --Telnet command line option things would work? I'm not too sure how to do that...

Posts: 7
Joined: 31 Aug 2015, 17:56

Re: BCI2000 Automation Remote IP/Port Error?

Post by jburnison » 13 Nov 2015, 09:52


Posts: 7
Joined: 31 Aug 2015, 17:56

Re: BCI2000 Automation Remote IP/Port Error?

Post by jburnison » 16 Nov 2015, 11:17

Despite which modules are started up including the set you suggested and the P3 tutorial modules, executing bci.Start() somehow is not starting all modules. It seems to just start the source module and others are just sitting at initialized and the rest won't execute.

Here's some detail: Running python interpreter on one 'machine A' and BCI2000 on machine "b"
1. Start Operator exe on 'B'
2. python on 'A':
>>> bci.TelnetAddress
>>> bci.OperatorPath
>>> bci.Connect()
>>> bci.WindowTitle = 'Python controlled'
>>> bci.Execute( "cd ${BCI2000LAUNCHDIR}" )
>>> bci.StartupModules( ( "SignalGenerator", "P3SignalProcessing", "P3Speller" ) )
>>> bci.LoadParametersRemote( "../parms/p3_tutorial/InitialP3Session.prm" )
>>> bci.Execute("Wait for Suspended 5")
>>> bci.SetConfig()
%%% Here we get the same IP/Port error described above in the Operator log
%manually going into machine B clicking Config and loading signal generator params
%and also the configs mentioned on the tutorial for training session(mostly channel names and transmitchList).
% Then I close the configure window and click Set Config on the operator window.
%The operator log shows that module 1,2 and 3 are all then initialized.

>>> bci.GetSystemState() - I don't know what these mean but when I run my intended setup I get 3956960.
>>> bci.Start()
% Here the interpreter is halted and I can't execute a bci.Stop() the operator log shows:
%"date/time stamp" - Operator started operation.
%"date/time stamp" - module 1: SignalGenerator running

The same thing happens with different modules, parameters and even if I run both BCI2000 and python operator control on the same machine.
Is there a parameter not set correctly that's ruining the processing or application modules? Can SystemState tell me anything more?

Posts: 3
Joined: 29 Jan 2016, 12:29

Re: BCI2000 Automation Remote IP/Port Error?

Post by GuglielmoElefante » 04 Mar 2016, 09:08

Hi, I had the same problem in my C++ BCI2000Remote project but after some test I solved it disabling few row in the BCI2000Remote::StartupModules inside the BCI2000Remote.cpp. Following the code fragment:

BCI2000Remote::StartupModules( const std::vector<string>& inModules )
Execute( "shutdown system", 0 );
bool success = WaitForSystemState( "Idle" );

if( success )
ostringstream startupCommand;
int port = 4000;
startupCommand << "startup system localhost ";


/*for( size_t i = 0; i < inModules.size(); ++i ) //The problem was here, looking at the BCI batch like
startupCommand << "module" << i + 1 << ":" << port++ << " ";*/ //"P3Speller_SignalGenerator.bat" there is no module's port declaration
//so I tried to deactivate them and BOOM! no more IP / Port Error
Execute( startupCommand.str(), 0 );
success = ( Result().find( "not" ) == string::npos );
I hope this could be useful to someone. Bye.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests