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.FrameDataNested 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.StepArrayprotected String[]protected DynamicParticle[]protected double[]protected TTrack.StepArrayprotected booleanprotected DynamicSystemInspectorprotected JMenuItemprotected intprotected intFields inherited from class org.opensourcephysics.cabrillo.tracker.DynamicParticlePolar
polarVarsFields inherited from class org.opensourcephysics.cabrillo.tracker.DynamicParticle
boosterName, cartVars, cellNumberField, frameStates, initialState, inSystem, iterationsPerStep, modelBooster, solver, state, systemFields 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, yLimitFields 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, yDataFields 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, ySpinnerFields 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 TypeMethodDescriptionbooleanaddParticle(DynamicParticle particle) Adds a particle to this system.voiddelete()Deletes this system.voiddispose()Disposes of resources when this track is deleted or cleared.voiddraw(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.ObjectLoaderReturns an ObjectLoader to save and load data for this class.doublegetMass()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.voidgetRate(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.voidinitialize(TrackerPanel trackerPanel) Finish up any unfinished loading business that for whatever reason was not finished upon loading a track.protected voidCreates and initializes the ModelFunctionPanel.booleanOverrides TTrack isDependent method to return true.voidResponds to property change events.protected voidrefreshData(DatasetManager data, TrackerPanel panel) Refreshes the data.protected voidRefreshes initial time parameter for this model.protected voidRefreshes the initial positions, velocities and particle masses based on the values for the particles in this system.booleanremoveParticle(DynamicParticle particle) Removes a particle from this system.voidsetFontLevel(int level) Sets the font level.booleansetParticles(DynamicParticle[] newParticles) Sets the particles in this system.protected voidsetTracePositions(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, initializeInitEditorMethods inherited from class org.opensourcephysics.cabrillo.tracker.DynamicParticle
boost, getBooster, getEndFrame, getNextTracePositions, getStartFrame, getState, isBoostedBy, refreshSteps, reset, resetState, restoreState, saveState, setBooster, setEndFrame, setSolver, setStartFrameMethods 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, trimStepsMethods 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, updateDerivativesMethods 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, updateListenerVisibleMethods inherited from class org.opensourcephysics.display.OSPRuntime.Supported
addListeners, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListenerSafely, dispose, firePropertyChange, firePropertyChange, removeListeners, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:
drawin interfaceDrawable- Overrides:
drawin classDynamicParticle- Parameters:
panel- the drawing panel requesting the drawing_g- the graphics context on which to draw
-
initialize
Description copied from class:TTrackFinish 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:
initializein classTTrack
-
getDisplayName
Gets a display name for this model.- Overrides:
getDisplayNamein classDynamicParticle- Returns:
- the display name
-
getMenu
Returns a menu with items that control this track.- Overrides:
getMenuin 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:
getToolbarTrackComponentsin classPointMass- Parameters:
trackerPanel- the tracker panel- Returns:
- a list of components
-
getMass
public double getMass()Gets the mass. Overrides PointMass method.- Overrides:
getMassin classParticleModel- Returns:
- the mass
-
isDependent
public boolean isDependent()Overrides TTrack isDependent method to return true.- Overrides:
isDependentin classParticleModel- Returns:
trueif 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:
deletein classDynamicParticle
-
getRate
public void getRate(double[] state, double[] rate) Gets the rate based on a specified state.- Specified by:
getRatein interfaceODE- Overrides:
getRatein classDynamicParticle- Parameters:
state- the staterate- the rate of change of the state
-
getInitialValues
public double[] getInitialValues()Gets the initial values.- Overrides:
getInitialValuesin classParticleModel- Returns:
- initial values {x1, vx1, y1, vy1, x2, vx2, y2, vy2, t}
-
propertyChange
Responds to property change events.- Specified by:
propertyChangein interfacePropertyChangeListener- Overrides:
propertyChangein classDynamicParticle- Parameters:
e- the property change event
-
setFontLevel
public void setFontLevel(int level) Description copied from class:PointMassSets the font level.- Overrides:
setFontLevelin 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:
getInitialStatein classDynamicParticlePolar- Returns:
- the initial state
-
refreshData
Refreshes the data. Overrides PointMass method.- Overrides:
refreshDatain classPointMass- Parameters:
data- the DatasetManagerpanel- the tracker panel
-
dispose
public void dispose()Description copied from class:TTrackDisposes of resources when this track is deleted or cleared.- Overrides:
disposein classDynamicParticle
-
refreshInitialTime
protected void refreshInitialTime()Refreshes initial time parameter for this model. Overrides ParticleModel.- Overrides:
refreshInitialTimein 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:
setTracePositionsin classDynamicParticle- Parameters:
state- the state
-
initializeFunctionPanel
protected void initializeFunctionPanel()Creates and initializes the ModelFunctionPanel.- Overrides:
initializeFunctionPanelin 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:
getModelsin 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
-