Author 
Topic 

Amr Alaa
USA
2 Posts 
Posted  Jan 17 2023 : 06:31:57

Hello everyone, I am trying to use Matlab to control the "FasterCap" program. My code looks like: 
path_to_input='C:\Users\Public\Documents\FastFieldSolvers\FasterCap\2D\three_line_bus_2d__single_file.lst';
ax=actxserver('FasterCap.Document');
ax.invoke('ShowWindow');
ax.invoke('Run',[path_to_input, ' a0.001']);
while(ax.invoke('Isrunning'))
pause(0.1);
end
C=cell2mat(ax.invoke('GetCapacitance'));
ax.invoke('Quit');  As you can see, I am running the "three_line_bus_2d__single_file" file from the example directory. The code runs pretty well, but there is a discrepancy between the results from FasterCap, and the results I end up having in Matlab. Specifically, after the last iteration in FasterCap, I get the following Capacitance matrix: Capacitance matrix is: Dimension 3 x 3 g1_microstrip 1.4166e010 2.15784e011 8.64043e013 g2_microstrip 2.16601e011 9.33457e011 1.80683e011 g3_microstrip 8.96116e013 1.80545e011 8.78264e011
On the other hand, the variable 'C' in the above Matlab code, gets populated with the following values: C =
2.5464 0.3879 0.0155 2.1710 0.3893 1.6779 0.3248 0.9937 0.0161 0.3245 1.5787 1.2724
I am not sure where is the discrepancy coming from. Thanks in advance. Amr


Enrico
543 Posts 
Posted  Jan 19 2023 : 16:47:49

Dear Amr,
after check and review, I confirm there is a bug affecting the export via Automation of the 2D capacitance extraction results.
The possible (ugly, I admit) workaround is registering to the logger via Automation and read the capacitance matrix from the text; however I believe this is not straightforward in Matlab (you have an example in the 'Automation' Samples directory as Visual Basic project).
Is this issue blocking for your activity?
Best Regards, Enrico



Amr Alaa
USA
2 Posts 
Posted  Jan 20 2023 : 05:27:50

Thanks Enrico for your response. Unfortunately, I am not an expert in VBS. I got the previous MATLAB code snippet from other users comments in this forum.
If fixing the bug is too much work, can you please help me with MATLAB commands to access the output text from FasterCap? Once I have that, I can try to parse the text, to extract the capacitance matrix.
Thanks, Amr 


Enrico
543 Posts 
Posted  Feb 21 2023 : 22:43:23

Dear Amr,
while we fix the code and generate a new binary, you have two possible workarounds, see below. Let me restate that this issue ONLY affects the retrieval of the 2D (two dimensional) simulation results via Automation.
1) Launch FasterCap including the 'e' option. FasterCap will dump the capacitance matrix to a .csv (comma separated values) file with the same name of the input file and in the same directory. This file can be easily read from Matlab and elaborated accordingly.
2) Use the result from FasterCap that you get via Automation and consider only the first N1 rows and N1 columns; the values in this (N1)x(N1) matrix must be scaled by 2*PI*E0 i.e. by about 5.563250279878e11 (the reason is in the code, sorry a bit longish to explain here).
Hope it is not too late for you to use this w/a. New code will come soon.
Best, Enrico



liping
7 Posts 
Posted  Sep 26 2023 : 19:37:21

This problem also occurs when I use python to control fastercap. Thanks to Enrico's reply, I found a solution. But I would also like to ask if there are any other bugs about using automation to solve 2D Capacitance , because I will have to do a lot of data solving work and cannot check them one by one. Thanks in advance. 


Enrico
543 Posts 
Posted  Sep 26 2023 : 22:23:58

Hi Liping,
while no code is without bugs, I am not aware of other specific issues found so far in the Automation interface.
Best Regards, Enrico




Topic 


