Logging Data based on range of tag values

Post Reply
SteveCody
Posts: 1
Joined: Wed Jul 11, 2018 7:56 pm

Logging Data based on range of tag values

Post by SteveCody »

I wish to log data (continuously) when a tag is between a range of values.

In my application, a welding process progresses through a number of steps. There is a tag from the controller which tells me the current step.

I wish to log trend data continuously when the welder is, say, between step 7 and step 10.
1. What is the best way to trigger this action?
2. How can I control the rate at which the data is logged?

Steve

Derkins.Goblertroter
Posts: 13
Joined: Tue Sep 04, 2018 1:20 am

Re: Logging Data based on range of tag values

Post by Derkins.Goblertroter »

Read the documentation, once in a while it has just what youre looking for.

Create a script module and initialise a Timer and declare a TimeSpan on ScriptCreated event

Code: Select all

private static Timer logTimer = null;
		private TimeSpan interval;
		
		void ScriptModule1_Created(System.Object sender, System.EventArgs e)
		{
			logTimer = new Timer();
			logTimer.Interval = 1000;
			logTimer.Enabled = true;
			logTimer.Tick += Tock;
			
			interval = new TimeSpan(0);
		}
In the Timer tick event we check if the value is in range and set the Log time interval as so :

Code: Select all

void Tock(System.Object sender, System.EventArgs e)
		{
			interval = TimeSpan.FromSeconds(Globals.Tags.IntervalVAL.Value);
			Globals.DataLogger1.LogInterval = interval;
			
			if(Globals.Tags.Test_VAL1.Value > 7 && Globals.Tags.Test_VAL1.Value < 10)
			{
				Globals.DataLogger1.Start() ;
			}
			else
			{
				Globals.DataLogger1.Stop() ;
			}
		}

Derkins.Goblertroter
Posts: 13
Joined: Tue Sep 04, 2018 1:20 am

Re: Logging Data based on range of tag values

Post by Derkins.Goblertroter »

There are certain parameters that the iX developer InteliSense doesnt pick up, for example the DataLoger.LogInterval

Post Reply