Skip to content

Conversation

@baggepinnen
Copy link
Member

Due to numerical rounding issues, OrdinaryDiffEq.solve sometimes fails to include the last time point and then lsim fails due to trying to access the solution out of bounds. This PR extends the time range by half a sample time to make sure the last time point is available.

This PR also adds an option to plot the states when plotting a SimResult

@JuliaControlBot
Copy link

This is an automated message.
Plots were compared to references. 9/11 images have changed, see differences below.
After pulling this PR, please update the reference images by creating a PR to ControlExamplePlots.jl here.

Difference Reference Image New Image
✔️ 0.003 Reference New
✔️ 0.003 Reference New
✔️ 0.0 Reference New
✔️ 0.001 Reference New
✔️ 0.0 Reference New
✔️ 0.0 Reference New
❌ 0.042 Reference New
✔️ 0.006 Reference New
✔️ 0.011 Reference New

@codecov
Copy link

codecov bot commented Feb 15, 2022

Codecov Report

Merging #632 (11414b8) into master (9f4c32c) will increase coverage by 0.06%.
The diff coverage is 95.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #632      +/-   ##
==========================================
+ Coverage   86.69%   86.75%   +0.06%     
==========================================
  Files          31       31              
  Lines        3240     3255      +15     
==========================================
+ Hits         2809     2824      +15     
  Misses        431      431              
Impacted Files Coverage Δ
src/plotting.jl 85.65% <95.00%> (+0.46%) ⬆️
src/timeresp.jl 89.68% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9f4c32c...11414b8. Read the comment docs.

# This will be called on plot(lsim(sys, args...))
@recipe function simresultplot(r::SimResult; plotu=false)
ny, nu = r.ny, r.nu
@recipe function simresultplot(r::SimResult; plotu=false, plotx=false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these keywords documented somewhere? Cause now that we have plotrecipes for types (and not bound to specific plotting function) it will be harder to make good documentation? Or can we just bind documentation to the plot function? Seems messy to me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No they can't really be documented anywhere other than in the general docs or perhaps docs of lsim. I'll add a note in the lsim docstring

Copy link
Member

@albheim albheim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@baggepinnen baggepinnen merged commit 1232cd0 into master Feb 15, 2022
@baggepinnen baggepinnen deleted the lsimfix branch February 15, 2022 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants