Error log?

Moderators: TomKerekes, dynomotion

4minnovations
Posts: 45
Joined: Fri Nov 01, 2019 7:18 pm

Error log?

Post by 4minnovations » Tue Aug 11, 2020 1:24 pm

hello,
I have a machine which uses a kflop, a snapamp and a konnect.
The machine stops once in a while in overload.
I was wondering if there was some kind of log I could consult to find out which axis is in trouble.

User avatar
TomKerekes
Posts: 1602
Joined: Mon Dec 04, 2017 1:49 am

Re: Error log?

Post by TomKerekes » Tue Aug 11, 2020 4:58 pm

Hi,

No there isn't. Not sure what you mean by "overload".

You could create one using a C Program to monitor things and log things. Such as:

Code: Select all

#include "KMotionDef.h"

void Log(int axis, int *Last);

void main()
{
	int Last0 = ch0->Enable, Last1=ch1->Enable, Last2=ch2->Enable;
	
	for(;;)
	{
		Delay_sec(1);
		Log(0, &Last0);		
		Log(1, &Last1);		
		Log(2, &Last2);		
	}
}

// Log to file whenever the axis is disabled
void Log(int axis, int *Last)
{
	int Now = chan[axis].Enable;
	
	if (*Last && !Now) // was enabled but not now?
	{
		FILE *f; /// yes, log
		f=fopen("c:\\Temp\\KFlopLog.txt","at"); // open in append mode
		fprintf(f,"Axis %d disabled Time since boot %f seconds\n",axis, Time_sec());
		fclose(f);
	}
	*Last = Now;
}
You could also have your App register to receive Console messages.
Regards,

Tom Kerekes
Dynomotion, Inc.

HowHardCanItBe
Posts: 17
Joined: Tue Nov 20, 2018 5:39 pm
Location: Sharonville, Ohio

Re: Error log?

Post by HowHardCanItBe » Thu Sep 17, 2020 9:05 pm

Tom,
Thanks again for the awesome support you provide.

Is the Windows PC's Date and Time available to timestamp logged events in our C Program? KMotion isn't normally running, and a KFLOP is running "headless" on a different machine. I'm logging when (and where) bits (limit switches, Estop) go low. After searching, I suspect not.

User avatar
TomKerekes
Posts: 1602
Joined: Mon Dec 04, 2017 1:49 am

Re: Error log?

Post by TomKerekes » Thu Sep 17, 2020 9:47 pm

Hi HowHardCanItBe,

No. I suppose you could create a small PC Program to write the PC's Date/Time to KFLOP. Then have KFLOP trigger it when needed or at some point to sync KFLOP time and clock time.
Regards,

Tom Kerekes
Dynomotion, Inc.

4minnovations
Posts: 45
Joined: Fri Nov 01, 2019 7:18 pm

Re: Error log?

Post by 4minnovations » Wed Feb 17, 2021 7:59 pm

Hi Tom,
my machine keeps stopping once in a while.

I would therefore like to be able to make an error log as you described to me. However, I don't know where to implement this.

How I can make sure that I have the information before the stop to put in my error log?

User avatar
TomKerekes
Posts: 1602
Joined: Mon Dec 04, 2017 1:49 am

Re: Error log?

Post by TomKerekes » Thu Feb 18, 2021 1:13 am

Hi,

You could put it into the forever loop in your initialization C Program. See here.

I'm not sure what information you are referring to. Could you describe what kind of system you have and what happens?
Regards,

Tom Kerekes
Dynomotion, Inc.

4minnovations
Posts: 45
Joined: Fri Nov 01, 2019 7:18 pm

Re: Error log?

Post by 4minnovations » Thu Feb 18, 2021 1:01 pm

Thanks Tom, my system is a pick and place for bags of flour. It works well in general and has been for 1 year. However, the system sometimes stops when moving one or more axes.

ch0: displacement in X
ch1: displacement in Y
ch2: movement of the rotating gripper
ch3: displacement of an elevator to bring the bag to the right height

The problem is an intermittend problem. In general, during a synchronized movement of ch0 and ch1. The machine stops and you have to start all over again.

