06-18-2012 12:47 PM
Hello fellow DIAdem users.
I have a question that i would like to have some help with if you feel like you have the time.
I want to start of by saying that my programming skills are rather low.
Ill try to explain my problem as detailed as possible
The thing i want to do is to program a script/program(dialog interface) that takes some channels as input (from like a combobox) and a trigger.
When i run this script/program i want it to "CUT" the parts where the trigger is 1 (see example.jpg below) and save it to a new channel and a group.
So after the programm have executed i would like it to look like this after the channels used by the program in dataportal;
Test1 (group1)
--Trigger S1
--pressure FA S1
--pressure RA S1
--Velocity S1
--Temp disc S1
--pressure FA S1_1
--pressure RA S1_1
--Velocity S1_1
--Temp disc S1_1
Test2 (group2)
--Trigger S2
--pressure FA S2
--pressure RA S2
--Velocity S2
--Temp disc S2
--pressure FA S2_1
--pressure RA S2_1
--Velocity S2_1
--Temp disc S2_1
.
.
.
Hope you understand what im aiming for.
I have been inspecting the channels manually before and have not been in need of automating. But now when there are 100+ triggercycles its to much to handle.
Would be so much easyer to just check out for example. group 52 and calculate mean and important formulas for just that test.
A programm like this would help out a lot.
I can add that i have went throu all of the 115 pages of POSTs here trying to find something like the problem i have, But without succsess.
I have tryed using a loop to find out at what row the trigger changes, but i just cant get the hang of it.
Im sorry for the wall of text. Just want to be as detailed as possible.
The channels are Time on the X-Axle, and Y-Axle differ from Psi to Celcius.
Anyone out there who have a simmilar program that they can share, Or someone who could give me some pointers where to start?
Thanks in advance
//Johnny
07-02-2012 02:26 AM
Hi,
I think I have something which is close to what you are looking for. I've been through the process of automatically "cutting" sections via a script. My scripts saves each section to a new dataset onto your hard drive as opposed to creating the groups in the data portal though. Basically you supply the script with criteria such as :
1) ChannelID
2) Rising Trigger threshold.
3) Falling trigger threshold.
4) Rising trigger margin
5) Falling trigger margin
Could you post an original data set and say the first 3 sections you have cut by hand so that I can have something to work with?
07-27-2012 03:02 PM
Johnny,
I would use a loop that uses the Call GroupCreate("Test"&i) to create a group. Then the "find" function to find when a channel (trigger) exceeds a value to find the cut points, you can also input a start point so as not to re-copy data by setting one of the internal globals to the last point found (L1, L2,L3...). Then I would use the dataareacopy function to copy that data to another data channel in the new group. then increment the i counter.
L1 = FIND("CH('Trigger')>=2.5",L2)
L2 = FIND("CH('Trigger')<=2.5",L1)
Call DataBlCopy(ChnNoStr, ChnRow(L1), ValNo(L2-L1), ChnNoStr1, TargetLine(1)) ---Parens for example
Then loop.
Regards,
David