How to use the andes.utils.math.ones function in andes

To help you get started, we’ve selected a few andes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cuihantao / andes / andes / variables / dae.py View on Github external
def init_y(self):
        self.y = zeros(self.m, 1)
        self.zymax = ones(self.m, 1)
        self.zymin = ones(self.m, 1)
        self.uy = ones(self.m, 1)
github cuihantao / andes / andes / variables / dae.py View on Github external
def init_x(self):
        self.x = zeros(self.n, 1)
        self.zxmax = ones(self.n, 1)
        self.zxmin = ones(self.n, 1)
        self.ux = ones(self.n, 1)
github cuihantao / andes / andes / variables / dae.py View on Github external
def init_x(self):
        self.x = zeros(self.n, 1)
        self.zxmax = ones(self.n, 1)
        self.zxmin = ones(self.n, 1)
        self.ux = ones(self.n, 1)
github cuihantao / andes / andes / variables / dae.py View on Github external
def init_g(self, resetz=True):
        self.zymax = ones(self.m, 1)
        self.zymin = ones(self.m, 1)
        self.g = zeros(self.m, 1)
github cuihantao / andes / andes / variables / dae.py View on Github external
def init_x(self):
        self.x = zeros(self.n, 1)
        self.zxmax = ones(self.n, 1)
        self.zxmin = ones(self.n, 1)
        self.ux = ones(self.n, 1)
github cuihantao / andes / andes / variables / dae.py View on Github external
def init_f(self, resetz=True):
        self.zxmax = ones(self.n, 1)
        self.zxmin = ones(self.n, 1)
        self.f = zeros(self.n, 1)
github cuihantao / andes / andes / models / pq.py View on Github external
if self.system.config.forcez:
            if self.v0:
                k = div(dae.y[self.v]**2, self.v0**2)
        elif self.system.config.forcepq:
            pass
        else:
            k = zeros(self.n, 1)

            self.below = altb(dae.y[self.v], self.vmin)
            k += mul(self.below, div(dae.y[self.v]**2, self.vmin**2))

            self.above = agtb(dae.y[self.v], self.vmax)
            k += mul(self.above, div(dae.y[self.v]**2, self.vmax**2))

            normal = nota(aorb(self.below, self.above))
            k += mul(normal, ones(self.n, 1))

        k = mul(self.u, k)
        self.p0 = mul(k, self.p)
        self.q0 = mul(k, self.q)

        if self.n <= 400:
            for a, v, p, q in zip(self.a, self.v, self.p0, self.q0):
                dae.g[a] += p
                dae.g[v] += q
        else:
            # use scipy.sparse.coo_matrix to accelerate for large systems

            p0 = coo_matrix(
                (np.array(self.p0).reshape((-1)), (self.a, np.zeros(self.n))),
                shape=(dae.m, 1))
            q0 = coo_matrix(
github cuihantao / andes / andes / variables / dae.py View on Github external
def init_y(self):
        self.y = zeros(self.m, 1)
        self.zymax = ones(self.m, 1)
        self.zymin = ones(self.m, 1)
        self.uy = ones(self.m, 1)