So I would like to be able to add an error log t
PAL-Master - 20200928a - copie installee 20201005.c
(44.31 KiB) Downloaded 24 times
o know where the error comes from.

download/file.php?mode=view&id=1507

User avatar
TomKerekes
Posts: 1602
Joined: Mon Dec 04, 2017 1:49 am

Re: Error log?

Post by TomKerekes » Thu Feb 18, 2021 4:11 pm

Hi,

You forgot to include fonctionsCalculs4Mv20200928.h

The program is big and nearly 65536 maximum bytes for a Thread so you might want to watch the size or not use the next Thread.

Counting Z encoder AB quadrature counts in software in encodeurZ is probably not reliable with such a big loop.

What do you mean "machine stops and you have to start all over again." When the machine stops what is the state? Are the motors enabled? Is your C Program running? Does KFLOP still contain your configuration? Are you Flashing anything into KFLOP? Anything printed on the Console?
Regards,

Tom Kerekes
Dynomotion, Inc.

4minnovations
Posts: 45
Joined: Fri Nov 01, 2019 7:18 pm

Re: Error log?

Post by 4minnovations » Thu Feb 18, 2021 5:05 pm

Hi Tom,

excuse me for the missing file:
fonctionsCalculs4Mv20200928.h
(1.53 KiB) Downloaded 11 times
I am aware of the size of the program and am doing everything I can not to exceed 65536 bytes.

However, I am using thread 7 for this program. If I understand well, it would be better to use thread 1 and make sure nothing is started in thread 2. This is right?

For the Z encoder, it works relatively well, as it is a very slow encoder, i.e. 100 counts for 20-30 sec.

For the stops, what I know is that the axes stop moving on their own and do not start again. Program C must be restarted so that the axes can move.

For the other questions, I cannot answer 100% for sure, because it has been a long time since I was present during the stop.

What we have seen is that there is a snapamp error (watchdog ??) which stops the movement (internal estop).

What we want is to be able to know the states of the snapamp channels just before the snapamp error occurs to be able to narrow down the issue.

User avatar
TomKerekes
Posts: 1602
Joined: Mon Dec 04, 2017 1:49 am

Re: Error log?

Post by TomKerekes » Thu Feb 18, 2021 6:19 pm

I am aware of the size of the program and am doing everything I can not to exceed 65536 bytes.

However, I am using thread 7 for this program. If I understand well, it would be better to use thread 1 and make sure nothing is started in thread 2. This is right?
The only advantage would be that KMotionCNC STOP doesn't Halt Thread #1 like it does to all other Threads.

What we have seen is that there is a snapamp error (watchdog ??) which stops the movement (internal estop).
There isn't really such a thing. There is a fault condition that disables the Motor Output when there is a peak current overload or Temperature is over 70C.

Without knowing what the error causes its hard to know of a way to know it happened or what to log.

You might simply add a button that the operator can push after the problem occurs that prints to a file a bunch of things like Axis Enables, Axis Positions, Axis Destinations, ch->LastFollowingError, some Axis Configuration variables to tell if it is still configured, extern int ThreadActive; (which Threads are running). You might copy your state machine variables to persist.UserData[] variables so those can be printed to know what state your code is stuck in.

SnapAmp status can be monitored like this:

Code: Select all

#include "KMotionDef.h"

main()
{
	int s;

	WaitNextTimeSlice(); // make sure we don't get interrupted
	s=ReadSnapAmp(SNAP0+SNAP_STATUS);

	printf("Fault          = %d\n",(s>>0)&1);
	printf("Over Current 0 = %d\n",(s>>1)&1);
	printf("Over Current 1 = %d\n",(s>>2)&1);
	printf("Over Temp 0    = %d\n",(s>>3)&1);
	printf("Over Temp 1    = %d\n",(s>>4)&1);
	printf("Fan            = %d\n",(s>>5)&1);
}
But after the machine stops/disables the status might be of no value.

You might monitor the Fault bit and log if it ever occurs with possibly other info.

Sorry for no simple solution.
Regards,

Tom Kerekes
Dynomotion, Inc.

Post Reply