nslj.src.system
Class NslSystem

java.lang.Object
  |
  +--nslj.src.system.NslSystem

public class NslSystem
extends java.lang.Object


Field Summary
 char _accessibilityChar
           
 boolean _runDeltaChanged
           
 boolean _trainDeltaChanged
           
static boolean applet
           
 boolean breakState
           
 int debug
           
 NslDisplaySystemVector display_system_list
           
 NslDoubleSync displayMonitor
           
 NslDoubleSync displayMonitorAck
           
 boolean doubleBuffering
           
 boolean endEpochChanged
           
static char init_run_char
           
 NslSync interpMonitor
           
static java.lang.String module_executing
           
 boolean noDisplay
           
 NslDiff nsldiff
           
protected  java.lang.String protocolName
           
 NslScheduler scheduler
           
 java.lang.String schedulerMethod
           
 boolean smallScreen
           
 boolean stepCmdRun
           
 NslSync stepMonitor
           
 
Constructor Summary
NslSystem()
          Set up all system lists for module and command registration.
 
Method Summary
 void addApproximationMethod(NslDiff m)
          Add a numerical method to the database
 void addCommand(NslCmd command)
          Add user command into the system
 void addDisplaySystem(NslDisplaySystem ds)
           
 void addModel(NslModule module, boolean noDisplay)
          Add a well-defined module into the system.
 void addNslsCommand(java.lang.String name, java.lang.String object)
           
 void addProtocol(java.lang.String name, NslModule module)
           
 void addProtocolToAll(java.lang.String name)
           
 void breakStep()
           
 void continueCmd()
           
 void continueStep()
           
 void endModule()
           
 void endRun()
           
 void endRunEpoch()
           
 void endSys()
           
 double endTime()
           
 void endTrain()
           
 void endTrainEpoch()
           
 boolean frameExist(java.lang.String name)
           
 NslCmd getCommand(java.lang.String name)
          get the user command with name name
 int getCurrentCycle()
          Get the current cycle in simulation environment
 int getCurrentEpoch()
           
 double getCurrentTime()
          Get the current time in simulation environment
 double getCurTime()
          Get the current time in simulation environment
 double getCycleAvgTime()
           
 double getCycleTimer()
           
 int getDebug()
          getDebug
 double getEndTime()
          Get the end time in simulation environment
 double getEpochAvgTime()
           
 int getEpochs()
           
 double getEpochTimer()
           
 int getFinishedCycles()
          Get the current cycle in simulation environment
 int getFinishedEpochs()
           
 NslFrame getFrame(java.lang.String name)
           
 NslInterpreter getInterpreter()
          Get the current user command interpreter
 boolean getNoDisplay()
          getNoDisplay
 java.lang.String getNslsObject(java.lang.String name)
           
 int getNumberOfDisplays()
           
 int getNumRunEpochs()
           
 int getNumTrainEpochs()
           
 NslHierarchy getRefToModuleOrClass(java.lang.String name, char desiredAccess)
          Get the ClassInstance or NslModule with label name
 double getRunEndTime()
          Get the end time in simulation environment
 int getRunEpoch()
           
 NslScheduler getScheduler()
          Get the current run-time scheduler
 java.lang.String getSchedulerMethod()
          getSchedulerMethod
 boolean getSmallScreen()
          getSmallScreen
 double getTrainEndTime()
           
 int getTrainEpoch()
           
 void incCycle()
          Increment by a one the cycle
 void incRunEpoch()
           
 void incTime()
          Increment by a run_time_step.
 void incTrainEpoch()
           
 void init_displays()
           
 void initModule()
           
 void initRun()
          Initialize the system.
 void initRunEpoch()
           
 void initSys()
           
 void initTrain()
          Initialize the system.
 void initTrainEpoch()
           
 boolean isSchedulerInRunMode()
           
 boolean isSchedulerInTrainMode()
           
 boolean isStepCmdRunning()
           
 boolean isStepHalted()
           
 void notifyDisplays()
           
 void notifySchedulerAck()
           
 void notifyStep()
           
 void nslAddCommand(java.lang.String name, java.lang.String className)
           
 void nslCreateProtocol(java.lang.String name, java.lang.String label, NslModule module)
           
 char nslGetAccess()
           
 double nslGetApproximationDelta()
          get approximation delta - integration time step / numerical method time step tm
 NslDiff nslGetApproximationMethod()
          Get current differential method in use
 double nslGetApproximationTimeConstant()
          get approximation timeConstant - integration time step / numerical method time step tm
 boolean nslGetBuffering()
           
 NslData nslGetDataVar(java.lang.String name)
           
 NslData nslGetDataVar(java.lang.String name, char desiredAccess)
           
 double nslGetDelta()
          get run step size, delta t
 NslModule nslGetModelRef()
          Get the current module context
 NslModule nslGetModuleRef(java.lang.String name)
          Get the module with label name
 NslModule nslGetModuleRef(java.lang.String name, char desiredAccess)
          Get the module with label name
 java.lang.String nslGetProtocol()
           
 double nslGetRunDelta()
          get run step size, delta t
 double nslGetTrainDelta()
          get train step size, delta t
 NslData nslGetValue(java.lang.String name)
           
 void nslPrint(java.lang.String msg)
           
 void nslPrintAllVariables()
           
 void nslPrintln(java.lang.String msg)
           
 void nslPrintStatistics()
           
 void nslSetAccess(char v)
           
 void nslSetAccessRecursive(char v)
           
 void nslSetApproximationDelta(double t)
          To set the time step size
 void nslSetApproximationMethod(NslDiff m)
          Set current differetial (numerical method) to use
 void nslSetApproximationTimeConstant(double t)
          To set the time step size
 void nslSetBuffering(boolean v)
           
 void nslSetProtocol(java.lang.String name)
           
 void nslSetRunDelta(double t)
          set run step size, delta t
 void nslSetScheduler(NslScheduler sch)
          Set the current run-time scheduler
 void nslSetSchedulerMethod(java.lang.String method)
          nslSetSchedulerMethod
 void nslSetTrainDelta(double t)
          set train step size, delta t
 boolean nslSetValue(NslData target, java.lang.String name)
           
 boolean nslSetValue(java.lang.String target, NslData value)
           
 boolean nslSetValueGeneric(NslData target, NslData provider)
           
 void printClassVariablesRecursively(NslClass cl)
           
 void printModuleVariablesRecursively(NslModule module)
           
 boolean protocolExist(java.lang.String name)
           
 void reflect()
           
 void remove(NslFrame df)
           
 void resetCycleTimer()
           
 void resetEpochTimer()
           
 void resetPorts()
           
 void setCurCycle(int cyc)
          Set the current cycle in simulation environment
 void setCurrentCycle(int cyc)
           
 void setCurrentTime(double t)
          Set the current time in simulation environment
 void setCurTime(double t)
          Set the current time in simulation environment
 void setDebug(int flag)
          setDebug
 void setEndTime(double t)
          Set the end time in simulation environment
 void SetEndTime(double val)
           
 void setExecutive(NslExecutive e)
           
 void setInterpreter(NslInterpreter interp)
          Set the current user command interpreter
 void setNoDisplay(boolean flag)
          setNoDisplay
 void setNumRunEpochs(int n)
           
 void setNumTrainEpochs(int n)
           
 void setRunEndTime(double t)
          Set the end time in simulation environment
 void setRunEpoch(int epoch)
           
 void setSmallScreen(boolean flag)
          setSmallScreen
 void setTrainEndTime(double val)
           
 void setTrainEpoch(int epoch)
           
 void startCycleTimer()
           
 void startEpochTimer()
           
 void stepCmdFinished()
           
 void stepCmdStarted()
           
 void stopCycleTimer()
           
 void stopEpochTimer()
           
 java.lang.String toString()
           
 void waitDisplayAck()
           
 void waitScheduler()
           
 void waitStep()
           
 void waitTheScheduler()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

scheduler

public NslScheduler scheduler

interpMonitor

public NslSync interpMonitor

stepMonitor

public NslSync stepMonitor

displayMonitor

public NslDoubleSync displayMonitor

displayMonitorAck

public NslDoubleSync displayMonitorAck

breakState

public boolean breakState

stepCmdRun

public boolean stepCmdRun

_runDeltaChanged

public boolean _runDeltaChanged

_trainDeltaChanged

public boolean _trainDeltaChanged

_accessibilityChar

public char _accessibilityChar

applet

public static boolean applet

display_system_list

public NslDisplaySystemVector display_system_list

module_executing

public static java.lang.String module_executing

init_run_char

public static char init_run_char

endEpochChanged

public boolean endEpochChanged

nsldiff

public NslDiff nsldiff

doubleBuffering

public boolean doubleBuffering

smallScreen

public boolean smallScreen

noDisplay

public boolean noDisplay

debug

public int debug

schedulerMethod

public java.lang.String schedulerMethod

protocolName

protected java.lang.String protocolName
Constructor Detail

NslSystem

public NslSystem()
Set up all system lists for module and command registration. Set up simulation clock and other system parameter to a default value
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

SetEndTime

public void SetEndTime(double val)

endTime

public double endTime()

initSys

public void initSys()

