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 events to models #22

Open
filip-jezek opened this issue Apr 11, 2019 · 7 comments
Open

Add events to models #22

filip-jezek opened this issue Apr 11, 2019 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@filip-jezek
Copy link
Member

A JS code, run on model event (initial, start, stop, step, crash .. ?), would enable to hand-code a number of features, which are not yet introduced into the composer GUI.

@filip-jezek filip-jezek added the enhancement New feature or request label Apr 11, 2019
@david-polak
Copy link
Contributor

'play',
'pause',
'reset',
'tick',
'terminate',
'beforeEnterInitializationMode',
'enterInitializationMode',

@filip-jezek
Copy link
Member Author

  • 'warning' (from assert)?

@filip-jezek
Copy link
Member Author

"Regarding the Tank overflow; The real behavior of the Test bench is to stop the pump before it overflows. Would it be possible to set the voltage to 0V, if the water level reaches 0.6 meters?"

Model event OnTick would enable to check for the level and adjust the parameter (which is otherwise input from the slider) accordingly.

@filip-jezek
Copy link
Member Author

And what about including pre-set (empty) event, which is called on each:

  • page load
  • model init
  • model tick

This would enable initialization scripts (e.g. setting intiial dataset visibility false) and scripts observing some model value (e.g. value is over some threshold -> set input range to zero).

@filip-jezek filip-jezek added this to the Niveau-simulator set milestone Aug 12, 2019
@david-polak
Copy link
Contributor

This can be implemented in several ways. But backwards compatibility is gonna suffer in the future, once the model gets run in a webworker, any previous .bjp files containing JavaScript crossing the model/component boundary would break hard.

Any code attached to a model method which would need to communicate with other components would have to use the web worker messaging system and message catching code would need to be written for the target component.

@filip-jezek
Copy link
Member Author

Hm.. good point.. So any workaround on how to set the toggles true / false and hide datasets from graph on page load? This does not communicate with the model, at least.

@david-polak
Copy link
Contributor

I don't believe it's going to have a large impact, since the plan for the model thread separation was to support both encapsulated and traditional model. The message layer between widgets and models should support both types of model endpoints.

This decision should be documented somewhere, I will go on with the implementation of this issue.

This was referenced Aug 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants