Esempio n. 1
0
        static void Main(string[] args)
        {
            var threads = new ThreadGenerator();

            var output = threads.StartThreads();

            Console.WriteLine(output);

            Console.ReadLine();
        }
Esempio n. 2
0
        /// <summary>
        /// Simulate the current configuration
        /// </summary>
        /// <param name="currentSimulation"></param>
        /// <param name="dataPath"></param>
        /// <param name="rampUpPeriod"></param>
        public static void SimulateConfiguration(CurrentSimulation currentSimulation, string dataPath, int rampUpPeriod = 100)
        {
            ThreadGenerator.StopThreads();

            CriticalSection.InitCriticalSection(currentSimulation.CriticalSectionDimension, dataPath);

            ThreadGenerator.InitThreads(currentSimulation);

            ThreadGenerator.StartThreads(rampUpPeriod);
        }
Esempio n. 3
0
        public TestComponent()
        {
            ThreadGenerator pg1 = new ThreadGenerator("g1");

            System.Collections.Generic.List <IntermediateStorage> il = new System.Collections.Generic.List <IntermediateStorage>();

            for (int i = 0; i < 10; i++)
            {
                IntermediateStorage ist = new IntermediateStorage("i" + i.ToString());
                il.Add(ist);

                Builders.Builder.PowerConnect(pg1, ist);
                ist.Enable();
            }

            foreach (IntermediateStorage x in il)
            {
                foreach (IntermediateStorage y in il)
                {
                    //if(!Object.Equals(x, y))
                    Builders.Builder.DataConnect(x, y);
                }
            }

            SupplyStorage ss = new SupplyStorage("s1");

            Builders.Builder.PowerConnect(pg1, ss);
            Builders.Builder.DataConnect(ss, il[0]);
            ss.Enable();

            BuyerStorage bs = new BuyerStorage("b1");

            Builders.Builder.PowerConnect(pg1, bs);
            Builders.Builder.DataConnect(il[0], bs);
            bs.Enable();


            //SupplyStorage ss = new SupplyStorage("Supplier");
            //BuyerStorage bs = new BuyerStorage("Buyer");

            //Builders.Builder.PowerConnect(pg1, ss);
            //Builders.Builder.PowerConnect(pg1, bs);

            //Builders.Builder.DataConnect(ss, bs);
            //Builders.Builder.DataConnect(ss, bs);

            //bs.Enable();
            //ss.Enable();

            pg1.Enable();
        }
Esempio n. 4
0
 /// <summary>
 /// Stop the simulation
 /// </summary>
 public static void StopSimulation()
 {
     ThreadGenerator.StopThreads();
 }