Пример #1
0
        public TheModel()
        {
            this.Server = 10000;
            base.AddName("Server", this.Server);
            Storage storage = new Storage(new NumberOperand(1));

            storage.SetId(this.Server);
            base.AddVerb(storage);

            Start start = new Start(new NumberOperand(10000), null, null, null);

            base.AddVerb(start);

            Generate generate = new Generate(new NumberOperand(7), new NumberOperand(5), null, null, null);

            base.AddVerb(generate);

            this.Turn = 10001;
            base.AddName("Turn", this.Turn);
            TheModel theModel = this;
            Queue    queue    = new Queue(new ParExpression(new ExpressionDelegate(theModel.Verb4_Operand1)), null);

            base.AddVerb(queue);

            TheModel theModel1 = this;
            Enter    enter     = new Enter(new ParExpression(new ExpressionDelegate(theModel1.Verb5_Operand1)), null);

            base.AddVerb(enter);

            TheModel theModel2 = this;
            Depart   depart    = new Depart(new ParExpression(new ExpressionDelegate(theModel2.Verb6_Operand1)), null);

            base.AddVerb(depart);

            Advance advance = new Advance(new NumberOperand(5), new NumberOperand(3));

            base.AddVerb(advance);

            TheModel theModel3 = this;
            Leave    leave     = new Leave(new ParExpression(new ExpressionDelegate(theModel3.Verb8_Operand1)), null);

            base.AddVerb(leave);

            Terminate terminate = new Terminate(new NumberOperand(1));

            base.AddVerb(terminate);
        }
Пример #2
0
        public override void Execute(Simulation simulation)
        {
            // A: Required. The operand must be Expression.
            if (this.X_Expression == null)
            {
                throw new ModelingException("EQU: Operand X must be Expression!");
            }
            double value = this.X_Expression.GetValue();

            string           name  = simulation.NamesAndVarsDictionary.GetNameByValue(this.Id);
            ReferencedNumber refNo = simulation.NamesAndVarsDictionary.GetValue(name);

            simulation.NamesAndVarsDictionary.Remove(name);
            refNo.SetValueDouble(value);
            simulation.NamesAndVarsDictionary.AddVar(name, refNo);

            // Equ command Id is useless.
            this.Id = 0;
        }
