-
Notifications
You must be signed in to change notification settings - Fork 61
User defined force - RM3 #112
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
base: dev
Are you sure you want to change the base?
Changes from all commits
2b11825
26e525e
f30dac1
0047930
868bda6
f678ce0
3938a42
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| data3 = load("ResultsV1\output_force3.mat"); | ||
| data0 = load("output_noForce.mat"); | ||
|
|
||
| figure() | ||
| plot(data0.output.bodies(1).time, data0.output.bodies(1).position(:,4),output.bodies(1).time, output.bodies(1).position(:,4),data3.output.bodies(1).time, data3.output.bodies(1).position(:,4)) | ||
| legend('No Force', 'Ramp', 'No Ramp') | ||
| title('Roll - X rotation') | ||
|
|
||
| figure() | ||
| plot(data0.output.bodies(1).time, data0.output.bodies(1).position(:,5),output.bodies(1).time, output.bodies(1).position(:,5),data3.output.bodies(1).time, data3.output.bodies(1).position(:,5)) | ||
| legend('No Force', 'Ramp', 'No Ramp') | ||
| title('Pitch - Y rotation') | ||
|
|
||
| figure() | ||
| plot(data0.output.bodies(1).time, data0.output.bodies(1).position(:,6),output.bodies(1).time, output.bodies(1).position(:,6),data3.output.bodies(1).time, data3.output.bodies(1).position(:,6)) | ||
| legend('No Force', 'Ramp', 'No Ramp') | ||
| title('Yaw - Z rotation') |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. resave to older simulink version |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If only position output is visualized, pare down file size |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If only position output is visualized, pare down file size |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If only position output is visualized, pare down file size |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If only position output is visualized, pare down file size |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rename file |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| %% Data Visualization: Force Comparison (Updated Structure) | ||
| % Load the datasets | ||
| data0 = load("output_noForce.mat"); | ||
| data1 = load("output_force1.mat"); | ||
| data2 = load("output_force2.mat"); | ||
| data3 = load("output_force3.mat"); | ||
| data4 = load("output_force4.mat"); | ||
|
|
||
| figure('Color', 'w'); | ||
| hold on; grid on; | ||
|
|
||
| % Plot each line using the updated .output.bodies path | ||
| plot(data0.output.bodies(1).time, data0.output.bodies(1).position(:,3), 'k--', 'LineWidth', 1.5); | ||
| plot(data1.output.bodies(1).time, data1.output.bodies(1).position(:,3), 'LineWidth', 1.2); | ||
| plot(data2.output.bodies(1).time, data2.output.bodies(1).position(:,3), 'LineWidth', 1.2); | ||
| plot(data3.output.bodies(1).time, data3.output.bodies(1).position(:,3), 'LineWidth', 1.2); | ||
| plot(data4.output.bodies(1).time, data4.output.bodies(1).position(:,3), 'LineWidth', 1.2); | ||
|
|
||
| % Formatting the plot | ||
| xlabel('Time (s)', 'FontSize', 12); | ||
| ylabel('Vertical Position (m)', 'FontSize', 12); | ||
| title('Body 1 Heave Response Across Force Profiles', 'FontSize', 14); | ||
|
|
||
| legend('No Force', 'Force 1', 'Force 2', 'Force 3', 'Force 4', ... | ||
| 'Location', 'best'); |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If only position output is visualized, pare down file size |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| %Example of user input MATLAB file for post processing | ||
|
|
||
| %Plot waves | ||
| waves.plotElevation(simu.rampTime); | ||
| try | ||
| waves.plotSpectrum(); | ||
| catch | ||
| end | ||
|
|
||
| %Plot heave response for body 1 | ||
| output.plotResponse(1,3); | ||
|
|
||
| %Plot heave response for body 2 | ||
| output.plotResponse(2,3); | ||
|
|
||
| %Plot heave forces for body 1 | ||
| output.plotForces(1,3); | ||
|
|
||
| %Plot heave forces for body 2 | ||
| output.plotForces(2,3); | ||
|
|
||
| %Save waves and response as video | ||
| % output.saveViz(simu,body,waves,... | ||
| % 'timesPerFrame',5,'axisLimits',[-150 150 -150 150 -50 20],... | ||
| % 'startEndTime',[100 125]); | ||
|
Comment on lines
+3
to
+25
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pare down to visualizations specific to this case. Maybe combine with |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| %% Simulation Data | ||
| simu = simulationClass(); % Initialize Simulation Class | ||
| simu.simMechanicsFile = 'RM3.slx'; % Specify Simulink Model File | ||
| simu.mode = 'normal'; % Specify Simulation Mode ('normal','accelerator','rapid-accelerator') | ||
| simu.explorer = 'off'; % Turn SimMechanics Explorer (on/off) | ||
| simu.startTime = 0; % Simulation Start Time [s] | ||
| simu.rampTime = 100; % Wave Ramp Time [s] | ||
| simu.endTime = 400; % Simulation End Time [s] | ||
| simu.solver = 'ode4'; % simu.solver = 'ode4' for fixed step & simu.solver = 'ode45' for variable step | ||
| simu.dt = 0.1; % Simulation time-step [s] | ||
|
|
||
| %% Wave Information | ||
| % % noWaveCIC, no waves with radiation CIC | ||
| % waves = waveClass('noWaveCIC'); % Initialize Wave Class and Specify Type | ||
|
|
||
| % % Regular Waves | ||
| waves = waveClass('regular'); % Initialize Wave Class and Specify Type | ||
| waves.height = 2.5; % Wave Height [m] | ||
| waves.period = 8; % Wave Period [s] | ||
|
|
||
| %% Body Data | ||
| % Float | ||
| %External force on Body 1 | ||
| F_ext_b1 = [0,0,5.0e5,0,0,0]; | ||
|
|
||
| body(1) = bodyClass('../_Common_Input_Files/RM3/hydroData/rm3.h5'); | ||
| % Create the body(1) Variable, Set Location of Hydrodynamic Data File | ||
| % and Body Number Within this File. | ||
| body(1).geometryFile = '../_Common_Input_Files/RM3/geometry/float.stl'; % Location of Geometry File | ||
| body(1).mass = 'equilibrium'; | ||
| % Body Mass. The 'equilibrium' Option Sets it to the Displaced Water | ||
| % Weight. | ||
| body(1).inertia = [20907301 21306090.66 37085481.11]; % Moment of Inertia [kg*m^2] | ||
|
|
||
| % Spar/Plate | ||
| body(2) = bodyClass('../_Common_Input_Files/RM3/hydroData/rm3.h5'); | ||
| body(2).geometryFile = '../_Common_Input_Files/RM3/geometry/plate.stl'; | ||
| body(2).mass = 'equilibrium'; | ||
| body(2).inertia = [94419614.57 94407091.24 28542224.82]; | ||
|
|
||
| %% PTO and Constraint Parameters | ||
| % Floating (3DOF) Joint | ||
| constraint(1) = constraintClass('Constraint1'); % Initialize Constraint Class for Constraint1 | ||
| constraint(1).location = [0 0 0]; % Constraint Location [m] | ||
|
|
||
| % Translational PTO | ||
| pto(1) = ptoClass('PTO1'); % Initialize PTO Class for PTO1 | ||
| pto(1).stiffness = 0; % PTO Stiffness [N/m] | ||
| pto(1).damping = 1200000; % PTO Damping [N/(m/s)] | ||
| pto(1).location = [0 0 0]; % PTO Location [m] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename file