Class PolarToComplex

  • All Implemented Interfaces:
    java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class PolarToComplex
    extends TypedAtomicActor
    This actor reads two double tokens (magnitude and angle) and outputs a single complex token. The output is a complex token representation of the coordinates given at the inputs in polar form. The complex token has two parts: the first part correspond to the real part, which is magnitude * cos(angle, and the second part is the imaginary part, which is magnitude * sin(angle). Note that the angle input is assumed to be in radians. If either input is NaN or infinity, then the output is NaN or infinity.
    Since:
    Ptolemy II 1.0
    Version:
    $Id$
    Author:
    Michael Leung, Edward A. Lee, Paul Whitaker
    Pt.AcceptedRating:
    Green (pwhitake)
    Pt.ProposedRating:
    Green (pwhitake)
    • Field Detail

      • magnitude

        public TypedIOPort magnitude
        The input port for the magnitude component, which has type DoubleToken.
      • angle

        public TypedIOPort angle
        The input port for the angle component (in radians), which has type DoubleToken.
      • output

        public TypedIOPort output
        The port for the output, which has type ComplexToken.
    • Method Detail

      • fire

        public void fire()
                  throws IllegalActionException
        Consume a double token from each input port (magnitude and angle) and output a new complex token on the output port. The output is a complex representation of the coordinates given at the inputs in polar form. The input angle is assumed to be in radians. If either input has no token, then do nothing.
        Specified by:
        fire in interface Executable
        Overrides:
        fire in class AtomicActor<TypedIOPort>
        Throws:
        IllegalActionException - If there is no director.