60
63
p1->addCalendar( c );
62
t1 = p1->createTask( p1 );
65
s1 = p1->createTask( p1 );
67
p1->addTask( s1, p1 );
69
t1 = p1->createTask( s1 );
63
70
t1->setName( "T1" );
64
71
t1->estimate()->setUnit( Duration::Unit_d );
65
72
t1->estimate()->setExpectedEstimate( 5.0 );
66
73
t1->estimate()->setType( Estimate::Type_Effort );
67
p1->addTask( t1, p1 );
74
p1->addSubTask( t1, s1 );
69
m1 = p1->createTask( p1 );
76
s2 = p1->createTask( p1 );
78
p1->addTask( s2, p1 );
80
m1 = p1->createTask( s2 );
70
81
m1->estimate()->setExpectedEstimate( 0 );
71
82
m1->setName( "M1" );
72
p1->addTask( m1, p1 );
83
p1->addSubTask( m1, s2 );
74
85
ResourceGroup *g = new ResourceGroup();
75
86
g->setName( "G1" );
96
107
r2->setNormalRate( 0.0 ); // NOTE
97
108
p1->addResource( m, r2 );
111
r3->setName( "Material 2" );
112
r3->setType( Resource::Type_Material );
113
r3->setNormalRate( 6.0 );
114
p1->addResource( m, r3 );
99
116
gr = new ResourceGroupRequest( m );
100
117
t1->addRequest( gr );
101
118
rr = new ResourceRequest( r2, 100 );
167
184
QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
168
185
QCOMPARE( ecm.costOnDate( d ), 8.5 );
188
d = t1->startTime().date();
189
ecm = s1->bcwsPrDay();
190
QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
191
QCOMPARE( ecm.costOnDate( d ), 8.5 );
193
d = s1->endTime().date();
194
ecm = s1->bcwsPrDay();
195
QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
196
QCOMPARE( ecm.costOnDate( d ), 8.5 );
172
199
void PerformanceTester::bcwpPrDayTask()
265
292
Debug::print( t1->completion(), t1->name(), "BCWP Performance with shutdown cost" );
266
293
QCOMPARE( ecm.bcwpEffortOnDate( d ), 80.0 );
267
294
QCOMPARE( ecm.bcwpCostOnDate( d ), 40.0 + 0.5 + 0.5 ); //100% progress
297
d = s1->startTime().date();
298
ecm = s1->bcwpPrDay();
299
QCOMPARE( ecm.bcwpEffortOnDate( d ), 8.0 );
300
QCOMPARE( ecm.bcwpCostOnDate( d ), 4.0 + 0.5 ); //10% progress
303
d = s1->endTime().date();
304
ecm = s1->bcwpPrDay();
305
QCOMPARE( ecm.bcwpEffortOnDate( d ), 80.0 );
306
QCOMPARE( ecm.bcwpCostOnDate( d ), 40.0 + 0.5 + 0.5 ); //100% progress
270
309
void PerformanceTester::acwpPrDayTask()
366
405
Debug::print( t1->completion(), t1->name(), "ACWP Performance with shutdown cost" );
367
406
QCOMPARE( eca.hoursOnDate( d ), 12.0 );
368
407
QCOMPARE( eca.costOnDate( d ), 12.25 );
410
d = s1->startTime().date();
412
QCOMPARE( eca.hoursOnDate( d ), 8.0 );
413
QCOMPARE( eca.costOnDate( d ), 8.5 );
416
d = s1->endTime().date();
418
QCOMPARE( eca.hoursOnDate( d ), 12.0 );
419
QCOMPARE( eca.costOnDate( d ), 12.25 );
371
422
void PerformanceTester::bcwsMilestone()
432
483
Debug::print( ecm, "BCWP Milestone" );
433
484
QCOMPARE( ecm.bcwpEffortOnDate( d ), 0.0 );
434
485
QCOMPARE( ecm.bcwpCostOnDate( d ), 0.75 );
487
// check sub-milestone
488
d = s2->startTime().date();
489
QCOMPARE( ecm.bcwpEffortOnDate( d ), 0.0 );
490
QCOMPARE( ecm.bcwpCostOnDate( d ), 0.75 );
437
493
void PerformanceTester::acwpMilestone()
463
519
Debug::print( m1->completion(), m1->name(), "ACWP Milestone with shutdown cost" );
464
520
QCOMPARE( eca.hoursOnDate( d ), 0.0 );
465
521
QCOMPARE( eca.costOnDate( d ), 0.75 );
523
// check sub-milestone
524
d = s2->endTime().date();
526
QCOMPARE( eca.hoursOnDate( d ), 0.0 );
527
QCOMPARE( eca.costOnDate( d ), 0.75 );
468
530
void PerformanceTester::bcwsPrDayTaskMaterial()
476
538
d = d.addDays( 1 );
477
539
ecm = t1->bcwsPrDay();
478
540
QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) ); //material+work resource
479
// QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
480
541
QCOMPARE( ecm.costOnDate( d ), 8.8 );
482
543
d = d.addDays( 1 );
483
544
ecm = t1->bcwsPrDay();
484
545
QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
485
// QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
486
QCOMPARE( ecm.costOnDate( d ), 8.8 );
489
ecm = t1->bcwsPrDay();
490
QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
491
// QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
492
QCOMPARE( ecm.costOnDate( d ), 8.8 );
495
ecm = t1->bcwsPrDay();
496
QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
497
// QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
498
QCOMPARE( ecm.costOnDate( d ), 8.8 );
501
ecm = t1->bcwsPrDay();
502
QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
503
// QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
546
QCOMPARE( ecm.costOnDate( d ), 8.8 );
549
ecm = t1->bcwsPrDay();
550
QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
551
QCOMPARE( ecm.costOnDate( d ), 8.8 );
554
ecm = t1->bcwsPrDay();
555
QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
556
QCOMPARE( ecm.costOnDate( d ), 8.8 );
559
ecm = t1->bcwsPrDay();
560
QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
504
561
QCOMPARE( ecm.costOnDate( d ), 8.8 );
506
563
d = d.addDays( 1 );
523
579
d = t1->endTime().date();
524
580
ecm = t1->bcwsPrDay();
525
581
QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
526
// QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
527
QCOMPARE( ecm.costOnDate( d ), 8.0 + 0.25 + 0.8 );
582
QCOMPARE( ecm.costOnDate( d ), 8.0 + 0.25 + 0.8 );
585
d = s1->startTime().date();
586
ecm = s1->bcwsPrDay();
587
QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
588
QCOMPARE( ecm.costOnDate( d ), 8.0 + 0.5 + 0.8 );
590
d = s1->endTime().date();
591
ecm = s1->bcwsPrDay();
592
QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
593
QCOMPARE( ecm.costOnDate( d ), 8.0 + 0.25 + 0.8 );
531
596
void PerformanceTester::bcwpPrDayTaskMaterial()
535
600
QDate d = t1->startTime().date();
536
601
EffortCostMap ecm = t1->bcwpPrDay();
537
602
QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
538
// QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
539
603
QCOMPARE( ecm.costOnDate( d ), 8.0 + 0.8 );
540
604
QCOMPARE( ecm.bcwpEffortOnDate( d ), 0.0 );
541
605
QCOMPARE( ecm.bcwpCostOnDate( d ), 0.0 );
599
657
d = t1->startTime().date();
600
658
ecm = t1->bcwpPrDay();
601
659
QCOMPARE( ecm.bcwpEffortOnDate( d ), 8.0 );
602
// QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
603
QCOMPARE( ecm.bcwpCostOnDate( d ), 4.0 + 0.05 + 0.4 ); // 10% progress
660
QCOMPARE( ecm.bcwpCostOnDate( d ), 4.0 + 0.5 + 0.4 ); // 10% progress
605
662
// add shutdown cost
606
663
t1->setShutdownCost( 0.25 );
610
667
ecm = t1->bcwpPrDay();
611
668
Debug::print( t1->completion(), t1->name(), "BCWP Material with shutdown cost" );
612
669
QCOMPARE( ecm.bcwpEffortOnDate( d ), 80.0 );
613
// QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
614
QCOMPARE( ecm.bcwpCostOnDate( d ), 40.0 + 0.5 + 0.25 + 4.0 ); // 100% progress
670
QCOMPARE( ecm.bcwpCostOnDate( d ), 40.0 + 0.5 + 0.25 + 4.0 ); // 100% progress
673
d = s1->startTime().date();
674
ecm = s1->bcwpPrDay();
675
QCOMPARE( ecm.bcwpEffortOnDate( d ), 8.0 );
676
QCOMPARE( ecm.bcwpCostOnDate( d ), 4.0 + 0.5 + 0.4 ); // 10% progress
678
d = s1->endTime().date();
679
ecm = s1->bcwpPrDay();
680
QCOMPARE( ecm.bcwpEffortOnDate( d ), 80.0 );
681
QCOMPARE( ecm.bcwpCostOnDate( d ), 40.0 + 0.5 + 0.25 + 4.0 ); // 100% progress
617
685
void PerformanceTester::acwpPrDayTaskMaterial()
628
696
EffortCostMap eca = t1->acwp();
630
698
QCOMPARE( ecb.effortOnDate( d ), Duration( 0, 16, 0 ) );
631
// QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
632
699
QCOMPARE( ecb.costOnDate( d ), 8.0 + 0.8 );
633
700
QCOMPARE( ecb.bcwpEffortOnDate( d ), 0.0 );
634
701
QCOMPARE( ecb.bcwpCostOnDate( d ), 0.0 );
644
711
// Debug::print( t1->completion(), t1->name(), QString( "ACWP on date: %1" ).arg( d.toString( Qt::ISODate ) ) );
645
712
// Debug::print( eca, "ACWP" );
646
713
QCOMPARE( ecb.bcwpEffortOnDate( d ), 8.0 );
647
// QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
648
714
QCOMPARE( ecb.bcwpCostOnDate( d ), 4.0 + 0.4 );
649
715
QCOMPARE( eca.hoursOnDate( d ), 8.0 );
650
716
QCOMPARE( eca.costOnDate( d ), 8.0 );
696
760
ecb = t1->bcwpPrDay();
697
761
eca = t1->acwp();
698
762
QCOMPARE( ecb.bcwpEffortOnDate( d ), 64.0 );
699
// QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
700
763
QCOMPARE( ecb.bcwpCostOnDate( d ), 32.0 + 3.2 );
701
764
QCOMPARE( eca.hoursOnDate( d ), 12.0 );
702
765
QCOMPARE( eca.costOnDate( d ), 12.0 );
721
784
Debug::print( t1->completion(), t1->name(), "ACWP Performance with shutdown cost" );
722
785
QCOMPARE( eca.hoursOnDate( d ), 12.0 );
723
786
QCOMPARE( eca.costOnDate( d ), 12.0 + 0.25 ); //NOTE: material not included
789
d = s1->startTime().date();
791
QCOMPARE( eca.hoursOnDate( d ), 8.0 );
792
QCOMPARE( eca.costOnDate( d ), 8.0 + 0.5 ); //NOTE: material not included
795
d = s1->endTime().date();
797
QCOMPARE( eca.hoursOnDate( d ), 12.0 );
798
QCOMPARE( eca.costOnDate( d ), 12.0 + 0.25 ); //NOTE: material not included
726
801
void PerformanceTester::bcwsPrDayProject()
884
959
ecm = p1->bcwpPrDay();
885
960
QCOMPARE( ecm.bcwpEffortOnDate( d ), 80.0 );
886
961
QCOMPARE( ecm.bcwpCostOnDate( d ), 40.0 + 0.5 + 0.25 ); // 100% progress
963
// check with ECCT_EffortWork
965
d = p1->startTime().date();
966
ecm = p1->bcwpPrDay( CURRENTSCHEDULE, ECCT_EffortWork );
967
QCOMPARE( ecm.totalEffort(), Duration( 40.0, Duration::Unit_h ) );
968
QCOMPARE( ecm.hoursOnDate( d ), 8.0 ); // hours from r1
969
QCOMPARE( ecm.costOnDate( d ), 8.0 + 0.5 ); // cost from r1 (1.0) + r2 (0.0) + startup cost (0.5)
970
QCOMPARE( ecm.bcwpEffortOnDate( d ), 4.0 ); // 10% progress
971
QCOMPARE( ecm.bcwpCostOnDate( d ), 4.0 + 0.5 ); // 10% progress
973
d = p1->endTime().date();
974
ecm = p1->bcwpPrDay( CURRENTSCHEDULE, ECCT_EffortWork );
975
QCOMPARE( ecm.bcwpEffortOnDate( d ), 40.0 ); // hours from r1
976
QCOMPARE( ecm.bcwpCostOnDate( d ), 40.0 + 0.5 + 0.25 ); // 100% progress
978
// add a new task with a material resource
979
Task *tt = p1->createTask( p1 );
981
p1->addTask( tt, p1 );
982
tt->estimate()->setUnit( Duration::Unit_d );
983
tt->estimate()->setExpectedEstimate( 5.0 );
984
tt->estimate()->setType( Estimate::Type_Duration );
985
tt->estimate()->setCalendar( p1->calendarAt( 0 ) );
987
r3->setNormalRate( 1.0 );
989
ResourceGroupRequest *gr = new ResourceGroupRequest( r3->parentGroup() );
990
tt->addRequest( gr );
991
ResourceRequest *rr = new ResourceRequest( r3, 100 );
992
gr->addResourceRequest( rr );
994
ScheduleManager *sm = p1->createScheduleManager( "" );
995
p1->addScheduleManager( sm );
996
sm->createSchedules();
997
p1->calculate( *sm );
999
QString s = " Material resource, no progress ";
1000
Debug::print( tt, s, true );
1002
d = tt->endTime().date();
1003
ecm = tt->bcwpPrDay( sm->scheduleId(), ECCT_EffortWork );
1004
Debug::print( ecm, "BCWP: " + tt->name() + s );
1006
QCOMPARE( ecm.hoursOnDate( d ), 0.0 );
1007
QCOMPARE( ecm.costOnDate( d ), 16.0 );
1008
QCOMPARE( ecm.bcwpEffortOnDate( d ), 0.0 );
1009
QCOMPARE( ecm.bcwpCostOnDate( d ), 0.0 ); // 0% progress
1011
d = p1->endTime().date();
1012
ecm = p1->bcwpPrDay( sm->scheduleId(), ECCT_EffortWork );
1013
Debug::print( p1, s, true );
1014
Debug::print( ecm, "BCWP Project: " + p1->name() + s );
1015
QCOMPARE( ecm.bcwpEffortOnDate( d ), 40.0 ); // hours from r1
1016
QCOMPARE( ecm.bcwpCostOnDate( d ), 40.0 + 0.5 + 0.25 );
889
1019
void PerformanceTester::acwpPrDayProject()
968
1098
t1->completion().setStartTime( t1->startTime() );
969
1099
t1->completion().setStarted( true );
970
1100
t1->setStartupCost( 0.5 );
971
d = t1->startTime().date();
1101
d = p1->startTime().date();
972
1102
eca = p1->acwp();
973
1103
QCOMPARE( eca.hoursOnDate( d ), 8.0 );
974
1104
QCOMPARE( eca.costOnDate( d ), 8.0 + 0.5 );