Class DynamicSystem
java.lang.Object
org.opensourcephysics.display.OSPRuntime.Supported
org.opensourcephysics.cabrillo.tracker.TTrack
org.opensourcephysics.cabrillo.tracker.PointMass
org.opensourcephysics.cabrillo.tracker.ParticleModel
org.opensourcephysics.cabrillo.tracker.DynamicParticle
org.opensourcephysics.cabrillo.tracker.DynamicParticlePolar
org.opensourcephysics.cabrillo.tracker.DynamicSystem
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
,Drawable
,Interactive
,Measurable
,Trackable
,ODE
This models a system of 2 particles that interact via internal forces.
- Version:
- 1.0
- Author:
- D. Brown
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opensourcephysics.cabrillo.tracker.PointMass
PointMass.FrameData
Nested classes/interfaces inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
TTrack.NameDialog, TTrack.StepArray, TTrack.TextLineLabel, TTrack.TrackDecimalField, TTrack.TrackNumberField
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String[]
protected ParticleModel[]
protected TTrack.StepArray
protected String[]
protected DynamicParticle[]
protected double[]
protected TTrack.StepArray
protected boolean
protected DynamicSystemInspector
protected JMenuItem
protected int
protected int
Fields inherited from class org.opensourcephysics.cabrillo.tracker.DynamicParticlePolar
polarVars
Fields inherited from class org.opensourcephysics.cabrillo.tracker.DynamicParticle
boosterName, cartVars, cellNumberField, frameStates, initialState, inSystem, iterationsPerStep, modelBooster, solver, state, system
Fields inherited from class org.opensourcephysics.cabrillo.tracker.ParticleModel
dt, endFrame, functionEditor, functionPanel, inspectorH, inspectorX, inspectorY, invalidWarningShown, loading, massParamListener, modelBuilder, modelBuilderItem, myPoint, nan, nCalc, points, prevX, prevY, refreshDerivsLater, refreshStepsLater, showModelBuilder, stampItem, startFrame, startFrameUndefined, t0, time, timeFormat, timeParamListener, tracePt, tracePtsPerStep, traceX, traceY, useDefaultReferenceFrame, useDefaultRefFrameItem, xLimit, yLimit
Fields inherited from class org.opensourcephysics.cabrillo.tracker.PointMass
aAtOrigin, accelerationMenu, aColorItem, aDeriv, aDerivSpill, aFootprint, aFootprintMenu, aFootprints, algorithm, allVariables, aTailsToOriginItem, aTailsToPositionItem, autotrackItem, aVisibleItem, aVisibleOnAll, BOUNCE_DETECT, bounceDerivs, bounceDerivsSpill, derivData, drawsTrace, fieldVariables, FINITE_DIFF, FINITE_DIFF_VSPILL2, footprintNames, formatDescriptionMap, formatMap, formatVariables, isAutofill, isAutoKeyDown, labelsVisible, mass, massField, massLabel, MINIMUM_MASS, mSeparator, params, showfilledSteps, skippedSteps, trace, traceStroke, traceVisible, validData, vAtOrigin, vColorItem, vDeriv, vDerivSpill, vectorFields, velocityMenu, vFootprint, vFootprintMenu, vFootprints, vTailsToOriginItem, vTailsToPositionItem, vVisibleItem, vVisibleOnAll, xData, xVisibleOnAll, yData
Fields inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
angleField, angleLabel, angleSeparator, attachmentNames, attachments, autoAdvance, autoAdvanceItem, autoTrackerMarking, circleFootprintListener, clearStepsItem, closeButton, colorItem, constantsLoadedFromXML, customNumberFormats, dataBuilderItem, dataDescriptions, dataFrames, dataProp, datasetManager, dataValid, defaultColors, defaultFootprint, deleteStepItem, deleteTrackItem, description, descriptionItem, enabled, fieldBorder, fixedItem, footprint, footprintListener, footprintMenu, footprints, formatAngleMouseListener, formatMouseListener, hint, HINT_STEP_ADDED_OR_REMOVED, HINT_STEPS_SELECTED, initialized, isMarking, keyFrames, labelFont, locked, lockedItem, magField, magLabel, magSeparator, markByDefault, markByDefaultItem, name, nameDialog, nameItem, nextID, NOMAP, NOMAPS, NOVARA, NOVARS, numberFields, partName, positionFields, preferredColumnOrder, properties, PROPERTY_TTRACK_COLOR, PROPERTY_TTRACK_DATA, PROPERTY_TTRACK_FOOTPRINT, PROPERTY_TTRACK_FORMAT, PROPERTY_TTRACK_LOCKED, PROPERTY_TTRACK_MASS, PROPERTY_TTRACK_MODELEND, PROPERTY_TTRACK_MODELSTART, PROPERTY_TTRACK_NAME, PROPERTY_TTRACK_STEP, PROPERTY_TTRACK_STEPS, PROPERTY_TTRACK_TEXTCOLUMN, PROPERTY_TTRACK_VISIBLE, refreshDataLater, skippedStepWarningCheckbox, skippedStepWarningDialog, skippedStepWarningOn, skippedStepWarningTextpane, stepLabel, steps, stepSeparator, stepSizeWhenFirstMarked, stepValueLabel, targetIndex, textColumnEntries, textColumnNames, tField, tframe, tLabel, toolbarPointComponents, toolbarTrackComponents, tp, trailLength, trailVisible, trailVisibleItem, tSeparator, ttype, tValueLabel, TYPE_CALIBRATION, TYPE_CIRCLEFITTER, TYPE_COORDAXES, TYPE_LINEPROFILE, TYPE_OFFSETORIGIN, TYPE_PERSPECTIVE, TYPE_POINTMASS, TYPE_PROTRACTOR, TYPE_RGBREGION, TYPE_TAPEMEASURE, TYPE_UNKNOWN, TYPE_VECTOR, viewable, visible, visibleItem, xField, xLabel, xSeparator, xSpinner, yField, yLabel, ySeparator, ySpinner
Fields inherited from interface org.opensourcephysics.media.core.Trackable
PROPERTY_ADJUSTING
-
Constructor Summary
ConstructorsConstructorDescriptionNo-arg constructor.DynamicSystem
(DynamicParticle[] parts) Constructor with particles. -
Method Summary
Modifier and TypeMethodDescriptionboolean
addParticle
(DynamicParticle particle) Adds a particle to this system.void
delete()
Deletes this system.void
dispose()
Disposes of resources when this track is deleted or cleared.void
draw
(DrawingPanel panel, Graphics _g) Overrides DynamicParticle draw method.Gets a display name for this model.double[]
Gets the initial state.double[]
Gets the initial values.static XML.ObjectLoader
Returns an ObjectLoader to save and load data for this class.double
getMass()
Gets the mass.getMenu
(TrackerPanel trackerPanel, JMenu menu0) Returns a menu with items that control this track.protected ParticleModel[]
Gets the particle models associated with this model.void
getRate
(double[] state, double[] rate) Gets the rate based on a specified state.protected double[]
getRelativePolarState
(double[] state) Converts a two-body cartesian state {x1, vx1, y1, vy1, x2, vx2, y2, vy2, t} to a relative polar state {r, vr, theta, omega, t}.protected double[]
getState
(DynamicParticle particle) Gets the current state of the specified particle.Gets the system inspector.protected double[]
getSystemState
(double[] state) Gets the state of this system based on the states of its particles.getToolbarTrackComponents
(TrackerPanel trackerPanel) Overrides TTrack getToolbarTrackComponents method.void
initialize
(TrackerPanel trackerPanel) Finish up any unfinished loading business that for whatever reason was not finished upon loading a track.protected void
Creates and initializes the ModelFunctionPanel.boolean
Overrides TTrack isDependent method to return true.void
Responds to property change events.protected void
refreshData
(DatasetManager data, TrackerPanel panel) Refreshes the data.protected void
Refreshes initial time parameter for this model.protected void
Refreshes the initial positions, velocities and particle masses based on the values for the particles in this system.boolean
removeParticle
(DynamicParticle particle) Removes a particle from this system.void
setFontLevel
(int level) Sets the font level.boolean
setParticles
(DynamicParticle[] newParticles) Sets the particles in this system.protected void
setTracePositions
(double[] state) Sets the positions of the trace points based on a specified state.Methods inherited from class org.opensourcephysics.cabrillo.tracker.DynamicParticlePolar
getBoostState, getBoostVars, getPolarState, getXYForces, initializeInitEditor
Methods inherited from class org.opensourcephysics.cabrillo.tracker.DynamicParticle
boost, getBooster, getEndFrame, getNextTracePositions, getStartFrame, getState, isBoostedBy, refreshSteps, reset, resetState, restoreState, saveState, setBooster, setEndFrame, setSolver, setStartFrame
Methods inherited from class org.opensourcephysics.cabrillo.tracker.ParticleModel
createMassAndTimeParameters, createPositionStep, doStamp, drawMe, findInteractive, fireStepsChanged, getFunctionEditor, getInitEditor, getLastValidFrame, getModelBuilder, getParamEditor, getToolbarPointComponents, holdPainting, isAutoTrackable, isModelsVisible, isStepComplete, isUseDefaultReferenceFrame, newTimeParam, refreshDerivsIfNeeded, setAnglesInRadians, setLastValidFrame, setLocked, setMass, setName, setTrackerPanel, setUseDefaultReferenceFrame, trimSteps
Methods inherited from class org.opensourcephysics.cabrillo.tracker.PointMass
autoMarkAt, createGUI, createMenuIfNecessary, createStep, deleteAutoTrackerStep, deleteStep, erase, erase, getAArray, getAcceleration, getAccelerationFootprint, getAccelerationFootprints, getAccelerations, getBaseType, getFootprint, getFootprintLength, getFootprints, getFormatDescMap, getFormatMap, getFormatVariables, getNextVisibleStep, getNumberFields, getNumberFieldsForStep, getPreviousVisibleStep, getRotationData, getRotationData, getStep, getStepLength, getTargetDescription, getUnfilledGapCount, getVarDimsImpl, getVArray, getVelocities, getVelocity, getVelocityFootprint, getVelocityFootprints, getWorldAcceleration, getWorldPosition, getWorldVelocity, hasGaps, isAcceleration, isAutofill, isAVisible, isLabelsVisible, isPosition, isPositionVisible, isStepVisible, isTraceVisible, isVelocity, isVVisible, markAllInterpolatedSteps, markInterpolatedSteps, markInterpolatedSteps, remark, remark, setAccelerationColor, setAccelerationFootprint, setAccelerationFootprints, setAlgorithm, setAutoFill, setAVisible, setAVisibleOnAll, setColor, setFootprint, setLabelsVisible, setMarking, setPositionVisible, setPositionVisibleOnAll, setTraceVisible, setVelocityColor, setVelocityFootprint, setVelocityFootprints, setVisible, setVVisible, setVVisibleOnAll, updateDerivatives, updateDerivatives, updateDerivatives, updateDerivatives, updateDerivatives
Methods inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
addFixedItem, addFootprint, addListener, addListenerNCF, addPanelEvents, addStepListener, addTextColumn, assembleMenu, clearColumns, convertTextToDataColumn, createAllVariables, createWarningDialog, delete, finalize, getAllVariables, getAttachmentDescription, getAttachmentLength, getAttachments, getBaseTrackName, getBaseTypeInt, getColor, getCustomFormatPatterns, getData, getData, getDataDescription, getDataName, getDefaultFormatPatterns, getDefaultFormatPatterns, getDescription, getFootprint, getFootprintName, getFootprints, getFormatPatterns, getFrameForData, getIcon, getID, getMarkedPoint, getMarkingCursor, getMenuItems, getMessage, getName, getName, getNameDialog, getPlotViews, getPreferredDataOrder, getProperty, getPropertyNames, getSkippedStepWarningDialog, getStep, getSteps, getStepSizeWarningDialog, getTableViews, getTargetIndex, getTextColumnEntry, getTextColumnNames, getTrack, getTrailLength, getValues, getVarFormatPattern, getVariableDimensions, getVariablesFromFormatterDisplayName, getX, getXMax, getXMin, getY, getYMax, getYMin, invalidateData, isAttached, isAutoAdvance, isAutoTrackable, isDataValid, isEmpty, isEnabled, isFullyAttached, isLocked, isMarkByDefault, isMarking, isMeasured, isTrailVisible, isViewable, isVisible, loadAttachmentsFromNames, refreshAttachments, refreshAttachmentsLater, refreshData, refreshDecimalSeparators, removeActiveTrack, removeDeleteTrackItem, removeListener, removeListenerNCF, removePanelEvents, removeStepListener, removeTextColumn, renameTextColumn, repaint, repaint, repaintAll, repaintStep, restorePatterns, savePatterns, setActive, setAutoAdvance, setColorToDefault, setDefaultNameAndColor, setDescription, setEnabled, setFixedPosition, setFootprint, setFootprints, setFootprints, setFormatPattern, setInitialFormatPatterns, setMarkByDefault, setProperty, setTargetIndex, setTargetIndex, setTargetIndex, setTextColumnEntry, setTrailLength, setTrailVisible, setViewable, setX, setXY, setY, showAnglePopup, showFormatPopup, toString, updateListenerVisible
Methods inherited from class org.opensourcephysics.display.OSPRuntime.Supported
addListeners, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListenerSafely, dispose, firePropertyChange, firePropertyChange, removeListeners, removePropertyChangeListener, removePropertyChangeListener
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opensourcephysics.display.Interactive
isInteractive
-
Field Details
-
particles
-
models
-
particleState
protected double[] particleState -
systemInspector
-
systemInspectorItem
-
particleNames
-
realSteps
-
noSteps
-
systemInspectorX
protected int systemInspectorX -
systemInspectorY
protected int systemInspectorY -
frameRelativeStates
-
refreshing
protected boolean refreshing -
dataVariables
-
-
Constructor Details
-
DynamicSystem
public DynamicSystem()No-arg constructor. -
DynamicSystem
Constructor with particles.- Parameters:
parts
- an array of up to two dynamic particles
-
-
Method Details
-
draw
Overrides DynamicParticle draw method.- Specified by:
draw
in interfaceDrawable
- Overrides:
draw
in classDynamicParticle
- Parameters:
panel
- the drawing panel requesting the drawing_g
- the graphics context on which to draw
-
initialize
Description copied from class:TTrack
Finish up any unfinished loading business that for whatever reason was not finished upon loading a track. For example, adding masses to a center-of-mass system, or adding particles to a DynamicSystem.- Overrides:
initialize
in classTTrack
-
getDisplayName
Gets a display name for this model.- Overrides:
getDisplayName
in classDynamicParticle
- Returns:
- the display name
-
getMenu
Returns a menu with items that control this track.- Overrides:
getMenu
in classParticleModel
- Parameters:
trackerPanel
- the tracker panelmenu0
- the menu. If null, a dynamic menu is returned that adds items only when selected- Returns:
- a menu
-
getToolbarTrackComponents
Overrides TTrack getToolbarTrackComponents method.- Overrides:
getToolbarTrackComponents
in classPointMass
- Parameters:
trackerPanel
- the tracker panel- Returns:
- a list of components
-
getMass
public double getMass()Gets the mass. Overrides PointMass method.- Overrides:
getMass
in classParticleModel
- Returns:
- the mass
-
isDependent
public boolean isDependent()Overrides TTrack isDependent method to return true.- Overrides:
isDependent
in classParticleModel
- Returns:
true
if this track is dependent
-
addParticle
Adds a particle to this system.- Parameters:
particle
- the particle to add- Returns:
- true if particle added
-
removeParticle
Removes a particle from this system.- Parameters:
particle
- the particle to remove- Returns:
- true if particle removed
-
setParticles
Sets the particles in this system.- Parameters:
newParticles
- an array of zero to two dynamic particles- Returns:
- true if particles accepted
-
delete
public void delete()Deletes this system. Overrides DynamicParticle method to clean up particles after deleting.- Overrides:
delete
in classDynamicParticle
-
getRate
public void getRate(double[] state, double[] rate) Gets the rate based on a specified state.- Specified by:
getRate
in interfaceODE
- Overrides:
getRate
in classDynamicParticle
- Parameters:
state
- the staterate
- the rate of change of the state
-
getInitialValues
public double[] getInitialValues()Gets the initial values.- Overrides:
getInitialValues
in classParticleModel
- Returns:
- initial values {x1, vx1, y1, vy1, x2, vx2, y2, vy2, t}
-
propertyChange
Responds to property change events.- Specified by:
propertyChange
in interfacePropertyChangeListener
- Overrides:
propertyChange
in classDynamicParticle
- Parameters:
e
- the property change event
-
setFontLevel
public void setFontLevel(int level) Description copied from class:PointMass
Sets the font level.- Overrides:
setFontLevel
in classPointMass
- Parameters:
level
- the desired font level
-
getSystemInspector
Gets the system inspector.- Returns:
- the system inspector
-
getInitialState
public double[] getInitialState()Gets the initial state. Overrides DynamicParticle method.- Overrides:
getInitialState
in classDynamicParticlePolar
- Returns:
- the initial state
-
refreshData
Refreshes the data. Overrides PointMass method.- Overrides:
refreshData
in classPointMass
- Parameters:
data
- the DatasetManagerpanel
- the tracker panel
-
dispose
public void dispose()Description copied from class:TTrack
Disposes of resources when this track is deleted or cleared.- Overrides:
dispose
in classDynamicParticle
-
refreshInitialTime
protected void refreshInitialTime()Refreshes initial time parameter for this model. Overrides ParticleModel.- Overrides:
refreshInitialTime
in classParticleModel
-
refreshSystemParameters
protected void refreshSystemParameters()Refreshes the initial positions, velocities and particle masses based on the values for the particles in this system. -
setTracePositions
protected void setTracePositions(double[] state) Sets the positions of the trace points based on a specified state.- Overrides:
setTracePositions
in classDynamicParticle
- Parameters:
state
- the state
-
initializeFunctionPanel
protected void initializeFunctionPanel()Creates and initializes the ModelFunctionPanel.- Overrides:
initializeFunctionPanel
in classDynamicParticlePolar
-
getSystemState
protected double[] getSystemState(double[] state) Gets the state of this system based on the states of its particles.- Parameters:
state
- the particle state {x1, vx1, y1, vy1, x2, vx2, y2, vy2, t}- Returns:
- the system state {x_cm, vx_cm, y_cm, vy_cm, t}
-
getState
Gets the current state of the specified particle.- Parameters:
particle
- the particle- Returns:
- the state of the particle {x, vx, y, vy, t}
-
getModels
Gets the particle models associated with this model.- Overrides:
getModels
in classParticleModel
- Returns:
- an array of particle models
-
getRelativePolarState
protected double[] getRelativePolarState(double[] state) Converts a two-body cartesian state {x1, vx1, y1, vy1, x2, vx2, y2, vy2, t} to a relative polar state {r, vr, theta, omega, t}.- Parameters:
state
- the cartesian state of both particles- Returns:
- the polar state of particle 1 relative to particle 2
-
getLoader
Returns an ObjectLoader to save and load data for this class.- Returns:
- the object loader
-