Quintiq file version 2.0
|
#parent: #root
|
StaticMethod SetUnitShiftPattern (
|
MacroPlan macroPlan,
|
UnitPeriodTimes unitPeriodTimes,
|
ShiftPattern shiftPattern
|
)
|
{
|
TextBody:
|
[*
|
// Akari Oct-10-2024 (created)
|
firstElement := minselect( unitPeriodTimes, Elements, e, true, e.Start() );
|
|
start := macroPlan.Start();
|
timeunit := macroPlan.StartOfPlanningPeriod().TimeUnit();
|
maintenance := Duration::Zero();
|
efficiency := 1.0;
|
allocation := 1.0;
|
|
maxloadpercentage := macroPlan.GlobalParameters_MP().DefaultMaxLoadPercentage();
|
nrofunitopen := 1;
|
minloadthreshold := 0.0;
|
|
if( not isnull( firstElement ) ){
|
// To inherit the value from last unit availability while creating a new unit availability
|
unitavailability := firstElement.UnitAvailability();
|
start := firstElement.Start();
|
|
if( not isnull( unitavailability ) ){
|
timeunit := unitavailability.TimeUnit();
|
maintenance := unitavailability.Maintenance();
|
efficiency := unitavailability.Efficiency();
|
allocation := unitavailability.Allocation();
|
|
maxloadpercentage := unitavailability.MaximumLoadPercentage();
|
nrofunitopen := unitavailability.NrOfUnitsOpen();
|
minloadthreshold := unitavailability.MinimumLoadThreshold();
|
}else{
|
timeunit := firstElement.Period_MP().TimeUnit();
|
maintenance := firstElement.Maintenance();
|
efficiency := firstElement.Efficiency();
|
allocation := firstElement.Allocation();
|
|
maxloadpercentage := firstElement.MaximumLoadPercentage();
|
nrofunitopen := firstElement.NrOfOpen();
|
minloadthreshold := firstElement.MinimumLoadThreshold();
|
}
|
}
|
|
traverse( unitPeriodTimes,Elements,unitPeriodTime,isnull( unitPeriodTime.UnitAvailability())){
|
// UnitAvailability::Create( unitPeriodTime.Unit(),
|
// unitPeriodTime.Start(),
|
// timeunit,
|
// maintenance,
|
// efficiency,
|
// allocation,
|
// shiftPattern,
|
// maxloadpercentage,
|
// nrofunitopen,
|
// minloadthreshold,
|
// true );
|
unitPeriodTime.CalcUnitAvailability();
|
}
|
|
isbatchedit := unitPeriodTimes.Size() > 1;
|
UnitAvailability::CreateOrUpdateForUnitPeriodTimes( unitPeriodTimes,
|
not isbatchedit or false,
|
timeunit,
|
maintenance,
|
not isbatchedit or false,
|
efficiency,
|
false,
|
allocation,
|
not isbatchedit or true,
|
shiftPattern,
|
not isbatchedit or false,
|
maxloadpercentage,
|
not isbatchedit or false,
|
nrofunitopen,
|
false,
|
not isbatchedit or false,
|
minloadthreshold
|
);
|
//UnitAvailability::CreateOrUpdateForUnitPeriodTimes( unitPeriodTimes,
|
// not isbatchedit or CheckBoxBatchEditMaintenance.Checked(),
|
// data.TimeUnit(),
|
// data.Maintenance(),
|
// not isbatchedit or CheckBoxBatchEditEfficiency.Checked(),
|
// data.Efficiency(),
|
// false,
|
// data.Allocation(),
|
// not isbatchedit or CheckBoxBatchEditShiftPattern.Checked(),
|
// data.ShiftPattern(),
|
// not isbatchedit or CheckBoxBatchEditMaxLoadPercentage.Checked(),
|
// data.MaximumLoadPercentage(),
|
// not isbatchedit or CheckBoxBatchEditNrOfUnitsOpen.Checked(),
|
// data.NrOfUnitsOpen(),
|
// DataHolderFromThisPeriodOnward.Data(),
|
// not isbatchedit or CheckBoxBatchEditMinimumLoadThreshold.Checked(),
|
// data.MinimumLoadThreshold()
|
// );
|
*]
|
}
|