Пример #3
0
        public TheModel()
        {
            this.Server = 10000;
            base.AddName("Server", this.Server);
            TheModel theModel = this;
            Storage  storage  = new Storage(new ParExpression(new ExpressionDelegate(theModel.Verb1_Operand1)));

            storage.SetId(this.Server);
            base.AddVerb(storage);
            TheModel theModel1 = this;
            Start    start     = new Start(new ParExpression(new ExpressionDelegate(theModel1.Verb2_Operand1)), null, null, null);

            base.AddVerb(start);
            TheModel theModel2 = this;
            Generate generate  = new Generate(new ParExpression(new ExpressionDelegate(theModel2.Verb3_Operand1)), null, null, null, null);

            base.AddVerb(generate);
            this.GenerateCounter = 10001;
            base.AddName("GenerateCounter", this.GenerateCounter);
            TheModel  theModel3 = this;
            TheModel  theModel4 = this;
            Savevalue savevalue = new Savevalue(new ParExpression(new ExpressionDelegate(theModel3.Verb4_Operand1)), new ParExpression(new ExpressionDelegate(theModel4.Verb4_Operand2)));

            base.AddVerb(savevalue);
            this.Tail = 10002;
            base.AddName("Tail", this.Tail);
            this.GoAway = 10003;
            base.AddName("GoAway", this.GoAway);
            LiteralOperand literalOperand = new LiteralOperand("L");
            TheModel       theModel5      = this;
            ParExpression  parExpression  = new ParExpression(new ExpressionDelegate(theModel5.Verb5_Operand2));
            TheModel       theModel6      = this;
            TheModel       theModel7      = this;
            Test           test           = new Test(literalOperand, parExpression, new ParExpression(new ExpressionDelegate(theModel6.Verb5_Operand3)), new ParExpression(new ExpressionDelegate(theModel7.Verb5_Operand4)));

            base.AddVerb(test);
            TheModel theModel8 = this;
            Queue    queue     = new Queue(new ParExpression(new ExpressionDelegate(theModel8.Verb6_Operand1)), null);

            base.AddVerb(queue);
            TheModel theModel9  = this;
            TheModel theModel10 = this;
            Enter    enter      = new Enter(new ParExpression(new ExpressionDelegate(theModel9.Verb7_Operand1)), new ParExpression(new ExpressionDelegate(theModel10.Verb7_Operand2)));

            base.AddVerb(enter);
            TheModel theModel11 = this;
            Depart   depart     = new Depart(new ParExpression(new ExpressionDelegate(theModel11.Verb8_Operand1)), null);

            base.AddVerb(depart);
            TheModel theModel12 = this;
            Advance  advance    = new Advance(new ParExpression(new ExpressionDelegate(theModel12.Verb9_Operand1)), null);

            base.AddVerb(advance);
            TheModel theModel13 = this;
            TheModel theModel14 = this;
            Leave    leave      = new Leave(new ParExpression(new ExpressionDelegate(theModel13.Verb10_Operand1)), new ParExpression(new ExpressionDelegate(theModel14.Verb10_Operand2)));

            base.AddVerb(leave);
            this.RejetionProb = 10004;
            base.AddName("RejetionProb", this.RejetionProb);
            this.RejectCounter = 10005;
            base.AddName("RejectCounter", this.RejectCounter);
            TheModel  theModel15 = this;
            TheModel  theModel16 = this;
            Savevalue savevalue1 = new Savevalue(new ParExpression(new ExpressionDelegate(theModel15.Verb11_Operand1)), new ParExpression(new ExpressionDelegate(theModel16.Verb11_Operand2)));

            base.AddVerb(savevalue1);
            TheModel  theModel17 = this;
            Terminate terminate  = new Terminate(new ParExpression(new ExpressionDelegate(theModel17.Verb12_Operand1)));

            base.AddVerb(terminate);
            this.GoAway = 11;
            base.ReplaceNameId("GoAway", this.GoAway);
            TheModel  theModel18 = this;
            TheModel  theModel19 = this;
            Savevalue savevalue2 = new Savevalue(new ParExpression(new ExpressionDelegate(theModel18.Verb13_Operand1)), new ParExpression(new ExpressionDelegate(theModel19.Verb13_Operand2)));

            base.AddVerb(savevalue2);
            base.AddVerb(new Terminate(null));
        }
