org.simBio.core
Class Conductor

java.lang.Object
  extended by org.simBio.core.Component
      extended by org.simBio.core.Parameter
          extended by org.simBio.core.Composite
              extended by org.simBio.core.Reactor
                  extended by org.simBio.core.Conductor
All Implemented Interfaces:
java.lang.Runnable, Node, Visitor

public class Conductor
extends Reactor
implements java.lang.Runnable, Visitor

root instance to conduct integration. At this moment, ODE is calculated by Euler method.
モデルツリーのルートになり、積分計算を行います。 Runnableをimplementsしており、Threadを1つ使います。

Version:
$Id: Conductor.java,v 1.7 2007/09/18 07:27:34 nsarai Exp $
Author:
Nobuaki Sarai

Field Summary
 double adjustDyOverY
          for variable time step, empirical method
 double dtMax
          maximum time step of integration
 double dtMin
          minimum time step of integration
 Node duration
          duration of integration
 Node elapsedTime
          elapsed time
 Node timeStep
          time step of integration
 
Fields inherited from class org.simBio.core.Parameter
value
 
Constructor Summary
Conductor()
           
 
Method Summary
 void addCalculationObserver(CalculationObserver obs)
          計算を開始・終了した時に、通知が行われる監視オブジェクトを追加します。
 void calculate(double t)
          call calculate(double t) of the every Reactor.
 void checkException()
          Check if this thread has thrown an exception.
protected  void end()
          end of integration
 void exit()
          exit run() of this Thread.
protected  void integrate()
          integrate ODEs.
 void prepare()
          initialization for calculation.
protected  void quit()
          call before exit thread.
 void removeCalculationObserver(CalculationObserver obs)
          計算を開始・終了した時に、通知が行われる監視オブジェクトを削除します。
 void run()
          main entry of this thread.
protected  void setLinks()
          call after instance tree has constructed.
 void start()
          start calculation.
 void stop()
          stop calculation.
 void visit(Component component)
          Add Variables to the list.
 void visit(Composite composite)
          add Reactors to ReactorList, and Analyzers to AnalyzerList.
 
Methods inherited from class org.simBio.core.Composite
accept, getLink, getNode, getNodesIterator, getNodesSize
 
Methods inherited from class org.simBio.core.Parameter
addValue, getValue, getValueString, setInitializer, setValue, setValueString, setValueToField
 
Methods inherited from class org.simBio.core.Component
addDydt, getIndent, getIndentedShortName, getName, getName, getParent, getRoot, getShortName, getUnits, isNamed, isPrefixed, logIndented
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.simBio.core.Node
addDydt, addValue, getValue, setValue
 

Field Detail

elapsedTime

public Node elapsedTime
elapsed time


duration

public Node duration
duration of integration


timeStep

public Node timeStep
time step of integration


dtMin

public double dtMin
minimum time step of integration


dtMax

public double dtMax
maximum time step of integration


adjustDyOverY

public double adjustDyOverY
for variable time step, empirical method

Constructor Detail

Conductor

public Conductor()
Method Detail

visit

public void visit(Component component)
Add Variables to the list.
Variableをlistに登録します。

Specified by:
visit in interface Visitor
See Also:
Visitor.visit(org.simBio.core.Component)

visit

public void visit(Composite composite)
add Reactors to ReactorList, and Analyzers to AnalyzerList.
Reactor, Analyzerをlistに登録します。

Specified by:
visit in interface Visitor
See Also:
Visitor.visit(org.simBio.core.Composite)

run

public void run()
main entry of this thread.
setLinks()を呼び出した後、待機ループにはいります。 計算開始flagが立てられると、integrate()を呼び出し、積分計算をします。 終了flagが立てられると、NodeList.quit()を呼び出し、threadを終了します。

Specified by:
run in interface java.lang.Runnable
See Also:
Runnable.run()

setLinks

protected void setLinks()
call after instance tree has constructed.
次のようなinstance treeの場合、
        external
                cell
                        Vm
                        Na
                        K
                        NaChannel
                                4sGate
                                2sGate
                        /NaChannel
                        K1Channel
                /cell
        /external
        
次の順序で全てのNodeのsetLinks()を呼び出します。
                        Vm
                        Na
                        K
                                4sGate
                                2sGate
                        NaChannel
                        K1Channel
                cell
        external

Overrides:
setLinks in class Component
See Also:
Component.setLinks()

quit

protected void quit()
call before exit thread.

Overrides:
quit in class Component
See Also:
Component.quit()

prepare

public void prepare()
initialization for calculation.

Overrides:
prepare in class Parameter
See Also:
Component.prepare()

end

protected void end()
end of integration

Overrides:
end in class Component
See Also:
Component.end()

integrate

protected void integrate()
integrate ODEs.

First prepare() is called, then for every time step:

  1. calculate(double t)
  2. analyze(double t) of all Analyzer
  3. update(double t) of all Variable
  4. Elapsed time is renewed, and continue calculation during duration.
Last end() is called.

最初にprepare()を呼び出します。各time step毎に、

  1. calculate(double t)
  2. 全てのVariableのupdate(double t). (注: Variables.update()を、xmlで指定して作成するように変更すれば、計算方式を変更できます。)
  3. 全てのAnalyzerのanalyze(double t)をtreeの末端から順に呼び出します。
  4. elapsed timeを更新し、durationに設定された時間分だけ、計算をします。
最後に、end()を呼び出します。

See Also:
calculate(double)

calculate

public void calculate(double t)
call calculate(double t) of the every Reactor.
Reactor.calculate(double)を呼び出す順序は、以下のようになります。
                                4sGate
                                2sGate
                        NaChannel
                        K1Channel
                cell
        external
        

Specified by:
calculate in class Reactor
Parameters:
t - elapsed time (ms)
See Also:
Reactor.calculate(double)

checkException

public void checkException()
                    throws java.lang.Exception
Check if this thread has thrown an exception.

Throws:
java.lang.Exception

start

public void start()
start calculation. set calculate flag = true


stop

public void stop()
stop calculation. set calculate flag = false


exit

public void exit()
exit run() of this Thread. set active flag = false


addCalculationObserver

public void addCalculationObserver(CalculationObserver obs)
計算を開始・終了した時に、通知が行われる監視オブジェクトを追加します。

Parameters:
obs - 監視オブジェクト

removeCalculationObserver

public void removeCalculationObserver(CalculationObserver obs)
計算を開始・終了した時に、通知が行われる監視オブジェクトを削除します。

Parameters:
obs - 監視オブジェクト


Copyright © 2002-2008 Cell/Biodinamics simulation project. All Rights Reserved.