View Javadoc

1   package org.catacomb.numeric.difnet.model;
2   
3   import org.catacomb.numeric.difnet.DiffusibleQuantity;
4   import org.catacomb.numeric.difnet.StateNode;
5   import org.catacomb.numeric.difnet.Stimulus;
6   import org.catacomb.numeric.difnet.StructureNode;
7   
8   
9   
10  public class BasicStateNode implements StateNode {
11  
12      BasicStructureNode structure;
13  
14      double value;
15      double current; // supplied by the net diffuser for stimulated nodes;
16  
17      double capacitance;
18  
19      Stimulus stimulus;
20  
21      double appliedValue;
22  
23  
24      public BasicStateNode(BasicStructureNode bsn) {
25          structure = bsn;
26          value = structure.getInitialValue();
27  
28          capacitance = structure.getCapacitance();
29  
30          if (structure.fixed) {
31              appliedValue = structure.getInitialValue();
32          } else {
33              appliedValue = -999.;
34          }
35      }
36  
37  
38  
39  
40      public double getValue(DiffusibleQuantity dq) {
41          return value;
42      }
43  
44      public double getAppliedValue(DiffusibleQuantity dq) {
45          return appliedValue;
46      }
47  
48      public void setValue(DiffusibleQuantity dq, double d) {
49          value = d;
50      }
51  
52  
53      public void setFlux(DiffusibleQuantity dq, double d) {
54          current = d;
55      }
56  
57  
58      public void setStimulus(Stimulus stim) {
59          stimulus = stim;
60      }
61  
62      public Stimulus getStimulus() {
63          return stimulus;
64      }
65  
66  
67      /** gets the capacitance of this node. Fo electrical diffusion this may be
68       * zero, since the capacitance is associated with the membrane, whereas
69       * for chemical diffusiion, the link capacitance would be zero, and the
70       * capacitance where would be related to the node volume.
71       *
72       * @param dq the diffusible quantity for which to get the capacitance.
73       */
74      public double getCapacitance(DiffusibleQuantity dq) {
75          return capacitance;
76      }
77  
78      public StructureNode getStructureNode() {
79          return structure;
80      }
81  
82  
83  }
84  
85  
86  /*
87      public void incrementFluxes(NameValueSet nvs,
88  				boolean flip, Timestep tstep) {
89         double dt = tstep.getDeltaT();
90         //  POSERR should proifile to see if worth looking up in advance;
91         String[] sa = recNames;
92         for (int i = 0; i < sa.length; i++) {
93  
94  	  if (sa[i].startsWith("total ")) {
95  
96  	     String ssp = sa[i].substring(6, sa[i].length());
97  	     double flux = nvs.valueFor(ssp);
98  
99  	     // flip here is wrong.... POSERR;
100 
101 	     recValues[i] += dt * flux * (flip ? -1 : 1);
102 	     recValues[i] =  flux * (flip ? -1 : 1) * 1.e-2;
103 	  }
104 
105        }
106     }
107 
108 
109     public void initializeState() {
110        potential = props.Vinit;
111        if (controller != null) {
112 	  stimulus = controller.getStimulus(0, 0.);
113 	  if (stimulus != null && stimulus.getType() == Stimulus.VALUE) {
114 	     potential = stimulus.getValue();
115 	  }
116        }
117     }
118 
119 
120 
121 */
122 
123 
124 
125 
126