Calculate a sum of values of a parameter for all components in Altium? ATEX  - Page 1
Forum section: electronics / general

author: ManCave
author_rank: Regular Contributor
timestamp: June 07, 2017, 03:51:42 pm
content: HiI've been searching altium documentation but am unable to solve this. I am working on a design where I need to see in some way a sum of total capacitance of capacitors belonging to certain evaluation group.For example:I would use a query to search for: HasParameter('CapGroup', 'GroupA')Then I would like to calculate a sum of capacitance values: Parameter('Capacitance_uF', '')Ideally I would like to create a textbox on the schematic sheet where I would have a table showing sums of capacitances in various groups. e.g.GROUP TOTAL CAPACITANCEGroupA 22.5uFGroupB 120uFGroupC 22.6uF....etc...Please, I'm pulling my hair out. I know this is quite an advanced thing I'm asking altium to do but hey, you never know. It would really make my life easier.Thanks!

author: pigrew
author_rank: Frequent Contributor
timestamp: June 07, 2017, 04:49:59 pm
content: I don't think the software by default can do that. One possibility would be to write a script to make the calculation. Another would be to export a BOM which includes the value column, and have excel perform the sum. You could even make a custom BOM template to "automatically" do the calculation when the BOM is exported.

author: ManCave
author_rank: Regular Contributor
timestamp: June 07, 2017, 05:16:41 pm
content: Thanks!Scripting, I might look into it but at the moment cannot write altium scripts.BOM, That is the next best choice which I considered but would really like to have a calculation shown on the sheet and updated when I change something. If there is no other way to do this, I think I'll do that.Any other ideas?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: June 07, 2017, 11:15:03 pm
content: You'll have to evaluate it manually.The query system is powerful, but it's first-order only, and selects objects based on their data. That is, you can't select objects based on their child properties, or based on relationships between objects.(You can select the child properties themselves, if they are objects -- system parameters are not objects (but system parameters are integrated with the parent object, so can be filtered on, directly), but user parameters are. Once you have parameter objects selected, go to Inspector and click the Owner link to select the Parts.)You can also make powerful use of the List panel, or the Parameter Manager, by filtering and editing in those directly, or copying the data into a spreadsheet program to do more powerful things there, then paste it back.Tim

author: voltsandjolts
author_rank: Unknown
timestamp: June 08, 2017, 08:28:04 am
content: Curiosity has got the better of me! Got to ask, why do you need to add up capacitance values?ATEX application? But then voltage across capacitors would need to be considered also.

author: ManCave
author_rank: Regular Contributor
timestamp: June 08, 2017, 08:42:54 am
content: Quote from: T3sl4co1l on June 07, 2017, 11:15:03 pmThanks Tim!Copying from the parameter manager to a spreadsheet with pre-made formulas to calculate what I need might be the simplest way then (I'm torn between this and using a template for BOM export)...Quote from: voltsandjolts on June 08, 2017, 08:28:04 amIt is for ATEX and ICEx. It's an intrinsically safe design where you are only allowed certain energy to prevent sparking, hence limited capacitance at certain voltage.Voltage across capacitor is taken care of using zener barriers and capacitors are selected at Vcap>1.5*Vmax of the circuit. No more consideration needs to be given to the voltage across capacitor than in standard design practice, really

author: voltsandjolts
author_rank: Unknown
timestamp: June 08, 2017, 09:37:34 am
content: Interesting, thanks.We've not yet tackled an ATEX design, circled the problem several times but didn't take the plunge.It looks to be quite an undertaking both for initial design (working with certified body) and ongoing manufacturing re-cert where having ISO9000 accreditation can help.If you had a few minutes to create thread and outline some of your thoughts on the process it would be greatly appreciated, by me at least!

author: ManCave
author_rank: Regular Contributor
timestamp: June 08, 2017, 10:23:36 am
content: Quote from: voltsandjolts on June 08, 2017, 09:37:34 amIt is! Although the concept (once understood) is logical and straightforward, lots and lots of thought and care needs to go into component selection, correct schematic design and especially layout. A good starting point would be to grab a copy of the 60079-11 standard and read through it, then read again....then once again :)It's not that long.Also worth looking at 60079-0 which is a general Explosive Atmospheres standard. I think I saw older version available for free online. Although, not up to date, the concepts are the same, some specific requirements will be different so if doing design make sure you buy the latest copy.I did think about sharing my knowledge (somehow limited still as don't have years of experience doing Ex-i design) but wasn't sure how helpful that would be. It's an involving topic. I do have my own youtube channel so though of doing a Ex-i design series but just don't have time at the moment as working 120% both at work and on my house refurb...If you have any specific questions, feel free to ask. I might get to doing the videos or write some articles some time in the future.

author: voltsandjolts
author_rank: Unknown
timestamp: June 08, 2017, 01:03:57 pm
content: ATEX is a niche topic and I find there is a lack of practical information from actual engineers who have been there and done it, even on this excellent forum.Info comes from(1) Technical standards like those you mentioned(2) Certified bodies who have a vested interest in extrapolating the projectIt would be great to hear about your experience, although I don't think it would get 100K hits on YouTube!