Пример #4
0
        public MM3Model_Dynamic()
        {
            // Server STORAGE 3
            this.SERVER = 10000;
            this.AddName("SERVER", SERVER);
            AnyCommand command1 = new Storage(new ParExpression(this.Command1_Operand1));

            command1.SetId(this.SERVER);
            this.AddVerb(command1);

            // START 1000
            AnyCommand command2 = new Start(new ParExpression(this.Command2_Operand1), null, null, null);

            this.AddVerb(command2);

            // GENERATE (Exponential(1,0,1/2))
            AnyBlock block1 = new Generate(new ParExpression(this.Block1_Operand1), null, null, null, null);

            this.AddVerb(block1);

            // SAVEVALUE GenerateCounter,X$GenerateCounter+1
            this.GENERATECOUNTER = 10001;
            this.AddName("GENERATECOUNTER", GENERATECOUNTER);
            AnyBlock block2 = new Savevalue(new ParExpression(this.Block2_Operand1), new ParExpression(this.Block2_Operand2));

            this.AddVerb(block2);

            // TEST L Q$Tail,20,GoAway		;Jump if in Queue >20
            this.TAIL = 10002;
            this.AddName("TAIL", TAIL);
            this.GOAWAY = 10003;
            this.AddName("GOAWAY", GOAWAY);
            AnyBlock block3 = new Test(new LiteralOperand("L"), new ParExpression(this.Block3_Operand2), new ParExpression(this.Block3_Operand3), new ParExpression(this.Block3_Operand4));

            this.AddVerb(block3);

            // QUEUE Tail
            AnyBlock block4 = new Queue(new ParExpression(this.Block4_Operand1), null);

            this.AddVerb(block4);

            // ENTER Server,1
            AnyBlock block5 = new Enter(new ParExpression(this.Block5_Operand1), new ParExpression(this.Block5_Operand2));

            this.AddVerb(block5);

            // DEPART Tail
            AnyBlock block6 = new Depart(new ParExpression(this.Block6_Operand1), null);

            this.AddVerb(block6);

            // ADVANCE (Exponential(2,0,1/0.2))
            AnyBlock block7 = new Advance(new ParExpression(this.Block7_Operand1), null);

            this.AddVerb(block7);

            // LEAVE Server,1
            AnyBlock block8 = new Leave(new ParExpression(this.Block8_Operand1), new ParExpression(this.Block8_Operand2));

            this.AddVerb(block8);

            // SAVEVALUE RejetionProb,(X$RejectCounter/X$GenerateCounter)
            this.REJETIONPROB = 10004;
            this.AddName("REJETIONPROB", REJETIONPROB);
            this.REJECTCOUNTER = 10005;
            this.AddName("REJECTCOUNTER", REJECTCOUNTER);
            AnyBlock block9 = new Savevalue(new ParExpression(this.Block9_Operand1), new ParExpression(this.Block9_Operand2));

            this.AddVerb(block9);

            // TERMINATE 1
            AnyBlock block10 = new Terminate(new ParExpression(this.Block10_Operand1));

            this.AddVerb(block10);

            // GoAway	SAVEVALUE RejectCounter,X$RejectCounter+1
            this.GOAWAY = 11;
            this.ReplaceNameId("GOAWAY", GOAWAY);
            AnyBlock block11 = new Savevalue(new ParExpression(this.Block11_Operand1), new ParExpression(this.Block11_Operand2));

            this.AddVerb(block11);

            // TERMINATE        ;Delete rejected.
            AnyBlock block12 = new Terminate(null);

            this.AddVerb(block12);
        }
