Skip to content

Commit

Permalink
Merge pull request #27 from NREL/simulink
Browse files Browse the repository at this point in the history
Update ROSCO Simulink Example
  • Loading branch information
nikhar-abbas committed Jan 11, 2021
2 parents 3aab5c8 + 5940292 commit ff4ec14
Show file tree
Hide file tree
Showing 25 changed files with 1,145 additions and 304 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,7 @@ Matlab_Toolbox/*.slxc

# Exclude testing results
ROSCO_testing/results/

# Simulink/Matlab temp files
*.slxc
*.autosave
2 changes: 1 addition & 1 deletion Matlab_Toolbox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ The modules not currently implemented include:
- Shutdown control
- Flap control

`runFAST.m` can be used to load the ROSCO parameters from a .IN file, using `load_ROSCO_params.m` and a more detailed version can be found in the `matlab-toolbox` [repository](https://github.com/dzalkind/matlab-toolbox/tree/master/Simulations).
`runFAST.m` can be used to load the ROSCO parameters from a .IN file, using `load_ROSCO_params.m`. Add the `matlab-toolbox` [repository](https://github.com/OpenFAST/matlab-toolbox) to your matlab path.

29 changes: 29 additions & 0 deletions Matlab_Toolbox/Utilities/Af_HPF.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
function [dHPF,HPF] = Af_HPF(omega,zeta,DT,varargin)
%% Example Code
% omega = 2*pi*6; %rad/s
% HPF = tf(om^2,[1,2*zeta*omega,omega^2]);
% dHFP = c2d(LPF,DT);
%
% varargin to specify order

if isempty(varargin)
order = 2;
else
order = varargin{1};
end

if order == 2
HPF = tf([1,0,0],[1,2*zeta*omega,omega^2]);
elseif order > 2
[b,a] = butter(order,omega,'high','s');
HPF = tf(b,a);
else
HPF = tf([1,0],[1,omega]);
end

dHPF = c2d(HPF,DT,'tustin');

if 0
figure(881);
bode(HPF);
end
29 changes: 29 additions & 0 deletions Matlab_Toolbox/Utilities/Af_LPF.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
function [dLPF,LPF] = Af_LPF(omega,zeta,DT,varargin)
%% Example Code
% omega = 2*pi*6; %rad/s
% LPF = tf(om^2,[1,2*zeta*omega,omega^2]);
% dLFP = c2d(LPF,DT);
%
% varargin to specify order

if isempty(varargin)
order = 2;
else
order = varargin{1};
end

if order == 2
LPF = tf(omega^2,[1,2*zeta*omega,omega^2]);
elseif order > 2
[b,a] = butter(order,omega,'s');
LPF = tf(b,a);
else
LPF = tf(omega,[1,omega]);
end

dLPF = c2d(LPF,DT,'tustin');

if 0
figure(881);
bode(LPF);
end
Loading

0 comments on commit ff4ec14

Please sign in to comment.