Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

How to write a script for triggered event with Data Event and assign File Marks to specific record number?


Ema2017 Apr 26, 2017 05:45 PM

Dear all,

I have to write a script with trigger condition and file marks for data collection, but I need help because am I a new to writing CR scripts and I dont quirte understand the part with assigning File Marks.

I am doing an impact hammer test with cards CR9052IEPE. I am using one instrumented hammer and 10 accelerometers. The captured data from the hammer and all 10 accelerometers is written in the same DataTable.

I want to write the data to DataTable from all accelerometers and instrumented hammer but when a condition is met on the instrumented hammer channel. The event that will trigger the data writing is when the voltage on instrumented hammer is greater than 1 mV. Besides the trigger, I want to include file marks in the tables because I will have multiple trigered events and each trigered event I want to have in a separate file.

Lets say I use scan interval of 0,1 msec and a single triger event. In total I want to capture five triggered events per one data collection because I am applying five hammer impacts. So, I should have 5 data files, each for every hammer impact.

The part where I define the DataEvent looks like this:
DataEvent(5000,Impact>1,0,55000)

The part that is related to assigning the file marks I don't understand. I want to write the file marks at the location of last record of each triggered event. I think that should be record number 60 001. I don't know how to write the code for this. I tryed following:

If Impact>2 then Flag = 1
If Flag = 1 then 'Here I should somehow include the record number
If 'the record number is equal to the last record of the trigered event Then FileMark(DataTable)
CallTable DataTable
Endif
If 'the record number is less than the last record of the trigered event
Flag = 0
Endif

Next Scan

Do you have any tips or suggestions how to write this?
Also I am not sure I am on the right track with using the Data Event and File MArks.
I am writting the script with the CR9000x manual, but I couldn't find much reagards my application.

Many thanks,

Emina

Log in or register to post/reply in the forum.