SETCOMMAND function does not seem to respond properly

8 years 6 months ago #29530210 by jlpcornelissen2014
The setup
A rotary platform is activated by a motor and must turn 360 degrees or more in both directions. The rotary platform is fitted with an incremental encoder.

A rotary control handle fitted with a rotary position sensor gives a command signal. The signal is from 0.5V at zero degree, rising linearly at 4.5 volts when reaching 360 degrees.

The rotary platform should always align with the control handle through the shortest route (within 180 degrees).

The present configuration parameters are set on Close Loop Position Relative (I have also tried OPEN LOOP with no success)

What goes well
A short script calculates the gap between the rotary platform and the control handle, and the required polarity for the motor to go the shortest route.

Reading inputs from both ends is OK. Calculations and logic condition are showing well on the Motor Control Utility Scripting Simulator.

What goes wrong
Except for emergency stop, the SETCOMMAND function does not seem to respond properly.

For example when running a simple test comparing two variables, the script is running well until when it is time to activate the motor

if (Gap1 > 500) then

SETCOMMAND (_EX,1)
Will work, (also shows that the script is working)

SETCOMMAND (_MS,1)
Will NOT work

SETCOMMAND (_GO,1,100)
Will NOT work either

I only need to power the motor forward or reverse

Any idea what the problem is?

PS: The controller seem to be in good condition except for the Din5 light that light up from time to time in the Motor Control Utility

Please Log in or Create an account to join the conversation.

8 years 6 months ago - 8 years 6 months ago #29530211 by TechSupport
The setcommand(_MS, 1) is wrong. It is setcommand(_MG, 1) to release from E-stop.

Because of this, the next line telling the motor to go +100 won't happen.

Edit:

1 more thing to point out. You can always try to shorthand. Setcommand(_G, 1, 100)

Please Log in or Create an account to join the conversation.

8 years 6 months ago #29530212 by jlpcornelissen2014
I think I was not clear enough in describing the problem, here a more details (3 different tests)

Note: The line “if (Gap1 > 500)” relates to the gap between (_cmdana,1) and (_feedbk,1). I have also setup print command to be able to follow their value in the Console

Test 1 - This group works fine, when condition is met:
motor starts and stops every one second and,
the screen on the console also scrolls and stops every second

if (Gap1 > 500) then
setcommand (_EX,1)
wait(1000)
setcommand(_MG,1)
wait(1000)

Test 2 - This group works strange, when condition is met:
motor keeps running with no difference but screen on the console scrolls and stops every second ???

if (Gap1 > 500) then
setcommand(_MS,1)
wait(1000)
setcommand(_MG,1)
wait(1000)

Test 3 - This group works also strange, when condition is met:
motor keeps running with no difference but screen on the console scrolls and stops every second ??? I have also tried different value for the setcommand with no differences

if (Gap1 > 500) then
setcommand(_G,1,100)
wait(1000)

It seems to me that the script in itself is working fine, the console is responding. But something blocks the command going the power stage of motor 1

Please Log in or Create an account to join the conversation.

8 years 6 months ago #29530213 by TechSupport
If it starts and stops upon command, then likely it is the watchdog timer. It times out every 1 second by default. So to keep the motor running without disabling the watchdog timer, you have to send a command at least once every second.

Since only a portion of script is pasted here it is hard to say what exactly is going on.

In console, you send ^RWD 0 to disable.

In scripting it is setcommand(_RWD, 0)

Please Log in or Create an account to join the conversation.

8 years 6 months ago #29530214 by TechSupport
Correction: Should be setconfig(_RWD, 0)
The following user(s) said Thank You: jlpcornelissen2014

Please Log in or Create an account to join the conversation.

8 years 6 months ago #29530215 by jlpcornelissen2014
Watchdog was already set at zero, I added “setconfig(_RWD, 0)” just to make sure, no difference

I have done plenty of tests
On the Console, the following instructions work perfect
!r
!r 0
!MG
!EX
!C 1 0 (works with different values, motor will spin accordingly)
^mmod 1 0 and ^mmod 1 2 (works perfect)

The equivalent in Script mode works perfect just the same

The problems seems to be only with direct orders to the motor, they are acknowledged be a + on the console but nothing happens

!ms 1 (no response)
!G 1 1000 or !G 1 -1000 or Setcommand(_G, 1, 1000) (no response

I have no idea of the problem

Please Log in or Create an account to join the conversation.

8 years 6 months ago #29530216 by TechSupport
The !MS is motor stop. This is specified to a specific motor channel.

The MS command is similar to the EX command except that it is applied to the specified
motor channel (see "EX - Emergency Stop” on page 168).
Syntax: !MS [nn]
Where: nn = motor channel

You have to send !MG to release it like the emergency stop. I just tested and it works.

Please Log in or Create an account to join the conversation.

8 years 6 months ago #29530217 by jlpcornelissen2014
Thanks for you patience

I know that !MS is for motor stop. I am just trying various very simple instructions to see which ones are working and which ones are not.

I tested !MS 1 again and it does not work on my MDC2230. The console is acknowledging as a valid command with a “+” but the motor keeps spinning full speed (while it stops fine with !EX, and restarts immediately with !MG)

I need to control the speed and direction of my motor and !G is really the command I need the most:
!G 1 1000 or !G 1 -500 or Setcommand(_G, 1, 800): nothing works

Why? Is it the Script, The configuration? This particular model? The firmware?
It is a coincidence that two commands I am having a problem with are the motor stop and start (both motors need to be independent)

I have run tests wired on the output of motor 2 with exactly the same results

Thanks for your assistance

Please Log in or Create an account to join the conversation.

8 years 6 months ago #29530218 by TechSupport
Which mode are you in; open loop, speed?

I'm using the MDC2460 with the latest firmware that is available on the web, 11/21/14. MDC2230 shouldn't be any different since they are using the exact same firmware.

I did my test with a small fan motor in open loop mode.

Please Log in or Create an account to join the conversation.

8 years 6 months ago #29530219 by jlpcornelissen2014
Surprise, !MS 1 and !G 1 xxx are working now

Command Mode is set at Close Loop Relative Position
Firmware is Roboteq v1.2 RCB400 05/25/2013

The problem was Command Priority 1 being setup at Analog and Priority 2 at RS232
It is now setup Command Priority 1 at RS232, Priorities 2 and 3 at none
On the console, punching !G 1 100 and !G 1 -100 has the motor to change direction immediately

It is great, I am glad to see the problem is not the equipment.

I am not to sure how to go from there. I need Analog Input and Scripting

To summarize I need to:
Read the various inputs in the -1000/+1000 format, that works.
Rework the intensity and polarity of the commands to be sent to the motor, that works.

I now realise that it is easy to have the Analog or the RS232/Script to take control.
I am just not to sure how to avoid conflict when combining both modes.

Any cues?

Thanks very much for your patience

Please Log in or Create an account to join the conversation.

Time to create page: 0.106 seconds