Package ptolemy.domains.de.kernel

Examples of ptolemy.domains.de.kernel.DEDirector


     *  the timer is set to expire.
     *  @exception IllegalActionException If there is no director.
     */
    public void fire() throws IllegalActionException {
        super.fire();
        DEDirector dir = (DEDirector) getDirector();
        Time now = dir.getModelTime();

        if (set.hasToken(0)) {
            // reset timer
            double delay = ((DoubleToken) set.get(0)).doubleValue();

            if (delay > 0.0) {
                _expireTime = now.add(delay);
                dir.fireAt(this, _expireTime);
            } else {
                // disable timer
                _expireTime = new Time(dir, -1.0);
            }

View Full Code Here


        _msgNum = 0;
        _nextMsgTime = new Time(getDirector(), -1.0);

        //System.out.println("DEChannel " + getFullName() +
        //        " initializing at time " + getCurrentTime());
        DEDirector dir = (DEDirector) getDirector();
        Time now = dir.getModelTime();
        dir.fireAt(this, now.add(((DoubleToken) maxDelay.getToken())
                .doubleValue()
                * Math.random()));
    }
View Full Code Here

            request.broadcast(new Token());
            _firstFire = false;
            return;
        }

        DEDirector dir = (DEDirector) getDirector();
        Time now = dir.getModelTime();
        double maxDelayValue = ((DoubleToken) maxDelay.getToken())
                .doubleValue();

        if (next.hasToken(0)) {
            next.get(0);

            if (now.compareTo(_nextMsgTime) < 0) {
                // ignore this
            } else {
                // compute a random delay between zero and MaxDelay.
                double delay = maxDelayValue * Math.random();
                _nextMsgTime = now.add(delay);
                dir.fireAt(this, _nextMsgTime);
            }

            //System.out.println("DEMessageSource " + this.getFullName() +
            //        " next message " + "scheduled at " + _nextMsgTime);
        }
View Full Code Here

    public Iterations() throws KernelException {
        Workspace w = new Workspace("w");
        TypedCompositeActor toplevel = new TypedCompositeActor(w);
        toplevel.setName("toplevel");

        DEDirector director = new DEDirector(toplevel, "director");

        //director.addDebugListener(new StreamListener());
        Manager manager = new Manager(w, "manager");
        toplevel.setManager(manager);
View Full Code Here

            NameDuplicationException {
        Workspace w = new Workspace("w");
        TypedCompositeActor toplevel = new TypedCompositeActor(w);
        toplevel.setName("toplevel");

        DEDirector director = new DEDirector(toplevel, "director");

        // director.addDebugListener(new StreamListener());
        Manager manager = new Manager(w, "manager");
        toplevel.setManager(manager);
View Full Code Here

    public Mutate() throws IllegalActionException, NameDuplicationException {
        _top = new TypedCompositeActor();
        _top.setName("top");
        manager = new Manager();
        _director = new DEDirector();
        _top.setDirector(_director);
        _top.setManager(manager);

        _clock = new Clock(_top, "clock");
        _clock.values.setExpression("[1.0]");
View Full Code Here

     */
    public TestDE() throws IllegalActionException, NameDuplicationException {
        _top = new TypedCompositeActor();
        _top.setName("top");
        _manager = new Manager();
        _director = new DEDirector();
        _top.setDirector(_director);
        _top.setManager(_manager);

        _clock = new Clock(_top, "clock");
        _clock.values.setExpression("{1.0}");
View Full Code Here

public class TutorialApplet2 extends PtolemyApplet {
    public NamedObj _createModel(Workspace workspace) throws Exception {
        TypedCompositeActor toplevel = new TypedCompositeActor(workspace);

        // Create the director.
        DEDirector director = new DEDirector(toplevel, "director");
        director.stopTime.setExpression("10.0");

        // Create two actors.
        Clock clock = new Clock(toplevel, "clock");
        TimedPlotter plotter = new TimedPlotter(toplevel, "plotter");
View Full Code Here

        // Creating the model.
        super(workspace);
        setName("DigitalSystem");

        // Set up the top level composite actor, director and manager
        DEDirector deDirector = new DEDirector(this, "DEDirector");

        //deDirector.addDebugListener(new StreamListener());
        double stopT = 15.0;
        deDirector.stopTime.setToken(new DoubleToken(stopT));
View Full Code Here

        // Give the model parameters default values.
        stopTime.setExpression("10.0");
        clockPeriod.setExpression("2.0");

        // Create the director.
        DEDirector director = new DEDirector(this, "director");
        setDirector(director);

        // Create two actors.
        Clock clock = new Clock(this, "clock");
        TimedPlotter plotter = new TimedPlotter(this, "plotter");
View Full Code Here

TOP

Related Classes of ptolemy.domains.de.kernel.DEDirector

Copyright © 2018 www.massapicom. 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.