How can I develop a matlab code which analyses and checks how thick the cracks of a wheel surface are?
Recently I have done a measurement for a wheel to find out how overused it is by using the confocal sensor and the data recorder to check how deep the cracks on the surface are by the light distance.
The measured data looks like this e. g.:
With the green diagram you can see how long the distance of the measured light = how deep the cracks on the surface are. The red and the yellow ones are the high and low voltage level.
Now the challenge is that I need to find out how thin/thick the cracks are using this data. Is there anyway I can use matlab to solve this problem?
I have already written a matlab code that checks how many cracks are there by adding a threshold or a mm light distance. But still have not found out a way yet how to find out how long/thick the cracks on the surface are…
Thanks a lot in advance for the help!
% Create PNRF reader OLE Automation server
FromDisk = actxserver(‘Perception.Loaders.pNRF’);
% Use the open file dialog to select a recording file
[FileName,PathName] = uigetfile(‘*.pNRF’,’U:SP90000_12_12_23′);
if isequal(FileName,0)
error(‘Benutzer hat die Auswahl abgebrochen.’);
end
MyRecordingName = fullfile(PathName, FileName);
% Laden der Aufzeichnung
MyData = FromDisk.LoadRecording(MyRecordingName); % Zugriff auf den ersten Recorder
% Initialize channel arrays
channelNames = {}; % Initialisiert als leere Zelle
channel = {}; % Initialisiert als leere Zelle
% Loop through all recorders and channels to get the names of all channels
indexer = 0;
for r = 1: MyData.Recorders.Count
% Get an interface to each recorder
MyRecorder = MyData.Recorders.Item(r);
% Get the channel collection from the recorder
myChannels = MyRecorder.Channels;
% Loop through each channel in the recorder
for i = 1:myChannels.Count
myChannel = myChannels.Item(i);
channelNames{end+1} = string(myChannel.Name);
channel{end+1} = myChannel;
end
end
% Show a modal selection list with all the channels so the operator can select a channel
[indx, tf] = listdlg(‘ListString’,channelNames);
if ~tf
error(‘Kein Kanal ausgewählt.’);
end
myChannel = channel{indx};
SelectedChannelName = myChannel.Name;
% Now we get the DataSrc (data source) interface from the selected channel
ItfData = myChannel.DataSource(3);
% Check if we have synchronous or asynchronous data by using the TimeInfo property
myTimeInfo = ItfData.TimeInfo;
isAsyncData = ~strcmp(myTimeInfo, ‘DataSourceTimeInfo_Implicit’);
% Get the sweeps collection from the datasource interface
MySweeps = ItfData.Sweeps;
% Get the start and end time of the recorded data of the first channel
dStartTime = MySweeps.StartTime;
dEndTime = MySweeps.EndTime;
% Get the data segments collection between the start and end time
SegmentsOfData = ItfData.Data(dStartTime, dEndTime); % Now the actual data is read.
% Take the first data segment
myFirstSegment = SegmentsOfData.Item(1);
% Check the number of samples
NumberOfSamples = myFirstSegment.NumberOfSamples;
if NumberOfSamples > 500000
NumberOfSamples = 500000;
end
% Show the data in a diagram
figure1 = figure(‘NumberTitle’,’off’,’Name’, SelectedChannelName);
% axes1 = axes(‘Parent’,figure1,’Position’,[0.2 0.05 0.6 0.9]);
%set(figure1, ‘Position’, [100 100 1200 800]);
if isAsyncData
[WaveformDateWithTimes, Times] = myFirstSegment.WaveformWithTimes(5, 1, NumberOfSamples, 1);
plot(Times, WaveformDateWithTimes);
title(‘Not-Equidistant data points’);
else
WaveformData = myFirstSegment.Waveform(5, 1, NumberOfSamples, 1);
tEnd = myFirstSegment.StartTime + (NumberOfSamples – 1) * myFirstSegment.SampleInterval;
t = myFirstSegment.StartTime: myFirstSegment.SampleInterval : tEnd;
plot(t, WaveformData);
title(‘Equidistant data points’);
end
legend(SelectedChannelName);
xlabel([‘Time (‘,ItfData.XUnit ,’)’]);
ylabel([SelectedChannelName, ‘ (‘, ItfData.YUnit ,’)’]);
% Create a Textbox to display data values from the information sheet
% myDataValues = MyData.DataValues;
% cInfo = ”;
% for i = 1:myDataValues.Count
% myDataValue = myDataValues.Item(i);
% cInfo = sprintf(‘%s%s: %s %sn’, cInfo, myDataValue.Name, myDataValue.Value, myDataValue.Units);
% end
% annotation(figure1, ‘textbox’, [0.66 0.05 0.32 0.9], ‘String’, cInfo, ‘FitBoxToText’, ‘on’);
% Schätze die Bildschirmgröße ab und positioniere das Fenster
screenSize = get(0, ‘ScreenSize’); % Dies gibt [left bottom width height]
figureWidth = 1200;
figureHeight = 800;
figureLeft = (screenSize(3) – figureWidth) / 2; % Zentriert horizontal
figureBottom = (screenSize(4) – figureHeight) / 2; % Zentriert vertikal
set(figure1, ‘Position’, [figureLeft figureBottom figureWidth figureHeight]);
% Ersetzen oder fügen Sie nach der Plot-Erstellung hinzu
if isAsyncData
[WaveformDateWithTimes, Times] = myFirstSegment.WaveformWithTimes(5, 1, NumberOfSamples, 1);
plot(Times, WaveformDateWithTimes);
WaveformData = WaveformDateWithTimes; % Verwendung der asynchronen Daten für die Statistik
else
WaveformData = myFirstSegment.Waveform(5, 1, NumberOfSamples, 1);
tEnd = myFirstSegment.StartTime + (NumberOfSamples – 1) * myFirstSegment.SampleInterval;
t = myFirstSegment.StartTime: myFirstSegment.SampleInterval : tEnd;
plot(t, WaveformData);
end
% Statistikberechnungen
averageValue = mean(WaveformData);
minValue = min(WaveformData);
maxValue = max(WaveformData);
numberOfPositiveValues = sum(WaveformData > 0);
% Anzahl der Werte größer als 0.25 mm
numberOfValuesAboveThreshold = sum(WaveformData > 0.25);
% Anzeige der berechneten Werte
disp([‘Durchschnittswert: ‘, num2str(averageValue)]);
disp([‘Minimaler Wert: ‘, num2str(minValue)]);
disp([‘Maximaler Wert: ‘, num2str(maxValue)]);
disp([‘Anzahl positiver Werte: ‘, num2str(numberOfPositiveValues)]);
disp([‘Anzahl der Werte über 0.1 mm: ‘, num2str(numberOfValuesAboveThreshold)]);Recently I have done a measurement for a wheel to find out how overused it is by using the confocal sensor and the data recorder to check how deep the cracks on the surface are by the light distance.
The measured data looks like this e. g.:
With the green diagram you can see how long the distance of the measured light = how deep the cracks on the surface are. The red and the yellow ones are the high and low voltage level.
Now the challenge is that I need to find out how thin/thick the cracks are using this data. Is there anyway I can use matlab to solve this problem?
I have already written a matlab code that checks how many cracks are there by adding a threshold or a mm light distance. But still have not found out a way yet how to find out how long/thick the cracks on the surface are…
Thanks a lot in advance for the help!
% Create PNRF reader OLE Automation server
FromDisk = actxserver(‘Perception.Loaders.pNRF’);
% Use the open file dialog to select a recording file
[FileName,PathName] = uigetfile(‘*.pNRF’,’U:SP90000_12_12_23′);
if isequal(FileName,0)
error(‘Benutzer hat die Auswahl abgebrochen.’);
end
MyRecordingName = fullfile(PathName, FileName);
% Laden der Aufzeichnung
MyData = FromDisk.LoadRecording(MyRecordingName); % Zugriff auf den ersten Recorder
% Initialize channel arrays
channelNames = {}; % Initialisiert als leere Zelle
channel = {}; % Initialisiert als leere Zelle
% Loop through all recorders and channels to get the names of all channels
indexer = 0;
for r = 1: MyData.Recorders.Count
% Get an interface to each recorder
MyRecorder = MyData.Recorders.Item(r);
% Get the channel collection from the recorder
myChannels = MyRecorder.Channels;
% Loop through each channel in the recorder
for i = 1:myChannels.Count
myChannel = myChannels.Item(i);
channelNames{end+1} = string(myChannel.Name);
channel{end+1} = myChannel;
end
end
% Show a modal selection list with all the channels so the operator can select a channel
[indx, tf] = listdlg(‘ListString’,channelNames);
if ~tf
error(‘Kein Kanal ausgewählt.’);
end
myChannel = channel{indx};
SelectedChannelName = myChannel.Name;
% Now we get the DataSrc (data source) interface from the selected channel
ItfData = myChannel.DataSource(3);
% Check if we have synchronous or asynchronous data by using the TimeInfo property
myTimeInfo = ItfData.TimeInfo;
isAsyncData = ~strcmp(myTimeInfo, ‘DataSourceTimeInfo_Implicit’);
% Get the sweeps collection from the datasource interface
MySweeps = ItfData.Sweeps;
% Get the start and end time of the recorded data of the first channel
dStartTime = MySweeps.StartTime;
dEndTime = MySweeps.EndTime;
% Get the data segments collection between the start and end time
SegmentsOfData = ItfData.Data(dStartTime, dEndTime); % Now the actual data is read.
% Take the first data segment
myFirstSegment = SegmentsOfData.Item(1);
% Check the number of samples
NumberOfSamples = myFirstSegment.NumberOfSamples;
if NumberOfSamples > 500000
NumberOfSamples = 500000;
end
% Show the data in a diagram
figure1 = figure(‘NumberTitle’,’off’,’Name’, SelectedChannelName);
% axes1 = axes(‘Parent’,figure1,’Position’,[0.2 0.05 0.6 0.9]);
%set(figure1, ‘Position’, [100 100 1200 800]);
if isAsyncData
[WaveformDateWithTimes, Times] = myFirstSegment.WaveformWithTimes(5, 1, NumberOfSamples, 1);
plot(Times, WaveformDateWithTimes);
title(‘Not-Equidistant data points’);
else
WaveformData = myFirstSegment.Waveform(5, 1, NumberOfSamples, 1);
tEnd = myFirstSegment.StartTime + (NumberOfSamples – 1) * myFirstSegment.SampleInterval;
t = myFirstSegment.StartTime: myFirstSegment.SampleInterval : tEnd;
plot(t, WaveformData);
title(‘Equidistant data points’);
end
legend(SelectedChannelName);
xlabel([‘Time (‘,ItfData.XUnit ,’)’]);
ylabel([SelectedChannelName, ‘ (‘, ItfData.YUnit ,’)’]);
% Create a Textbox to display data values from the information sheet
% myDataValues = MyData.DataValues;
% cInfo = ”;
% for i = 1:myDataValues.Count
% myDataValue = myDataValues.Item(i);
% cInfo = sprintf(‘%s%s: %s %sn’, cInfo, myDataValue.Name, myDataValue.Value, myDataValue.Units);
% end
% annotation(figure1, ‘textbox’, [0.66 0.05 0.32 0.9], ‘String’, cInfo, ‘FitBoxToText’, ‘on’);
% Schätze die Bildschirmgröße ab und positioniere das Fenster
screenSize = get(0, ‘ScreenSize’); % Dies gibt [left bottom width height]
figureWidth = 1200;
figureHeight = 800;
figureLeft = (screenSize(3) – figureWidth) / 2; % Zentriert horizontal
figureBottom = (screenSize(4) – figureHeight) / 2; % Zentriert vertikal
set(figure1, ‘Position’, [figureLeft figureBottom figureWidth figureHeight]);
% Ersetzen oder fügen Sie nach der Plot-Erstellung hinzu
if isAsyncData
[WaveformDateWithTimes, Times] = myFirstSegment.WaveformWithTimes(5, 1, NumberOfSamples, 1);
plot(Times, WaveformDateWithTimes);
WaveformData = WaveformDateWithTimes; % Verwendung der asynchronen Daten für die Statistik
else
WaveformData = myFirstSegment.Waveform(5, 1, NumberOfSamples, 1);
tEnd = myFirstSegment.StartTime + (NumberOfSamples – 1) * myFirstSegment.SampleInterval;
t = myFirstSegment.StartTime: myFirstSegment.SampleInterval : tEnd;
plot(t, WaveformData);
end
% Statistikberechnungen
averageValue = mean(WaveformData);
minValue = min(WaveformData);
maxValue = max(WaveformData);
numberOfPositiveValues = sum(WaveformData > 0);
% Anzahl der Werte größer als 0.25 mm
numberOfValuesAboveThreshold = sum(WaveformData > 0.25);
% Anzeige der berechneten Werte
disp([‘Durchschnittswert: ‘, num2str(averageValue)]);
disp([‘Minimaler Wert: ‘, num2str(minValue)]);
disp([‘Maximaler Wert: ‘, num2str(maxValue)]);
disp([‘Anzahl positiver Werte: ‘, num2str(numberOfPositiveValues)]);
disp([‘Anzahl der Werte über 0.1 mm: ‘, num2str(numberOfValuesAboveThreshold)]); Recently I have done a measurement for a wheel to find out how overused it is by using the confocal sensor and the data recorder to check how deep the cracks on the surface are by the light distance.
The measured data looks like this e. g.:
With the green diagram you can see how long the distance of the measured light = how deep the cracks on the surface are. The red and the yellow ones are the high and low voltage level.
Now the challenge is that I need to find out how thin/thick the cracks are using this data. Is there anyway I can use matlab to solve this problem?
I have already written a matlab code that checks how many cracks are there by adding a threshold or a mm light distance. But still have not found out a way yet how to find out how long/thick the cracks on the surface are…
Thanks a lot in advance for the help!
% Create PNRF reader OLE Automation server
FromDisk = actxserver(‘Perception.Loaders.pNRF’);
% Use the open file dialog to select a recording file
[FileName,PathName] = uigetfile(‘*.pNRF’,’U:SP90000_12_12_23′);
if isequal(FileName,0)
error(‘Benutzer hat die Auswahl abgebrochen.’);
end
MyRecordingName = fullfile(PathName, FileName);
% Laden der Aufzeichnung
MyData = FromDisk.LoadRecording(MyRecordingName); % Zugriff auf den ersten Recorder
% Initialize channel arrays
channelNames = {}; % Initialisiert als leere Zelle
channel = {}; % Initialisiert als leere Zelle
% Loop through all recorders and channels to get the names of all channels
indexer = 0;
for r = 1: MyData.Recorders.Count
% Get an interface to each recorder
MyRecorder = MyData.Recorders.Item(r);
% Get the channel collection from the recorder
myChannels = MyRecorder.Channels;
% Loop through each channel in the recorder
for i = 1:myChannels.Count
myChannel = myChannels.Item(i);
channelNames{end+1} = string(myChannel.Name);
channel{end+1} = myChannel;
end
end
% Show a modal selection list with all the channels so the operator can select a channel
[indx, tf] = listdlg(‘ListString’,channelNames);
if ~tf
error(‘Kein Kanal ausgewählt.’);
end
myChannel = channel{indx};
SelectedChannelName = myChannel.Name;
% Now we get the DataSrc (data source) interface from the selected channel
ItfData = myChannel.DataSource(3);
% Check if we have synchronous or asynchronous data by using the TimeInfo property
myTimeInfo = ItfData.TimeInfo;
isAsyncData = ~strcmp(myTimeInfo, ‘DataSourceTimeInfo_Implicit’);
% Get the sweeps collection from the datasource interface
MySweeps = ItfData.Sweeps;
% Get the start and end time of the recorded data of the first channel
dStartTime = MySweeps.StartTime;
dEndTime = MySweeps.EndTime;
% Get the data segments collection between the start and end time
SegmentsOfData = ItfData.Data(dStartTime, dEndTime); % Now the actual data is read.
% Take the first data segment
myFirstSegment = SegmentsOfData.Item(1);
% Check the number of samples
NumberOfSamples = myFirstSegment.NumberOfSamples;
if NumberOfSamples > 500000
NumberOfSamples = 500000;
end
% Show the data in a diagram
figure1 = figure(‘NumberTitle’,’off’,’Name’, SelectedChannelName);
% axes1 = axes(‘Parent’,figure1,’Position’,[0.2 0.05 0.6 0.9]);
%set(figure1, ‘Position’, [100 100 1200 800]);
if isAsyncData
[WaveformDateWithTimes, Times] = myFirstSegment.WaveformWithTimes(5, 1, NumberOfSamples, 1);
plot(Times, WaveformDateWithTimes);
title(‘Not-Equidistant data points’);
else
WaveformData = myFirstSegment.Waveform(5, 1, NumberOfSamples, 1);
tEnd = myFirstSegment.StartTime + (NumberOfSamples – 1) * myFirstSegment.SampleInterval;
t = myFirstSegment.StartTime: myFirstSegment.SampleInterval : tEnd;
plot(t, WaveformData);
title(‘Equidistant data points’);
end
legend(SelectedChannelName);
xlabel([‘Time (‘,ItfData.XUnit ,’)’]);
ylabel([SelectedChannelName, ‘ (‘, ItfData.YUnit ,’)’]);
% Create a Textbox to display data values from the information sheet
% myDataValues = MyData.DataValues;
% cInfo = ”;
% for i = 1:myDataValues.Count
% myDataValue = myDataValues.Item(i);
% cInfo = sprintf(‘%s%s: %s %sn’, cInfo, myDataValue.Name, myDataValue.Value, myDataValue.Units);
% end
% annotation(figure1, ‘textbox’, [0.66 0.05 0.32 0.9], ‘String’, cInfo, ‘FitBoxToText’, ‘on’);
% Schätze die Bildschirmgröße ab und positioniere das Fenster
screenSize = get(0, ‘ScreenSize’); % Dies gibt [left bottom width height]
figureWidth = 1200;
figureHeight = 800;
figureLeft = (screenSize(3) – figureWidth) / 2; % Zentriert horizontal
figureBottom = (screenSize(4) – figureHeight) / 2; % Zentriert vertikal
set(figure1, ‘Position’, [figureLeft figureBottom figureWidth figureHeight]);
% Ersetzen oder fügen Sie nach der Plot-Erstellung hinzu
if isAsyncData
[WaveformDateWithTimes, Times] = myFirstSegment.WaveformWithTimes(5, 1, NumberOfSamples, 1);
plot(Times, WaveformDateWithTimes);
WaveformData = WaveformDateWithTimes; % Verwendung der asynchronen Daten für die Statistik
else
WaveformData = myFirstSegment.Waveform(5, 1, NumberOfSamples, 1);
tEnd = myFirstSegment.StartTime + (NumberOfSamples – 1) * myFirstSegment.SampleInterval;
t = myFirstSegment.StartTime: myFirstSegment.SampleInterval : tEnd;
plot(t, WaveformData);
end
% Statistikberechnungen
averageValue = mean(WaveformData);
minValue = min(WaveformData);
maxValue = max(WaveformData);
numberOfPositiveValues = sum(WaveformData > 0);
% Anzahl der Werte größer als 0.25 mm
numberOfValuesAboveThreshold = sum(WaveformData > 0.25);
% Anzeige der berechneten Werte
disp([‘Durchschnittswert: ‘, num2str(averageValue)]);
disp([‘Minimaler Wert: ‘, num2str(minValue)]);
disp([‘Maximaler Wert: ‘, num2str(maxValue)]);
disp([‘Anzahl positiver Werte: ‘, num2str(numberOfPositiveValues)]);
disp([‘Anzahl der Werte über 0.1 mm: ‘, num2str(numberOfValuesAboveThreshold)]); cracks, confocal, sensor, thickness, thick, thin, matlab, code MATLAB Answers — New Questions