endSys

public void endSys()

initModule

public void initModule()

initRunEpoch

public void initRunEpoch()

initTrainEpoch

public void initTrainEpoch()

initRun

public void initRun()
Initialize the system. Set the clock to zero. Ready for next simulation to run. init_run_flag=before, during, after B,D,A - after = after nslUpdateBuffers

endRun

public void endRun()

endRunEpoch

public void endRunEpoch()

initTrain

public void initTrain()
Initialize the system. Set the clock to zero. Initialize scheduler. Ready for next simulation to run. init_run_flag=before, during, after B,D,A - after = after nslUpdateBuffers

endTrain

public void endTrain()

endTrainEpoch

public void endTrainEpoch()

endModule

public void endModule()

isSchedulerInRunMode

public boolean isSchedulerInRunMode()

isSchedulerInTrainMode

public boolean isSchedulerInTrainMode()

addModel

public void addModel(NslModule module,
                     boolean noDisplay)
Add a well-defined module into the system. Connect the internal modules.
Parameters:
module - module to be added

nslGetModuleRef

public NslModule nslGetModuleRef(java.lang.String name)
Get the module with label name
Parameters:
name - The name to search
Returns:
module, null if not found

nslGetModuleRef

public NslModule nslGetModuleRef(java.lang.String name,
                                 char desiredAccess)
Get the module with label name
Parameters:
name - The name to search
Returns:
module, null if not found

getRefToModuleOrClass

public NslHierarchy getRefToModuleOrClass(java.lang.String name,
                                          char desiredAccess)
Get the ClassInstance or NslModule with label name
Parameters:
name - -The name to search
desiredAccess - - what type of desiredAccess is desired
parent - - where are we starting from
Returns:
moduleOrClass - NslBase, or null if not found

nslGetDataVar

public NslData nslGetDataVar(java.lang.String name)

nslGetDataVar

public NslData nslGetDataVar(java.lang.String name,
                             char desiredAccess)

nslGetValue

public NslData nslGetValue(java.lang.String name)

nslSetValue

public boolean nslSetValue(java.lang.String target,
                           NslData value)

nslSetValue

public boolean nslSetValue(NslData target,
                           java.lang.String name)

nslSetValueGeneric

public boolean nslSetValueGeneric(NslData target,
                                  NslData provider)

nslPrintAllVariables

public void nslPrintAllVariables()

printModuleVariablesRecursively

public void printModuleVariablesRecursively(NslModule module)

printClassVariablesRecursively

public void printClassVariablesRecursively(NslClass cl)

nslGetModelRef

public NslModule nslGetModelRef()
Get the current module context
Returns:
currnet module

addCommand

public void addCommand(NslCmd command)
Add user command into the system
Parameters:
command -  

getCommand

public NslCmd getCommand(java.lang.String name)
get the user command with name name
Parameters:
name - the command name
Returns:
the command with the name, null if not found

setInterpreter

public void setInterpreter(NslInterpreter interp)
Set the current user command interpreter
Parameters:
interp -  

getInterpreter

public NslInterpreter getInterpreter()
Get the current user command interpreter
Returns:
Interpreter

waitScheduler

public void waitScheduler()

continueCmd

public void continueCmd()

waitStep

public void waitStep()

notifyStep

public void notifyStep()

waitTheScheduler

public void waitTheScheduler()

notifyDisplays

public void notifyDisplays()

waitDisplayAck

public void waitDisplayAck()

notifySchedulerAck

public void notifySchedulerAck()

isStepHalted

public boolean isStepHalted()

breakStep

public void breakStep()

continueStep

public void continueStep()

isStepCmdRunning

public boolean isStepCmdRunning()

stepCmdStarted

public void stepCmdStarted()

stepCmdFinished

public void stepCmdFinished()

nslSetScheduler

public void nslSetScheduler(NslScheduler sch)
Set the current run-time scheduler
Parameters:
interp -  

getScheduler

public NslScheduler getScheduler()
Get the current run-time scheduler
Returns:
Scheduler

addApproximationMethod

public void addApproximationMethod(NslDiff m)
Add a numerical method to the database
Parameters:
m - the numerical method

nslSetApproximationMethod

public void nslSetApproximationMethod(NslDiff m)
Set current differetial (numerical method) to use
Parameters:
m - numerical method.

nslGetApproximationMethod

public NslDiff nslGetApproximationMethod()
Get current differential method in use

getEpochTimer

public double getEpochTimer()

getCycleTimer

public double getCycleTimer()

getEpochAvgTime

public double getEpochAvgTime()

getCycleAvgTime

public double getCycleAvgTime()

startCycleTimer

public void startCycleTimer()

startEpochTimer

public void startEpochTimer()

stopCycleTimer

public void stopCycleTimer()

stopEpochTimer

public void stopEpochTimer()

resetCycleTimer

public void resetCycleTimer()

resetEpochTimer

public void resetEpochTimer()

getCurTime

public double getCurTime()
Get the current time in simulation environment
Returns:
cur_time - current time

setCurTime

public void setCurTime(double t)
Set the current time in simulation environment
Parameters:
t - - current time

getCurrentTime

public double getCurrentTime()
Get the current time in simulation environment
Returns:
cur_time - current time

setCurrentTime

public void setCurrentTime(double t)
Set the current time in simulation environment
Parameters:
t - - current time

getCurrentCycle

public int getCurrentCycle()
Get the current cycle in simulation environment
Returns:
cur_cycle - current cycle

getFinishedCycles

public int getFinishedCycles()
Get the current cycle in simulation environment
Returns:
cur_cycle - current cycle

setCurCycle

public void setCurCycle(int cyc)
Set the current cycle in simulation environment
Parameters:
t - - current cycle int

setCurrentCycle

public void setCurrentCycle(int cyc)

incCycle

public void incCycle()
Increment by a one the cycle

getRunEpoch

public int getRunEpoch()

getTrainEpoch

public int getTrainEpoch()

setRunEpoch

public void setRunEpoch(int epoch)

setTrainEpoch

public void setTrainEpoch(int epoch)

incRunEpoch

public void incRunEpoch()

incTrainEpoch

public void incTrainEpoch()

incTime

public void incTime()
Increment by a run_time_step.

setNumTrainEpochs

public void setNumTrainEpochs(int n)

setNumRunEpochs

public void setNumRunEpochs(int n)

getNumTrainEpochs

public int getNumTrainEpochs()

getNumRunEpochs

public int getNumRunEpochs()

getEpochs

public int getEpochs()

getEndTime

public double getEndTime()
Get the end time in simulation environment
Returns:
end_time - end time

setEndTime

public void setEndTime(double t)
Set the end time in simulation environment
Parameters:
t - - end time

setTrainEndTime

public void setTrainEndTime(double val)

getTrainEndTime

public double getTrainEndTime()

getRunEndTime

public double getRunEndTime()
Get the end time in simulation environment
Returns:
end_time - end time

setRunEndTime

