Main Content

Model Drivetrain Noise

R2026b

This example shows how to inject a fault into a drivetrain using a Torque Noise Source block. Injecting noise into your model allows you to predict how your actual physical system responds when it experiences environmental or internal disturbances. It also allows you to test the robustness and responsiveness of your control system.

In the example, the noise is injected into one of the sprockets on a metal sheet feeder that is moving a piece of stock. Although you can perform most of the steps in this example using tools that the Simulink® and Simscape™ Driveline™ user interfaces provide, programmatic commands are supplied. You can combine the programmatic commands to create a script for parameter sweeps.

  1. Open the model. At the MATLAB® command prompt, enter:

    openExample('sdl/SheetMetalFeederExample')
    model = 'SheetMetalFeeder';

  2. Simulate the model and plot the results.

    %% Simulate
    sim(model)
    
    %% Define the data
    simlog1 = simlog_SheetMetalFeeder;
    time = simlog1.Sensor_Stock.Motion_Sensor.x.series.time;
    sheetPosition = simlog1.Sensor_Stock.Motion_Sensor.x.series.values;
    sprocketTorque = simlog1.Sprocket_to_Belt_R.t.series.values;
    
    %% Create figure
    figure1 = figure('NumberTitle','off',...
        'Name','Simscape Results: SheetMetalFeeder_noise',...
        'OuterPosition',[565 52 733 822]);
    
    %% Create subplot 1: Sprocket to Belt L Tourque versus Time
    % Create axes for 
    axes1 = axes('Parent',figure1,...
        'Position',[0.13 0.709 0.775 0.216]);
    hold(axes1,'on')
    box(axes1,'on')
    grid(axes1,'on')
    % Create title & axis labels
    title('Stock Position versus Time')
    % xlabel('Time (s)')
    ylabel('m')
    % Create plot 
    plot(time,sheetPosition,'Parent',axes1) 
    
    %% Create subplot 2: Sprocket to Belt R Tourque versus Time
    % Create axes
    axes2 = axes('Parent',figure1,...
        'Position',[0.13 0.409 0.775 0.2156]);
    hold(axes2,'on')
    box(axes2,'on')
    grid(axes2,'on')
    % Create title & axis labels
    title('Sprocket-to-Right-Belt Torque versus Time')
    xlabel('Time (s)')
    ylabel('N*m')
    % Create plot with linked axes
    plot(time,sprocketTorque,'Parent',axes2)
    linkaxes([axes1,axes2],'x')

  3. Add, configure, connect, and arrange these blocks as shown:

    • Step block — Specify 7.5 for the Step time parameter and 300 for the Final value parameter.

    • Simulink-PS Converter block

    • Mechanical Rotational Reference block

    • Torque Noise Source block — For the Sample time, specify 1e-1, for Repeatability, select Specify seed, and for Seed specify 0.

    %% Expand the model window to make room for new blocks
    set_param(model,'Location',[108    73   881   682])
    
    %% Add and configure Step block
    % Define block
    stepPath = [model,'/Step'];
    stepLib = 'simulink/Sources/Step';
    stepPosition = [-195   205  -165   235];
    stepTime = '7.5';
    stepValue = '300';
    % Add block
    add_block(stepLib,stepPath,'Position',stepPosition)
    % Configure Step block
    set_param(stepPath,'Time',stepTime,...
        'After',stepValue)
    % Check block configuration
    open_system(stepPath)
    pause(3);
    close_system(stepPath)
    % Get output port
    stepPortHandle = get_param(stepPath,'PortHandles');
    stepOutport = stepPortHandle.Outport;
    
    %% Add and configure S-PS Converter block
    % Define block
    sPSConvPath = [model,'/Simulink-PS Converter'];
    sPSConvLib = ...
       'nesl_utility/Simulink-PS Converter';
    sPSConvPathPosition = [-115   205   -85   235];
    % Add block
    add_block(sPSConvLib,sPSConvPath,'Position',sPSConvPathPosition)
    % Get output port
    sPSConvPortHandle = get_param(sPSConvPath,'PortHandles');
    sPSConvInport = sPSConvPortHandle.Inport;
    sPSConvConPort = sPSConvPortHandle.RConn(1,1);
    
    
    %% Add Mechanical Rotational Reference block
    % Define block
    mechRotRefPath = [model,'/Mechanical Rotational Reference'];
    mechRotRefLib = ...
       'fl_lib/Mechanical/Rotational Elements/Mechanical Rotational Reference';
    mechRotRefPosition = [-40   255   -20   275];
    % Add block
    add_block(mechRotRefLib,mechRotRefPath,'Position',mechRotRefPosition)
    %% Get output port
    mechRotRefPortHandle = get_param(mechRotRefPath,'PortHandles');
    mechRotRefConPort = mechRotRefPortHandle.LConn(1,1);
    
    %% Add and configure Torque Noise Source block
    % Define block
    torqueNoisePath = [model,'/Torque Noise Source'];
    torqueNoiseLib = 'sdl_lib/Sources/Torque Noise Source';
    torqueNoisePosition = [25   210    65   250];
    %% Add block
    add_block(torqueNoiseLib,torqueNoisePath,'Position',torqueNoisePosition)
    %% Get output port
    torqueNoisePortHandle = get_param(torqueNoisePath,'PortHandles');
    torqueNoiseConPort1 = torqueNoisePortHandle.LConn(1,1);
    torqueNoiseConPort2 = torqueNoisePortHandle.LConn(1,2);
    torqueNoiseConPort3 = torqueNoisePortHandle.RConn(1,1);
    %% Configure  block
    set_param(torqueNoisePath, 'sample_time','1e-1',...
        'repeatability','3')
    %% Check block configuration
    open_system(torqueNoisePath)
    pause(3);
    close_system(torqueNoisePath)
    
    %% Get block points for connecting as a branched line
    torqueNoisePortPoints = get_param(torqueNoisePath,'PortConnectivity');
    [torqueNoiseLConnPoints1,torqueNoiseLConnPoints2,torqueNoiseRConnPoints]...
        = torqueNoisePortPoints.Position;
    sprocketPath = [model,'/Sprocket to Belt R'];
    sprocketPortHandle = get_param(sprocketPath,'PortHandles');
    sprocketConPort1 = sprocketPortHandle.RConn(1,1);
    sproketPortPoints = get_param(sprocketPath,'PortConnectivity');
    [sproketLConnPoints,sproketRConnPoints] = sproketPortPoints.Position;
    
    %% Connect blocks
    add_line(model,stepOutport,sPSConvInport)
    add_line(model,sPSConvConPort,torqueNoiseConPort1)
    add_line(model,mechRotRefConPort,torqueNoiseConPort2)
    add_line(model,[sproketLConnPoints;torqueNoiseRConnPoints])
    
    %% Hold to check connections
    pause(5);

  4. Simulate the model and plot the results.

    %% Simulate model
    sim(model)
    
    %% Define the datalog variable
    simlog2 = simlog_SheetMetalFeeder;
    time = simlog2.Sensor_Stock.Motion_Sensor.x.series.time;
    sheetPosition = ...
        simlog2.Sensor_Stock.Motion_Sensor.x.series.values;
    sprocketTorque = simlog2.Sprocket_to_Belt_R.t.series.values;
    noiseTorque = simlog2.Torque_Noise_Source.t.series.values;
    
    %% Update plots 1 & 2
    figure1;
    hold on
    axes1;
    hold on
    plot(time, sheetPosition,'Parent',axes1,'Linestyle','--','Color','r')
    axes2;
    hold on 
    plot(time,sprocketTorque,'Parent',axes2','Linestyle','--','Color','r')
    
    
    %% Create subplot 3: Sprocket to Belt R Tourque versus Time
    % Create axes
    axes3 = axes('Parent',figure1,...
        'Position',[0.13 0.11 0.775 0.200]);
    hold(axes3,'on')
    box(axes3,'on')
    grid(axes3,'on')
    
    % Create title and axis labels
    title('Noise Source Torque versus Time')
    xlabel('Time (s)') 
    ylabel('N*m')
    linkaxes([axes1,axes2,axes3],'x')
    
    % Create plot
    plot(time,noiseTorque,'Parent',axes3,'Color','r')
    legend(axes1,'No Noise','Noise','Location','southeast');
    ylim(axes3,[-120 120]);

    The noise injected at simulation time, t = 7.5 seconds introduces torque disturbances.

  5. Zoom in to see the effects of the disturbance.

    %% Zoom to examine data at peak noise
    xlim(axes3,[12.0 14.50]);
    ylim(axes3,[-120 120]);

    When the noise source torque exceeds ±50 N*m, it most significantly effects the torque applied by the sprocket and, therefore, the position of the stock.

See Also

| | | | |