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.

Control SW12-1 Turn on heating on CR1000X


dreamfox7612 Aug 20, 2021 09:23 AM

Dear All i have purchase a new CR1000X and i have a problem with my code.

Interval 30 min data,Turn on heating in 20 minutes.

After recording, turn off the heating and wait for the next turn on.

CODE:

Public Batt_Volt
Public TDP_mv(8)

Units Batt_Volt=Volts
Units TDP_mv=mV

'Define Data Tables
DataTable(Table1,True,-1)
DataInterval(0,30,Min,10)
Average(1,TDP_mv(1),FP2,False)
Average(1,TDP_mv(2),FP2,False)
Average(1,TDP_mv(3),FP2,False)
Average(1,TDP_mv(4),FP2,False)
Average(1,TDP_mv(5),FP2,False)
Average(1,TDP_mv(6),FP2,False)
Average(1,TDP_mv(7),FP2,False)
Average(1,TDP_mv(8),FP2,False)
Average(1,Batt_Volt,FP2,False)
EndTable

'Main Program
BeginProg
Scan(10,Sec,1,0)
'Default Datalogger Battery Voltage measurement Batt_Volt:
Battery(Batt_Volt)
'Generic Differential Voltage measurements TDP_mv(1):
VoltDiff(TDP_mv(1),8,mV200,1,True,0,_50Hz,1.0,0.0)

SW12 (SW12_1,TimeIsBetween (20,10,30,min) ,1)

'Call Data Tables and Store Data
CallTable(Table1)
NextScan
EndProg

But on the CR1000X this code doesn't work.

i have try the instruction SW12 but no power.

Can help me have an idea to miodify my code ?

Regards

Thank's All


Nico Aug 24, 2021 09:40 AM

I guess

'CR1000X

Public Batt_Volt
Units Batt_Volt=Volts

Public TDP_mv(8)
Units TDP_mv=mV

DataTable(Table1,True,-1)
  DataInterval(0,30,Min,10)
  Average(8,TDP_mv(1),FP2,False)
  Average(1,Batt_Volt,FP2,False)
EndTable

BeginProg
  Scan(10,Sec,1,0)
    Battery(Batt_Volt)
    VoltDiff(TDP_mv(1),8,mV200,1,True,0,_50Hz,1.0,0.0) ' measure TDP's
    SW12(SW12_1,TimeIsBetween(20,30,30,min),1)
    CallTable(Table1)
  NextScan
EndProg

 OR more explicit..

BeginProg
  Scan(10,Sec,1,0)
    Battery(Batt_Volt)
    If TimeIsBetween(20,30,30,min) Then: 'check if between or outside of the last 10 minutes in a 30min interval
      SW12(SW12_1,1,1) 'switch ON as between 20-30 
    Else:
      SW12(SW12_1,0,1) 'switch OFF as outside of 20-30 
    EndIf  
    VoltDiff(TDP_mv(1),8,mV200,1,True,0,_50Hz,1.0,0.0) ' measure TDP's
    CallTable(Table1)
  NextScan
EndProg

 What your code did looked like this on the SW_1 port (checked with an oscilloscope after speeding up the scan loop (1msec) and adjusted the TimeIsBetween command to msec like so TimeIsBetween(200,100,300,mSec):

12V ----------    -----------    ----
             |    |         |    | 
             |    |         |    |
 0V          ------         ------

sec 0   10   20   30   40   50   60

meas              X              X

 So the last 10 minutes of a half an hour the TDP were not powered while they have been powered the first 20 minutes.. exactly opposite how you wanted it.


dreamfox7612 Aug 25, 2021 02:43 AM

Thank you so much for helping!!!. 

Reason I got the wrong direction.

Thank's!!!!!

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