Funny Magnetostatics problem - Page 1
Forum section: electronics / projects

author: Etesla
author_rank: Regular Contributor
timestamp: December 13, 2019, 05:07:31 am
content: Hi folks, I'm trying to find a mathematical model for an electromagnet used in a solenoid valve. The end goal is to be able to predict the holding strength of the electromagnet given different currents, core materials, sizes ect. The equation you can find easily online does not account for core reluctance, so they show the force between the electromagnet and it's target shooting to infinity as the distance between the objects goes to zero, which is obviously not the case. Accounting for core reluctance, I got the equation that's boxed at the bottom of the handwritten page.Plugging that equation into matlab and plotting across very small air gap lengths, I get something interesting. The peak positive force is on the order of magnitude of what I witnessed in real life for the real solenoid, but it looks like as the gap length goes to zero, the force goes negative and actually repels the electromagnet from the target.... I'm fairly certain that my equation is alright, as its results line up with the simpler version of the equation that does not account for core reluctance as the gap length L gets larger. I also plotted the magnetic field density to make sure my assumption that the material which is some kind of cobalt iron for the original solenoid wouldn't saturate (B < .5 ish). My question is as follows: Why does the force appear to go negative when the gap distance is very small? Is this just a fluke in the math, or is this a known and real phenomenon? Any help is appreciated.In case it helps, here's the matlab code, it should probably work in octave as well:clear;close all;A = 1.3e-5; %cross sectional area of U shaped electromagnet in meters squaredur = 2000; %relative permeability of core materialuo = (4e-7)*pi;N = 16; %number of turns on electromagnetLd = .01; %average distance of a 'loop' that goes through the U core, through the air, and through the thing that's being attractedI = .04; %current running in the electromagnetL = 0:.000000001:.00002; %an array of air gap sizes (lengths) to iterate overdelta = .0000000000001; %the difference in gap lengths used to calculate the forceForce = zeros(1,length(L)); %initialize Force arrayB = zeros(1,length(L));ForceIgnoreCore = zeros(1,length(L)); %initialize Force array that will use the math ignoreing core reluctanceL1 = 0; %temp variables to hold L1 and L2, which are two very similar lengths with difference deltaL2 = 0;for i = 1:length(L)L1 = L(i);L2 = L1 - delta;Force(i) = -(uo*L1*A*(N*I/(2*L1 + Ld/ur))^2 - uo*L2*A*(N*I/(2*L2+Ld/ur))^2)/(L1-L2);B(i) = N*I*uo/(2*L1+Ld/ur);ForceIgnoreCore(i) = uo*A*(N*I)^2/(4*L2^2);end%plot(L,Force,L, ForceIgnoreCore);plot(L,Force);title('Force vs distance of solenoid valve');ylabel('Force (Newtons)');yyaxis right;plot(L,B);ylabel('B (Tesla)');xlabel('Gap Distance (Meters)');

author: Kleinstein
author_rank: Super Contributor
timestamp: December 13, 2019, 07:59:58 am
content: The principle way of calculating the force looks good. However I think you missed that with changing distance the flied in the core will also change and thus an additional contribution.Instead of the formula with 2 distances close by one should use the derivative as the limiting case of the 2 L very close.

author: ChunkyPastaSauce
author_rank: Unknown
timestamp: December 13, 2019, 08:08:39 am
content: force equation is different than what's on paper

author: TurboTom
author_rank: Super Contributor
timestamp: December 13, 2019, 08:31:10 pm
content: Just a general hint: When I'm faced with electromagnetic problems like this, I foundFEMMto be a very useful, free program. It's by far not as complex and "heavy-weight" as a full blown electromagnetic CFD (i.e. Ansys) but provides good reliability for two-dimensional problems. U/I is soemthing you've got to get used to, thoughP.S. See example "Force on a Taper Plunger Magnet"

author: Conrad Hoffman
author_rank: Super Contributor
timestamp: December 20, 2019, 08:23:48 pm
content: +1 on FEMM. This site is also useful for some formulas-https://nbviewer.jupyter.org/github/tiggerntatie/emagnet-py/blob/master/index.ipynb

author: T3sl4co1l
author_rank: Super Contributor
timestamp: December 20, 2019, 08:47:03 pm
content: Hm, I wonder how close to saturation a typical solenoid operates. It may be below saturation when open (partial air path), but into saturation when closed (path predominantly through core material).In that case you need to account for the increase in reluctance as a function of flux density, and you need a function that fits the B-H curve.Tim

author: duak
author_rank: Super Contributor
timestamp: December 20, 2019, 09:31:02 pm
content: I would think a simple DC solenoid operates way up on the B-H curve close to saturation. It's a tradeoff of wasting possible core flux vs wasting power. AC solenoids are another thing. I've got a few somewhere so maybe I should try it.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: December 20, 2019, 10:23:52 pm
content: Regarding the math -- where did L1 and L2 come from? Are those adjacent elements of the incremental array, thus calculating the forward difference, with L1 = L and L2 = L + dL?Also, why not take the symbolic derivative? The expression has the form aL / (L + b)^2, with derivative a(b - L) / (L + b)^3 and which has a local minima L = 2b (which I think you've got the negative of, reflecting positive attractive force, so a local maxima in your case).I'm not sure how to explain it, if the force does in fact reduce for gaps this small (mind, it might not be easy to measure this in practice, due to the high mu_r of real materials (obviously, that one can be defeated by intentionally using a lower mu material), and the uneven surfaces of real parts), or if the expression for work is wrong, or what. It looks right at a glance.I will note that the total work should include the core length term (LA --> (L + Ld/mu_r)A), so that it can be equated to the electrical work done -- this simply reflects that a closed solenoid still has large (but finite) inductance, and so stores some energy when flux is given to it. But this is a constant term in the work equation, which goes away in the force equation (d/dL(term) = 0), so isn't related to the result in question.Wait no, duh, the Ld term is still over (L + Ld/mu_r) so it doesn't go away. Or actually, together it's the same as one denominator factor, so we can cancel it: the square goes away, there's no L on top and it's simply of the form a/(L+b) with derivative -a/(L+b)^2 which has no local minima or other interesting behavior around L ~ b, and saturates smoothly to -a/b^2 as L --> 0, as we expect.Cheers!Tim