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, which must be done in EVENT_STATE_SET, since your parameters are only made available to you during this Event. First, somewhere to keep the persistent parameter...

C++ Source Code (against 1199)
// our internal state DOUBLE currentMembranePotential;
// our parameters
DOUBLE tau;

Then the code to read them both...

C++ Source Code (against 1199)
// initialise our internal state
currentMembranePotential = 0.5;
// get our parameters
currentMembranePotential = nodeState.getField("initialMembranePotential").getDOUBLE();
tau = nodeState.getField("tau").getDOUBLE();

And finally a modification to use the passed value of tau rather than the hard-coded value...

C++ Source Code (against 1199)
// run dynamics
DOUBLE tau = 0.01; /* 10mS membrane time constant */
DOUBLE fS = sampleRateToRate(time->sampleRate); DOUBLE lambda = exp(-1./(tau * fS)); 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 1199, you will probably explore your parameters through the DataMLNode interface, which is an interface to the underlying DataML XML node. You can just access the raw XML through the XMLNode interface, but it's a lot more onerous. If you need to get more advanced, here, start with the DataMLNode documentation, and have a quick look through the source code for the Standard Library processes - they don't do anything too advanced, but they show how to use different Numeric Types.