summarylogtreecommitdiffstats
path: root/PR11.patch
blob: 3bd3bf26b084e360008da884b0204ac05e5469eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
From 55bb786945ed5f605328bd27eb4f2cd1e6b60686 Mon Sep 17 00:00:00 2001
From: Julien Schueller <schueller@phimeca.com>
Date: Fri, 11 Jan 2019 09:02:05 +0100
Subject: [PATCH 1/3] Fix encoding issue

Partially addresses #10, it seems there are more of these
---
 src/pyfmi/fmi.pyx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/pyfmi/fmi.pyx b/src/pyfmi/fmi.pyx
index d30de5f..8ca80e4 100644
--- a/src/pyfmi/fmi.pyx
+++ b/src/pyfmi/fmi.pyx
@@ -1164,7 +1164,7 @@ cdef class FMUModelBase(ModelBase):
 
         fmu_full_path = os.path.abspath(os.path.join(path,fmu))
         if _unzipped_dir:
-            fmu_temp_dir = encode(_unzipped_dir)
+            fmu_temp_dir  = _unzipped_dir
         else:
             fmu_temp_dir  = encode(create_temp_dir())
         self._fmu_temp_dir = <char*>FMIL.malloc((FMIL.strlen(fmu_temp_dir)+1)*sizeof(char))
@@ -3758,7 +3758,7 @@ cdef class FMUModelBase2(ModelBase):
 
         #Get the FMI version of the provided model
         if _unzipped_dir:
-            fmu_temp_dir  = encode(_unzipped_dir)
+            fmu_temp_dir  = _unzipped_dir
         else:
             fmu_temp_dir  = encode(create_temp_dir())
         self._fmu_temp_dir = <char*>FMIL.malloc((FMIL.strlen(fmu_temp_dir)+1)*sizeof(char))

From 35d0ffd76da42d78c107ba24deff25e0c46b69c7 Mon Sep 17 00:00:00 2001
From: Julien Schueller <schueller@phimeca.com>
Date: Fri, 11 Jan 2019 11:53:19 +0100
Subject: [PATCH 2/3] Fix encoding for convert_str_list

---
 src/common/io.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/common/io.py b/src/common/io.py
index 0a3c176..7490aa1 100644
--- a/src/common/io.py
+++ b/src/common/io.py
@@ -2141,8 +2141,8 @@ def simulation_start(self):
         name_data = ["time"] + [var.name for var in sorted_vars]
         desc_data = ["Time in [s]"] + [var.description for var in sorted_vars]
         
-        len_name_data, name_data = fmi_util.convert_str_list(name_data)
-        len_desc_data, desc_data = fmi_util.convert_str_list(desc_data)
+        len_name_data, name_data = fmi_util.convert_str_list(list(map(str.encode, name_data)))
+        len_desc_data, desc_data = fmi_util.convert_str_list(list(map(str.encode, desc_data)))
         
         self._write_header("name", len_name_data, len_name_items, "char")
         self.dump_native_data(name_data)

From e72e5f5de6ffa67d0c2ef571b1213071abd0eb6b Mon Sep 17 00:00:00 2001
From: Julien Schueller <schueller@phimeca.com>
Date: Fri, 11 Jan 2019 13:20:21 +0100
Subject: [PATCH 3/3] Try to fix encoding issue in ResultDymolaBinary

---
 src/common/io.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/common/io.py b/src/common/io.py
index 7490aa1..76d24ce 100644
--- a/src/common/io.py
+++ b/src/common/io.py
@@ -1111,8 +1111,8 @@ def __init__(self,fname):
         self.raw = scipy.io.loadmat(fname,chars_as_strings=False, variable_names=["name", "dataInfo", "data_1", "data_2"])
         name = self.raw['name']
         #self.name = ["".join(name[:,i]).rstrip() for i in range(name[0,:].size)]
-        #self.name = fmi_util.convert_array_names_list_names(name)
-        self.name = fmi_util.convert_array_names_list_names_int(name.view(np.int32))
+        self.name = fmi_util.convert_array_names_list_names(name)
+        #self.name = fmi_util.convert_array_names_list_names_int(name.view(np.int32))
         self.dataInfo = self.raw['dataInfo'].transpose()
         
         #self.name = [