private async Task StartSimulator()
        {
            var noOfTimes          = GetEnumVal <NoOfTimes>(cmb_noOfTimes.SelectedValue);
            var noOfPlayers        = GetEnumVal <NoOfPlayers>(cmb_noOfPlayers.SelectedValue);
            var noOfCardPacks      = GetEnumVal <NoOfCardPacks>(cmb_noOfCardPacks.SelectedValue);
            var noOfTimesPerPeriod = GetEnumVal <NoOfTimesPerPeriod>(cmb_noOfTimesPerPeriod.SelectedValue);
            var dataFileName       = cmb_dataFileName.SelectedValue ?? throw new InvalidOperationException("Data fileName cannot be null");
            var modelFileName      = cmb_modelFileName.SelectedValue ?? "";

            modelFileName = (modelFileName.ToString() == "DefaultSelector") ? "" : modelFileName.ToString();

            Pb_gameData.Value      = 0;
            Lbl_gameDataPb.Content = "Generating...";
            HasStarted             = true;
            SetIsEnableProperty(false);

            await SimulatorController.Start(options =>
            {
                options.NoOfTimes          = noOfTimes;
                options.NoOfPlayers        = noOfPlayers;
                options.NoOfCardPacks      = noOfCardPacks;
                options.NoOfTimesPerPeriod = noOfTimesPerPeriod;

                options.FileName        = dataFileName.ToString();
                options.MlModelFileName = modelFileName.ToString();
            });
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            // Preplata na zeljene topike
            NMSSubscriber NMSProxy = new NMSSubscriber(SimulatorModel.Instance);

            NMSProxy.Subscribed(new List <DMSType> {
                DMSType.ANALOGVALUE, DMSType.DISCRETEVALUE, DMSType.SYNCMACHINE
            });

            // Inicijalizacija modela
            SimulatorModel.Instance.Initialization();

            ControlActiveSettingsCallback callback = new ControlActiveSettingsCallback();
            CASSubscriberProxy            CASProxy = new CASSubscriberProxy(callback);

            CASProxy.Subscribed();


            // Inicijalizacija kontrolera za simulator
            SimulatorController simulator = new SimulatorController();

            simulator.StartSimulator();


            Console.ReadKey();
        }
        public static void Main(string[] args)
        {
            handler = new GUIHandler();
            //Thread t = new Thread(handler.ShowControlForm);
            //handler.ShowControlForm();
            SimulatorController controller = new SimulatorController(handler);
            Thread t = new Thread(() => controller.Run("Data/Short Race Simulation-01.csv"));

            t.Start();
            //controller.Run("Data/Short Race Simulation-01.csv");

            handler.ShowControlForm();
        }
        public SimulatorPage(
            SimulatorController simulatorController,
            IOptions <KnbOptions> knbOptions,
            DataFilesStorageController dataFilesStorageController,
            ModelFilesStorageController modelFilesStorageController)
        {
            DataFilesStorageCtrl        = dataFilesStorageController ?? throw new ArgumentNullException();
            ModelFilesStorageController = modelFilesStorageController ?? throw new ArgumentNullException();
            KnbOptions          = knbOptions.Value ?? throw new ArgumentNullException();
            SimulatorController = simulatorController ?? throw new ArgumentNullException();

            InitializeComponent();
            Init();
        }
Ejemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="OutputFileName"></param>
        /// <param name="ReadsPerBase"></param>
        /// <param name="LengthOfReads"></param>
        /// <param name="ReverseHalf"></param>
        public IEnumerable <ISequence> DoDeterministicSimulation(int ReadsPerBase, int LengthOfReads, bool ReverseHalf)
        {
            Sequence         SequenceToSplit       = new Sequence(DnaAlphabet.Instance, MT_GENOME_NO_N);
            long             seqCount              = (ReadsPerBase * SequenceToSplit.Count);
            List <ISequence> generatedSequenceList = new List <ISequence>();

            for (long i = 0; i <= (SequenceToSplit.Count - LengthOfReads); i++)
            {
                for (int j = 0; j < ReadsPerBase; j++)
                {
                    bool reverse = ReverseHalf ? j % 2 == 0 : false;
                    yield return(SimulatorController.CreateDeterministicSubsequence(i, SequenceToSplit, LengthOfReads, reverse));
                }
            }
        }
        private async void Btn_startSimulator_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var btn = ((Button)sender);
                if (HasStarted)
                {
                    SimulatorController.Stop();
                    btn.IsEnabled = false;
                }
                else
                {
                    HasStarted  = true;
                    btn.Content = "Stop";
                    SetIsEnableProperty(false);

                    await StartSimulator();

                    HasStarted  = false;
                    btn.Content = "Start";
                    SetIsEnableProperty(true);
                }
            }
            catch (InvalidOperationException ex)
            {
                MessageBox.Show("Please carefully fill all the reaquired fields",
                                "Knb",
                                MessageBoxButton.OK);
                HasStarted = false;
                Btn_startSimulator.Content = "Start";
                SetIsEnableProperty(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show("An unexpected problem occured", "Error", MessageBoxButton.OK);
            }
        }
Ejemplo n.º 7
0
 public void StartSimulation()
 {
     controller = new SimulatorController();
     controller.Run("../../../SimulationData/Century Simulation-01.csv");
 }