- Make sure the fields where you have defined the parameter are configured to be run-time parameters. The setting is shown below.
- To reduce the complexity a bit, try storing the values you are sweeping in a separate MATLAB variable, just to see if that works. Enter F_vDamper and F_fDamper directly in the fields. This is not required, but it eliminates some complexity to figure out what is not working.

# Nonlinear damper parameter sweep problem

1 view (last 30 days)

Show older comments

I’m simulating a multibody vehicle model. Within this model I’m using nonlinear dampers – damper subsystem reads the damper velocity vector and damper force vector from base workspace. Force and velocity vectors are defined via live script which uses base workspace variables for “low speed” compression damping, “high speed” compression damping, blow off velocity (damper velocity at which it “switches” to “high speed” damping curve etc.

%Variables that I want to change/sweep in an automated design stady

fdlb; % Bump/Compression Low speed damping rate

fdhb; % Bump/Compression High speed damping rate

fdlr; % Rebound Low speed damping rate

fdhr; % Rebound High speed damping rate

fkb; % Bump/Compression High/Low speed cutoff coefficient (number of velocity vector component)

fkr; % Rebound High/Low speed cutoff coefficient

fvb=0:0.025:0.3; % Bump/Compression velocity (positive) vector

fvr=-0.3:0.025:0; % Rebound velocity (negative) vector

fvhb=fvb(fkb:end); % Bump/Compression High Speed velocity vector

fvlr=fvr(fkr:end); % Rebound Low Speed velocity vector

fvhr=fvr(1:fkr); % Rebound High Speed velocity vector

fDbl=fvlb*fdlb; % Bump/Compression Low Speed damping forces

fDbhi=fvhb*fdhb; % Bump/Compression High Speed damping forces (starting from zero)

fDeltab=fDbl(end)-fDbhi(1); % Delta at kb (cutoff velocity)

fDbh=fvhb*fdhb+fDeltab; % Bump/Compression High Speed damping forces

fDrl=fvlr*fdlr; % Rebound Low Speed damping forces

fDrhi=fvhr*fdhr; % Rebound High Speed damping forces (starting from zero)

fDeltar=fDrl(1)-fDrhi(end); % Delta at kr (cutoff velocity)

fDrh=fvhr*fdhr+fDeltar; % Rebound High Speed damping forces

% Front Damper force and velocity vectors

F_vDamper=[fvr,fvb(2:end)]

F_fDamper=[fDrh,fDrl(2:end),fDbl(2:end),fDbh(2:end)]

% assigning vectors to workspace variables that simulink non linear

% damper will use for velocity and force vectors

Damper.NonLinear.Faxle.vDamper.Value=F_vDamper;

Damper.NonLinear.Faxle.fDamper.Value=F_fDamper;

In the Model Callbacks (InitFcn) I call this above-mentioned Live script to update damping force and velocity vectors according to current values (base workspace) of above-mentioned variables.

My problem is that I can’t figure out how I can do damping parameter sweeps… i.e. how can I set up the model so that it runs multiple simulations and changes damping related variables (base workspace) according to some predefined list. It works fine if I would be changing/sweeping any of model block parameters or variables that are mentioned within block. In this particular case it’s an array with values calculated via script. If I setup design study from multiple simulations panel – it doesn’t effect variables in base workspace that would effect the script that calculates required vectors.

I’ve tried to use matlab function that would use this script to create required vectors and assign it to base (or model) workspace but it doesn’t work or better say I don’t know how to do it properly.

Any suggestions would be very highly appreciated.

Thank you.

Ted

##### 0 Comments

### Accepted Answer

Steve Miller
on 22 Nov 2022

Hi Tudor,

Two things to try:

--Steve

##### 5 Comments

### More Answers (1)

### See Also

### Categories

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!