Skip to content
Snippets Groups Projects
Commit 8326fb1a authored by Adam Friedrich Schrey's avatar Adam Friedrich Schrey
Browse files

Add more support for 2 dimensional arrays

parent 66e64686
No related branches found
No related tags found
1 merge request!1merge develop into master
...@@ -114,7 +114,7 @@ class SquareSignal(Block): ...@@ -114,7 +114,7 @@ class SquareSignal(Block):
def Step(self,t,dt): def Step(self,t,dt):
d = t/self.Ts-floor(t/self.Ts); d = t/self.Ts-int(t/self.Ts);
if d > self.duty: if d > self.duty:
self.y[0] = self.lo; self.y[0] = self.lo;
else: else:
...@@ -451,7 +451,13 @@ class StateSpace(Block): ...@@ -451,7 +451,13 @@ class StateSpace(Block):
else: else:
print("WARNING: Can not handle self.C with dimension "+str(self.C.ndim)) print("WARNING: Can not handle self.C with dimension "+str(self.C.ndim))
for j in range(0,self.ninput): for j in range(0,self.ninput):
if self.C.ndim == 1:
self.y[i] = self.y[i] + self.D[j]*self.u[j] self.y[i] = self.y[i] + self.D[j]*self.u[j]
elif self.C.ndim == 2:
#prevent [ValueError: setting an array element with a sequence.] for 2 dimensional self.C:
self.y[i] = self.y[i] + self.D[i][j]*self.u[j]
else:
print("WARNING: Can not handle self.D with dimension "+str(self.C.ndim))
self.updatestate(t,dt) self.updatestate(t,dt)
def Reset(self): def Reset(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment