Jump to content

Simple XY cordinate movment by HSC counting - activating output by multiple conditions


MarinZ

Recommended Posts

Hello!

 

I have machine which moves left - right, up - down  based on counts from HSC, counts are like 8 pulses per 1cm of movement as precision is not factor here. Since i have multiple points ( liek go forward for 100, back 100, forward 50 etc, etc) I did solve those by counting and compare blocks, so when HSC value goes over set value it sets coil and when other rung does it sets other and resets that one....

 

And than I do run inverter by classic run fwd and run rev logic command from  outputs. As you can see I do have direct coil for each output on PLC and I set them ON by contact, which are triggered by set/reset coils on rung where rest is. What you think is that good practice or not? For now it works ok, and even great for this kind of precision. But in case I need to have multiple choices of movements and triggering direction, than things get veeeeery complicated (much of rungs and contacts for set/reset). I have posted code and would like to hear if someone had better more effective approach  to this, plus is it better to trigger output this way, or direct from compare blocks?

P.S. This is just part of project, but you will get point.

 

thanks!

 

part1.jpg

part2.jpg

hsc_test_v1.ulpr

Link to comment
Share on other sites

  • MVP 2023

If the example given by you works and fulfills the task, then in this case it is not worth changing it.

Solving a similar problem for uniaxial movement, I used the State Machine.

After starting, the PLC solves the task of finding the zero coordinate.

The State Machine is made in such a way that it constantly compares whether the given coordinate is equal to the desired one with a predetermined +- precision. In the first state where we get to after setting the zero position, three conditions are used:

1) the specified coordinate lies within the required +- accuracy - we are not going anywhere Motion state = stop

2) the specified coordinate is greater than required - we move in the direction of decrease Movement state = back.

3) the specified coordinate is smaller than required - we move in the direction of increasing the coordinate.

Using this principle, I can set the coordinate in an arbitrary order with another state machine or by going through the rows of the Data Table. I don't need to repeatedly check if the counter is in the right coordinate. This is done automatically by the state machine.

The output of the constructed algorithm is discrete signals for the frequency converter to move - forward - stop or backward.

To speed up the process, I constantly check whether the distance to be traveled is long. If so, then I turn on the high-speed movements with an additional discrete output.

Unfortunately, this algorithm is implemented in Visilogic, but I think you can come up with a similar one for Unilogic

Link to comment
Share on other sites

I know for state machine, actually my approach is quite similar as you can see. I constantly check when movement is withing limit and when is out that other movement is set untill it reaches limits and it continues..... Only I use compare block, instead state machine. But, I would just like too see if there is another, maybe more flexible idea to implement same thing. As, if i want more movements , than thit becomes relly complicated.

Link to comment
Share on other sites

  • MVP 2023
1 hour ago, MarinZ said:

As, if i want more movements , than thit becomes relly complicated.

One of my latest applications was to create a two-axis stepper motor machine with freely programmable position, sequence and speed parameters for each movement. In addition, in some phases of movement, it was necessary to implement the procedure of turning on and off additional devices participating in the process, according to the current coordinate.

The main task was to provide the user with the ability to select a sequence of movements and save the selected sequence as a separate program in the list of programs. V350, as a two-axis stepper motor controller, received tasks through unican from V1210, on which the sequence programming system was implemented. In this way, it was possible to implement the increase in the number of programmable positions similar to your desire. At the same time, it does not require me as the author of the program to change parameters and sequences of movements.

Actually, this is one of the directions for improving your program.

P.S. Two PLCs are used only because V1210 does not support PTO control of two stepper motors, and it is difficult to implement a user interface for convenient program change on a small screen size.

Link to comment
Share on other sites

To bring topic back. I have spoken with one colegue and he did gave me some point of idea. Maybe I could use arrays which is filled with cordinate. For example, when operator chose start and end point of movement plus increment for every new line of movement. I could write those in array in that mater where array will be filled like table with max and min cordinate incremented for every movement. And then, when motor is started from zero position it moves forward and watch for 0 array where data for stop position are stored. There for example I can store end position 1000, next movement 500Y axis and now check another array element where it says 10X axis, etc, etc.... I don't know how practical this can be, but i think  code would be much more flexibile in way of changing movement and sizes. Also Data Table can be maybe used for this and data table can be edited on HMI or outside......

 

 

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...