Skip to content

Commit

Permalink
Display a warning in command window if no data point is shown for a g…
Browse files Browse the repository at this point in the history
…iven condition
  • Loading branch information
dciliberti committed Apr 9, 2020
1 parent cb6a5e7 commit 2d0f1dd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions performanceCharts.m
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,22 @@

% Interpolate data to caclculate current drawn, motor torque and propeller
% efficiency at assigned operating points
warning('off','backtrace')
for i = 1:numel(condition)
% create a temporary variable to access cell data
tempMat = condition{i};
tempMat(:,4) = griddata(s,r,c,tempMat(:,2),tempMat(:,3)); % current
tempMat(:,5) = griddata(s,r,t,tempMat(:,2),tempMat(:,3)); % torque
tempMat(:,6) = griddata(s,r,h,tempMat(:,2),tempMat(:,3)); % efficiency
condition{i} = tempMat;

% Display a warning if no solution is found for the i-th condition
% (i.e. the required performance is out of the motor map)
if any(all(isnan(tempMat(:,4:6)),1))
warning(['Cannot operate with: ',conditionLabels{i}])
end
end
warning('on','backtrace')

% CONDITION = [J, SHAFT POWER, RPM, CURRENT, TORQUE, EFFICIENCY];

Expand Down

0 comments on commit 2d0f1dd

Please sign in to comment.