Hello Guest it is April 26, 2024, 04:05:35 AM

Author Topic: Spindle speed not correct  (Read 5312 times)

0 Members and 1 Guest are viewing this topic.

Re: Spindle speed not correct
« Reply #10 on: January 24, 2021, 08:43:50 AM »
Hello, the PMC is the programmable Mach controller ... it is much like a PLC and will update each scan. What we will do to make this work is read the spindle speed and set the value to the analog register. This will allow is some room to play around with the values. We can map what you get for a command to what you need for an output. If you want to do this I will make up the code as I think this is a tool that could help others later on. You tell me what you want to do :) funny enough this is how I made the code for surface mapping and screw mapping. The problem and the users change but the math to solve them stays the same lol. I suspect I could make this code in a few hours or so. Make a deal, if I do this we can post the code here and you tell how to make it work, a white paper is what I would call it. Sound like a plan?
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com

Offline MN300

*
  •  298 298
    • View Profile
Re: Spindle speed not correct
« Reply #11 on: January 24, 2021, 09:14:44 AM »
I have looked over your information. The first two parameter lines have what I assume are typos as the drive does run.

I interpret PD073 Lower Analog Frequency to be the speed the VFD will run when the analog voltage is zero. When a manual potentiometer is used this would set the minimum speed the operator could select. For your use this should be zero as your analog voltage out starts at zero.

You didn't list your value for PD011 Frequency Lower Limit. This is where the 120 Hz minimum you selected should be.
Re: Spindle speed not correct
« Reply #12 on: January 24, 2021, 10:34:13 AM »
Sorry, yes a typo, PD001 is set to 1, PD002 also set to 1. PD011, the frequency lower limit, should have been in there as well, it is set to 120Hz currently though I have tried it at zero with no obvious effect since PD073 is also in play.
I have also tried playing with both the PD011 and PD073 parameters, as they both set the lower operating frequency, but it seems that the PD073 value has the effect of altering the resultant spindle speed over the entire range, whereas PD011 just does what it’s supposed to, ie set a minimum speed.
Re code for the PMC - I’m happy to do whatever I can, though I think I’d need to do some background reading to get an understanding of the topic. The spindle isn’t fitted with any sort of speed sensor, so presumably you would take the speed info from the G code?? As for the PMC, do you mean the Ethernet Smoothstepper controller, or is it a separate bit of hardware?
Re: Spindle speed not correct
« Reply #13 on: January 24, 2021, 11:03:09 AM »
The PMC is a place where we can run some code on your machine to customize the machine. It is loaded in the screen edit mode.. Anyway that part is easy ! The hard part is to make the code ... I just happen to have made the code this morning for fun :) What can I say I don't get out much LOL
 Here is the code :
Code: [Select]
-- Fit Spindle Speed with linear interpolation

function buildtbl()
rpmtbl = { points = 0,
   addPoint = function (self, commandRPM, trueRPM )
self[tonumber(self.points)] = {}
self[tonumber(self.points)].commandRPM = commandRPM
self[tonumber(self.points)].trueRPM = trueRPM
self.points = self.points + 1
end,
linearInterp = function(self, RPM)
local low = -1
local high = -1
for i=0, self.points-1,1 do-- loop through the points and get the high and the low around the requested RPM
if (self[i].commandRPM <= RPM) then
low = i
end
if (self[i].commandRPM >= RPM) then
high = i
break
end
end
--check to see if the point is on the table, if not simply return what was input
if(high == -1 or low == -1)then
return RPM
end
if(high == low) then
return self[low].trueRPM
end
--y = y1 + ((x – x1) / (x2 – x1)) * (y2 – y1)
--time to figure it out!
local NewRPM = self[low].trueRPM + ( (RPM - self[low].commandRPM) / ( self[high].commandRPM -self[low].commandRPM )) * (self[high].trueRPM  - self[low].trueRPM )
return NewRPM
end,
}

--To add a point call the addPoint function with the Requested PRM, Than the True RPM (this must be done without this function active)
-- Example Command 500 RPM Spindle is teally going 750 
-- The following call would be made rpmtbl:addPoint(500 ,750)
rpmtbl:addPoint(100,10)
rpmtbl:addPoint(200,100)
rpmtbl:addPoint(2000,2500)
rpmtbl:addPoint(3000,5000)
end



