| Quintiq file version 2.0 | 
| #parent: #root | 
| Method InitVariablesForUnitPeriod ( | 
|   CapacityPlanningSuboptimizer_CapacityPlanningAlgorithm program, | 
|   const UnitPeriod unitperiod, | 
|   const LibOpt_Scope scope | 
| ) const | 
| { | 
|   Description: 'Initialize the variables for a single unit period related to the capacity calculations' | 
|   TextBody: | 
|   [* | 
|     // UnitCapacityNotMet variable UoM: Unit or Time | 
|     unitperiod.NewCapacityNotMetVariable( program );      // The additional quantity/time which needs to be processed by the unit period to reach the defined minimum usage | 
|       | 
|     // UnitCapacityOverloaded variable UoM: Unit or Time | 
|     unitperiod.NewCapacityOverloadedVariable( program );  | 
|      | 
|     if( unitperiod.istype( UnitPeriodTime ) and this.MacroPlan().HasTool() ) | 
|     { | 
|       // UnitPeriodNrOfToolChange variable  | 
|       nrchangevar := program.UnitPeriodNrOfToolChangeVariables().New( unitperiod );      // The number of tool change required for the unit period | 
|       this.SetStartSolutionNrOfToolChangeVar( nrchangevar, unitperiod );  | 
|        | 
|     } | 
|      | 
|     if( unitperiod.istype( UnitPeriodTransportQuantity ) | 
|         and unitperiod.astype( UnitPeriodTransportQuantity ).HasSecondaryCapacityDefinition() ) | 
|     { | 
|       // UnitSecondaryCapacityNotMet variable UoM: TransportCapacity | 
|       program.UnitSecondaryCapacityNotMetVariables().New( unitperiod ); | 
|       // UnitSecondaryCapacityOverloaded variable UoM: TransportCapacity | 
|       program.UnitSecondaryCapacityOverloadedVariables().New( unitperiod ); | 
|     } | 
|      | 
|     // capacity smoothing  | 
|     if( this.GetRunContextConst().UseCapacitySmoothing()  | 
|         and not isnull( unitperiod.AsCapacitySmoothingUnitPeriod() ) ) | 
|     { | 
|       // Calculate capacity usage of unit period | 
|       // CapacityUsage variable UoM: % | 
|       program.CapacityUsageVariables().New( unitperiod ); | 
|      | 
|       // Store min and max capacity usage over next Unit.CapacitySmoothingLength periods | 
|       if( not isnull( unitperiod.AsCapacitySmoothingHead() ) ) | 
|       { | 
|         // MinCapacityUsage variable UoM: % | 
|         program.MinCapacityUsageVariables().New( unitperiod ); | 
|         // MaxCapacityUsage variable UoM: % | 
|         program.MaxCapacityUsageVariables().New( unitperiod ); | 
|        // Capacity smoothing slack variable | 
|         program.CapacitySmoothingSlackVariables().New( unitperiod ); | 
|       } | 
|     } | 
|   *] | 
|   InterfaceProperties { Accessibility: 'Module' } | 
| } |