Commit 10ec7673 authored by hazrmard's avatar hazrmard
Browse files

added RC circuit w/ parasitic capacitance

Pipeline #142 failed with stages
in 1 second
\ No newline at end of file
% This script generates .mat files for various inputs on
% the RC model. The .mat files have a data variable
% datRC with three columns:
% time V_in I_capacitor
% Other variables like peak, freq etc are stored for
% relevant inputs.
duration = 1000;
resolution = 0.1;
N = duration / resolution;
t = 0:resolution:(duration-resolution);
noise = 25; % signal-to-noise ratio in dB
peak = 10; % amplitude of signal
freq = 1; % frequency of sine signal
bias = 3; % bias of offset sine signal
% constant input
in = ones(N,1) * peak;
sim_in = [t', awgn(in, noise, 'measured')];
datRC = runSim('RC', sim_in);
save('resRC_const.mat', 'datRC', 'peak', 'noise');
% sine input
in = sin(2*pi*freq*t') * peak;
sim_in = [t', awgn(in, noise, 'measured')];
datRC = runSim('RC', sim_in);
save('resRC_sine.mat', 'datRC', 'freq', 'peak', 'noise');
% combined constant + sine
in = bias + sin(2*pi*freq*t') * peak;
sim_in = [t', awgn(in, noise, 'measured')];
datRC = runSim('RC', sim_in);
save('resRC_comb.mat', 'datRC', 'freq', 'peak', 'bias', 'noise');
\ No newline at end of file
function results = runSim(model, sim_in)
% Runs a Simulink model. The `model` takes as input
% a workspace variable `sim_in` which is a matrix where
% the first column is a time stamp and the remaining
% columns are individual inputs. The model outputs to
% a workspace variable `sim_out` which is a timestamp
% object.
% The function parses the `sim_out` and returns `result`
% in the same form as `sim_in`.
stop_t = sim_in(end,1);
steps = diff(sim_in(:, 1));
minStep = min(steps(:));
set_param(model, 'StopTime', num2str(stop_t), 'MaxStep', num2str(minStep));
results = [sim_out.Time sim_out.Data];
# Data Driven Models
Using data to augment physical system models.
See [docs/](/docs/) for details.
\ No newline at end of file
# Data Driven Models
This project explores how combinations of physical and data based models fare against actual systems.
Physical models require a rigorous understanding of the system. Even then, they are not equipped to account for noise, degradation, and higher order effects.
Data driven models do not depend on an underlying model of the system. They simply develop mappings between input and output variables. However, by doing this, they forego *a priori* knowledge of the distribution of measurements. That is, they have to build an understanding of the system from scratch which requires more data.
## Appproaches
* Train the data model on a simple physics model to initialize parameters. Then train the data model on the actual readings.
* Make a composite additive model based on physical and machine learning sub-models.
## Project Structure
### `PhysicalModels`
This directory contains files that simulate physical systems and return input/output readings. MatLab Simulink/Simscape are used for this purpose.
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment