I’m currently working on a Vensim model from Python using the DLL.
I’m trying to get the values of a vector, and while the code is running, it’s not returning the correct result (it’s returning -1.2980742e+33 when the value should be 10).
Any ideas on what might be happening?
Here is a sample of the code I’m using:
Thanks in advanceimport numpy as np
from ctypes import c_float, POINTER
Variable = ['A', 'B', 'C', 'D', 'E', 'F']
def GetData(Variable):
vec = np.zeros(len(Variable), dtype=np.float32)
fp = (c_float * len(Variable))(*vec)
# Retrieving the values of the variable
var = ['Offer [' + t + ']' for t in Variable]
for t in range(len(Variable)):
vec[t] = vensim_dll.vensim_get_varoff(var[t].encode('utf-8'))
vensim_dll.vensim_get_vecvals(vec.ctypes.data_as(POINTER(c_float)), fp, len(Variable))
dOffer = np.ctypeslib.as_array(fp)
return dOffer
dOffer = GetData(Variable)
print(dOffer)