Package ptolemy.actor.util

Examples of ptolemy.actor.util.Time.subtract()


                output.send(0, _newToken);
            } else {
                double valueDifference = ((DoubleToken) _newToken
                        .subtract(_lastToken)).doubleValue();
                double timeDifference = currentTime.subtract(_lastTime)
                        .getDoubleValue();
                double rate = valueDifference / timeDifference;
                double risingRate = ((DoubleToken) risingSlewRate.getToken())
                        .doubleValue();
                double fallingRate = ((DoubleToken) fallingSlewRate.getToken())
View Full Code Here


                    .first();
            Time nextBreakpointTime = nextBreakpoint.timestamp();
            int comparison = nextBreakpointTime.compareTo(_iterationBeginTime
                    .add(refinedStep));
            if (comparison < 0) {
                refinedStep = nextBreakpointTime.subtract(_iterationBeginTime)
                        .getDoubleValue();
                if (refinedStep < 0.0) {
                    throw new IllegalActionException(this,
                            "Cannot set a step size to respect the breakpoint at "
                                    + nextBreakpoint);
View Full Code Here

                    .first();
            if (_debugging) {
                _debug("The first breakpoint is at " + nextBreakpoint);
            }
            Time breakpointTime = nextBreakpoint.timestamp();
            double result = breakpointTime.subtract(getModelTime())
                    .getDoubleValue();
            if (result < suggestedStep) {
                if (result < 0.0) {
                    throw new InternalErrorException(
                            "Missed a breakpoint at time " + breakpointTime
View Full Code Here

            // environment time.
            // NOTE: This depends on the property that if an integration
            // step with a larger step size was successful and produced
            // no events, then an integration step with this now smaller
            // step size will also be successful and produce no events.
            _currentStepSize = outTime.subtract(_iterationBeginTime)
                    .getDoubleValue();
            // If the step size is now negative, then we are trying
            // to roll back too far.
            if (_currentStepSize < 0.0) {
                throw new IllegalActionException(this,
View Full Code Here

                // for the width, apparently due to simultaneous events,
                // we leave it unchanged instead.
                return;
            }

            double average = lastEntryTime.subtract(firstEntryTime)
                    .getDoubleValue();
            average = average / (entryArray.length - 1);

            double effectiveAverage = 0;
            int effectiveSamples = 0;
View Full Code Here

                            /*
                            if (currentTime.getDoubleValue() <= elapsedTimeInSeconds) {
                                break;
                            }*/

                            long timeToWait = (long) (currentTime.subtract(
                                    elapsed).getDoubleValue() * 1000.0);

                            if (timeToWait > 0) {
                                if (_debugging) {
                                    _debug("Waiting for real time to pass: "
View Full Code Here

        }

        Time currentTime = getDirector().getModelTime();

        if (_previousTime.compareTo(Time.NEGATIVE_INFINITY) != 0) {
            DoubleToken outToken = new DoubleToken(currentTime.subtract(
                    _previousTime).getDoubleValue());
            output.send(0, outToken);
        }
    }
View Full Code Here

                        + breakpoints.first());
            }

            // NOTE: the breakpoint table is not changed.
            Time nextBreakpoint = ((Time) breakpoints.first());
            double maximAllowedStepSize = nextBreakpoint.subtract(
                    getModelTime()).getDoubleValue();

            if (maximAllowedStepSize < refinedStepSize) {
                refinedStepSize = maximAllowedStepSize;
                if (_debugging) {
View Full Code Here

                aheadLength = _outsideTime.subtract(getModelTime())
                        .getDoubleValue();

            } else {
                aheadLength = outsideNextIterationTime.subtract(_outsideTime)
                        .getDoubleValue();
            }

            if (_debugging) {
                _debug(getName(), " local time = " + localTime,
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.