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

Add dispatch to fpswhen for time-varying rate #170

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

saolof
Copy link

@saolof saolof commented Nov 23, 2017

Cleaned up version of PR #164. Adds a dispatch to fpswhen so that the rate is allowed to be a signal, as opposed to defining a separate function in the previous PR. Makes a slight change to fpswhen_connect in order to make it cover both cases without code duplication.

Cleaned up version of PR 164. Adds a dispatch to fpswhen so that the rate is allowed to be a signal, instead of defining a separate function. Makes a slight change to fpswhen_connect in order to make it cover both cases.
Copy link
Member

@JobJob JobJob left a comment

Choose a reason for hiding this comment

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

This is much better - do you have a test for this by any chance that you could add to /test

@@ -117,6 +117,13 @@ function fpswhen(switch, rate; name=auto_name!("$rate fpswhen", switch))
n
end

function fpswhen(switch, rate::Signal; name=auto_name!("fpswhen_rate", rate, switch))
#Dispatch for the case where the rate is a time-varying signal.
n = Signal(Float64, 0.0, (switch,rate ,); name=name)
Copy link
Member

Choose a reason for hiding this comment

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

Having rate as a parent of n seems reasonable. I'm curious, was it needed, or you just thought it was sensible?

Copy link
Author

Choose a reason for hiding this comment

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

The latter. I haven't tried it without rate as a parent though.

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.

2 participants