function simulation_config(model, maxTime, simTimeRand)
%
% ------------------------------------------------------------------------------
% author: Taylor T. Johnson
% ------------------------------------------------------------------------------

% get and set simulator parameters
    configSet = getActiveConfigSet(model);
    
    configSet_mdl = configSet.copy;
    configSetNames = get_param(configSet_mdl, 'ObjectParameters');

    cfg_name = get_param(configSet_mdl, 'Name');
    try
        cfg_max_timestep = get_param(configSet_mdl, 'MaxStep');
        set_param(configSet_mdl, 'MaxStep', num2str(0.00001));
        %set_param(configSet_mdl, 'MaxStep', simTimeRand * num2str(maxTime / 1000));
        set_param(configSet_mdl, 'ShapePreserveControl', 'EnableAll');
    end
    set_param(configSet_mdl, 'Name', ['rand', cfg_name]);
    cfg_name = get_param(configSet_mdl, 'Name');
    try
        cfg_max_timestep = get_param(configSet_mdl, 'MaxStep')
    end
    
    % TODO: error handling, this can give an exception if name already exists
    attachConfigSet(model, configSet_mdl, false);
    setActiveConfigSet(model, cfg_name);
    
    set_param(model,'RelTol',num2str(1e-12));
    set_param(model,'AbsTol',num2str(1e-15));
    
    % deprecated method, wasn't sure if set param would work
    %simset('RelTol', '1e-12');
    %simset('RelTol', '1e-15');
end