cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Condition to prevent a unloaded variable (MathCad 15)

Johnruehlz
7-Bedrock

Condition to prevent a unloaded variable (MathCad 15)

Hi all,

I currently trying to write a condition so that based on what an excel file provides to Mathcad, "Yes" if there are variables, "No" if there isn't any variables. The goal is that instead of have multiple writes to Excel I can go to 1 write. However there is no way currently to predetermine how many circuits will be needed. So my plan is for Mathcad to get a variable from excel to determine if there is any content in the variables and if not load a 0 in its place.

2 REPLIES 2


@Johnruehlz wrote:

Hi all,

I currently trying to write a condition so that based on what an excel file provides to Mathcad, "Yes" if there are variables, "No" if there isn't any variables. The goal is that instead of have multiple writes to Excel I can go to 1 write. However there is no way currently to predetermine how many circuits will be needed. So my plan is for Mathcad to get a variable from excel to determine if there is any content in the variables and if not load a 0 in its place.


Let's see:

  • Your Mathcad template has no math, just a note: 

    This template is created for eight feeders however this windfarm only has four feeders. Remaining cells not being used in excel should remain zeros.

  • So the template is supposed (when done, one believes) to handle eight sets of variables.  But your EXCEL sheet has 21 columns by 250 rows of numbers (0 is a number) followed by a single column of ten yes's.  In the table of numbers there are nine groups of six rows of contiguous non-zero values.  NONE OF THESE NUMBERS IS AN INTEGER MULTIPLE OF 4 OR 8!

As far as I can see, if you passed the "Mathcad Export" sheet to Mathcad, it would tell you there are 21 x 250 variable values present.  You could strip out the zeros; but such a procedure would also strip any valid zero in the data.

 

Both Mathcad and EXCEL understand "NaN" (Not a Number).  Maybe you could use that.  But I can't tell, from what you sent, what you want to have happen.

The variables are all achieved through importing to Mathcad.

 

My goal is create one write function to Excel, since the write function takes so much time to achieve if I can cut by 1/10 I would be greatly increasing efficiency. However since each Wind farm can have numerous amounts of different circuits. I'm looking for a way for Mathcad to able to "ignore" the circuit and leave the areas in the matrix as zeros. If this makes sense.

 

My idea was to use global variables to initialize each "Circuit" with zeros so that if no value was entered the Mathcad would just use those values, however I realized that if there is an uninitialized variable set equal to that variable underneath of the global variable, the variable will still be uninitialized still!

 

See below where I'm working with only two circuits. 

Top Tags