Ich möchte ein CPE in meiner Schaltung verwenden, aber ich kann kein CPE in der Simscape- Bibliothek finden, also möchte ich ein CEP mit der Simscape-Sprache erstellen. Was kann ich machen? Ich möchte nur diese Schaltung bauen, wie das Bild, die Impedanz ist eine komplexe Zahl, ich kann ihren imaginären Teil nicht ausdrücken.
Sie können eine benutzerdefinierte Komponente schreiben:
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...
Dieser Code ist nicht annähernd praktikabel, denken Sie daran, dass dies ein wenig meiner Zeit gekostet hat, also hoffe ich, dass Sie etwas Wertschätzung dafür haben (und entsprechend stimmen). Das Schreiben benutzerdefinierter Komponenten ist nicht einfach, und es wird einige Wochen dauern, bis Sie sich frustriert die Haare raufen, bevor Sie die Konzepte verstehen, mit denen dies funktioniert. Es gibt ein Konzept, das ich nicht verstehe, das Sie ausfüllen müssen, und das ist das Hinzufügen der Differentialgleichungen. Diese benutzerdefinierte Komponente ist ein Beispiel. Simscape macht s-Parameter
Ich musste die Dokumentation ungefähr 4 Mal durchgehen und einfache Beispiele ausprobieren, bevor ich mich zu einer vollständigen Komponente mit vielen Knoten hocharbeiten konnte. Das erste, was ich tun würde, ist, nur die Zcpe-Komponente zum Laufen zu bringen und als benutzerdefinierte Komponente zu testen, und mich dann nach oben zu arbeiten. Wenn Sie Zcpe bekommen können, können Sie alles zum Laufen bringen.
Hazem
C.Bing