FastFieldSolvers Forum
FastFieldSolvers Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
 All Forums
 FastFieldSolvers
 FasterCap and FastCap2
 Question about "GetCapacitance" with Matlab
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Amr Alaa

USA
2 Posts

Posted - Jan 17 2023 :  06:31:57  Show Profile  Reply with Quote
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.4166e-010 -2.15784e-011 -8.64043e-013
g2_microstrip -2.16601e-011 9.33457e-011 -1.80683e-011
g3_microstrip -8.96116e-013 -1.80545e-011 8.78264e-011

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

530 Posts

Posted - Jan 19 2023 :  16:47:49  Show Profile  Reply with Quote
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) work-around 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
Go to Top of Page

Amr Alaa

USA
2 Posts

Posted - Jan 20 2023 :  05:27:50  Show Profile  Reply with Quote
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
Go to Top of Page

Enrico

530 Posts

Posted - Feb 21 2023 :  22:43:23  Show Profile  Reply with Quote
Dear Amr,

while we fix the code and generate a new binary, you have two possible work-arounds, see below. Let me re-state 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 N-1 rows and N-1 columns; the values in this (N-1)x(N-1) matrix must be scaled by 2*PI*E0 i.e. by about 5.563250279878e-11 (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


Go to Top of Page

liping

7 Posts

Posted - Sep 26 2023 :  19:37:21  Show Profile  Reply with Quote
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.
Go to Top of Page

Enrico

530 Posts

Posted - Sep 26 2023 :  22:23:58  Show Profile  Reply with Quote
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
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
FastFieldSolvers Forum © 2020 FastFieldSolvers S.R.L. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.06