gyorilab / mira

MIRA modeling framework
BSD 2-Clause "Simplified" License
9 stars 7 forks source link

Observables disappear from stockflow and regnet models #312

Closed sabinala closed 5 months ago

sabinala commented 5 months ago

When stockflow or regnet models are loaded as template models, the observables disappear. This is not the case for petrinets.

See this notebook for example: https://github.com/ciemss/pyciemss/blob/552-disappearing-observables/docs/source/Issue552.ipynb

bgyori commented 5 months ago

@sabinala, I looked at the regnet model first: in https://raw.githubusercontent.com/DARPA-ASKEM/simulation-integration/main/data/models/LV_rabbits_wolves_model03_regnet.json, the observables key is not in the right place. It needs to be under semantics / ode, not under model.

bgyori commented 5 months ago

Ironically, the stock and flow AMR is defined the other way around: it assumes observables are under model, not under ode / semantics. The reason for this has to do with elements that are natively associated with a given framework vs custom additions that are not natively part of the framework. So in the case of https://raw.githubusercontent.com/DARPA-ASKEM/simulation-integration/main/data/models/SEIRHD_stockflow.json, move the observables under model.

bgyori commented 5 months ago

Independently, I found some issues with how stock and flow observables are handled in MIRA and submitted a PR with new tests to make sure those work.