|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--java.awt.Panel
|
+--java.applet.Applet
|
+--edu.davidson.tools.SApplet
|
+--circuitsimulator.Circuit
Main applet to use in exercises, displays the circuit build by a script.
| Inner classes inherited from class java.applet.Applet |
java.applet.Applet.AccessibleApplet |
| Inner classes inherited from class java.awt.Panel |
java.awt.Panel.AccessibleAWTPanel |
| Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
| Field Summary | |
double |
dt
time step width in the calculation of the V and I functions. |
double |
fps
frames (clock steps) per second |
java.lang.String |
imagedir
|
int |
noc
number of calculations (dt time steps) in one clock step |
int |
numberofdt
Number of time steps. |
double |
realt
Real time for the circuit when the clock is running |
| Fields inherited from class edu.davidson.tools.SApplet |
autoRefresh, clock, dataConnections, dataListeners, dataSources, debugLevel, lock, oneShotMsg, staticDebugLevel |
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
Circuit()
The constructor. |
|
| Method Summary | |
int |
addObject(java.lang.String name,
java.lang.String list)
The element objects (wire, resistor, capacitor, inductor, source, general) can be added at the wanted coordinates: |
java.net.URL |
base()
|
void |
calculateCircuit()
Calculates all Voltage and Current parameters that are defined after a parse action for a whole time interval. |
boolean |
changePolarity(int id)
Changes the polarity of an element |
boolean |
couple(int id1,
int id2)
Couples two elements together |
java.lang.String |
get(int id)
Gets the property list of an element |
double[] |
getCurrent(int id)
Read the Current curve of an object for the whole time interval. |
double |
getDCLevel(int id)
Calculates the mean Voltage level for a whole time interval. |
double |
getIAmplitude(int id)
Read the amplitude of the Current curve for the whole time interval. |
int |
getID(int r,
int c,
java.lang.String to)
Get the ID of an element to row "R", column "C", direction "to" horizontal ("h") or vertical ("h") |
double |
getIMaxT(int id)
Read the time of the maximum Current value of an object for a whole time interval |
double |
getIMinT(int id)
Read the time of the minimum Current value of an object for a whole time interval |
double |
getIrms(int id)
Read the RMS value of the Current curve for the whole time interval. |
double[] |
getPar(int par)
|
java.lang.String |
getScript()
|
double[] |
gett()
|
double |
getVAmplitude(int id)
Read the amplitude of the Voltage curve for the whole time interval. |
double |
getVMaxT(int id)
Read the time of the maximum Voltage value of an object for a whole time interval |
double |
getVMinT(int id)
Read the time of the minimum Voltage value of an object for a whole time interval |
double[] |
getVoltage(int id)
Read the Voltage curve of an object for the whole time interval. |
double[] |
getVoltage(int br,
int bc,
int er,
int ec)
Read the Voltage curve between two points of the circuit for the whole time interval. |
double |
getVrms(int id)
Read the RMS value of the Voltage curve for the whole time interval. |
void |
init()
|
void |
parse()
Interprets the whole circuit and translates this into a set of equations. |
boolean |
removeObject(int id)
|
void |
reset()
|
void |
resetTiming()
|
void |
run()
|
boolean |
set(int id,
java.lang.String s)
Sets properties of an element |
void |
setDT(double dt)
|
boolean |
setFont(int id,
java.lang.String family,
int style,
int size)
Change the font style of an element |
boolean |
setFormat(int id,
java.lang.String fstr)
Change the numeric format of an element. |
void |
setFPS(double fps)
|
void |
setGrid(int r,
int c)
Set the size of the circuit grid. |
void |
setGrid(java.lang.String list)
Set the size of the circuit grid. |
boolean |
setImage(int id,
java.lang.String gifname)
Changes the element's default image. |
boolean |
setImageVisible(int id,
boolean status)
Changes the visibility of the element's default image |
void |
setIntergrid(int ig)
|
boolean |
setLabel(int id,
java.lang.String l)
Changes the label of an element |
boolean |
setMaxCurrentValue(int id,
java.lang.String s)
Sets the value for the highest possible current for the component |
void |
setNOC(int noc)
|
void |
setNumberOfDT(int numberofdt)
|
boolean |
setRCTo(int id,
int r,
int c,
java.lang.String to)
Move an element to row "R", column "C", direction "to" horizontal ("h") or vertical ("h") |
void |
setShowCurrent(int sc)
Enable/disable the display of current arrows. |
boolean |
setValue(int id,
java.lang.String s)
Sets the value of a passive element (resistor, capacitor, inductor) |
boolean |
setValueVisible(int id,
boolean status)
Changes the visibility of an element's value or function |
void |
start()
Start is called by the browser whenever the html page is entered. |
void |
step(double dt,
double time)
The step method that will be called at every clock step. |
void |
stop()
|
| Methods inherited from class edu.davidson.tools.SApplet |
addDataListener, addDataSource, cleanupDataConnections, clearAllData, clearData, cyclingClock, deleteDataConnection, deleteDataConnections, destroy, forward, getClockID, getClockTime, getDataConnectionFromDL, getDataConnectionFromDS, getDataFromDS, getDataListener, getDataListener, getDataSource, getDataSource, getDebugLevel, getID, getRunningID, getSourceData, getSourceVariables, isAutoRefresh, isClockRunning, makeDataConnection, pause, pausingClock, removeDataListener, removeDataSource, reverse, setAutoRefresh, setClockContinous, setClockCycle, setClockOneShot, setClockTime, setConnectionBlock, setConnectionListener, setConnectionSmoothing, setConnectionSource, setConnectionStride, setDebugLevel, setDefault, setDt, setExternalClock, setRunningID, setRunningID, setTimeContinuous, setTimeCycle, setTimeOneShot, startClock, stepClock, stepTime, stepTimeBack, stepTimeForward, stopClock, stoppingClock, updateDataConnection, updateDataConnections |
| Methods inherited from class java.applet.Applet |
getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus |
| Methods inherited from class java.awt.Panel |
addNotify |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, update, validate, validateTree |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public int numberofdt
Number of time steps.
The whole time interval is determined by numberofdt times dt.public double dt
public int noc
public double fps
public double realt
public java.lang.String imagedir
| Constructor Detail |
public Circuit()
The constructor. DO NO SCRIPT!
Register the applet as a clock listener so that we can step the solution in time.
| Method Detail |
public void start()
Start is called by the browser whenever the html page is entered. DO NOT SCRIPT.
Since start runs after to that ALL html elements have been loaded, it is a good place to do initialization. This version of start is used for testing only since we can't script fron the JDK.
start in class java.applet.Appletpublic void run()
run in interface java.lang.Runnablepublic void stop()
stop in class java.applet.Appletpublic void reset()
reset in class edu.davidson.tools.SAppletpublic void init()
init in class java.applet.Applet
public void setGrid(int r,
int c)
r - number of rowsc - number of columnspublic void setGrid(java.lang.String list)
list - String : "rows=***,cols=***"public void calculateCircuit()
public void step(double dt,
double time)
step in interface edu.davidson.tools.SStepablepublic void setIntergrid(int ig)
public java.net.URL base()
public void parse()
public void setDT(double dt)
public void setNOC(int noc)
public void setNumberOfDT(int numberofdt)
public void setFPS(double fps)
setFPS in class edu.davidson.tools.SAppletpublic void resetTiming()
public void setShowCurrent(int sc)
sc - 0 disables the display, all other values enable the displaypublic double[] gett()
public java.lang.String getScript()
public double[] getPar(int par)
public int getID(int r,
int c,
java.lang.String to)
r - rowc - columnto - direction
public double[] getVoltage(int br,
int bc,
int er,
int ec)
br - row for the negative probe pointbc - column for the negative probe pointer - row for the positive probe pointec - column for the positive probe pointpublic double[] getVoltage(int id)
id - the object identifierpublic double[] getCurrent(int id)
id - the object identifierpublic double getVAmplitude(int id)
id - the object identifierpublic double getIAmplitude(int id)
id - the object identifierpublic double getVMaxT(int id)
id - the object identifierpublic double getVMinT(int id)
id - the object identifierpublic double getVrms(int id)
id - the object identifierpublic double getIMaxT(int id)
id - the object identifierpublic double getIMinT(int id)
id - the object identifierpublic double getIrms(int id)
id - the object identifierpublic double getDCLevel(int id)
id - the object identifier
public int addObject(java.lang.String name,
java.lang.String list)
The element objects (wire, resistor, capacitor, inductor, source, general) can be added at the wanted coordinates:
The 'source' has additional parameters:
---- OR ---- Instead of the func-parameter, the following predefined functions can be used:
Other objects have following parameters:
A probe is set as in following example:
addObject("probe","row=1,col=0,row2=3,col2=4");
Examples:
name - the object to be addedlist - a list of settable parameters
public boolean couple(int id1,
int id2)
id - the object identifiers - the property list
public boolean set(int id,
java.lang.String s)
id - the object identifiers - the property listpublic java.lang.String get(int id)
id - the object identifier
public boolean setValue(int id,
java.lang.String s)
id - the object identifierv - the new value
public boolean setMaxCurrentValue(int id,
java.lang.String s)
id - the object identifierv - the new valuepublic boolean changePolarity(int id)
id - the object identifier
public boolean setLabel(int id,
java.lang.String l)
id - the object identifierl - the new label
public boolean setValueVisible(int id,
boolean status)
id - the object identifierstatus - the value is visible if status = true
public boolean setImageVisible(int id,
boolean status)
id - the object identifierstatus - the default image is visible if status = true
public boolean setImage(int id,
java.lang.String gifname)
id - the object identifiergifname - the name of the image new gif file
public boolean setFormat(int id,
java.lang.String fstr)
id - the object identifierfstr - the format string
public boolean setFont(int id,
java.lang.String family,
int style,
int size)
id - the object identifierfamily - The font family: Helvetica, Times.style - The style: 0=plain, 1=bold.size - The size of the font.
public boolean setRCTo(int id,
int r,
int c,
java.lang.String to)
id - the object identifierr - rowc - columnto - directionpublic boolean removeObject(int id)
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||