Examples of TypedCompositeActor


Examples of ptolemy.actor.TypedCompositeActor

            //parser.setErrorHandler(new StreamErrorHandler());
            // We use parse(URL, URL) here instead of parseFile(String)
            // because parseFile() works best on relative pathnames and
            // has problems finding resources like files specified in
            // parameters if the xml file was specified as an absolute path.
            TypedCompositeActor toplevel = (TypedCompositeActor) parser.parse(
                    null, new File(args[0]).toURI().toURL());

            System.out.println(generateGiottoCode(toplevel));
        } catch (Throwable ex) {
            System.err.println("Command failed: " + ex);
View Full Code Here

Examples of ptolemy.actor.TypedCompositeActor

        int N = ((IntToken) nInstances.getToken()).intValue();

        // Make sure instance is correct (ignore any user errors :)
        instance.setToken(new IntToken(0));

        TypedCompositeActor container = (TypedCompositeActor) getContainer();

        // Now instantiate the clones and connect them to the model
        for (int i = 1; i < N; i++) {
            MultiInstanceComposite clone = (MultiInstanceComposite) container
                    .getEntity(getName() + "_" + i);

            if (clone == null) {
                try {
                    clone = (MultiInstanceComposite) _cloneClone(container
                            .workspace());
                } catch (CloneNotSupportedException ex) {
                    throw new IllegalActionException(this, ex, "Clone failed.");
                }
                try {
View Full Code Here

Examples of ptolemy.actor.TypedCompositeActor

        // Note: wrapup() is called on any normal or abnormal run
        // termination. When embedded in a class that has already been
        // removed from its container, nContext may be eventually
        // referring to an undefined expression, so don't try getToken()
        // on it.
        TypedCompositeActor container = (TypedCompositeActor) getContainer();

        if (container == null) {
            return;
        }

        int i = 1;
        while (true) {
            // FIXME: Using a naming convention here is fragile!
            MultiInstanceComposite clone = (MultiInstanceComposite) container
                    .getEntity(getName() + "_" + i);
            if (clone == null) {
                break;
            }
            ++i;
View Full Code Here

Examples of ptolemy.codegen.c.actor.TypedCompositeActor

            State state) throws IllegalActionException {

        ptolemy.domains.fsm.kernel.MultirateFSMDirector director = (ptolemy.domains.fsm.kernel.MultirateFSMDirector) getComponent();
        ptolemy.domains.fsm.kernel.FSMActor controller = director
                .getController();
        TypedCompositeActor containerHelper = (TypedCompositeActor) _getHelper(director
                .getContainer());
        Actor[] refinements = state.getRefinement();
        if (refinements == null) {
            return;
        }
        TypedCompositeActor refinementHelper = (TypedCompositeActor) _getHelper((NamedObj) refinements[0]);
        Iterator states = controller.entityList().iterator();
        int tempSum = 0;

        while (states.hasNext()) {
            State nextState = (State) states.next();
            Actor[] actors = nextState.getRefinement();
            if (actors != null) {
                TypedCompositeActor helper = (TypedCompositeActor) _getHelper((NamedObj) actors[0]);
                int[][] rates = helper.getRates();

                if (nextState == state) {
                    if (rates == null) { // only one internal configuration
                        codeBuffer.append(containerHelper
                                .processCode("$actorSymbol("
View Full Code Here

Examples of ptolemy.codegen.c.actor.TypedCompositeActor

                    if (actors[0] instanceof CompositeActor) {
                        ptolemy.actor.Director localDirector = actors[0]
                                .getDirector();
                        if (localDirector instanceof ptolemy.domains.hdf.kernel.HDFDirector
                                || localDirector instanceof ptolemy.domains.hdf.kernel.HDFFSMDirector) {
                            TypedCompositeActor actorHelper = (TypedCompositeActor) _getHelper((NamedObj) actors[0]);
                            int[] arrayOfFiringsPerGlobalIterationOfActor = actorHelper
                                    .getFiringsPerGlobalIteration();
                            if (arrayOfFiringsPerGlobalIterationOfActor == null) {
                                arrayOfFiringsPerGlobalIterationOfActor = new int[length];
                                actorHelper
                                        .setFiringsPerGlobalIteration(arrayOfFiringsPerGlobalIterationOfActor);
                            }
                            arrayOfFiringsPerGlobalIterationOfActor[i] = firingsPerGlobalIterationOfContainer;
                        }
                    }
View Full Code Here

Examples of ptolemy.codegen.c.actor.TypedCompositeActor

                        }
                        // key statement here
                        int firingsPerGlobalIterationOfActor = firingsPerLocalIteration
                                * firingsPerGlobalIterationOfContainer;

                        TypedCompositeActor actorHelper = (TypedCompositeActor) _getHelper((NamedObj) actor);
                        int[] arrayOfFiringsPerGlobalIterationOfActor = actorHelper
                                .getFiringsPerGlobalIteration();
                        if (arrayOfFiringsPerGlobalIterationOfActor != null) {
                            int temp = arrayOfFiringsPerGlobalIterationOfActor[actorConfigurations[actorNumber]];
                            // only the maximum matters
                            if (temp < firingsPerGlobalIterationOfActor) {
                                arrayOfFiringsPerGlobalIterationOfActor[actorConfigurations[actorNumber]] = firingsPerGlobalIterationOfActor;
                            }
                        } else {
                            arrayOfFiringsPerGlobalIterationOfActor = new int[actorHelper
                                    .getRates().length];
                            actorHelper
                                    .setFiringsPerGlobalIteration(arrayOfFiringsPerGlobalIterationOfActor);
                            arrayOfFiringsPerGlobalIterationOfActor[actorConfigurations[actorNumber]] = firingsPerGlobalIterationOfActor;
                        }
                    }
                }
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.