-
Notifications
You must be signed in to change notification settings - Fork 6
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
Implement data structure for (boolean) control #266
Comments
Here is a concept for how to implement control (also relevant for #263), feel free to criticize. Relevant node categoriesThere are 3 categories of node that are relevant for control:
TablesWe introduce a new table called The
Implementation in Julia coreSay we implement a
We add a function condition!(u,t,integrator)
p = integrator.p
out = 1.0
condition_index = 0
for node_id, var, greater_than in p.control.conditions
condition_index += 1
# get value of variable
value = get_value(node_id,var)
diff = value - greater_than
out *= diff
p.control.condition_value[condition_index] = (diff > 0)
end
return out
end The condition function essentially implements a polynomial function with a zero at each condition change. When a root of the condition function is found, the function affect!(integrator)
p = integrator.p
for node_id in p.control.control_state.keys()
# - Check what the current control state for this node ID should be based on p.control.condition_value and p.control.logic_mapping
# - Check whether this is different from the current control state for this node ID and whether the minimal time for the current control state has passed based on p.control.control_state[node_id]
# - Adapt parameters accordingly
...
end
end Final remarks
|
Nice proposal! I think this approach is worth pursuing, it seems quite flexible. Some comments:
Perhaps when we set the control state we can stop after
This seems like quite a deviation from the rest. Do I understand correctly that essentially with this proposal there is no reason to ever have more than 1 control node? |
Thanks for the write up!
Agreed, this was never discussed and makes the implementation more complex.
It's hard to discern what the Partial proposal: We do use the Edge table for Control nodes, where A Now there's two things left, when to control (change) and to what value. While I'm confident about the above, this is more speculation. For the change logic, I'd propose rules which target a certain state. By default this state is say 1, and at each callback, you check all the rules relating to the possible target states, with the minimum state taking precedence if multiple rules match. For example you could have
And another table
So for each node, you check the rules for each unique state and combine them using the Now, what value to set with a new state? I'd argue that we don't save these values in the Control tables at all, but add The only downside is that this is very discrete. Although that's exactly what's proposed, setting a pump to a percentage of some Q somewhere else is not (pragmatically) possible. Maybe we should name this |
Looks very interesting and probably sufficient universal for expanding. |
Part of #13
The text was updated successfully, but these errors were encountered: