Closed onodip closed 4 years ago
Some update: i was looking into an older commit, but after updating I got the same vector issue, which was fixed by adding alts = np.reshape(alts, alts.size)
line:
def compute(self, inputs, outputs):
n_int_per_seg = self.options['n_int_per_seg']
mission_segment_names = self.options['mission_segments']
nn = (n_int_per_seg * 2 + 1)
nn_tot = nn * len(mission_segment_names)
last_seg_index = len(mission_segment_names) - 1
altitude_vecs = []
Ueas_vecs = []
vs_vecs = []
for i, segment_name in enumerate(mission_segment_names):
if i == last_seg_index:
h0 = inputs[segment_name+'|h0']
hf = inputs[segment_name+'|hf']
else:
next_seg_name = mission_segment_names[i+1]
h0 = inputs[segment_name+'|h0']
hf = inputs[next_seg_name+'|h0']
vs = (hf - h0) / inputs[segment_name+'|time']
alts = np.linspace(h0,hf,nn)
alts = np.reshape(alts, alts.size)
altitude_vecs.append(alts)
Ueas_vecs.append(np.ones(nn)*inputs[segment_name+'|Ueas'])
vs_vecs.append(np.ones(nn)*vs)
outputs[segment_name+'|dt'] = inputs[segment_name+'|time'] / (nn-1)
outputs['fltcond|h'] = np.concatenate(altitude_vecs)
outputs['fltcond|Ueas'] = np.concatenate(Ueas_vecs)
outputs['fltcond|vs'] = np.concatenate(vs_vecs)
Hi @onodip , can you tell me which version of numpy you're using?
I had numpy 1.16.2 (the newest), I just used the requirements file to install the packages in a clean virtual environment.
Now I tried with 1.15.0, and it suddenly works! Hmm, maybe something is messed up in the new numpy version?
Hi!
When trying out the TBM850 example I got a vector size mismatch (see traceback at the end).
Some of the vars have a shape (n, 1), and some (n,).
I fixed with adding the two lines below to
MissionFlightConditions
to get the same shape for all vectors:I did not modify anything in the code before trying. Package versions as in the reqs, I am running it on Windows, and I tried with Python 2.7 and 3.7.
Is this a known issue, or something wrong with my installation?
Traceback: