private void GetCostWeights(OplDataHandler handler) { // initialize the tuple set 'CostFunctionWeights' handler.StartElement("CostFunctionWeights"); handler.StartSet(); // Add tuple handler.StartTuple(); handler.AddStringItem("a"); handler.AddNumItem(LithographyArea.WeightA); handler.EndTuple(); // Add tuple handler.StartTuple(); handler.AddStringItem("b"); handler.AddNumItem(LithographyArea.WeightB); handler.EndTuple(); // Add tuple handler.StartTuple(); handler.AddStringItem("c"); handler.AddNumItem(LithographyArea.WeightC); handler.EndTuple(); handler.EndSet(); handler.EndElement(); }
private void GetOrders(OplDataHandler handler) { // initialize the tuple set 'Products' handler.StartElement("Orders"); handler.StartSet(); // Loop through queue for (int i = 0; i < Queue.Length; i++) { // Peek next lot in queue Lot peekLot = Queue.PeekAt(i); bool eligible = false; // Check if elible on any machine (not Down) foreach (Machine machine in LithographyArea.Machines) { // Check if machine is Down if (LithographyArea.MachineStates[machine.Name] == "Down") { continue; } // Get needed recipe for the lot string recipe = CPDispatcher.GetRecipe(peekLot, machine); string recipeKey = machine.Name + "__" + recipe; // Check if needed recipe is eligible on machine bool recipeEligible = CPDispatcher.CheckMachineEligibility(recipeKey); // Check if processingTime is known bool processingTimeKnown = CPDispatcher.CheckProcessingTimeKnown(peekLot, machine, recipe); if (recipeEligible && processingTimeKnown) { eligible = true; break; } } if (eligible) { // Add tuple handler.StartTuple(); handler.AddStringItem(peekLot.Id.ToString()); //handler.AddStringItem(peekLot.Id.ToString()); handler.AddIntItem(ProductNameToID[peekLot.MasksetLayer_RecipeStepCluster]); handler.AddIntItem(peekLot.LotQty); handler.AddNumItem(CPDispatcher.GetDueDateWeight(peekLot)); handler.AddNumItem(CPDispatcher.GetWIPBalanceWeight(peekLot)); handler.EndTuple(); } } handler.EndSet(); handler.EndElement(); }
/// <summary> /// Add a new item (field) to the Set currently in the Data handler. /// /// The value of the field is converted and added depending on fieldType. /// </summary> /// <param name="handler">The OPL data handler</param> /// <param name="fieldType">The type of the field to add</param> /// <param name="value">The value to convert</param> private void HandleColumnValue(OplDataHandler handler, OplElementDefinitionType.Type fieldType, object value) { if (fieldType == OplElementDefinitionType.Type.INTEGER) { handler.AddIntItem(Convert.ToInt32(value)); } else if (fieldType == OplElementDefinitionType.Type.FLOAT) { handler.AddNumItem(Convert.ToDouble(value)); } else if (fieldType == OplElementDefinitionType.Type.STRING) { handler.AddStringItem(Convert.ToString(value)); } }
public override void CustomRead() { OplDataHandler handler = DataHandler; // initialize the int 'simpleInt' handler.StartElement("anInt"); handler.AddIntItem(3); handler.EndElement(); // initialize the int array 'simpleIntArray' handler.StartElement("anIntArray"); handler.StartArray(); handler.AddIntItem(1); handler.AddIntItem(2); handler.AddIntItem(3); handler.EndArray(); handler.EndElement(); // initialize int array indexed by float 'anArrayIndexedByFloat' handler.StartElement("anArrayIndexedByFloat"); handler.StartIndexedArray(); handler.SetItemNumIndex(2.0); handler.AddIntItem(1); handler.SetItemNumIndex(2.5); handler.AddIntItem(2); handler.SetItemNumIndex(1.0); handler.AddIntItem(3); handler.SetItemNumIndex(1.5); handler.AddIntItem(4); handler.EndIndexedArray(); handler.EndElement(); // initialize int array indexed by string 'anArrayIndexedByString' handler.StartElement("anArrayIndexedByString"); handler.StartIndexedArray(); handler.SetItemStringIndex("idx1"); handler.AddIntItem(1); handler.SetItemStringIndex("idx2"); handler.AddIntItem(2); handler.EndIndexedArray(); handler.EndElement(); // initialize a tuple in the order the components are declared handler.StartElement("aTuple"); handler.StartTuple(); handler.AddIntItem(1); handler.AddNumItem(2.3); handler.AddStringItem("not named tuple"); handler.EndTuple(); handler.EndElement(); // initialize a tuple using tuple component names. handler.StartElement("aNamedTuple"); handler.StartNamedTuple(); handler.SetItemName("f"); handler.AddNumItem(3.45); handler.SetItemName("s"); handler.AddStringItem("named tuple"); handler.SetItemName("i"); handler.AddIntItem(99); handler.EndNamedTuple(); handler.EndElement(); // initialize the tuple set 'simpleTupleSet' handler.StartElement("aTupleSet"); handler.StartSet(); // first tuple handler.StartTuple(); handler.AddIntItem(1); handler.AddNumItem(2.5); handler.AddStringItem("a"); handler.EndTuple(); // second element handler.StartTuple(); handler.AddIntItem(3); handler.AddNumItem(4.1); handler.AddStringItem("b"); handler.EndTuple(); handler.EndSet(); handler.EndElement(); // initialize element 3 and 2 of the tuple array 'simpleTupleArray' in that particular order handler.StartElement("aTupleArray"); handler.StartIndexedArray(); // initialize 3rd cell handler.SetItemIntIndex(3); handler.StartTuple(); handler.AddIntItem(1); handler.AddNumItem(2.5); handler.AddStringItem("a"); handler.EndTuple(); // initialize second cell handler.SetItemIntIndex(2); handler.StartTuple(); handler.AddIntItem(3); handler.AddNumItem(4.1); handler.AddStringItem("b"); handler.EndTuple(); handler.EndIndexedArray(); handler.EndElement(); // initialize int array indexed by tuple set 'anArrayIndexedByTuple' handler.StartElement("anArrayIndexedByTuple"); handler.StartIndexedArray(); handler.StartItemTupleIndex(); handler.AddIntItem(3); handler.AddNumItem(4.1); handler.AddStringItem("b"); handler.EndItemTupleIndex(); handler.AddIntItem(1); handler.EndIndexedArray(); handler.EndElement(); // initialize a 2-dimension int array 'a2DIntArray' handler.StartElement("a2DIntArray"); handler.StartArray(); for (int i = 1; i <= 2; i++) { handler.StartArray(); for (int j = 1; j <= 3; j++) { handler.AddIntItem(i * 10 + j); } handler.EndArray(); } handler.EndArray(); handler.EndElement(); }