Пример #1
0
        public ProcessItem(
            ILogger <ProcessItem> logger, CourseService courseService, LanguageService languageService,
            IdService idService, AppOptions appOptions, IHubContext <LiveHub> liveHub,
            CompareService compareService, MatlabServer matlabServer, EvaluationService evaluationService,
            CcData item)
        {
            _logger            = logger;
            _courseService     = courseService;
            _languageService   = languageService;
            _liveHub           = liveHub;
            _idService         = idService;
            _appOptions        = appOptions;
            _compareService    = compareService;
            _matlabServer      = matlabServer;
            _evaluationService = evaluationService;

            Item    = item;
            Context = new CourseContext(
                _courseService,
                _languageService,
                Item
                );

            _matlabServer.Initialize(ProcessService.ContainerName);

            var timeout = Context.CourseProblem.Timeout < 1 ? DefaultTimeoutPerCase : Context.CourseProblem.Timeout;

            TimeBank = new TimeBank(
                Context.Language,
                Item.Action == "input" ? IncreaseTimeoutForInput(timeout) : timeout
                );
            Item.Result.TimeLimit = TimeBank.TimeLeft;
        }
Пример #2
0
        /// <summary>
        /// Execute MATLAB command, raising exception if error string returned.
        /// ****** REQUIRES ABSTRACTION --- duplicate in BAYES CLASSIFIER MODULE
        /// </summary>
        /// <param name="command"></param>
        private void Execute(string command)
        {
            var s = MatlabServer.Execute(command);

            if (s != "")
            {
                throw new ApplicationException(s);
            }
        }
Пример #3
0
    private int sendSize       = 32; //Amount of information in bytes to send to Simulink.


    // Use this for initialization
    void Awake()
    {                              //Always called before start() functions
      //Makes sure that there is only one instance of Matlab Server (singleton)
        if (instance == null)      //If no game control found
        {
            instance = this;       //Then this is the instance of the game control
        }
        else if (instance != this) //If the game object finds that instance is already on another game object, then this destroys itself as it's not needed
        {
            Destroy(gameObject);
        }
        //ipAddress = PlayerPrefs.GetString("IPAddress", "127.0.0.1");
        forceFeedback = (float)PlayerPrefs.GetInt("ForceToggle", 1);
    }