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.

Concurrent task.


Adrian Aug 27, 2009 05:14 PM

Hi, I'm using a cr1000 to store data from 8 sensors, the datalogger read the sensors 1 time per second and store de integrate value every 10 minutes in a data table (salidaCr1000).
I want to store some values from the channel 1 in a diferent data table (SparkTracker), using the DataEvent function with a trigger value.
I need a concurrent task because I don't want loose readings from the first data table code.

Is the next code ok for duty?


'CR1000

'August 2009.

'Adrian.

'-----------------------------

'Declare Constants, Variables and Units

Const Cte = 0.0081

Const RadMax = 1200

Public Batt_Volt

Public DiffVolt(8)

Units Batt_Volt=Volts

Units DiffVolt=mV

'-----------------------------

'---------------Tables-------------------------

'Define Data Tables

'----------SalidaCr1000------------

DataTable(SalidaCr1000,True,-1)

DataInterval(0,10,Min,10)

Totalize(1,DiffVolt(1),FP2,False)

FieldNames("PSP")

Totalize(1,DiffVolt(2),FP2,False)

FieldNames("Canal2")

Totalize(1,DiffVolt(3),FP2,False)

FieldNames("Canal3")

Totalize(1,DiffVolt(4),FP2,False)

FieldNames("Canal4")

Totalize(1,DiffVolt(5),FP2,False)

FieldNames("Canal5")

Totalize(1,DiffVolt(6),FP2,False)

FieldNames("Canal6")

Totalize(1,DiffVolt(7),FP2,False)

FieldNames("Canal7")

Totalize(1,DiffVolt(8),FP2,False)

FieldNames("Canal8")

EndTable

'----------------------------------

'---------BatteryTest-----------------

DataTable(BatteryTest,True,-1)

DataInterval(0,1440,Min,10)

Minimum(1,Batt_Volt,FP2,False,False)

EndTable

'-------------------------------------

'-----------SparkTracker------------------------

DataTable( SparkTracker, True, -1)

DataEvent (2,DiffVolt(1)/Cte>RadMax,1,1)

Sample(1,DiffVolt(1),IEEE4)

EndTable

'-----------------------------------------------

'----------------EndTables----------------------

'-------'Main Program-------------------------------------------------------------

BeginProg

Scan(1,Sec,1,0)

'---------------------------------------------------------

'Default Datalogger Battery Voltage measurement Batt_Volt:

Battery(Batt_Volt)

'---------------------------------------------------------

'---------------------------------------------------------------

' Differential Voltage measurements

VoltDiff(DiffVolt(1),1,mV25,1,True,0,_50Hz,1,0.0)'Channel 1

VoltDiff(DiffVolt(2),7,mV25,2,True,0,_50Hz,1,0.0)'Channel 2 al 8

'---------------------------------------------------------------

'---------------------------------

'Call Data Tables and Store Data

CallTable(SalidaCr1000)

CallTable(BatteryTest)

CallTable(SparkTracker)

'---------------------------------

NextScan

EndProg

'-----------EndMainProgram---------------------------------------------------------


Note : Was compiled in pipeline mode.

Thanks,


jra Aug 27, 2009 09:06 PM

Yes, that will work. The different DataTables keep track of their processing, Totals, Averages, etc. independently.

The one thing I would note is that you should specify the number of records in event driven tables. Take a look at the last tutorial called "Data Table Memory Allocation" here:
http://www.campbellsci.com/19_1_773

Change this line: DataTable( SparkTracker, True, -1)
to something like this: DataTable( SparkTracker, True, 1000)

Post again if you have other questions.
Regards,
Janet


Adrian Aug 27, 2009 10:56 PM

Hi Janet, thanks a lot for your responds.

I will change the line you say and this one: DataTable(BatteryTest,True,60) for DataTable(BatteryTest,True,-1) instead (two months of battery check is enough).

Let DataTable(SalidaCr1000,True,-1) without change make the rest of memory avaliable for this Data Table. Is that correct?

By the way, the tutorials are MS. exe format. This is not appropriate for mi due I have GNU/Linux in my PC box with internet link.

Kind regards, Adrian.

* Last updated by: Adrian on 8/27/2009 @ 4:57 PM *


jra Aug 28, 2009 04:58 PM

Hi Adrian,

Let DataTable(SalidaCr1000,True,-1) without change make the rest of memory avaliable for this Data Table. Is that correct?

Yes. The datalogger will first allocate memory for your fixed sized tables (BatteryTest and SparkTraker in your example) then the remaining memory will be evenly allocated to the other auto allocated tables (SalidaCr1000 in your case).

Let us know if you have other question.
Have a good weekend.
Janet


Adrian Aug 28, 2009 05:34 PM

Hi Janet, thanks again.

Good weekend for you too.

Kisses, Adrian.

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