Examples of DoubleToken


Examples of ptolemy.data.DoubleToken

     */
    public Joystick(CompositeEntity container, String name)
            throws NameDuplicationException, IllegalActionException {
        super(container, name);

        deadZone = new Parameter(this, "deadZone", new DoubleToken("0.01"));

        isPolling = new Parameter(this, "isPolling", new BooleanToken("true"));

        pollingInterval = new Parameter(this, "pollingInterval", new IntToken(
                "50"));
View Full Code Here

Examples of ptolemy.data.DoubleToken

        if (_isPollingValue) {
            _joy.poll();
        }

        x.send(0, new DoubleToken(_joy.getX()));
        y.send(0, new DoubleToken(_joy.getY()));
    }
View Full Code Here

Examples of ptolemy.data.DoubleToken

        iterationsPerUpdate = new Parameter(this, "iterationsPerUpdate");
        iterationsPerUpdate.setExpression("1");

        // set the parameters
        xInit = new Parameter(this, "xInit", new DoubleToken(0.0));
        xInit.setTypeEquals(BaseType.DOUBLE);
        xUnit = new Parameter(this, "xUnit", new DoubleToken(1.0));
        xUnit.setTypeEquals(BaseType.DOUBLE);

        // initialize the parameters
        attributeChanged(xInit);
        attributeChanged(xUnit);
View Full Code Here

Examples of ptolemy.data.DoubleToken

        output.setMultiport(false);
        output.setTypeEquals(BaseType.BOOLEAN);
        new Parameter(output, "signalType", new StringToken("DISCRETE"));

        _thWidth = 1e-2;
        thresholdWidth = new Parameter(this, "thresholdWidth", new DoubleToken(
                _thWidth));

        _thCenter = 0.0;
        thresholdCenter = new Parameter(this, "thresholdCenter",
                new DoubleToken(_thCenter));

        _lowerBound = -5e-3;
        _upperBound = 5e-3;
    }
View Full Code Here

Examples of ptolemy.data.DoubleToken

    public TimedScope(CompositeEntity container, String name)
            throws IllegalActionException, NameDuplicationException {
        super(container, name);

        // set the parameters
        width = new Parameter(this, "width", new DoubleToken(10.0));
        width.setTypeEquals(BaseType.DOUBLE);
        persistence = new Parameter(this, "persistence", new DoubleToken(10.0));
        persistence.setTypeEquals(BaseType.DOUBLE);
    }
View Full Code Here

Examples of ptolemy.data.DoubleToken

        input = new TypedIOPort(this, "input", true, false);
        input.setMultiport(true);
        input.setTypeEquals(BaseType.DOUBLE);

        // set the parameters
        xInit = new Parameter(this, "xInit", new DoubleToken(0.0));
        xInit.setTypeEquals(BaseType.DOUBLE);
        xUnit = new Parameter(this, "xUnit", new DoubleToken(1.0));
        xUnit.setTypeEquals(BaseType.DOUBLE);

        // initialize the parameters
        attributeChanged(xInit);
        attributeChanged(xUnit);
View Full Code Here

Examples of ptolemy.data.DoubleToken

        int width = input.getWidth();
        int offset = ((IntToken) startingDataset.getToken()).intValue();

        for (int i = width - 1; i >= 0; i--) {
            if (input.hasToken(i)) {
                DoubleToken curToken = (DoubleToken) input.get(i);
                if (curToken.isNil()) {
                    _connected[i] = false;
                } else {
                    double curValue = curToken.doubleValue();

                    // NOTE: We assume the superclass ensures this
                    // cast is safe.

                    ((Plot) plot).addPoint(i + offset, _xValue, curValue,
View Full Code Here

Examples of ptolemy.data.DoubleToken

                // Algebraic system
                if (a[0] == b[0]) {
                    connect(input, output);
                } else {
                    Scale scaleD = new Scale(this, "ScaleD");
                    scaleD.factor.setToken(new DoubleToken(b[0] / a[0]));
                    connect(input, scaleD.input);
                    connect(output, scaleD.output);
                }
            } else {
                double d = b[0] / a[0];
                int order = n - 1;
                AddSubtract inputAdder = new AddSubtract(this, "InputAdder");
                AddSubtract outputAdder = new AddSubtract(this, "OutputAdder");
                Integrator[] integrators = new Integrator[order];
                IORelation[] nodes = new IORelation[order];
                Scale[] feedback = new Scale[order];
                Scale[] feedforward = new Scale[order];

                for (int i = 0; i < order; i++) {
                    // The integrator names are d0x, d1x, etc.
                    integrators[i] = new Integrator(this, "Integrator" + i);
                    feedback[i] = new Scale(this, "Feedback" + i);
                    feedback[i].factor.setToken(new DoubleToken(-a[i + 1]
                            / a[0]));
                    feedforward[i] = new Scale(this, "Feedforward" + i);
                    feedforward[i].factor.setToken(new DoubleToken(
                            (b[i + 1] - (d * a[i + 1])) / a[0]));

                    // connections
                    nodes[i] = (IORelation) connect(integrators[i].output,
                            feedforward[i].input, "node" + i);
                    feedback[i].input.link(nodes[i]);
                    connect(feedback[i].output, inputAdder.plus);
                    connect(feedforward[i].output, outputAdder.plus);

                    if (i >= 1) {
                        integrators[i].input.link(nodes[i - 1]);
                    }
                }

                connect(inputAdder.output, integrators[0].input);

                IORelation inputRelation = (IORelation) connect(input,
                        inputAdder.plus, "inputRelation");
                connect(output, outputAdder.output, "outputRelation");

                if (d != 0) {
                    Scale scaleD = new Scale(this, "ScaleD");
                    scaleD.factor.setToken(new DoubleToken(d));
                    scaleD.input.link(inputRelation);
                    connect(scaleD.output, outputAdder.plus);
                }
            }

View Full Code Here

Examples of ptolemy.data.DoubleToken

        for (int i = width - 1; i >= 0; i--) {
            if (input.hasToken(i)) {
                currentTimeValue = input.getModelTime(i).getDoubleValue();

                DoubleToken currentToken = (DoubleToken) input.get(i);
                double currentValue = currentToken.doubleValue();

                // NOTE: We assume the superclass ensures this cast is safe.
                ((Plot) plot).addPoint(i + offset, currentTimeValue,
                        currentValue, true);
            }
View Full Code Here

Examples of ptolemy.data.DoubleToken

     */
    public void fire() throws IllegalActionException {
        super.fire();
        if (input.hasToken(0)) {
            double inputValue = ((DoubleToken) input.get(0)).doubleValue();
            output.send(0, new DoubleToken(_doFunction(inputValue)));
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.