Skip to main content
1-Visitor
July 31, 2013
Question

Electronic board design: discrete variable value

  • July 31, 2013
  • 5 replies
  • 7961 views

Hello,

I'm setting up a Mathcad document for electronic circuit project.

I need a variable wich value are not continuos, but discrete: resistors for example are not avaible in alla value .. so I decalred a vector with the possible value of the resistors in the market:

10 12 15 18 22 27 33 39 47 56 68 82 100 120 150 180 220 270 330 390 470 560 680 820 1000 1200 1500 1800 2200 2700 3300 3900 4700 5600 6800 10000 12000 15000 18000 22000 27000 33000 39000 47000 56000 68000 100000 120000 150000 180000 220000 270000 330000 390000 470000 560000 680000

How can I declare a new variable with only this possible value?
I'd like to try a solution block to minimize and maximize a value of a voltage splitter (Vsplit = (V1/(R1+R2))*R2), but the resistor value must be one of the market value.

Thankyou

5 replies

19-Tanzanite
July 31, 2013

1. Upload a worksheet with what you've done so far, rather than have others type all the numbers in.

2. To maximise Vsplit for a given V1 it looks like you should choose the smallest value of R1 with the largest value of R2. Similarly, to minimise Vsplit, choose the largest value of R1 with the smallest R2.

Alan

24-Ruby IV
July 31, 2013

Mathcad 15 or Prime?

25-Diamond I
July 31, 2013

Yet another reason for posting a worksheet along with a question whenever possible.

25-Diamond I
July 31, 2013

There is no way to restrict a variable to a set of values (unfortunately there is no such construct as a set in Mathcad, just vectors). Unless the problem is fairly easy to see what values to take (like the points Alan had posted) you would have to write your own routine which cycles through all possible values to find what you are looking for. Even more trouble if you add tolerance.

25-Diamond I
July 31, 2013

Just found that some months ago you had a similar question concerning tolerance values and you used Prime Express 2 at that time.

You could use the findExtrema() routine I provided here http://communities.ptc.com/message/199660#199660 and feed it with your vector of values instead of R1 and/or R2 which were resistance vectors, too, created by tolVec() [see below].

If you wish to combine your list of restistances AND tolerance, it should be not so hard to rewrite tolVec() to take vector arguments instead of scalars, if you are interested.

BTW, the following is what Alan was talking about (I didn't bother entering the full list)

MinMax2.png

The unit Volt at the end of vector V is wrong, its a Prime bug. It belongs to the min and max values (0.001 and 23.999) only.

You may have noticed that error already in the last thread (shame on me - I hadn't).

1-Visitor
July 31, 2013

Another way to solve the problem, without using the SolveBlock.

Federico Manfrin wrote:


I need a variable wich value are not continuos, but discrete: resistors for example are not avaible in alla value .. so I decalred a vector with the possible value of the resistors in the market:

10 12 15 18 22 27 33 39 47 56 68 82 100 120 150 180 220 270 330 390 470 560 680 820 1000 1200 1500 1800 2200 2700 3300 3900 4700 5600 6800 10000 12000 15000 18000 22000 27000 33000 39000 47000 56000 68000 100000 120000 150000 180000 220000 270000 330000 390000 470000 560000 680000

How can I declare a new variable with only this possible value?

So, the variable is already declared; it is the vector. I assume that this is one of the Rs (say R1); then R2 must take the same values as R1.

Consider V1 a constant.

Now, if R1 and R2 are introduced in the Vsplit function and evaluated, a matrix (n x n) representing the values of Vsplit is obtained. And the minimum / maximum value can be selected, and from its 'address', the corresponding (discrete) values of R1 and R2 are also obtained.

And the solution found must be as given by Alan / Werner.

25-Diamond I
July 31, 2013

Now, if R1 and R2 are introduced in the Vsplit function and evaluated, a matrix (n x n) representing the values of Vsplit is obtained.

Unfortunately not! If you put two vectors R1 and R2 into a function Vsplit (and you would have to use vectorization) you will only get a vector of the same dimension n as a result. Only the k-th element of each of both vectors would be combined.

So you would have to write your own routine to combine every value from one vector with every value of the other to get your n x n matrix to look for the extrema.

This is basically what my function findExtrema() from the aforementioned thread does, but more general in as much as it would take an arbitrary function and and arbitrary number of variables (vectors or scalars) to cycle through.

After all this brute force method of an exhausting search is limited by the number of combinations as it will take too much time with more variables and larger vectors . In this case we would have to resort to more intelligent algorithms and Richard once suggested simulated annealing (http://communities.ptc.com/message/208841#208841)

1-Visitor
July 31, 2013

Werner Exinger wrote:

If you put two vectors R1 and R2 into a function Vsplit (and you would have to use vectorization) you will only get a vector of the same dimension n as a result. Only the k-th element of each of both vectors would be combined.

What I mean is:

R1 (i) = 10, ... 680000; i = 1... number of R1 values

R2 (j) = 680000, ... 10; j = 1... number of R2 values

Then, evaluate the function: V_split (i,j) = Vsplit (R1(i),R2(j)).

Is this going to work?