function calcRPM(rpm)
-- take the requested RPM and adjust based on the table fitting points
if(rpmtbl == nil) then--build a global table on the first scan
buildtbl()
end
local adjRPM = rpmtbl:linearInterp(101)

end
local SpindleRPM = 2500
local outputRPM = calcRPM(SpindleRPM)

I know this is scary to see the code but all you really need to do is look at the following lines:
   rpmtbl:addPoint(100,10)
   rpmtbl:addPoint(200,100)
   rpmtbl:addPoint(2000,2500)
   rpmtbl:addPoint(3000,5000)

The first number is the RPM you asked for the 2nd one is what you got for an RPM. You can add as many points as you would like. This thing expands every time you add a point. If you ask for an RPM outside of the range it will just return what you sent . You think you can get that data ? I think you had it in your graph ;)


Thanks
Brian
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com

Offline MN300

*
  •  298 298
    • View Profile
Re: Spindle speed not correct
« Reply #14 on: January 24, 2021, 11:09:17 AM »
Setting PD073 to something besides zero changes the offset and the slope of the requested speed to frequency tracking. Are you sure you have tried PD011-120 and PD073=0 ?
Re: Spindle speed not correct
« Reply #15 on: January 24, 2021, 12:42:06 PM »
MCN300 - I was pretty sure I tried it, but to be certain I have just checked again, with PD011 set to 120 and PD73 to zero, with the following results:
Requested speed, Measured speed, Hz display on VFD
9000, 7200, 120
12000, 7200, 120
15000, 9000, 150
18000, 12000, 200
21000, 15250, 258
24000, 18800, 312
As you can see, it doesn’t get anywhere near the 400Hz specified elsewhere in the parameters. The only way I can get that is to set PD073 to 400 (which of course is pointless), or to run the vfd manually by disconnecting the analog signal from the BOB and using my benchtop power supply.

Brian - I don’t think anyone gets out much at the moment, not in the U.K. anyway!
I’ve had a very quick scan through the code and, with your comments, can recognise what some of it does even if I wouldn’t be able to write it myself. I’ll have a more detailed look later this evening to see if I really understand it.
To my amateur eye it would seem the approach would be to make a backup of the existing (WX4) screen set, copying and pasting the code into a clean screen set after I’ve put in the rpm data needed and then testing the result. You’d need to point me to the right place to paste the code of course.
If it’s going to be a help to others, then I will gladly write it all up as a possible solution, graphs, photos etc to make it readable.
Re: Spindle speed not correct
« Reply #16 on: January 24, 2021, 03:44:37 PM »
If we put it in the PMC it will be very portable :) I can show you how that is done. Very easy!
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: Spindle speed not correct
« Reply #17 on: January 26, 2021, 06:53:26 AM »
I've had a look at the code. But i wonder if there will be a problem actually implementing it. At the moment it seems that the top speed is limited to 312Hz or around 18,800 rpm. That is presumably because the analog voltage is being limited to around 7.5volts. While it will be possible to substitute actual speeds for commanded speeds with the code, I don't see how that will enable any speeds over 18,800 to be obtained, since whatever anomaly is limiting the analog voltage to 7.5 volts is still going to be present.
This makes me wonder if the best options are to investigate modbus control or to replace the inverter. The modbus option is attractive as the hardware only costs a few bucks, in contrast to a decent name-brand vfd. Against the modbus option is that Huanyang vfds apparently don't conform to normal standards so the Mach4 modbus plug-in may well not work.

Offline MN300

*
  •  298 298
    • View Profile
Re: Spindle speed not correct
« Reply #18 on: January 26, 2021, 07:40:45 AM »
Your VFD might be usable if you are willing to give up the protection of having the minimum speed set in the VFD and are careful not to command too low a speed from MACH4.
If your analog output is limited to 7.5 volts the VFD has a 0 to 5V option.

It just occurred to me that the symptoms might be explained if you have connected the analog signal to the current input instead of the voltage input. The correct terminals are ACM and VI
Re: Spindle speed not correct
« Reply #19 on: January 26, 2021, 10:00:48 AM »
It’s definitely connected to VI and ACM, and parameters set for 0-10 volts.
I think you had it right in one of your earlier replies - the VFD is probably asking the breakout board for a bit more current than it can supply, so the voltage drops.
I’ve got a usb-RS485 converter ordered, so I will have a play with it to see if the Huanwang understands Mach4 modbus and if that doesn’t work it will be relegated to running an old bandsaw in the workshop, and replaced with something better.