Michael Thomas Flanagan's Java Scientific Library

ClosedLoop Class:      Control Theory Closed Loop Modelling

     

Last update: 8 November 2009                                                                                                                              Main Page of Michael Thomas Flanagan's Java Scientific Library

This class supports the creation of a closed loop of Black Boxes, i.e. of instances of BlackBox and of any of its subclasses, e.g. PropIntDeriv, FirstOrder, and the methods to combine these into a single instance of BlackBox, a forward path and a feedback path, e.g,



The boxes constituting the forward path and the total closed loop path (forward path plus feedback path) are also combined into relevant segments as defined in the class OpenLoop.
This class is a sub-class of BlackBox. WARNING! Any BlackBox method will treat an instance of ClosedLoop as a single entity, e.g. the transient response methods will use the instance's combined transfer function in the s-domain to generate a transient response curve irrespective of whether the the loop contains only analogue components, only digital components or a mixture of analogue and digital components.

import directive: import flanagan.control.ClosedLoop;

SUMMARY OF CONSTRUCTORS AND METHODS

Constructor   public ClosedLoop()
Add boxes to the paths
Forward path public void addBoxToForwardPath(BlackBox box)
Feedback path public void addBoxToFeedbackPath(BlackBox box)
Combine all added boxes into a single box
  public void consolidate()
Remove all boxes from the path
  public void removeAllBoxes()
Get the Vector of segments
Closed loop path public Vector getClosedLoopSegmentsVector()
Forward path public Vector getForwardPathSegmentsVector()
Get the names of the boxes in the paths
Closed loop path public String getNamesInClosedLoop()
Forward path public String getNamesInForwardPath()
Get the number of boxes in the paths
Closed loop path public int getNumberOfBoxesInClosedLoop()
Forward path public int getNumberOfBoxesInForwardPath()
Get the number of segments in the paths
Closed loop path public int getNumberOfSegmentsInClosedLoop()
Forward path public int getNumberOfSegmentsInForwardPath()
Deep Copy   public ClosedLoop copy()
public Object clone()
See BlackBox for the inherited methods



CONSTRUCTOR

public ClosedLoop()
Usage:                      ClosedLoop cl = new ClosedLoop();
This constructor creates a new instance of ClosedLoop. This instance inherits all the methods of the superclass BlackBox but some of these methods may not always be physically meaningful when applied to some instances of ClosedLoop.



ADD BOXES TO THE PATHS

Add boxes to the forward path
public void addBoxToForwardPath(BlackBox input)
Usage:                      cl.addBoxToForwardPath(box);
The method allows a box to be added to the forward path (see diagram at top of page). The box may be BlackBox, AtoD, DtoA, FirstOrder, SecondOrder, PropIntDeriv, PropInt, PropDeriv, Prop, Transducer, DelayLine, ZeroOrderHold or any instance that is a sub-class of BlackBox.
Only one box may be added at a time but addBoxToForwardPath() may be called as often as required to add as many boxes to the path as required.

Add boxes to the feedback path
public void addBoxToFeedbackPath(BlackBox input)
Usage:                      cl.addBoxToFeedbackPath(box);
The method allows a box to be added to the feedback path (see diagram at top of page). The box may be BlackBox, AtoD, DtoA, FirstOrder, SecondOrder, PropIntDeriv, PropInt, PropDeriv, Prop, Transducer, DelayLine, ZeroOrderHold or any instance that is a sub-class of BlackBox.
Only one box may be added at a time but addBoxToFeedbackPath() may be called as often as required to add as many boxes to the path as required.



COMBINE ALL BOXES INTO A SINGLE BOX

public void consolidate()
Usage:                      cl.consolidate();
This method combines all the boxes that have been entered, via call/s to addBoxToForwardPath() and addBoxToFeedbackPath(), into a single box.



REMOVE ALL BOXES FROM THE LOOP

public void removeAllBoxes()
Usage:                      cl.removeAllBoxes();
This method removes all the boxes that have been entered to both the forward path and the feedback path allowing new paths to be entered



GET THE VECTOR OF SEGMENTS

Get the segments reprsenting the total closed loop
public Vector getClosedLoopSegmentsVector()
Usage:                      seg = cl.getClosedLoopSegmentsVector();
This method returns a Vector of segments in the total closed loop, i.e. forward path plus feedback path (see diagram at the top of the page and diagram on OpenLoop).
The Vector elements are: Get the segments reprsenting the forward path
public Vector getForwardPathSegmentsVector()
Usage:                      seg = cl.getForwardPathSegmentsVector();
This method returns a Vector of segments in the forward path (see diagram at the top of the page and diagram on OpenLoop).
The Vector elements are defined immediately above.



GET THE NAMES OF THE BOXES IN THE PATHS

Get the names of the boxes in the closed loop
public String getNamesInClosedLoop()
Usage:                      names = cl.getNamesInClosedLoop();
This method returns a String that is a list of the names of the boxes in the total closed loop, i.e. forward path plus feedback path (see diagram at the top of the page and diagram on OpenLoop).

Get the names of the boxes in the forward path
public String getNamesInForwardPath()
Usage:                      names = cl.getNamesInForwardPath();
This method returns a String that is a list of the names of the boxes in the forward path (see diagram at the top of the page and diagram on OpenLoop).



GET THE NUMBER OF THE BOXES IN THE PATHS

Get the number of boxes in the closed loop
public int getNumberOfBoxesInClosedLoop()
Usage:                      numBox = cl.getNumberOfBoxesInClosedLoop();
This method returns the number of boxes entered into the the total closed loop, i.e. forward path plus feedback path (see diagram at the top of the page and diagram on OpenLoop).

Get the number of boxes in the forward path
public int getNumberOfBoxesInForwardPath()
Usage:                      numBox = cl.getNumberOfBoxesInForwardPath();
This method returns the number of boxes entered into the the forward path (see diagram at the top of the page and diagram on OpenLoop).



GET THE NUMBER OF THE SEGMENTS IN THE PATHS

Get the number of segments in the closed loop
public int getNumberOfSegmentsInClosedLoop()
Usage:                      numSeg = cl.getNumberOfSegmentsInClosedLoop();
This method returns the number of segments into which the total closed loop, i.e. forward path plus feedback path has been split. See diagram at the top of the page for closed loop definition and diagram on OpenLoop for definition of a segment.

Get the number of segments in the forward path
public int getNumberOfSegmentsInForwardPath()
Usage:                      numSeg = cl.getNumberOfSegmentsInForwardPath();
This method returns the number of segments into which the forward path has been split. See diagram at the top of the page for forward path definition and diagram on OpenLoop for definition of a segment.



DEEP COPY

public ClosedLoop copy()
public Object clone()

Copy a ClosedLoop
Usage:                      aa = bb.copy();
A deep copy of ClosedLoop, bb, is returned as aa.

Clone a ClosedLoop
Usage:                      aa = bb.clone();
A deep copy of ClosedLoop, bb, is returned as aa cast as Object. This method overrides java.lang.Object.clone().



EXAMPLE PROGRAMS

Example Program One
The simple example program, ClosedLoopExampleOne.java, illustrates the display of the transient response, to a step input, of a closed loop with a proportional controller and first order process in the forward path and a transducer in the feedback path:



Compare with the Open Loop Example equivalent example program. Note the time axis difference.

Example Program Two
The simple example program, ClosedLoopExampleTwo.java, illustrates the display of the steady state transfer function value, for a step input, of a closed loop with a proportional controller and first order process in the forward path and a transducer in the feedback path, as a function of increasing proportional controller gain (block diagram as above in Example One).





OTHER CLASSES USED BY THIS CLASS

This class is a subclass of BlackBox which uses the following classes in this library:


This page was prepared by Dr Michael Thomas Flanagan