simStarted

Класс: simevents. SimulationObserver
Пакет: simevents

Задайте поведение, когда симуляция запустится

Синтаксис

simStarted(obj)

Описание

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

Входные параметры

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

Объект класса SimulationObserver

Примеры

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

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

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

Для просмотра документации необходимо авторизоваться на сайте