diff --git a/src/pyfmi/fmi.pyx b/src/pyfmi/fmi.pyx index 79b7aa36..36da6c0a 100644 --- a/src/pyfmi/fmi.pyx +++ b/src/pyfmi/fmi.pyx @@ -5098,7 +5098,7 @@ cdef class FMUModelBase2(ModelBase): filter_list = self._convert_filter(filter) length_filter = len(filter_list) - for i in range(variable_list_size): + for i in range(variable_list_size): variable = FMIL.fmi2_import_get_variable(variable_list, i) @@ -5227,7 +5227,7 @@ cdef class FMUModelBase2(ModelBase): filter_list = self._convert_filter(filter) length_filter = len(filter_list) - for i in range(variable_list_size): + for i in range(variable_list_size): variable = FMIL.fmi2_import_get_variable(variable_list, i) @@ -7213,7 +7213,7 @@ cdef class FMUModelCS2(FMUModelBase2): value_refs[0] = self.get_variable_valueref(variables) elif isinstance(variables,list) and N.prod([int(isinstance(v,str)) for v in variables]): #prod equals 0 or 1 value_refs = N.array([0]*nref, dtype=N.uint32,ndmin=1).ravel() - for i in range(nref): + for i in range(nref): value_refs[i] = self.get_variable_valueref(variables[i]) orders[i] = order else: @@ -7279,7 +7279,7 @@ cdef class FMUModelCS2(FMUModelBase2): nref = len(variables) value_refs = N.array([0]*nref, dtype=N.uint32, ndmin=1).ravel() orders = N.array([0]*nref, dtype=N.int32) - for i in range(nref): + for i in range(nref): value_refs[i] = self.get_variable_valueref(variables[i]) orders[i] = order else: diff --git a/src/pyfmi/fmi_extended.pyx b/src/pyfmi/fmi_extended.pyx index 01ee7045..e0fa9407 100644 --- a/src/pyfmi/fmi_extended.pyx +++ b/src/pyfmi/fmi_extended.pyx @@ -293,9 +293,9 @@ cdef class FMUModelME1Extended(FMUModelME1): cdef N.ndarray[FMIL.fmi1_real_t, ndim=1,mode='c'] val = N.array(values, dtype=float, ndmin=1).flatten() nref = len(val) - orders = N.array([0]*nref, dtype=N.int32) + orders = N.array([0]*nref, dtype=N.int32) - if nref != len(np_orders): + if nref != len(np_orders): raise FMUException("The number of variables must be the same as the number of orders.") for i in range(len(np_orders)): @@ -308,13 +308,13 @@ cdef class FMUModelME1Extended(FMUModelME1): value_refs = N.array([0], dtype=N.uint32,ndmin=1).flatten() value_refs[0] = self.get_variable_valueref(variables) elif isinstance(variables,list) and isinstance(variables[-1],str): - value_refs = N.array([0]*nref, dtype=N.uint32,ndmin=1).flatten() - for i in range(nref): + value_refs = N.array([0]*nref, dtype=N.uint32,ndmin=1).flatten() + for i in range(nref): value_refs[i] = self.get_variable_valueref(variables[i]) else: raise FMUException("The variables must either be a string or a list of strings") - for i in range(nref): + for i in range(nref): self._input_derivatives[value_refs[i]][np_orders[i]-1] = val[i]/self._input_factorials[np_orders[i]-1] #Activate input diff --git a/src/pyfmi/fmi_util.pyx b/src/pyfmi/fmi_util.pyx index c98bbf8c..c5186d6e 100644 --- a/src/pyfmi/fmi_util.pyx +++ b/src/pyfmi/fmi_util.pyx @@ -1105,11 +1105,14 @@ cdef class DumpData: self.dump_data(np.array(float(self.model.time))) self.dump_data(diag_data) -from libc.stdio cimport * +# from libc.stdio cimport * cdef extern from "stdio.h": FILE *fdopen(int, const char *) - + FILE *fopen(const char *, const char *) + size_t fread(void*, size_t, size_t, FILE *) + int fseek(FILE *, long, int) + int fclose(FILE *) @cython.boundscheck(False) @cython.wraparound(False) diff --git a/src/pyfmi/master.pyx b/src/pyfmi/master.pyx index 4e1e5f2f..b68ec993 100644 --- a/src/pyfmi/master.pyx +++ b/src/pyfmi/master.pyx @@ -87,8 +87,9 @@ cdef perform_do_step_parallel(list models, FMIL.fmi2_import_t** model_addresses, Perform a do step on all the models. """ cdef int i, status = 0 - cdef int num_threads, id - cdef double time + cdef int num_threads + # cdef int id + # cdef double time for i in prange(n, nogil=True, schedule="dynamic", chunksize=1): #for i in prange(n, nogil=True, schedule="dynamic"):