Skip to main content
1-Visitor
October 30, 2014
Question

How to automate extrapolation in mathcad and write the result to excel?

  • October 30, 2014
  • 5 replies
  • 10250 views

Hi..

The Excel calculation given below in each step needs to check the current and stroke and import the force value from mathcad.

The Force thus obtained will give the current for the second step, which along with the corresponding stroke value again the force has to be taken from mathcad.

Is it posiible to automate this process using Mathcad by reading the excelsheet?

Capture.PNG

I have attached my worksheets herewith.

5 replies

1-Visitor
October 30, 2014

Use the READEXCEL function to bring in your data. I take it you are manually bringing it in at the moment?

1-Visitor
October 30, 2014

Yes. The highlighted Force values were entered manually by checking in mathcad.

1-Visitor
October 30, 2014

To automate, use the READEXCEL feature found on the Input/Output tab and specify the range of data you want to input.

C.jpg

23-Emerald I
October 30, 2014

There may be a reason not to do this; but why can't Mathcad calculate the current (bypass the ECXEL sheet)?

If EXCEL can compute the current from the force, then it should be possible to do that calculation in Mathcad as well.

1-Visitor
October 30, 2014

Fred Kohlhepp wrote:

There may be a reason not to do this; but why can't Mathcad calculate the current (bypass the ECXEL sheet)?

If EXCEL can compute the current from the force, then it should be possible to do that calculation in Mathcad as well.

I agree Fred, but Saranya has used a lot of data contained within Excel to calculate the Current values so I thought it would be best to keep it there.

1-Visitor
October 31, 2014

Thank you..

Kindly go through the description given below:

Capture.PNG

Problem description:

The table in the left side is the actual calculation that I’m doing.

The data in the right side is supporting my calculation.

The left side table values describe the performance of a coil which is fed by current (270,429,600,…) at different strokes(3.5mm,3mm,2.5mm,….) from Ansys simulation.

I need to estimate force value for any combination of current and stroke (say 280A & 3.4mm) which need to be extrapolated from the right side available data.

For that I have used the Mathcad program above which picks force value for any combination of Current and Stroke.

Coming to the Left side excel calculation, Kindly assume that Initially I know only the values highlighted in green.

The force in each step decides the stroke in the next step.

The column highlighted in Yellow ( current and stroke) in each step have to decide what will be the value of force.

Since it is not possible to manually enter the F(current,stroke) values in Mathcad for each step to check what will be the force and write it in the column highlighted in blue in left side table, I m thinking whether this can be automated like iteration process. Either by linking this Mathcad program in excel and make it run each time or reading the excel data in Mathcad and obtaining the required force values to fill the remaining steps in excel.

Saranya T L

1-Visitor
November 4, 2014

Thank You..

I have calculated current in mathcad itself.. Now how to do the iteration step by step???

I am stuck on finding force by checking with the stroke and Current step by step...

Capture.PNG

Please find the worksheet attached herewith..

1-Visitor
November 4, 2014

You can use a For Loop and iterate through either stroke or gap, whichever the iterative variable is. This will allow you to calculate a, velocity and inturn Stroke.

1-Visitor
November 4, 2014

I will take Stroke as the variable.can i write an expression sometng like S(i) := S(i-1)+ V(i-1)*T directly???

Also For that I need to pick the Force value F(current, stroke) which should be F(i) for further Calculation.(Net force, Acceleration,Velocity...)

Confused..

1-Visitor
November 6, 2014

Thank You All..

I will try with the method suggested and get back shortly...

1-Visitor
November 6, 2014

Im sorry If im confusing again..

Is it possible to make the no.of iterations as variable??

I have made some modifications...but i guess it is making a circular reference...

I tried to write the expressions for acceleration,velocity and stroke as below...

Capture.PNG

23-Emerald I
November 6, 2014

Okay;

You have a problem with your interpolation schemes, and the one in Force_recalculation just does not work.

polynomial regression fit shows how to get a polynomial fit to your data--linterp requires you to span the range of data, and when current or stroke goes outside your table it fails. (Your current will be negative some of the time!)

Force recalculation takes the third order fit of current, stroke, to force and shows the interpolation.

solenoid and spring takes the same interpolation and solves the ode for position.

I'm not sure of the correlation of x with stroke, and what to do about negative currents and forces.

Good luck!

1-Visitor
November 7, 2014

Thank You..

I agree...The problem is I am trying to find at what time 2mm stroke is attained & At that instant what will be the Force and current. The known values are I_t Characteristics, Spring data and inputs for calculation and interpolation.

I have changed the data in table with respect to Stroke so that the gap need not be considered.

In the interpolation function, each time entering the current and stroke value is not possible. Since i have to calculate the same for n number of iterations.(from time 0 till the time at 2 mm stroke)

Also, Im not worried about negative currents because my calculation will converge before the positive peak of current is reached. (2mm stroke is attained in less than 4 milliseconds).