-
Notifications
You must be signed in to change notification settings - Fork 0
/
queryhandler.m
43 lines (31 loc) · 832 Bytes
/
queryhandler.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
clear;
%% input netlist
% netlist is an array of string arrays not char arrays
% some elements transient property hasn't been added yet. might give
% unexpected result.
%sadiku ex 3.2
nl = ["I1 0 1 DC 3";
"Vd 1 4 DC 0";
"R1 4 2 2";
"R2 1 3 4";
"R3 2 0 4";
"R4 2 3 8";
"F1 3 0 Vd 2";
".SSA"];
%% parse input netlist to make a cell array of element objects
[elements, queries] = nlparser(nl);
%% handle queries
ana_type = queries{1}{1}; %THIS PART NEEDS TO BE CHANGED LATER
if ana_type == "SSA"
analy = {ana_type};
elseif ana_type == "TRA"
start = queries{1}{2};
stop = queries{1}{3};
step = queries{1}{4};
analy = {ana_type start stop step};
end
[sol, vars_index] = solver(elements, analy);
disp("Solution Matrix: ");
disp(sol);
disp("Node Index: ");
disp(vars_index);