Class TuningDashboardComponent

  • All Implemented Interfaces:
    com.inductiveautomation.factorypmi.application.binding.DynamicPropertyProvider, com.inductiveautomation.ignition.client.model.LocaleListener, com.inductiveautomation.vision.api.client.binding.MutableDynamicPropertyProvider, com.inductiveautomation.vision.api.client.binding.StyleProvider, com.inductiveautomation.vision.api.client.components.model.ComponentLifecycle, com.inductiveautomation.vision.api.client.components.model.ExtensibleComponent, com.inductiveautomation.vision.api.client.components.model.QualityMonitor, com.inductiveautomation.vision.api.client.components.model.VisionComponent, com.jlbcontrols.pidbot.client.ign.DatasetFromCsvTaskListener, com.jlbcontrols.pidbot.client.ign.ProcessModelerTaskListener, com.jlbcontrols.pidbot.common.modelfitting.FitDataListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, org.jfree.data.general.SeriesChangeListener

    public class TuningDashboardComponent
    extends com.inductiveautomation.vision.api.client.components.model.AbstractVisionPanel
    implements com.inductiveautomation.ignition.client.model.LocaleListener, java.beans.PropertyChangeListener, org.jfree.data.general.SeriesChangeListener, com.jlbcontrols.pidbot.client.ign.ProcessModelerTaskListener, com.jlbcontrols.pidbot.client.ign.DatasetFromCsvTaskListener, com.jlbcontrols.pidbot.common.modelfitting.FitDataListener, com.inductiveautomation.vision.api.client.components.model.ExtensibleComponent
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.BaselineResizeBehavior
    • Field Summary

      • Fields inherited from class javax.swing.JComponent

        TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • Fields inherited from class java.awt.Component

        BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface com.inductiveautomation.vision.api.client.components.model.ComponentLifecycle

        COMPONENT_RUNNING
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • Fields inherited from interface com.inductiveautomation.vision.api.client.binding.MutableDynamicPropertyProvider

        RESERVED_SET_KEY
      • Fields inherited from interface com.inductiveautomation.vision.api.client.components.model.VisionComponent

        COMPONENT_LOCKED, COMPONENT_PERMISSIONS, COMPONENT_TRANSLATIONS
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void accept()
      Accept new tuning values (copy "tuned" values to "current") after prompting user to confirm.
      java.lang.String createCombinedCSV()
      Creates a CSV of the combined pvData and cvData.
      java.awt.image.BufferedImage createModelChartImage​(int w, int h)
      Creates a buffered image of the model chart as it is currently displayed on the Model Tab
      java.awt.image.BufferedImage createTuneChartImage​(int w, int h)
      Creates a buffered image of the simulation chart as it is currently displayed on the Tune Tab
      java.lang.String exportCSV()
      Creates a CSV of the combined pvData and cvData, and prompts the user to save the file.
      java.lang.String getClosedLoopErrorMsg()
      Get text descriptions of problems preventing the closed loop "tune" simulation from running.
      com.inductiveautomation.ignition.common.Dataset getCombinedData()
      Combines the pvData and cvData into one dataset for more convenient csv export or other storage.
      boolean getPlotCurrentTuning()
      Flag to simulate current tuning values (if available), and display them on the simulation plot.
      double getProcessDeadTime()
      Returns the average modeled process dead time.
      double getProcessGain()
      Returns the average modeled process gain.
      double getProcessTimeConst()
      Returns the average modeled process time constant.
      double getTunedD()
      The "new" Derivative tuning value, proposed and simulated for consideration.
      double getTunedI()
      The "new" Integral tuning value, proposed and simulated for consideration.
      double getTunedP()
      The "new" Proportional tuning value, proposed and simulated for consideration.
      int getTuneType()
      Returns an integer indicating which tuning parameters that are included in suggested tuning values.
      int getTuningAggression()
      Adjustment factor (0-100) used to calculate suggesting tuning values *Note: Typo in function name to be fixed in next release.
      void importCSV()
      Prompts the user to select a csv file to import.
      void reset​(boolean confirmRequired)
      Stops data recording, clears all data and models.
      void setCombinedData​(com.inductiveautomation.ignition.common.Dataset ds)
      Sets the cvData and pvData from a single dataset.
      void setPlotCurrentTuning​(boolean plotCurrentTuning)
      Sets a flag to simulate current tuning values (if available), and display them on the simulation plot.
      void setTunedD​(double tunedD)
      Sets the "new" Derivative tuning value.
      void setTunedI​(double tunedI)
      Sets the "new" Integral tuning value.
      void setTunedP​(double tunedP)
      Sets the "new" Proportional tuning value.
      void setTuneType​(int tuneType)
      Sets which tuning parameters will be included in suggested tuning values.
      void setTuningAggression​(int tuningAggression)
      Set the tuning adjustment factor (0-100) and update suggested tuning values.
      • Methods inherited from class com.inductiveautomation.vision.api.client.components.model.AbstractVisionPanel

        getAppContext, getCursorCode, getDataQuality, getDynamicProps, getProperties, getPropertyValue, getStyles, getToolTipText, isAntialias, isPropertyDefined, localeChanged, setAntialias, setCursorCode, setDataQuality, setDynamicProps, setName, setPropertyValue, setStyles, setToolTipText, setVisible, shutdownComponent, startupComponent, updateQuality
      • Methods inherited from class javax.swing.JPanel

        getAccessibleContext, getUI, getUIClassID, setUI, updateUI
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setOpaque, setPreferredSize, setRequestFocusEnabled, setTransferHandler, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, list, list, paintComponents, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
      • Methods inherited from class java.awt.Component

        add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, hasFocus, imageUpdate, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, list, list, list, paintAll, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setSize, setSize, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface com.inductiveautomation.vision.api.client.components.model.ComponentLifecycle

        getAppContext, shutdownComponent, startupComponent
      • Methods inherited from interface com.jlbcontrols.pidbot.client.ign.DatasetFromCsvTaskListener

        notifyDsFromCsvComplete
      • Methods inherited from interface com.inductiveautomation.vision.api.client.components.model.ExtensibleComponent

        getExtensionFunctions, setExtensionFunctions
      • Methods inherited from interface com.jlbcontrols.pidbot.common.modelfitting.FitDataListener

        avgChanged, fitAdded, fitsRemoved, fitsUpdated, fitTypeChanged
      • Methods inherited from interface com.inductiveautomation.ignition.client.model.LocaleListener

        localeChanged
      • Methods inherited from interface com.jlbcontrols.pidbot.client.ign.ProcessModelerTaskListener

        notifyProcessModelerTaskComplete
      • Methods inherited from interface java.beans.PropertyChangeListener

        propertyChange
      • Methods inherited from interface org.jfree.data.general.SeriesChangeListener

        seriesChanged
    • Constructor Detail

      • TuningDashboardComponent

        public TuningDashboardComponent()
    • Method Detail

      • reset

        public void reset​(boolean confirmRequired)
        Stops data recording, clears all data and models.
        Parameters:
        confirmRequired - set this flag to show popup for user confirmation before resetting
      • getClosedLoopErrorMsg

        public java.lang.String getClosedLoopErrorMsg()
        Get text descriptions of problems preventing the closed loop "tune" simulation from running. Returns Null if there are no errors, and the simulation will be processed.
        Returns:
        Description of the closed loop sim errors.
      • accept

        public void accept()
        Accept new tuning values (copy "tuned" values to "current") after prompting user to confirm. Invokes "onAccept" extension function, which has the opportunity to cancel acceptance.
      • createModelChartImage

        public java.awt.image.BufferedImage createModelChartImage​(int w,
                                                                  int h)
        Creates a buffered image of the model chart as it is currently displayed on the Model Tab
        Parameters:
        w - pixel width of the image to create
        h - pixel height of the image to create
        Returns:
        a buffered image of the chart currently displayed on the Model Tab
      • createTuneChartImage

        public java.awt.image.BufferedImage createTuneChartImage​(int w,
                                                                 int h)
        Creates a buffered image of the simulation chart as it is currently displayed on the Tune Tab
        Parameters:
        w - pixel width of the image to create
        h - pixel height of the image to create
        Returns:
        a buffered image of the chart currently displayed on the Tune Tab
      • getPlotCurrentTuning

        public boolean getPlotCurrentTuning()
        Flag to simulate current tuning values (if available), and display them on the simulation plot. Does not apply if the dashboard property "showCurrentTuning" is false.
        Returns:
        Boolean flag indicating if current tuning values should be simulated.
      • setPlotCurrentTuning

        public void setPlotCurrentTuning​(boolean plotCurrentTuning)
        Sets a flag to simulate current tuning values (if available), and display them on the simulation plot. Does not apply if the dashboard property "showCurrentTuning" is false.
        Parameters:
        plotCurrentTuning - Boolean flag indicating if current tuning values should be simulated.
      • getTuneType

        public int getTuneType()
        Returns an integer indicating which tuning parameters that are included in suggested tuning values.
        Returns:
        an integer indicating which PID params will be suggested, 0:P-Only, 1=PI, 2=PID
      • setTuneType

        public void setTuneType​(int tuneType)
        Sets which tuning parameters will be included in suggested tuning values.
        Parameters:
        tuneType - an integer indicating which PID params will be suggested, 0:P-Only, 1=PI, 2=PID
      • getTuningAggression

        public int getTuningAggression()
        Adjustment factor (0-100) used to calculate suggesting tuning values *Note: Typo in function name to be fixed in next release. Higher values lead to faster responses, but loop stability is less robust. Only applies if "new" tuning values (tunedP,tunedI,tunedD) are not manually entered. Note:Typo if function name to be fixed in next release.
        Returns:
        the tuning calculation adjustment factor
      • setTuningAggression

        public void setTuningAggression​(int tuningAggression)
        Set the tuning adjustment factor (0-100) and update suggested tuning values.
      • getTunedP

        public double getTunedP()
        The "new" Proportional tuning value, proposed and simulated for consideration.
        Returns:
        the "new" Proportional tuning value.
      • setTunedP

        public void setTunedP​(double tunedP)
        Sets the "new" Proportional tuning value. This overrides the suggested tuning value.
      • getTunedI

        public double getTunedI()
        The "new" Integral tuning value, proposed and simulated for consideration.
        Returns:
        the new Integral tuning value. Units are [1/timeUnit] for Independent form PID, or [timeUnit] for Dependent. Time unit and PID form are part of the PID config settings.
      • setTunedI

        public void setTunedI​(double tunedI)
        Sets the "new" Integral tuning value. This overrides the suggested tuning value.
      • getTunedD

        public double getTunedD()
        The "new" Derivative tuning value, proposed and simulated for consideration.
        Returns:
        the new Derivative tuning value under consideration [timeUnit]. Time unit is part of the PID config settings.
      • setTunedD

        public void setTunedD​(double tunedD)
        Sets the "new" Derivative tuning value. This overrides the suggested tuning value.
      • getProcessGain

        public double getProcessGain()
        Returns the average modeled process gain.
        Returns:
        the average modeled process gain. For FOPDT processes, units are [PV Units/CV Units]. For IPDT processes, units are [(PV Units/CV Units)/second].
      • getProcessDeadTime

        public double getProcessDeadTime()
        Returns the average modeled process dead time.
        Returns:
        the average modeled process dead time [seconds].
      • getProcessTimeConst

        public double getProcessTimeConst()
        Returns the average modeled process time constant. Only applies to FOPDT Processes, N/A for IPDT processes.
        Returns:
        the average modeled process time constant [seconds].
      • getCombinedData

        public com.inductiveautomation.ignition.common.Dataset getCombinedData()
        Combines the pvData and cvData into one dataset for more convenient csv export or other storage.
        Returns:
        the combined CV and PV data
      • setCombinedData

        public void setCombinedData​(com.inductiveautomation.ignition.common.Dataset ds)
        Sets the cvData and pvData from a single dataset.
        Parameters:
        ds - Dataset of timestamped cv and pv data. The first column (time stamp) must be a Date or a Number, the second column (CV) and third column (PV) must be a Number data type.
      • exportCSV

        public java.lang.String exportCSV()
        Creates a CSV of the combined pvData and cvData, and prompts the user to save the file.
      • createCombinedCSV

        public java.lang.String createCombinedCSV()
                                           throws java.io.IOException
        Creates a CSV of the combined pvData and cvData. The csv timestamps have millisecond precision. This function was needed because Ignition's built-in functions, system.dataset.exportCSV & .toCSV, round Dates.
        Throws:
        java.io.IOException
      • importCSV

        public void importCSV()
        Prompts the user to select a csv file to import. The file must be formatted per the requirements Ignition's built-in system.dataset.fromCSV function. Use the Tuning Dashboard component's exportCSV function for formatting example. The first column (time stamp) must be a Date or a Number, the second column (CV) and third column (PV) must be a Number data type.