Use of tabbed arrays for a model to convert to SDEverywhere #277
-
Hello! My colleague Khaled asked a version of this question to @chrispcampbell and @ToddFincannon, but wanted to ask a follow-up here in case it's helpful to others. We are working to conform our model that we've been building for livestock response in Somalia to the SDEverywhere so that we can convert the model and make some web apps. One main issue that we are facing is that we use multi-dimensional subscripted variables which require tabbed arrays. We are pursuing a suggestion from a colleague to insert dummy values in the Vensim model, then use .csv with the parameter values to substitute the tabbed arrays. We are thus looking for the SDE feature, similar to that of Vensim's Simulation Control -> Constant Changes -> Changes files -> then we select the .csv containing the parameter values we want reflected into the model (screenshot below) before simulating. Based on our perusal of the SDE documentation, and the correspondence we received from Chris and Todd, our understanding is that the primary way to achieve this would be using the GET DIRECT CONSTANTS function in Vensim to build this functionality into the model directly. We were previously under the impression that it might be possible to use an SDEverywhere function to ingest data from a .csv (without changing the variables in Vensim to include the GET DIRECT CONSTANTS function), but it seems that may not be the case. Could you please confirm that? We have tried bringing in a And here are screenshots of the Could y'all confirm that there are no functions or features built in to SDEverywhere that would allow us to achieve this, or will we need to use the GET DIRECT CONSTANTS function on our variables in Vensim first? Apologies if this is a silly question, but I'm both new to this package and to SD in general! Thank you! Aaron EDIT - 10/28
I have tried this with both version I have attached the model file (just one variable), which was built using the 'directconst' sample model as a reference, the reference Thank you for any support you can provide. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
Thanks for trying SDEverywhere, Aaron. I installed the latest version of the SDEverywhere CLI with:
and did So it looks like Since your original model uses tabbed arrays, my understanding is that the data is static and will not change between runs. That would allow you to use |
Beta Was this translation helpful? Give feedback.
-
This is a bug in the SDEverywhere equation reader in the special handling for the |
Beta Was this translation helpful? Give feedback.
-
The problem is that the equation reader expects the priority profile argument to ALLOCATE AVAILABLE to be a non-apply-to-all variable, but in the test model, it is an apply-to-all variable. That is, in the test model, a single constant value of 1 is applied to all subscripts of the
The EquationReader exception does not occur if the priority profile subscript indices are defined separately ("non-apply-to-all").
This is a reasonable limitation, because in practice, ALLOCATE AVAILABLE is only useful when the priority is different for each requester. This prevents the priority profile from being an apply-to-all variable. For instance, in the
One other thing to note is that the Separating the |
Beta Was this translation helpful? Give feedback.
-
The other problem in the test model turns out to be caused by demand greatly outstripping supply. Vensim can handle this, but not the SDEverywhere implementation. If we reduce demand to fit supply, the model works.
Here is the test model modified to meet the limitations discussed in this post and the previous one. |
Beta Was this translation helpful? Give feedback.
Thanks for trying SDEverywhere, Aaron. I installed the latest version of the SDEverywhere CLI with:
and did
sde test
on your model, which generated correct results. If you dosde -v
, you should get version 0.7.4.So it looks like
GET DIRECT CONSTANTS
is working OK in the latest version of SDEverywhere. But I don't understand what you are trying to accomplish with overriding dummy variables. You can read the data into the variable withGET DIRECT CONSTANTS
just like you do in your test model. This should obviate the need for the tabbed arrays.Since your original model uses tabbed arrays, my understanding is that the data is static and will not change betw…