DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Conditional looping

Solved!
Go to solution

Hi all,

 

I have few .dat file which contains n number of channels.

 

I need to to some operations like filtering, deleting some initial data in channels till it reaches value 0(pre data) , and delete some data after it reaches 80(post data) with each channel. And plot all the exixting channels on report

 

But the number of channels are not always constant. Some time it may be 3, some times may be 10 and even 15. This makes myscript to change it each time, depending on number of channels.

 

So I thought of using this,

 

L1 = Globusedchn
msgBox globusedchn
l2 = 2
do until L2 < L1

'Filter  each channel using CFC 180 with x - axia as time channel

Loop

 

 

How can i improve my code to perform my task. Hope this is Clear 😉

 

Thanx in advance

Rsh

 

0 Kudos
Message 1 of 9
(4,742 Views)

Hi RSH,

 

I just discovered this unanswered post-- is this still a question you have?

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 2 of 9
(4,522 Views)

Hi Brad,

0 Kudos
Message 3 of 9
(4,514 Views)

Hi Brad,

 

Am doing this for Accleration test. Hope you remember I sent a post to do fit a dat file between upper limit and lower limit extracting from excel sheet.

 

Now the problem to me is, the number of channels will not be always constant. it keeps changing , so I have to keep changing the upper and lower limit channle numbers.

 

So, I thought let me run ,

 

 HeadLine = ChnName(1)
 For k = 1 to GlobUsedChn-1

 Call SUDDlgShow("Main", ResourceDrv & "AnaChnCFCFiltCalc")
   Next

 Pause(1)

 

1. So that the CFCFiltCalc Dialog will as many times as the number of channels in data portal -1.

 2. Then I will load excel values which I have saved as excel limits.tdm

But I am facing difficulty to run this script for all my tests which varies in the number of channels.

 

How can i make it full proof to execute for all my tests.

0 Kudos
Message 4 of 9
(4,510 Views)

Hi RSH,

 

I think the simplest way to handle this would be to create a "Limits" group, by adding the first 2 lines below to your code:

 

Call GroupCreate("Limits")
Call GroupDefaultSet(GroupCount)
Call ExcelImport(AutoActPath & ExcelFileName, ExcelSheetIdx, 0, AutoActPath & StpFileName)

Then you just need to reference the limit channels in the TDR file as "Limits/Lower Limit" and "Limits/Upper Limit", and you should be set.  I made that change in the TDR attached below.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 5 of 9
(4,500 Views)

Brad,

 

I could create the new group with upper and lower limits and refer the same in .tdr file to get the plots.

 

But, as mentioned earlier I have test files with varying number of channels.

 

IF GlobUsedChn < 6 THEN Call AutoQuit("The limit channel Excel import failed")
ChnName(5) = "Upper Limit"
ChnName(6) = "Lower Limit"

 

If i have test file with 3 channels( Time axis, Acc, Event input) , and 4th channel will be filtered Acc channel (Deceleration) the above line works  fine , with upper and lower limit being 5 and 6..

 

If I have 5 channels in my test file, the channel number of upper and lower limit has to be changed...

 

What i can do to overcome this..

0 Kudos
Message 6 of 9
(4,465 Views)
Solution
Accepted by topic author RSH

Hi RSH,

 

Please refer to the script I attached to my previous post which avoids that problem.  If you create a Group for just the limit channels, then it is easy to refer to those limit channels independently of the number of data channels loaded from your data file-- that is the whole point.  You don't want to use the (5) or (6) syntax at all for the limit channels.

 

Brad Turpin

DIAdem Product Support Engineer

National Instrumetns

0 Kudos
Message 7 of 9
(4,434 Views)

Please help me giving the idea for looping method. In my program, there is a input voltage and this voltage will change to equivalent temperature and the temperature will controlled by the logic gates. I want to add the looping method to get a automatic control system, for example if the temperature goes beyond the upper limit, the looping will decrease (decrement--) the input voltage and if the temperature goes below the lower limit, the looping will increase (increment++) the input voltage until the desire temperature is reached. And finally, at the desire temperature limit, the looping will end. I don't know well about how to decrease or increase the input voltage. Please explain in details. Thank you very much.

Best regards.

0 Kudos
Message 8 of 9
(4,164 Views)

If possible, please help me improved my program with loopings that I asked before. Thank you very much.

Best regards.

0 Kudos
Message 9 of 9
(4,148 Views)