hmph
This commit is contained in:
parent
75336752a3
commit
a4bdba9810
87
ME_2046/Midterm/midterm.m
Normal file
87
ME_2046/Midterm/midterm.m
Normal file
@ -0,0 +1,87 @@
|
||||
% ME 2046 MIDTERM
|
||||
% DANE SABO
|
||||
% MARCH 17TH, 2025
|
||||
% PROBLEM 5
|
||||
close all
|
||||
clear all
|
||||
|
||||
A = [1 0.09; 0 0.9];
|
||||
B = [0.005; 0.1];
|
||||
C = [1 0];
|
||||
D = 0;
|
||||
T = 0.1; %s
|
||||
|
||||
fprintf("\n======= Part 1: =========\n")
|
||||
p = [1 -1.776 0.819];
|
||||
fprintf("Closed loop poles: \n")
|
||||
lambdas = roots(p)
|
||||
|
||||
fprintf("Natural Frequency: \n")
|
||||
omega_n = sqrt(p(3))
|
||||
|
||||
fprintf("Damping Ratio: \n")
|
||||
zeta = abs(p(2)/2/omega_n)
|
||||
|
||||
fprintf("\n======= Part 2: =========\n")
|
||||
lambdas(:)
|
||||
K = place(A, B, lambdas(:))
|
||||
|
||||
fprintf("Check eigenvalues...\n")
|
||||
eig(A - B*K)
|
||||
fprintf("Great! \nNow finding N...")
|
||||
N = 1/(C*inv(eye(2) - A + B*K)*B)
|
||||
|
||||
fprintf("\n======= Part 3: =========\n")
|
||||
sys = ss(A-B*K, B*N, C, D, T)
|
||||
G_CL = tf(sys)
|
||||
|
||||
% Define simulation parameters
|
||||
n = 50; % number of steps
|
||||
t = 0:T:(n-1)*T; % time vector for discrete time instants
|
||||
u = ones(n,1); % step input (magnitude 1 at each step)
|
||||
x_0 = [-0.5; 0]; % initial condition
|
||||
|
||||
% Simulate the discrete system response using dlsim
|
||||
[y, x] = dlsim(A-B*K, B*N, C, D, u, x_0);
|
||||
|
||||
% Plot the discrete step response using stairs for clarity
|
||||
figure;
|
||||
stairs(t, y, 'LineWidth', 1.5)
|
||||
xlabel('Time')
|
||||
ylabel('Output')
|
||||
title('Discrete Step Response with Initial Conditions')
|
||||
grid on
|
||||
|
||||
fprintf("\n======= Part 4: =========\n")
|
||||
figure;
|
||||
bode(sys)
|
||||
|
||||
fprintf("\n======= Part 5: =========\n")
|
||||
witness_me = tf(1, [1, -1.638, 0.617], T);
|
||||
%WITNESS ME BLOOD BAG! WITNESSSS!!!! *spray paints mouth*
|
||||
observer = ss(witness_me)
|
||||
|
||||
fprintf("\n======= Part 6: =========\n")
|
||||
fprintf("Observer poles: \n")
|
||||
eig(observer.A)
|
||||
|
||||
fprintf("Closed-Loop poles: \n")
|
||||
eig(A - B*K)
|
||||
mag = sqrt(0.888^2 +0.1745^2)
|
||||
|
||||
fprintf("The observer has an unstable pole while the closed loop system has stable\n")
|
||||
fprintf("poles within the unit circle. This observer will not work, because \n")
|
||||
fprintf("the error will not converge to the true states.\n")
|
||||
|
||||
fprintf("\n======== Part 7: =========\n")
|
||||
fprintf("Let's make our closed loop observer poles 10 times faster than \n")
|
||||
fprintf("the original system.\n")
|
||||
fprintf("Going to the w-plane... \n")
|
||||
sys_w = d2c(sys, 'tustin');
|
||||
cl_poles_w = eig(sys_w)
|
||||
observer_poles_w = 10 * cl_poles_w
|
||||
fprintf("Now going back to the z-plane...")
|
||||
observer_poles_z = exp(observer_poles_w*T)
|
||||
|
||||
fprintf("and finally using place to get L...")
|
||||
L = transpose(place(A', C', observer_poles_z))
|
||||
6
ME_2046/Midterm/midterm.py
Normal file
6
ME_2046/Midterm/midterm.py
Normal file
@ -0,0 +1,6 @@
|
||||
import sympy as sm
|
||||
|
||||
z, a, x_0, x_d = sm.symbols("z, a, x_0, x_d")
|
||||
X_z = ((1 + a) / 2 * z / (z - 1) * x_d + z * x_0) / ((2 * z - (1 - a)) / 2)
|
||||
sm.pprint(X_z)
|
||||
sm.pprint(X_z.apart(z))
|
||||
BIN
ME_2046/Midterm/part4.png
Normal file
BIN
ME_2046/Midterm/part4.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
BIN
ME_2046/Midterm/part5.png
Normal file
BIN
ME_2046/Midterm/part5.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
1
ME_2150/Weather-Station-Tutorial
Submodule
1
ME_2150/Weather-Station-Tutorial
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 08ff8c433e17531ce1caaa712e905b8ebe6fc31b
|
||||
88
ME_2150/admin_example/README.md
Normal file
88
ME_2150/admin_example/README.md
Normal file
@ -0,0 +1,88 @@
|
||||
<!--
|
||||
Copyright (c) 2023, Kry10 Limited. All rights reserved.
|
||||
|
||||
SPDX-License-Identifier: LicenseRef-Kry10
|
||||
-->
|
||||
|
||||
# Admin Example
|
||||
|
||||
The admin example demonstrates a minimal system that runs the admin component on KOS. The admin
|
||||
component is an Elixir app that coordinates on-device administration activities, such as system restart and upgrade.
|
||||
The admin component also acts as a client to a Kry10 Server.
|
||||
|
||||
The admin example is entirely implemented by using the KOS Poukai manifest layer, requiring
|
||||
no further augmentations. In particular, the KOS Poukai apps present in this system are:
|
||||
|
||||
- `admin_ex`: an Erlang BEAM VM running an Elixir app that coordinates
|
||||
admin activities (such as restart and upgrade) and acts as a client to a
|
||||
Kry10 Server.
|
||||
- `key_store`: server that provides a way to store secrets (e.g private keys) that
|
||||
applications can request at runtime.
|
||||
- `ethernet`: contains an ethernet driver and implements the `ethernet` protocol
|
||||
to provide ethernet access to other apps on the device.
|
||||
- `tunnel`: a secure tunnel to a host machine (typically be managed by the
|
||||
Studio or Fleet Server).
|
||||
- `rng_server`: a CSPRNG server, providing an interface that allows applications to request
|
||||
arbitrary length streams of random bytes.
|
||||
- `log_server`: a system-wide logging service. The server provides an interface for
|
||||
applications to emit semi-structured log strings with an associated log
|
||||
level i.e. `INFO`, `WARN`, `ERROR` etc.
|
||||
- `self_test`: an app that performs a series of tests on startup.
|
||||
|
||||
This system demonstrates a good project starting point that can then be further modified as needed.
|
||||
|
||||
### Build Instructions
|
||||
|
||||
Launch a KOS development shell for the target platform:
|
||||
|
||||
```console
|
||||
$ kos-tool env -p <am335x|qemu-arm-virt|imx8mm-evk|portenta-x8|rpi4>
|
||||
```
|
||||
|
||||
Checkout the admin example sources:
|
||||
|
||||
```console
|
||||
$ mix kos.docs.example admin_example
|
||||
$ cd admin_example
|
||||
```
|
||||
|
||||
Build the admin example system:
|
||||
|
||||
```console
|
||||
$ mix kos.build
|
||||
```
|
||||
|
||||
Proceed to run the system using the Mix `kos.run` utility:
|
||||
|
||||
```console
|
||||
$ kos-run
|
||||
```
|
||||
|
||||
|
||||
You will see the admin component start up with output similar to the following:
|
||||
```
|
||||
| 0.693| Poukai.admin |
|
||||
| 0.693| Poukai.admin | ---- Poukai.admin ----
|
||||
| 0.732| Poukai.admin | beam tunnel connection established:
|
||||
| 0.732| Poukai.admin | IP addr: 192.168.2.6
|
||||
| 0.733| Poukai.admin | Netmask: 255.255.255.0
|
||||
| 0.733| Poukai.admin | Gateway: 192.168.2.100
|
||||
| 2.931| Poukai.admin |
|
||||
| 2.931| Poukai.admin | 08:21:57.837 [info] Starting connection with the Kry10 server on ws://192.168.2.100:4000/cnc
|
||||
| 2.952| Poukai.admin |
|
||||
| 2.952| Poukai.admin | 08:21:57.870 [info] starting KosSel4 server
|
||||
| 2.962| Poukai.admin |
|
||||
| 2.962| Poukai.admin | 08:21:57.879 [info] starting KosMsg server
|
||||
| 2.993| Poukai.admin |
|
||||
| 2.993| Poukai.admin | 08:21:57.909 [warning] Can't start KosTrace. Reason: Tracing Unavailable.
|
||||
| 2.995| Poukai.admin |
|
||||
| 2.995| Poukai.admin | 08:21:57.910 [info] Starting KosChannels server
|
||||
| 3.026| Poukai.admin |
|
||||
| 3.026| Poukai.admin | 08:21:57.941 [info] admin_ex's public key: 5paBAr9Cv+h6mZxus78c4BxBgIfyFLAdudrPn6xwR+Q=
|
||||
| 3.033| Poukai.admin |
|
||||
| 3.033| Poukai.admin | 08:21:57.950 [info] Starting SerialStream server
|
||||
| 3.033| Poukai.admin | 08:23:21.065 [info] Connection has been lost. Reason: {:error, :timeout}. Attempting to reconnect
|
||||
```
|
||||
|
||||
Follow the [Connecting a device to a Kry10 Server](server_connect_device) guide to connect it to a server so that you can interact
|
||||
with the example through your browser.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
ME_2150/admin_example/_build/am335x_dev/am335x-c4ca6edcafc/apps/elfloader
Executable file
BIN
ME_2150/admin_example/_build/am335x_dev/am335x-c4ca6edcafc/apps/elfloader
Executable file
Binary file not shown.
Binary file not shown.
BIN
ME_2150/admin_example/_build/am335x_dev/am335x-c4ca6edcafc/elfloader
Executable file
BIN
ME_2150/admin_example/_build/am335x_dev/am335x-c4ca6edcafc/elfloader
Executable file
Binary file not shown.
@ -0,0 +1 @@
|
||||
am335x,arch=aarch32
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
{application,admin_example,
|
||||
[{optional_applications,[]},
|
||||
{applications,[kernel,stdlib,elixir,logger,kos_manifest,
|
||||
kos_manifest_systems]},
|
||||
{description,"admin_example"},
|
||||
{modules,['Elixir.AdminExampleManifest']},
|
||||
{registered,[]},
|
||||
{vsn,"0.1.0"}]}.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,7 @@
|
||||
{application,kos_admin_ex,
|
||||
[{optional_applications,[]},
|
||||
{applications,[kernel,stdlib,elixir,kos_manifest]},
|
||||
{description,"kos_admin_ex"},
|
||||
{modules,['Elixir.Kos.Admin']},
|
||||
{registered,[]},
|
||||
{vsn,"0.1.0"}]}.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
{application,kos_ethernet,
|
||||
[{optional_applications,[]},
|
||||
{applications,[kernel,stdlib,elixir,kos_manifest]},
|
||||
{description,"kos_ethernet"},
|
||||
{modules,['Elixir.Kos.EthernetServer',
|
||||
'Elixir.Kos.EthernetServer.IOTGIMX8Plus']},
|
||||
{registered,[]},
|
||||
{vsn,"0.1.0"}]}.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,7 @@
|
||||
{application,kos_i2c,
|
||||
[{optional_applications,[]},
|
||||
{applications,[kernel,stdlib,elixir,kos_manifest]},
|
||||
{description,"kos_i2c"},
|
||||
{modules,['Elixir.Kos.I2CServer']},
|
||||
{registered,[]},
|
||||
{vsn,"0.1.0"}]}.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,7 @@
|
||||
{application,kos_key_store,
|
||||
[{optional_applications,[]},
|
||||
{applications,[kernel,stdlib,elixir,kos_manifest]},
|
||||
{description,"kos_key_store"},
|
||||
{modules,['Elixir.Kos.KeyStore']},
|
||||
{registered,[]},
|
||||
{vsn,"0.1.0"}]}.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,7 @@
|
||||
{application,kos_log_server,
|
||||
[{optional_applications,[]},
|
||||
{applications,[kernel,stdlib,elixir,kos_manifest]},
|
||||
{description,"kos_log_server"},
|
||||
{modules,['Elixir.Kos.LogServer']},
|
||||
{registered,[]},
|
||||
{vsn,"0.1.0"}]}.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user