-
Notifications
You must be signed in to change notification settings - Fork 41
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
Can noClock be used between different base-clocks? #2365
Comments
As far as I understand it that should be fine. Basically |
Ok. And I assume this means that noClock(u) is also legal in the continuous-time partition (but still u must be clocked)? |
No, it is explicitely stated, that As I understand it, the whole purpose of In fact the phrasing makes even more sense in the context of different Base-Clocks, as there is no guaranteed ordering between Clocks. Consequently the only value one can get from an other Base-Clock is that of the last tick. I think we should improve the wording to explicitely highlight that use case and explain the reasoning better. I will try to come up with a better wording tomorrow. |
I disagree. Also note that under section 16.7.3, "Base-clock Partitioning ", I also don't think For previous we have: "[...] the value of u from the previous clock activation is returned." For The latest clock tick might be the (sub)clock tick happening now, not the previous one. |
The reason for this ticket was questioning whether that made sense, and obviously if we decide that noClock can be used to connect different base-clock partitions updates would be needed. Thus I don't think we can dismiss it that easily. Note in #1094 (specifically #1094 (comment) ) it was stated that it could connect different base-clock partitions without anyone noticing anything odd. On the other hand connecting different base-clock partitions is inherently dangerous from a synchronous perspective; whereas different sub-clock partitions can more safely be mixed (I think), so using the same primitive to "cast" in both cases seems problematic. |
That would be terrible in that the model would be completely non-deterministic. If you indeed take the value of the "current" clock tick then all hell breaks loose with different Implementation leading to different Simulation results, as they can order the Subpartitions in some random way. I think that |
And points have been made that this is already allowed, which I think it is not.
Which doesn't mean there isn't something odd. According to the rules for base clock partitioning your partition would have had two different clocks, both Real clocks, which would not be allowed.
I agree with this. |
No, when sorting your equations you have to take the whole base partition into consideration. |
Note that this is not unique to |
In summary, my position is the following:
I think (1) is complicated (would probably need a whole MCP). I think (2) is confusing (because In the specification we can clarify the purpose of |
I fully agree that In contrast there is a clear benefit for So for me the question is, whether we should open |
I'm unsure if (2) would work even with an implicit delay, since the two base-clocks may not only tick at the same "time" - but also at slightly different times close together (that was after all one of the issues that synchronous extension would solve). |
Yes, I also don't see any benefit from the simulation perspective. I don't think there is one, nor do I believe there needs to be one. I would propose that this would be a differently named operator. Using
Yes, it might be problematic. |
So lets summarize that we would like a different operator that does the same as At the same time we definitely need to considerably impove the wording of the specification with regard to what last tick etc actually mean. Also what do we do if we get some algebraic loop between the Subpartitions. |
Well, I am not sure if I want it. What are the use cases? This should be a separate ticket, probably an MCP?
Agreed, the wording needs to be improved. Let's start with this:
This seems ok, since the second sentence starts out with basically saying that the inferred clock is the clock of
I propose that the above is changed to:
Last sentence in the current spec:
Keep as it is. Add the following (as non-normative? I don't know the policy on this):
This can be contrasted with calling e.g. So the full new text would be:
|
Comment on proposed full new text: The clock of y = noClock(u) is always inferred. At every tick of the clock of y, noClock(u) returns the value of u from the most recent tick of the clock of u, which might coincide with the current tick of the clock of y. If noClock(u) is called before the first tick of the clock of u, the start value of u is returned. noClock provides an interface between sub partitions without needing to specify the sampling relation between the sub partitions. I would change last sentence to (changes in italics) "The operator noClock provides an interface between sub-clock partitions without having to specify the sampling relation between the sub-clock partitions." And I thought I had pressed "comment" on this:
I think we can wait with that; until we see a clear need - since it seems to be problematic to accomplish it, and it goes counter to the idea of synchronous models.
Yes. The first part is just to clarify the existing operators; both to clarify their behavior and the restrictions on using them (in particular for noClock). |
I think we should at the beginning of the whole Chapter define what we mean by
as that is the foundation of everything and should be consistent between all partitions (including linked rational interval clocks). I think that you description for noClock is a good start
What I miss is a reference to the ordering of the subpartitions in the case that both tick during the activation of the basepartition. So I would phrase is like this
We should also consider whether we speak of |
I think that this will be a quite common use case where you have a controller that samples with a certain rate without necessarily knowing the sampling rate of some sensor. The possibility to omit Event-Iteration in these cases seems to be worthwile. However I agree this is something for an MCP |
I don't see a need for this requirement. |
I see two possibilities without that restriction:
I see problems with the latter alternative, and such cases can occcur, consider:
|
Yes, this is a more reasonable restriction than requiring the sub partitions to be ordered.
But this model can be handled. Depending on which subclock ticks, you have different active equations. What are the problems you see? |
The problem I see is that if subsample(c, 3) ticks but not subsample(c, 2) then x gets the previous value of y. If subsample(c, 3) does not tick, but subsample(c, 2) ticks then y=previous(x)/2+sample(time); (sort of). |
I agree with this interpretation of the model, but I don't think it's a problem. To me this seems to be something a tool could handle. |
I assume so, even if I don't know how complicated such things can become. |
I want to mention that the requirement I wrote was about ambiguity
One could simply extend the problem from Hans win another term:
Here it is completely unclear how to order the equations. Therefore if we allow such models, the qualitative result of the computation would be tool dependent which is something we should avoid. |
I don't think It is unclear.
for
for
for
Are you referring to the design of Modelica or the design of the model (or both)? I can see it being a problem with the design of the model, but also that it could be a desired feature (e.g., once in a while you solve a larger system of equations in a controller). We could make it a quality of implementation issue. |
A problem with the design of the model.
i agree that it in rare cases it might be desired (but I haven't seen such realistic use-cases), but to me it is much more likely that it is an error and thus it is better for users to get a diagnostics message. |
The problem is that it is not clear what you solve if both are active
or
Depending on which one you choose the result of the model is qualitative different. |
It's a system of equations. |
Trying to summarize this one so that we can get a decision at some point.
|
Agreement on forbidding both at phone meeting. |
Closes modelica#2365 Specifically: * Forbids noClock between different base-clocks. * Forbids system of equations between different sub-clocks.
Closes #2365 Specifically: * Forbids noClock between different base-clocks. * Forbids system of equations between different sub-clocks. Co-authored-by: Henrik Tidefelt <henrikt@wolfram.com>
Following #1094 and #2182 I noticed one issue:
The noClock-operator is listed as a sub-clock conversion operator, but it is also implied in that issue that it can convert between different base-clocks.
That should be clarified, and possibly noClock moved to another section. The description should say that noClock may be used to convert a value from one clock to another (that may or may not be part of the same base-clock partition). That also implies that noClock does not connect different partitions for solverMethod, right?
The text was updated successfully, but these errors were encountered: