Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Suo danielsuo

View GitHub Profile
View wilhelm.diff
diff --git a/wilhelm/control/eastman.py b/wilhelm/control/eastman.py
index a3d1ade..1defdbb 100644
--- a/wilhelm/control/eastman.py
+++ b/wilhelm/control/eastman.py
@@ -27,13 +27,23 @@ grad_loss = jax.grad(counterfact_loss, (0, 1))
def rolls_by_eastman(env_true, env_sim, U_old, k, K, X_old, D, F, alpha, w_is):
- H, M, lr, C = 3, 3, 0.001, 1.
+ H, M, lr, C = 3, 3, 0.1, 1.
View pid.diff
diff --git a/vent/controller/control_module.py b/vent/controller/control_module.py
index 3a7b724..ff819f3 100644
--- a/vent/controller/control_module.py
+++ b/vent/controller/control_module.py
@@ -610,17 +610,18 @@ class ControlModuleBase:
self._DATA_VOLUME += dt * self._DATA_Qout # Integrate what has happened within the last few seconds from flow out
self._DATA_PRESSURE = np.mean(self._DATA_PRESSURE_LIST)
+ self.__control_signal_in = self._adaptivecontroller.feed(self._DATA_PRESSURE, now)
+
View pid.diff
diff --git a/vent/controller/control_module.py b/vent/controller/control_module.py
index 3a7b724..ff819f3 100644
--- a/vent/controller/control_module.py
+++ b/vent/controller/control_module.py
@@ -610,17 +610,18 @@ class ControlModuleBase:
self._DATA_VOLUME += dt * self._DATA_Qout # Integrate what has happened within the last few seconds from flow out
self._DATA_PRESSURE = np.mean(self._DATA_PRESSURE_LIST)
+ self.__control_signal_in = self._adaptivecontroller.feed(self._DATA_PRESSURE, now)
+
View pid.diff
diff --git a/pid.txt b/pid.txt
index e453170..3015dbf 100644
--- a/pid.txt
+++ b/pid.txt
@@ -1,6 +1,6 @@
-def _PID_update(self, dt):
+def _Predictive_PID_update(self, dt):
'''
- This instantiates the PID control algorithms.
+ This instantiates the Predictive PID control algorithms.
View cg
def cg(A, b, x0=None, maxiter=None, tol=1e-5):
x = x0 or np.zeros_like(b)
k = 0
kmax = maxiter or len(b)
r = b - A @ x
p = r
d_o = np.dot(r, r)
d_n = d_o
View tadpoles_gmail.js
/*
Bookmarklet to download image / movie from tadpoles
Sources:
https://gist.github.com/sfrdmn/8834747 by sfrdmn, unlicenced but I hope you won't sue me :3
https://stackoverflow.com/a/49500465/2550406 by Leeroy, CC-BY-SA
*/
;(function() {
// Probably should do some validation, but whatever
var l = document.links;
View click.js
var simulateMouseEvent = function(element, eventName, coordX, coordY) {
element.dispatchEvent(new MouseEvent(eventName, {
view: window,
bubbles: true,
cancelable: true,
clientX: coordX,
clientY: coordY,
button: 0
}));
};
View tadpoles.js
/*
Bookmarklet to download image / movie from tadpoles
Sources:
https://gist.github.com/sfrdmn/8834747 by sfrdmn, unlicenced but I hope you won't sue me :3
https://stackoverflow.com/a/49500465/2550406 by Leeroy, CC-BY-SA
*/
;(function() {
// Probably should do some validation, but whatever
var images = [window.location.href + "?d=t"]
@danielsuo
danielsuo / ray.tmux
Last active Aug 15, 2018
Start ray processes in tmux
View ray.tmux
#!/usr/bin/env bash
set -x
# NOTES
# - Requires tmux 2.3 or greater
# - Run in the appropriate Python environment
# - Check out the keybindings for helpful tips
# - We could also do this in tmuxinator
View blockstack
Verifying that "danielsuo.id" is my Blockstack ID. https://onename.com/danielsuo
You can’t perform that action at this time.