Examples of AddSubtract


Examples of ptolemy.actor.lib.AddSubtract

                        + i + ")");
                states[i] = new TypedIORelation(this, "relation_state_" + i);
                integrators[i].output.link(states[i]);

                // One adder per integrator.
                stateAdders[i] = new AddSubtract(this, "stateAdder_" + i);
                connect(stateAdders[i].output, integrators[i].input);
                stateOutput.link(states[i]);
            }

            // State feedback
            Scale[][] feedback = new Scale[n][n];

            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    // We don't create the Scale if the corresponding element
                    // in the A matrix is 0.
                    feedback[i][j] = new Scale(this, "feedback_" + i + "_" + j);
                    feedback[i][j].factor.setExpression("A(" + i + ", " + j
                            + ")");
                    feedback[i][j].input.link(states[j]);
                    connect(feedback[i][j].output, stateAdders[i].plus);
                }
            }

            // Inputs
            Scale[][] inputScales = new Scale[n][m];
            IORelation[] inputs = new IORelation[m];

            for (int j = 0; j < m; j++) {
                inputs[j] = new TypedIORelation(this, "relation_input_" + j);
                input.link(inputs[j]);

                // Create input scales.
                for (int i = 0; i < n; i++) {
                    // We create a scale for each input even if the
                    // corresponding element in B is 0. Otherwise,
                    // if the elements of A's in this row are also zero,
                    // then we will have an illegal topology.
                    inputScales[i][j] = new Scale(this, "b_" + i + "_" + j);
                    inputScales[i][j].factor.setExpression("B(" + i + ", " + j
                            + ")");
                    inputScales[i][j].input.link(inputs[j]);
                    connect(inputScales[i][j].output, stateAdders[i].plus);
                }
            }

            // Outputs
            AddSubtract[] outputAdders = new AddSubtract[r];
            Scale[][] outputScales = new Scale[r][n];

            for (int l = 0; l < r; l++) {
                outputAdders[l] = new AddSubtract(this, "outputAdder" + l);
                connect(outputAdders[l].output, output);

                // Create the output scales only if the corresponding
                // 'c' element is not 0.
                for (int i = 0; i < n; i++) {
View Full Code Here

Examples of ptolemy.actor.lib.AddSubtract

                    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];
View Full Code Here

Examples of ptolemy.actor.lib.AddSubtract

        ChangeRequest change = new ChangeRequest(this, "test2") {
            protected void _execute() throws Exception {
                _const.output.unlinkAll();
                _rec.input.unlinkAll();

                AddSubtract add = new AddSubtract(_top, "add");
                SampleDelay sampleDelay = new SampleDelay(_top, "sampleDelay");
                sampleDelay.initialOutputs.setExpression("{4, 5}");
                _top.connect(_const.output, add.plus);

                ComponentRelation relation = _top.connect(add.output,
View Full Code Here

Examples of ptolemy.actor.lib.AddSubtract

        SIGMA.factor.setExpression("sigma");

        Scale B = new Scale(this, "B");
        B.factor.setExpression("b");

        AddSubtract ADD1 = new AddSubtract(this, "Add1");
        AddSubtract ADD2 = new AddSubtract(this, "Add2");
        AddSubtract ADD3 = new AddSubtract(this, "Add3");
        AddSubtract ADD4 = new AddSubtract(this, "Add4");

        MultiplyDivide MULT1 = new MultiplyDivide(this, "MULT1");
        MultiplyDivide MULT2 = new MultiplyDivide(this, "MULT2");

        Integrator X1 = new Integrator(this, "IntegratorX1");
View Full Code Here

Examples of ptolemy.actor.lib.AddSubtract

        // ---------------------------------
        // CTActors
        CurrentTime time = new CurrentTime(ctsub, "CurTime");
        TrigFunction trigFunction = new TrigFunction(ctsub, "TrigFunction");
        ZeroOrderHold hold = new ZeroOrderHold(ctsub, "Hold");
        AddSubtract add1 = new AddSubtract(ctsub, "Add1");

        Integrator intgl1 = new Integrator(ctsub, "Integrator1");
        Integrator intgl2 = new Integrator(ctsub, "Integrator2");
        Scale scale0 = new Scale(ctsub, "Scale0");
        Scale scale1 = new Scale(ctsub, "Scale1");
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.