smbSetSimulationtolerance

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - SimMechanics
Introduced first in SolidGeometry 5.3, Creation date: 2023-09-25, Last change: 2025-09-15

ability to change the Simulation Tolerance for smbSimulate

Description

Since SimScape 2023, there have been some changes that make modeling 4-bar linkages more difficult. In fact, the simulation fails due to inaccuracies and no longer passes smoothly through singularities. This function modifies the tolerance (ConsistencyTolFactor) that at least the lecture examples in MTT work.

See Also: smbSetTranslationVector , smbSimulate

Example Illustration

 missing image of smbSetSimulationtolerance (tol)

Syntax

smbSetSimulationtolerance([tol])

Input Parameter

tol: default is 0.001; USE 0.1 for MTT ==> ConsistencyTolFactor




Copyright 2023-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

This function, smbSetSimulationtolerance, is designed to adjust the simulation tolerance for SimScape models, particularly for 4-bar linkages, which have become more challenging to simulate accurately in recent versions.

Input Parameters

Algorithm Steps

  1. The function begins by retrieving the tolerance value from the input arguments using the getfuncparams function. If no value is provided, it defaults to 0.01.
  2. It checks if the retrieved tolerance value is a character string. If not, it converts the numeric value to a string using sprintf.
  3. The function then searches for the 'Solver Configuration' block in the current Simulink model using find_system with the current system context gcs.
  4. Once the 'Solver Configuration' block is identified, the function sets its ConsistencyTolFactor parameter to the specified tolerance value using set_param.

This function is part of the SolidGeometry library and is intended to ensure that simulation examples, particularly those used in lectures, run smoothly by adjusting the tolerance settings to accommodate changes in SimScape 2023.

Algorithm explaination created using ChatGPT on 2025-08-19 00:16. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21