Overview

The Process you've created doesn't take any parameters, so we can't control how it behaves on any particular execution. Let's add a parameter or two, and then we'll have a process that's beginning to look useful.

Passing parameters

Modify your test script as follows, to pass a couple of parameters to the process.

M Source Code (against 995)
% add process state = [];
state.initialMembranePotential = 0.8;
state.tau = 0.05;
fS = 1000;

You can go ahead and run this immediately, without modifying your process. Nothing will be different - the process has been presented these parameters, but it has ignored them, and this is quite acceptable in BRAHMS.

Reading parameters

Now modify your source file to actually read these parameters: the process state is passed in as persist.state, and is accessible in all events following EVENT_STATE_SET.

Here, we extract the parameter from the persist.state object during EVENT_STATE_SET, to illustrate that you may wish to prepare your state in some way during this event. If you've no preparations to make, you can equally leave it be and read it from there when you need it in later events.

M Source Code (against 1258)
% initialise a state
persist.currentMembranePotential = persist.state.initialMembranePotential;

Also add a modification to use the passed value of tau rather than the hard-coded value...

M Source Code (against 1258)
% run dynamics
tau = persist.state.tau;
fS = input.time.sampleRate.rate; lambda = exp(-1.0/(tau * fS)); persist.currentMembranePotential = persist.currentMembranePotential * lambda;

This should produce a plot like the following. Note that both the initial membrane potential, and the time constant of the decay, are now respecting the values we set in the test script.

Where do I go from here?

You can parametrize your process as much as you like, and pass in any Matlab structure of parameters. Here, we've seen only a couple of DOUBLE-type scalars, but there's no restriction, of course. How you access them in your Process will depend on the language you are writing in.

Using 1258, you will explore your parameters simply through the Matlab associative array interface, since they have been converted to this form from the underlying DataML XML node. This is, therefore, pretty trivial. What you pipe in in your Matlab system script comes out in your Matlab process.