Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Good explanation of different controllers #139

Open
ryancoe opened this issue May 8, 2020 · 2 comments
Open

Good explanation of different controllers #139

ryancoe opened this issue May 8, 2020 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@ryancoe
Copy link
Member

ryancoe commented May 8, 2020

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

  1. replicate the example below with actual simulations (not faked)
  2. 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')

exampleForMat

@ryancoe ryancoe added the documentation Improvements or additions to documentation label May 8, 2020
@H0R5E H0R5E added the proposal A proposal, for discussion with the development team label May 8, 2020
@ryancoe
Copy link
Member Author

ryancoe commented Sep 17, 2020

consider adding a page to docs using figure(s) from WaveBot paper (#169)

@H0R5E
Copy link
Member

H0R5E commented Sep 17, 2020

Shall we consider this one accepted now?

@H0R5E H0R5E removed the proposal A proposal, for discussion with the development team label Sep 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants