Conversation
|
Performance benchmarks:
|
|
One thing that I’ve been encountering while actually building stuff with both this and events, is that control over the order becomes more difficult. You need to keep carefully keep track of priorities with events. For signals, how can you currently determine the order of execution if multiple things subscribe to the same signal? The previous data collection stuff we just setup at the end of the init. I assume here is the problem that there’s user init code executed after that? Can/need we to wrap the user init? Or add a post init? edit: I thought we discussed something like this at some point, just found it: |
Both events and signals are first-in in first-out. Of course, with events, you have priority to further control this. For signals, you don't have priorities.
The problem is that with the old collection, the user explicitly has to call collect. With the new stuff, we aim for a fully reactive design. So, in #3145, after initializing the DataRecorder, it wants to collect immediately if the first collect is on t=0. But of course, this forces the user to initialize the recorder at the end of the There is no |
|
Performance benchmarks:
|
|
So what if somebody wants to check |
It just returns 0.0, because in the Just to clarify. An This PR is a somewhat convoluted way to emit a signal indicating that the run has started without having to add new signals. For mesa 4, I want to add RunControlSignals like |
|
Thanks for explaining. Are our observables build in such a way that they always (and automatically) have a private variable with the exact same name but with an underscore? If not, where does that assignment happen? |
yes. |
This reverts commit 86e71ed.
This PR ensures that time is set to 0.0 on the first call to advance_time. This means that anything that subscribes to changes of time can handle the t=0 situation after the model has been fully initialized.
This is one way of handling the problem. It is, in my view, for now, the simplest way to make the new data collection work. More sophisticated approaches require either additional SignalTypes (e.g., RunSignals.RUN_STARTEDk, RunSignals.RUN_ENDED), but these in turn require a RunConfiguration object. Feedback on this approach is welcome.
The way it works is that I set
self._timeto 0.0 in the init. This ensures that any get of time will return 0.0 (required in many tests). Then, in_advance_timewe check this attribute and explicitly set self.time to 0.0. This, in turn, triggers a signal that time is changed to 0.0. And this signal can be used to trigger, e.g., data recording.If we agree, I'll add additional tests.