Revision 0596ce67 src/eventlog/sequencechartfacade.cc

View differences:

src/eventlog/sequencechartfacade.cc
110 110
    timelineCoordinateSystemVersion++;
111 111
    timelineCoordinateOriginEventNumber = timelineCoordinateRangeStartEventNumber = timelineCoordinateRangeEndEventNumber = event->getEventNumber();
112 112
    timelineCoordinateOriginSimulationTime = event->getSimulationTime();
113
    timelineCoordinateOriginRealTime = event->getEarliestStartTime();
113
    timelineCoordinateOriginRealTime = event->getEarliestStartTime() / 1000000.0;
114 114
    event->cachedTimelineCoordinate = 0;
115 115
    event->cachedTimelineCoordinateSystemVersion = timelineCoordinateSystemVersion;
116 116
}
......
169 169

  
170 170
        switch (timelineMode) {
171 171
            case REAL_TIME:
172
                timelineCoordinate = ((event->getEarliestStartTime() - timelineCoordinateOriginRealTime));
172
                timelineCoordinate = ((event->getEarliestStartTime()/1000000.0 - timelineCoordinateOriginRealTime));
173 173
                break;
174 174
            case SIMULATION_TIME:
175 175
                timelineCoordinate = (event->getSimulationTime() - timelineCoordinateOriginSimulationTime).dbl();
......
247 247
        double timelineEventEndCoordinate;
248 248
        switch (timelineMode) {
249 249
            case REAL_TIME:
250
                timelineEventEndCoordinate = (event->getEarliestProcessingTime() - timelineCoordinateOriginRealTime);
250
                timelineEventEndCoordinate = (event->getEarliestProcessingTime()/ 1000000.0 - timelineCoordinateOriginRealTime) ;
251 251
                break;
252 252
            case SIMULATION_TIME:
253 253
                timelineEventEndCoordinate = (event->getSimulationTime()+event->getEventEntry()->duration - timelineCoordinateOriginSimulationTime).dbl();
......
315 315
            //TODO MAKE THIS MORE EFFICIENT (i.e. sorted data structure)!
316 316
            IEvent* res = eventLog->getFirstEvent();
317 317
            for (IEvent *current = eventLog->getFirstEvent(); current; current = current->getNextEvent()) {
318
                if ((double) current->getEarliestStartTime() < timelineCoordinate) {
318
                if ((double) current->getEarliestStartTime() / 1000000.0 < timelineCoordinate) {
319 319
                    if (current->getEarliestStartTime() > res->getEarliestStartTime()) {
320 320
                        res = current;
321 321
                    }
......
360 360
            //TODO MAKE THIS MORE EFFICIENT (i.e. sorted data structure)!
361 361
            IEvent* res = eventLog->getLastEvent();
362 362
            for (IEvent *current = eventLog->getFirstEvent(); current; current = current->getNextEvent()) {
363
                if ((double) current->getEarliestStartTime() > timelineCoordinate) {
363
                if ((double) current->getEarliestStartTime() / 1000000.0 > timelineCoordinate) {
364 364
                    if (current->getEarliestStartTime() < res->getEarliestStartTime()) {
365 365
                        res = current;
366 366
                    }
......
400 400
    simtime_t &nextEventSimulationTime, double &nextEventTimelineCoordinate,
401 401
    simtime_t &simulationTimeDelta, double &timelineCoordinateDelta)
402 402
{
403
    //TODO: REAL_TIME
404

  
405 403
    // if before the first event
406 404
    if (event) {
407
        eventSimulationTime = event->getSimulationTime();
405
        if (timelineMode==REAL_TIME) {
406
            eventSimulationTime = event->getEarliestStartTime() / 1000000.0;
407
        } else {
408
            eventSimulationTime = event->getSimulationTime();
409
        }
408 410
        eventTimelineCoordinate = getTimelineCoordinate(event);
409 411
    }
410 412
    else {
......
414 416

  
415 417
        if (timelineMode == EVENT_NUMBER)
416 418
            eventTimelineCoordinate -= 1;
419
        else if (timelineMode == REAL_TIME)
420
            eventTimelineCoordinate -= getTimelineCoordinateDelta(0);
417 421
        else
418 422
            eventTimelineCoordinate -= getTimelineCoordinateDelta(firstEvent->getSimulationTime().dbl());
419 423
    }
......
422 426
    nextEvent = event ? event->getNextEvent() : eventLog->getFirstEvent();
423 427

  
424 428
    if (nextEvent) {
425
        nextEventSimulationTime = nextEvent->getSimulationTime();
429
        if(timelineMode==REAL_TIME) {
430
            nextEventSimulationTime = nextEvent->getEarliestStartTime() / 1000000.0;
431
        } else {
432
            nextEventSimulationTime = nextEvent->getSimulationTime();
433
        }
434

  
426 435
        nextEventTimelineCoordinate = getTimelineCoordinate(nextEvent);
427 436

  
428 437
        simulationTimeDelta = nextEventSimulationTime - eventSimulationTime;
......
443 452
    {
444 453
        case REAL_TIME:
445 454
        {
446
            simtime_t lastEventSimulationTime = (eventLog->getLastEvent()->getEarliestStartTime()/1000000.0); //TODO: Change this to getEarliestStartTime();
455
            simtime_t lastEventSimulationTime = (eventLog->getLastEvent()->getEarliestStartTime())/1000000.0;
447 456
            //NOTE: This sometimes crashes the Sequencechart because the returned value might be too big
448
            simulationTime = max(BigDecimal::Zero, min(lastEventSimulationTime, (timelineCoordinate + timelineCoordinateOriginRealTime)/1000000.0));
457
            simulationTime = max(BigDecimal::Zero, min(lastEventSimulationTime, (timelineCoordinate + timelineCoordinateOriginRealTime)));
449 458
        }
450
            //Fall back to SIMULATION_TIME (TODO)
459
        break;
451 460
        case SIMULATION_TIME:
452 461
            {
453 462
                simtime_t lastEventSimulationTime = eventLog->getLastEvent()->getSimulationTime();
......
492 501

  
493 502
    Assert(!simulationTime.isNaN());
494 503
    Assert(simulationTime >= BigDecimal::Zero);
495
    Assert(simulationTime <= eventLog->getLastEvent()->getSimulationTime());
504
    if (timelineMode != REAL_TIME)
505
        Assert(simulationTime <= eventLog->getLastEvent()->getSimulationTime());
496 506

  
497 507
    return simulationTime;
498 508
}
......
505 515
        return 0;
506 516

  
507 517
    Assert(simulationTime >= BigDecimal::Zero);
508
    Assert(simulationTime <= eventLog->getLastEvent()->getSimulationTime());
518
    if (timelineMode != REAL_TIME)
519
        Assert(simulationTime <= eventLog->getLastEvent()->getSimulationTime());
520

  
509 521

  
510 522
    double timelineCoordinate;
511 523

  
512 524
    switch (timelineMode)
513 525
    {
514 526
        case REAL_TIME:
515
        //Fall back to SIMULATION_TIME (TODO)
527
            //treat simulationTime as real time:
528
            timelineCoordinate = simulationTime.dbl() - timelineCoordinateOriginRealTime;
529
            break;
516 530
        case SIMULATION_TIME:
517 531
            timelineCoordinate = (simulationTime - timelineCoordinateOriginSimulationTime).dbl();
518 532
            break;
......
939 953
        if(current->getEventEndEntry()) {
940 954
            current->_earliestProcessingTime = current->getComplexity();
941 955
        }
956

  
957
        current->setCriticalPredecessor(eventLog->getFirstEvent());
958

  
942 959
        for (IEvent *antecessor = eventLog->getFirstEvent(); antecessor; antecessor = antecessor->getNextEvent()) {
943 960
            if(antecessor==current) {
944 961
                break; //We have to consider earlier events only
......
948 965
            }
949 966
            if(antecessor->_earliestProcessingTime+current->getComplexity() > current->_earliestProcessingTime) {
950 967
                current->_earliestProcessingTime = antecessor->_earliestProcessingTime+current->getComplexity();
968
                current->setCriticalPredecessor(antecessor);
951 969
            }
952 970
        }
953 971
        // Memorize max event
......
956 974
            maxEarliestProcessingTimeEvent = current;
957 975
        }
958 976
    }
959
    //Now produce the convex hull of predecessors:
977
    //Now produce the convex hull of critical antecessors/predecessors:
960 978
    cachedCriticalPath.clear();
961
    for (IEvent *predecessor = maxEarliestProcessingTimeEvent; predecessor ; predecessor = predecessor->getCauseEvent()) {
979
    for (IEvent *predecessor = maxEarliestProcessingTimeEvent; predecessor ; predecessor = predecessor->getCriticalPredecessor()) {
962 980
        cachedCriticalPath.insert((ptr_t)predecessor);
963 981
        if(predecessor->getEventNumber() == 0) {
964 982
            break;

Also available in: Unified diff