public void setRunEndTime(double t)
Set the end time in simulation environment
Parameters:
t - - end time

nslGetDelta

public double nslGetDelta()
get run step size, delta t
Returns:
step size

getCurrentEpoch

public int getCurrentEpoch()

getFinishedEpochs

public int getFinishedEpochs()

nslGetRunDelta

public double nslGetRunDelta()
get run step size, delta t
Returns:
step size

nslSetRunDelta

public void nslSetRunDelta(double t)
set run step size, delta t
Parameters:
t - step size

nslGetTrainDelta

public double nslGetTrainDelta()
get train step size, delta t
Returns:
step size

nslSetTrainDelta

public void nslSetTrainDelta(double t)
set train step size, delta t
Parameters:
t - step size

nslGetApproximationDelta

public double nslGetApproximationDelta()
get approximation delta - integration time step / numerical method time step tm
Returns:
time step size

nslSetApproximationDelta

public void nslSetApproximationDelta(double t)
To set the time step size
Parameters:
t - time step size

nslGetApproximationTimeConstant

public double nslGetApproximationTimeConstant()
get approximation timeConstant - integration time step / numerical method time step tm
Returns:
time step size

nslSetApproximationTimeConstant

public void nslSetApproximationTimeConstant(double t)
To set the time step size
Parameters:
t - time step size

addDisplaySystem

public void addDisplaySystem(NslDisplaySystem ds)

remove

public void remove(NslFrame df)

getSmallScreen

public boolean getSmallScreen()
getSmallScreen
Returns:
smallScreen 98/8/4 aa

setSmallScreen

public void setSmallScreen(boolean flag)
setSmallScreen
Parameters:
boolean - flag

getNoDisplay

public boolean getNoDisplay()
getNoDisplay
Returns:
noDisplay 98/8/4 aa

setNoDisplay

public void setNoDisplay(boolean flag)
setNoDisplay
Parameters:
boolean - flag

getDebug

public int getDebug()
getDebug
Returns:
debug 98/8/4 aa

setDebug

public void setDebug(int flag)
setDebug
Parameters:
int - flag

getSchedulerMethod

public java.lang.String getSchedulerMethod()
getSchedulerMethod
Returns:
schedulerMethod 98/9/11 aa

nslSetSchedulerMethod

public void nslSetSchedulerMethod(java.lang.String method)
nslSetSchedulerMethod
Parameters:
int - flag note: "pre" parent before child "post" parent after child "mixed" init methods do p before c; run methods do p after c.

nslSetAccess

public void nslSetAccess(char v)

nslGetAccess

public char nslGetAccess()

nslSetAccessRecursive

public void nslSetAccessRecursive(char v)

nslSetBuffering

public void nslSetBuffering(boolean v)

nslGetBuffering

public boolean nslGetBuffering()

resetPorts

public void resetPorts()

addNslsCommand

public void addNslsCommand(java.lang.String name,
                           java.lang.String object)

getNslsObject

public java.lang.String getNslsObject(java.lang.String name)

nslAddCommand

public void nslAddCommand(java.lang.String name,
                          java.lang.String className)

reflect

public void reflect()

setExecutive

public void setExecutive(NslExecutive e)

addProtocolToAll

public void addProtocolToAll(java.lang.String name)

addProtocol

public void addProtocol(java.lang.String name,
                        NslModule module)

nslCreateProtocol

public void nslCreateProtocol(java.lang.String name,
                              java.lang.String label,
                              NslModule module)

protocolExist

public boolean protocolExist(java.lang.String name)

nslGetProtocol

public java.lang.String nslGetProtocol()

nslSetProtocol

public void nslSetProtocol(java.lang.String name)

nslPrint

public void nslPrint(java.lang.String msg)

nslPrintln

public void nslPrintln(java.lang.String msg)

nslPrintStatistics

public void nslPrintStatistics()

init_displays

public void init_displays()

getNumberOfDisplays

public int getNumberOfDisplays()

frameExist

public boolean frameExist(java.lang.String name)

getFrame

public NslFrame getFrame(java.lang.String name)