Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- component CPE
- % The rest of the comment shows up as the component explanation.
- nodes %conserving ports
- p = foundation.electrical.electrical; % +:top
- n = foundation.electrical.electrical; % -:bottom
- end
- nodes(Access=private)
- n1 = foundation.electrical.electrical;
- n2 = foundation.electrical.electrical;
- end
- % These ports show up in the block diagram. The comments immediately after the domain declaration controls the displayed name and location of the ports in the block diagram
- parameters
- Rs = { 1, 'Ohm' }; % Rs
- Rt = {2, 'Ohm'}; % Rt
- Q = {2, '1'}; % Q is unitless
- Aw = {2, '1'}; % Aw is unitless
- end
- variables(Access=public)
- i = { 0, 'A' }; % Current
- % v = { 0, 'V' }; % Voltage
- Zcpe = { 1, 'ohm' }; %
- Zw = { 0.75, 'ohm' }; %
- end
- function setup
- n1.v = {value={0, 'V'},priority=priority.high};
- n2.v = {value={0, 'K'},priority=priority.high};
- end
- % Parameter validation. These branches are half of the equations,
- %the other half go in the equations section, there can only be an
- % equal number of branch equations + equations = variables.
- branches
- i1 : p.i -> n1.i;
- i3 : n1.i -> n.i;
- i2 : n1.i -> n2.i;
- % i2a : n2.i -> n.i; %may not need this one, might want to eliminate node n2 and go straght from n1 to n
- end
- equations
- let
- v = p.v - n1.v;
- v2 = n1.v - n.v;
- v3 = n1.v - n.v;
- in
- v == i1*Rs; % Voltage equation
- i1 == i2 + i3;
- Zcpe*Zcpe * -Q*w == 1; %This will also need to be converted to a differential equation this is just an example
- %The equation is rewritten as follows Zcpe == 1/Q/(j*w);
- %to this by squaring both sides Zcpe*Zcpe == -1/(Q*Q*w*w); to this Zcpe*Zcpe *(Q*Q*w*w) ==1;
- %write the Zw equation the same but square it twice Zw*Zw*Zw*Zw == -4*Aw*Aw*Aw*Aw/(w*W);
- Zw*Zw*Zw*Zw*w*w == -4*Aw*Aw*Aw*Aw; %This will also need to be converted to a differential equation this is just an example
- v2 == i2*Zcpe;
- v3 == i3*(Rt+Zw);
- end
- end % equations
- end %component I miss the curly braces...
Add Comment
Please, Sign In to add comment