Пример #5
0
 public MM3Model_WithTable()
 {
     //
     // Server STORAGE 3
     this.Server = 10000;
     this.AddName("Server", this.Server);
     if (true)
     {
         MyAss.Framework.BuiltIn.Commands.Storage verb = new MyAss.Framework.BuiltIn.Commands.Storage(new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb1_Operand1)));
         verb.SetId(this.Server);
         this.AddVerb(verb);
     }
     //
     // OnQueue TABLE MP$OnQueueTime,0,4,20
     this.OnQueue = 10001;
     this.AddName("OnQueue", this.OnQueue);
     this.OnQueueTime = 10002;
     this.AddName("OnQueueTime", this.OnQueueTime);
     if (true)
     {
         MyAss.Framework.BuiltIn.Commands.Table verb = new MyAss.Framework.BuiltIn.Commands.Table(new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb2_Operand1)), new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb2_Operand2)), new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb2_Operand3)), new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb2_Operand4)));
         verb.SetId(this.OnQueue);
         this.AddVerb(verb);
     }
     //
     // START 10000
     if (true)
     {
         MyAss.Framework.BuiltIn.Commands.Start verb = new MyAss.Framework.BuiltIn.Commands.Start(new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb3_Operand1)), null, null, null);
         this.AddVerb(verb);
     }
     //
     // GENERATE Exponential(1, 0, (1 / 2))
     if (true)
     {
         MyAss.Framework.BuiltIn.Blocks.Generate verb = new MyAss.Framework.BuiltIn.Blocks.Generate(new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb4_Operand1)), null, null, null, null);
         this.AddVerb(verb);
     }
     //
     // MARK OnQueueTime
     if (true)
     {
         MyAss.Framework.BuiltIn.Blocks.Mark verb = new MyAss.Framework.BuiltIn.Blocks.Mark(new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb5_Operand1)));
         this.AddVerb(verb);
     }
     //
     // SAVEVALUE GenerateCounter,(X$GenerateCounter + 1)
     this.GenerateCounter = 10003;
     this.AddName("GenerateCounter", this.GenerateCounter);
     if (true)
     {
         MyAss.Framework.BuiltIn.Blocks.Savevalue verb = new MyAss.Framework.BuiltIn.Blocks.Savevalue(new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb6_Operand1)), new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb6_Operand2)));
         this.AddVerb(verb);
     }
     //
     // TEST L,Q$Tail,20,GoAway,,
     this.Tail = 10004;
     this.AddName("Tail", this.Tail);
     this.GoAway = 10005;
     this.AddName("GoAway", this.GoAway);
     if (true)
     {
         MyAss.Framework.BuiltIn.Blocks.Test verb = new MyAss.Framework.BuiltIn.Blocks.Test(new MyAss.Framework.OperandTypes.LiteralOperand("L"), new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb7_Operand2)), new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb7_Operand3)), new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb7_Operand4)));
         this.AddVerb(verb);
     }
     //
     // QUEUE Tail
     if (true)
     {
         MyAss.Framework.BuiltIn.Blocks.Queue verb = new MyAss.Framework.BuiltIn.Blocks.Queue(new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb8_Operand1)), null);
         this.AddVerb(verb);
     }
     //
     // ENTER Server,1
     if (true)
     {
         MyAss.Framework.BuiltIn.Blocks.Enter verb = new MyAss.Framework.BuiltIn.Blocks.Enter(new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb9_Operand1)), new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb9_Operand2)));
         this.AddVerb(verb);
     }
     //
     // DEPART Tail
     if (true)
     {
         MyAss.Framework.BuiltIn.Blocks.Depart verb = new MyAss.Framework.BuiltIn.Blocks.Depart(new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb10_Operand1)), null);
         this.AddVerb(verb);
     }
     //
     // TABULATE OnQueue
     if (true)
     {
         MyAss.Framework.BuiltIn.Blocks.Tabulate verb = new MyAss.Framework.BuiltIn.Blocks.Tabulate(new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb11_Operand1)), null);
         this.AddVerb(verb);
     }
     //
     // ADVANCE Exponential(2, 0, (1 / 0.2))
     if (true)
     {
         MyAss.Framework.BuiltIn.Blocks.Advance verb = new MyAss.Framework.BuiltIn.Blocks.Advance(new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb12_Operand1)), null);
         this.AddVerb(verb);
     }
     //
     // LEAVE Server,1
     if (true)
     {
         MyAss.Framework.BuiltIn.Blocks.Leave verb = new MyAss.Framework.BuiltIn.Blocks.Leave(new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb13_Operand1)), new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb13_Operand2)));
         this.AddVerb(verb);
     }
     //
     // SAVEVALUE RejetionProb,(X$RejectCounter / X$GenerateCounter)
     this.RejetionProb = 10006;
     this.AddName("RejetionProb", this.RejetionProb);
     this.RejectCounter = 10007;
     this.AddName("RejectCounter", this.RejectCounter);
     if (true)
     {
         MyAss.Framework.BuiltIn.Blocks.Savevalue verb = new MyAss.Framework.BuiltIn.Blocks.Savevalue(new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb14_Operand1)), new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb14_Operand2)));
         this.AddVerb(verb);
     }
     //
     // TERMINATE 1
     if (true)
     {
         MyAss.Framework.BuiltIn.Blocks.Terminate verb = new MyAss.Framework.BuiltIn.Blocks.Terminate(new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb15_Operand1)));
         this.AddVerb(verb);
     }
     //
     // GoAway SAVEVALUE RejectCounter,(X$RejectCounter + 1)
     this.GoAway = 13;
     this.ReplaceNameId("GoAway", this.GoAway);
     if (true)
     {
         MyAss.Framework.BuiltIn.Blocks.Savevalue verb = new MyAss.Framework.BuiltIn.Blocks.Savevalue(new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb16_Operand1)), new MyAss.Framework.OperandTypes.ParExpression(new MyAss.Framework.OperandTypes.ExpressionDelegate(this.Verb16_Operand2)));
         this.AddVerb(verb);
     }
     //
     // TERMINATE
     if (true)
     {
         MyAss.Framework.BuiltIn.Blocks.Terminate verb = new MyAss.Framework.BuiltIn.Blocks.Terminate(null);
         this.AddVerb(verb);
     }
 }