# Modeling of square wave

4 views (last 30 days)
Iurii Storozhenko on 8 Dec 2021
Answered: Abhimenyu on 7 Jun 2024
Hello everyone,
I am modeling the position varying gear mesh stiffness function with the following code inside ODE solver.
z(k) = mod(theta_p,2*pi/t_np);
if z(k)>=(2-c)*2*pi/t_np
k_m(k) = k_max;
else
k_m(k) = k_min;
end
where c, k_max, k_min, t_np are the constants:
k_min = 5e7/2; %minimum stiffness;
k_max = 5e7; %maximum stiffness;
c = 1.63; %engagement rate;
t_np = 25; %number of teeth on pinion;
The goal of this function is to make a square wave with t_np number of maximums over 2*pi interval.
This is how the time/varying gear mesh stiffness should look like:
When the gear have a fault, the stiffness of the faulty gear tooth is compromized, so when the broken tooth is in contact, the stiffness will decrease. I am struggling to figure out how to make the value of one of the minima less than others on each 2*pi intervals. Any suggestions highly appreciated.
Thank you!
Steve Miller on 9 Jan 2023
If you are interested in modeling gears with faulty behavior, you may be interested in the Simple Gear block in Simscape Driveline.
--Steve

Abhimenyu on 7 Jun 2024
Hi,
I understand that you want to modify the gear mesh stiffness function to include a fault that decreases the stiffness of one tooth in each 2π interval. For this, you can introduce a condition to identify the faulty tooth and adjust its stiffness accordingly. Please follow this example MATLAB code :
% Constants
k_min = 5e7 / 2; % minimum stiffness
k_max = 5e7; % maximum stiffness
c = 1.63; % engagement rate
t_np = 25; % number of teeth on pinion
% Faulty tooth index
faulty_tooth_index = 5; % example: 5th tooth is faulty
faulty_tooth_index: This variable specifies which tooth is faulty. In this example, the 5th tooth is considered faulty.
faulty_tooth_stiffness = k_min / 2; % stiffness of faulty tooth (you can adjust this value)
faulty_tooth_stiffness: This specifies the stiffness of the faulty tooth. You can adjust this value to reflect how much the stiffness decreases.
% ODE solver function
%theta_p as given in the diagram shared
for k = 1:length(theta_p)
z(k) = mod(theta_p(k), 2 * pi / t_np);
tooth_index = floor(theta_p(k) / (2 * pi / t_np)) + 1; % find current tooth index
tooth_index: This is calculated to determine which tooth is currently engaged based on the angle θp\theta_p​.
if tooth_index == faulty_tooth_index
k_m(k) = faulty_tooth_stiffness;
elseif z(k) >= (2 - c) * 2 * pi / t_np
k_m(k) = k_max;
else
k_m(k) = k_min;
end
end

### Categories

Find more on Programming in Help Center and File Exchange

R2021b

### Community Treasure Hunt

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

Start Hunting!