author: ManCave
author_rank: Regular Contributor
timestamp: June 08, 2017, 10:11:59 pm
content: Quite right, not many views, but I know how difficult it is to get started with Ex design without prior experience in the field. I really would like to share my knowledge, but unfortunately at the moment time doesn't allow.It is also one thing to be able to get my particular design through the certification process, but a completely different thing to explain all aspects off design for explosive atmospheres to someone else. Every design requires different approach with its own little issues.

author: free_electron
author_rank: Super Contributor
timestamp: June 09, 2017, 04:40:42 am
content: in your schematic symbols : add two parameters. one called group and one called capacitance or value or whatever (value is numerical only ! without suffixes. and 1uf based. so 1 pf is written as 0.000001) to all the capacitors ( ideally you do that in the library )now you can in the sch filter simply filter on netif innet('this') and incomponent 'C*')this will list all the capacitors attached to that net. now simply scroll to the column 'capacitance' copy , past in excel . and done.you can filter net immediately.but this is an interesting thing. i will see if i can write a small scrit where you simply click on a net and it displays the total capacitance attached to it. it is easy to do. all i have ot do is let you pick a net, extract the name, make an iterator over components called c* and see if they have a pin attached to the net. simply tally up valuevar total_capacitance : double;current_project :icb_project;part_iterator :ipcb_iterator;capacitor :ipcb_component;procedure Get_Total_capacitancecurrent:project :=pcbserver.getcurrentprojectpart_iterator :=current_project.create_iterator;part_iterator.addfilter ("designator","C*);capacitor := part_iterator.getfirstitemwhile capacitor <>nil do begintryif capacitor.pins.net := selectednet then total_capacitance := total_capacitance + capacitor.parameters("capacitance").todouble;if capacitor.pins.net := selectednet then total_capacitance := total_capacitance + capacitor.parameters("capacitance").todouble;finallyend;capacitor :=part_iterator.getnextitem;endshomessage ("total capacitance " + float2str(total_capacitance.)note : the above script is very rudementary as it does not contain code to let you pick the net. it may contain typo's as it has not been run. but you get the idea ...

author: floobydust
author_rank: Super Contributor
timestamp: June 09, 2017, 04:59:26 am
content: You can't add the capacitance values alone, you must include the +% tolerance. That's what the certification bodies do.I have done IEC 60079-11 hazloc designs. I add up capacitance manually, per voltage category (gas group) and then tack on the extra tolerance.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: June 09, 2017, 07:08:29 am
content: Also, FWIW, XSPICE (which Altium's simulation is based on) can calculate the total capacitance on a node. Often, this is a completely useless function (it doesn't calculate actual C equivalent, from circuit behavior / parameters), but it does at least tell you how much capacitance is attached to a node (so, real capacitors to GND/VCC, and digital logic gate input pin capacitances). Which is exactly what you're asking for.Note that, to perform this test, you need capacitances connected to the node of interest, and no direct voltage sources (which would short out the capacitances!). So, not just capacitors, but capacitance models inside the capacitors.Tim

author: ManCave
author_rank: Regular Contributor
timestamp: June 09, 2017, 07:52:45 am
content: Quote from: floobydust on June 09, 2017, 04:59:26 amIndeed. I've just made a BOM template which does it all. Not ideal, but best that can be done I guess. It takes capacitance vlaue, converts to uF, adds tolerance capacitance and then sums up all caps in the schematic which are marked as "Fitted" in the particular variant.

author: ManCave
author_rank: Regular Contributor
timestamp: June 09, 2017, 08:09:55 am
content: Quote from: free_electron on June 09, 2017, 04:40:42 amThanks free_electron! Unfortunately this still is more labour intensive than I was hoping for (if I interpret it correctly). Going around probing nets for sum of capacitance is a time saving as opposed to counting individual caps, but might be more error prone as if you accidentally probe same net which is visually discontinuous on the same schematic you get incorrect value. Also if you forget to probe one net... I prefer fully automated solution which shows all caps and always uses same algorithm to count them.Thank you for the script though! I've learned something

author: MagicSmoker
author_rank: Super Contributor
timestamp: June 09, 2017, 12:09:56 pm
content: I don't use Altium Designer so take this with a grain of salt, but the approach I would consider is to write a script to find all of the capacitors on a particularnet. Or add two fields to the BOM export script for the nets each component attaches, etc.Sure you'll still have to manually add up the capacitance if common multiplier suffixes are used (p, n, u, etc.) but for the most part you can just ignore everything but the u (micro) and m (milli) suffixed values.

author: free_electron
author_rank: Super Contributor
timestamp: June 09, 2017, 04:14:35 pm
content: Quote from: ManCave on June 09, 2017, 08:09:55 ammy script doesn't care how a net is drawn. i only use the 'click' to retrieve the netname of interest. then i walk over all capacitors in every page of the entire project and find anything hanging off that net. so it is fully automated.feed the netname of interest and the script collects the capacitors. i could even present you with a visual list of the parts . if your symbols contain the value and the tolerance i can extract that too.

author: ManCave
author_rank: Regular Contributor
timestamp: June 12, 2017, 10:31:59 am
content: Quote from: free_electron on June 09, 2017, 04:14:35 pm...I understand that it is automated for a net on all pages, but it still means I need to go around clicking on each net of interest, right? And this is where a human error could happen.