exponenta event banner

simStarted

Класс: симевенты. SimulationObserver
Пакет: симевенты

Указание поведения при запуске моделирования

Синтаксис

simStarted(obj)

Описание

simStarted(obj) определяет поведение при запуске моделирования. Переопределите эту функцию, чтобы задать поведение визуализации при запуске моделирования, как определено SimulationStatus параметр.

Входные аргументы

развернуть все

Объект класса М Наблюдатель

Примеры

развернуть все

Инициализируйте анимационный холст.

function simStarted(this)
            % Initialize the animation canvas
            
            % Re-initialize runtime work variables for simulation
            this.mEntityGlyphs = containers.Map('keytype', 'char', 'valuetype', 'any');
            this.mEntities = containers.Map('keytype', 'char', 'valuetype', 'any');
            this.mCombineMap = containers.Map('keytype', 'char', 'valuetype', 'char');
            this.mCachePostRun = containers.Map('keytype', 'char', 'valuetype', 'char');
            this.mTableOccupy = zeros(1, size(this.cTablePos,1)) - 1;
            
            % Setup the figure with the restaurant floor as background
            close all;
            im = imread('restaurant.png');
            image(im);
            this.mFig = gcf;
            set(this.mFig, 'Tag', 'Begin');
            this.mAx = gca;
            set(this.mFig, 'toolbar', 'none');
            set(this.mFig, 'menubar', 'none');
            set(this.mAx, 'XTickLabel', '');
            set(this.mAx, 'YTickLabel', '');
            set(this.mAx, 'Box', 'on');
            set(this.mAx, 'TickLength', [0 0]);
            set(this.mAx, 'position', [0 0 1 1]);
            hold on;
            
            % Set up the numeric statistics text labels on the figure
            this.mTxtEntry = text(170,850, '0');
            this.mTxtWaiting = text(10,160, '0');
            this.mTxtExit = text(920,330, '0');
            this.mTxtSelectedEnt = text(50,600,'');
            
            set(this.mTxtEntry, 'Color', [0.8500 0.3250 0.0980], 'FontWeight', 'bold', 'FontSize', 14);
            set(this.mTxtWaiting, 'Color', [0.8500 0.3250 0.0980], 'FontWeight', 'bold', 'FontSize', 14);
            set(this.mTxtExit, 'Color', [0.8500 0.3250 0.0980], 'FontWeight', 'bold', 'FontSize', 14);
            
            this.mLineSelectedEnt = plot(0,0,'.');
            
            % Set up the timer
            this.mTimer = timer(...
                'TimerFcn',      @(t,e)animate(this,t,e), ...
                'ExecutionMode', 'fixedSpacing', ...
                'Period',        this.cTimerPeriod);
            this.mTimerData = containers.Map('keytype', 'char', 'valuetype', 'any');
            this.mTimerRequestStop = false;
            this.mTimerRequestPause = false;
            start(this.mTimer);
        end
Представлен в R2016a