Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

voltage instabilities when combining multiple voltageClampTriple elements #51

Open
JustasB opened this issue May 18, 2017 · 2 comments
Open

Comments

@JustasB
Copy link

JustasB commented May 18, 2017

I have a vclamp protocol that has more than three steps (to test channel inactivation and deactivation eg. p52 of ICG paper). When I chain two voltageClampTriple elements with non-overlapping durations, I get voltage and current instabilities at step transitions.

    <voltageClampTriple id="Input_1"
        active = "1"
        delay="50ms" duration="200ms"
        conditioningVoltage="-84mV"
        testingVoltage="50mV"
        returnVoltage="-30mV"
        simpleSeriesResistance="1e6ohm"/>
        
    <voltageClampTriple id="Input_2"
        active = "1"
        delay="300ms" duration="100ms"
        conditioningVoltage="-30mV"
        testingVoltage="-84mV"
        returnVoltage="-84mV"
        simpleSeriesResistance="1e6ohm"/>

Results in:
screen shot 2017-05-18 at 2 58 14 pm

screen shot 2017-05-18 at 3 00 04 pm
screen shot 2017-05-18 at 2 59 29 pm

It seems that this could be avoided if the voltageClampTriple specified the duration of the final step, and the element logic only applied non-zero current during times inside the vclamp's time window.

This is the only place I could find the LEMS definition of the voltageClampTriple component. Is this the right place? I could add the bounds check to fix the problem. https://github.com/openworm/hodgkin_huxley_tutorial/blob/3915d4e393f520ce2f5dba6585357b439146cb38/Tutorial2/NeuroML2/vclamp.xml

CC @scrook

@pgleeson
Copy link
Member

The voltageClampTriple is included in the latest version of the development branches and released in the latest beta release https://github.com/NeuroML/jNeuroML/releases. See https://github.com/NeuroML/NeuroML2/blob/development/NeuroML2CoreTypes/Inputs.xml#L632.

You can't really add 2 vclamps to one cell, as each of them will try to force the cell to one of its chosen voltage levels at any given time. It would be better t create a new <voltageClampMultiple> ComponentType which can have many (nonoverlapiing) child levels, and each one only applies a current during its part.

<voltageClampMultiple >
    <voltageLevel start=0ms stop=100ms voltage=10mV simpleSeriesResistance=1e6ohm>
    <voltageLevel start=100ms stop=300ms voltage=20mV simpleSeriesResistance=1e6ohm>
</voltageClampMultiple >

This would also let you make more complex protocols, e.g. with ramping sections, as voltageClampMultiple doesn't really care what it's children are doing, only that they produce a current. In fact the <compoundInput> element might do this already for you, but you probably need a new <voltageLevel> CT.

@JustasB
Copy link
Author

JustasB commented Oct 31, 2017

I ended up adapting the voltageClampTripple code for my custom component with more steps (see below). I don't know LEMS well enough to express it in a more generic way that doesn't involve repetitious code.

    <ComponentType name="voltageClampProtocol" extends="baseVoltageDepPointCurrent">
        
        <Parameter name="active" dimension="none" />
        
        <Parameter name="delay" dimension="time" />
        <Parameter name="duration1" dimension="time" />
        <Parameter name="duration2" dimension="time" />
        <Parameter name="restingVoltage" dimension="voltage" />
        <Parameter name="voltage1" dimension="voltage" />
        <Parameter name="voltage2" dimension="voltage" />
        
        <Parameter name="simpleSeriesResistance" dimension="resistance"/>
        
        <!--TODO: remove! Only required as EventConnection is used in explicitInput to
         connect inputs to cells. Events aren't passed! ... -->
        <EventPort name="in" direction="in" description="Note this is not used here. Will be removed in future"/>
        
        <Dynamics>
            
            <StateVariable name="i" exposure="i" dimension="current"/>
            
            <OnEvent port="in"><!--TODO: remove, see above...
                                <StateAssignment variable="i" value="0"/>-->
            </OnEvent>
            
            <OnCondition test="active .eq. 1 .and. t .lt. delay">
                <StateAssignment variable="i" value="(restingVoltage - v) / simpleSeriesResistance"/>
            </OnCondition>
            
            <OnCondition test="active .eq. 1 .and. t .geq. delay .and. t .lt. (delay + duration1)">
                <StateAssignment variable="i" value="(voltage1 - v) / simpleSeriesResistance"/>
            </OnCondition>
            
            <OnCondition test="active .eq. 1 .and. t .geq. delay + duration1 .and. t .lt. delay + duration1 + duration2">
                <StateAssignment variable="i" value="(voltage2 - v) / simpleSeriesResistance"/>
            </OnCondition>
            
            <OnCondition test="active .eq. 1 .and. t .geq. delay + duration1 + duration2">
                <StateAssignment variable="i" value="(restingVoltage - v) / simpleSeriesResistance"/>
            </OnCondition>
            
        </Dynamics>
        
    </ComponentType>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

No branches or pull requests

2 participants