function setIdealizedSettings(this, runName)
    % PREPAREFORIDEALIZEDSIMULATION Prepares model for idealized simulated run

    % Copyright 2017-2019 The MathWorks, Inc.

	
    lastUsedShortcut = this.ShortcutManager.getLastUsedShortcut;
    % Apply DTO/MMO shortcuts if 
    % 1. Fast restart simulation is off  (OR)
    % 2. MMO/DTO/Merge run shortcuts have changed from previous simulation
    % (OR)
    % 3. Run name is different (OR)
    % All the above three states require model to not be in a compile state
    % and hence applying shortcuts is allowable.
    % When model is in fast restart, the shortcuts are not re-applied on the 
    % model between two fast restart simulations as long as there is no
    % change in shortcuts or run name. This preserves the model in the
    % current compiled state for faster execution during instrumentation
    if ~this.FastRestartHandler.isFastRestartOn || ...
        ~strcmp(lastUsedShortcut, this.ShortcutManager.getIdealizedBehaviorShortcut) || ...
        this.isRunNameDifferent(runName)         
    
        % When either one of the above conditions is met, this code path is 
        % triggered. ~(condition 1) && (condition 2) is changing DTO settings
        % when fast restart is on between two simulations. When this
        % happens, fast restart is turned off for applying the new DTO
        % settings.
        % Once fast restart is off, the model is out 
        % of the compiled state, settings are modified and then the model
        % is put back in Fast Restart. While taking the model off from Fast
        % Restart, the 'SimulationCompletedDataEvent' is thrown via the
        % fptcallback which updates the data in FPT with previously
        % simulated run name. This gives erroneous views in FPT and 
        % requires re-simulation with the new DTO settings (simulate twice) 
        % to update the new run with correct run name. By turning on 
        % isFPTCallbackSource flag, fptcallback does not trigger an update
        % of the spreadsheet.
        this.FPTInstance.isFPTCallbackSource = true;
        
        this.FastRestartHandler.turnOffFastRestart;

        this.FPTInstance.applyIdealizedSettings;
        
        this.changeRunNameAndRestoreDirty(runName);
        
        % Restore fast restart settings post changing shortcuts
        this.FastRestartHandler.restoreFastRestart;
        
        this.FPTInstance.isFPTCallbackSource = false;
        
    end
    
    this.FPTInstance.setupRestoreListener;
end
