-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Description
It's a common challenge for users to understand the difference between P, PS, and CC. I put together an example below that tries to illustrate this. I propose that we
- replicate the example below with actual simulations (not faked)
- add this to our documentation
- The three subplots from top to bottom are velocity, PTO force, and power, respectively
- The results are ‘faked’, not simulated (we should actually do this via simulation though). On key problem of this ‘faking' is that the velocity is the same for all three cases. The controller and PTO force affect the velocity of course, so this is not strictly correct...
- You can see from the PTO force plot:
- P controller is a negative factor of the velocity
- PS has a saturation
- You can see from the Power plot
- Negative power as absorbed power by the WE (negative = good)
- The dashed power lines are averages
- Power from P is always negative (no “reactive power”)
clc
clear
close all
%% calculations (fake)
T = 10;
f = 1/T;
w = 2*pi*f;
t = 0:0.01:10;
% velocity
v = cos(w*t);
% PTO force
fu.cc = -1*cos(w*t + 0.1*2*pi);
Fumax = 0.75*max(fu.cc);
fu.ps = arrayfun(@(x) sign(x) * min([abs(x),Fumax]), fu.cc);
fu.p = -0.5*v;
% power
fn = fields(fu);
for ii = 1:length(fn)
if ii < 3
vv = v*1.1;
else
vv = v;
end
pow.(fn{ii}) = vv .* fu.(fn{ii});
avgPow.(fn{ii}) = mean(pow.(fn{ii}));
end
%% plotting
figure('color','white')
ax(1) = subplot(3,1,1);
hold on
grid on
plot(t,v,'k')
set(gca,'XTick',0:2.5:10)
set(gca,'XTickLabels',[])
set(gca,'YTick',[-0.5, 0, 0.5])
set(gca,'YTickLabels',[])
ylabel('Velocity, $v$','Interpreter','latex')
ax(2) = subplot(3,1,2);
hold on
grid on
for ii = 1:length(fn)
plot(ax(2),t,fu.(fn{ii}), 'DisplayName', fn{ii})
end
legend('location','best','Interpreter','latex')
set(gca,'XTickLabels',[])
set(gca,'XTick',0:2.5:10)
set(gca,'YTickLabels',{'$F^{max}_{pto}$','0','$F^{max}_{pto}$'})
set(gca,'YTick',[-Fumax, 0, Fumax])
set(gca,'TickLabelInterpreter','latex')
ylabel('PTO force, $F_{pto}$','Interpreter','latex')
ax(3) = subplot(3,1,3);
hold on
grid on
for ii = 1:length(fn)
plot(ax(3),t,pow.(fn{ii}), 'DisplayName', fn{ii})
end
ax(3).ColorOrderIndex = 1;
for ii = 1:length(fn)
plot(ax(3),xlim,avgPow.(fn{ii})*ones(2,1), '--',...
'DisplayName', fn{ii})
end
set(gca,'XTick',0:2.5:10)
set(gca,'XTickLabels',[])
set(gca,'YTickLabels',{'','','0'})
linkaxes(ax,'x')
xlabel('Time, $t$','Interpreter','latex')
ylabel('Power','Interpreter','latex')
export_fig('exampleForMat.png')
savefig('exampleForMat.fig')Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
