Jump to content

PWM HSO Configuration with Target


Skof

Recommended Posts

Dear all, 

I have US5-B5-TA30 PLC with UIS-WCB2 modules and expansion adapter. 

I want to use PWM HSO for step control and set duty cycle, frequency and Target. 

In VisiLogic this was easy in HW Configuration setting High Speed Output (Step Control). In the attach you can find the example I made in VisiLogic. 

(LEVO - means left, DESNO - means right, on the display in the example). 

 

I am having troubles configuring the HSO on the WCB2 as PWM with target. I am relatively new to UniLogic, so please help. 

Thanks, 

BR

 

HSO Proba - SAMBA.vlp

Link to comment
Share on other sites

  • MVP 2023

See my answer to your other post.  The Vision functionality you're looking for with a fixed number of output pulses has not yet made it to UniStream.  I don't know what the Creator's plans are on this.

There is a brand new Ethernet IO module out that is a "Pulse" type part number URD_02PU.    I think you need one of these- ask a friendly dealer near you.

Joe T.

Link to comment
Share on other sites

Tnx Joe, I will check it with my dealer. 

The point is to send certain number of pulses with known frequency and let say duty cycle 50.0%  in order the stepper to open and close a valve. 

But for this I need the Target value that was present in VisiLogic. 

Is there another way in UniLogic to this somehow? 

BR

Link to comment
Share on other sites

  • MVP 2023

There's always a way, but we'll have to work within the rules of what we have.

I looked at your Samba project and you have the frequency set by a variable on the screen.  Also the number of steps needed.

The frequency  will be the limiting factor in trying to figure out how to UniStream this functionality, as we will be hobbled by the scan time.  Or we can use PWM and guess at how long to leave it on.

So we need to know the frequency and what happens to the valve if you send too many steps.  Or are you trying to send the valve to a certain postion?

Joe T.

Link to comment
Share on other sites

The valve is opened and closed via stepper motor, and I am trying to achieve a precise water flow measured from flowmeter. 

So the idea is like this, the pump starts pumping and I send "X" number of pulses in one direction so the valve is opening, (let say 2000 pulses/revolution). As the flow (from the flowmeter) is 

nearing the "set point" the number of pulses and frequency fall down (this I could achieve with linearization).  If setpoint >= flow  I change the direction. But I have to take in 

consideration the current position, which would give me the "Target value" in VisiLogic and store it and add and subtract from it with each turn. 

But If I cant get a hold of the position of the valve, there is a problem. If the motor keeps turning it will break the valve.. 

 

Tnx

 

 

Link to comment
Share on other sites

  • MVP 2023

So we need to count the pulses going out.  The scan time of the controller will dictate how fast we can do this.

1 hour ago, Joe Tauser said:

So we need to know the frequency

I really did mean it when I asked this.

If the frequency is relatively low the UniStream will be able to handle it.  Go online with your UniStream and let us know what the scan currently is.

Joe T.

Link to comment
Share on other sites

35 minutes ago, Joe Tauser said:

Go online with your UniStream and let us know what the scan currently is.

I am beginning developing it.  The frequency is not set yet, I wanted to make it variable. Max value would be around 10kHz  (not necessarily it could be up to 2kHz). You think we can use the scan cycle to count the pulses using the rising edge on the output of the UDFB for PWM?  

But the program will get bigger for I have to control 3 HSO PWM valves for 3 lines.  I also have 6 AI and 3 AO signals for other purposes. I just think 

that maybe best solution is to go back to VisiLogic at this early stage.  Let me think this trough for the next 2 days.  I will write again for sure. 

BR

Link to comment
Share on other sites

  • MVP 2023
1 hour ago, Skof said:

But If I cant get a hold of the position of the valve, there is a problem. If the motor keeps turning it will break the valve.. 

Maybe my post will not help solve the problem with stepper motor,

but I want to note (you wrote about the possibility of breaking the valve) - this system, even with the best settings, will break it someday ...

 

Therefore, I recommend abandoning the stepper motor and consider other options:

1) use the 3 state control actuator  with analog feedback (Belimo or other type), and apply the control algorithm idea described in the example

V120_PID_motorized_valve_output_with_physical_feedback.vlp  from Visilogic help.

2) use the 3 state drive without feedback but with the ability to safely stop at the end points and not break even with a constant control signal.

An example PID with motorized valve.U90  is present in the U90ladder software  program.  You can use idea from this code.

3) use actuator with analog input

3) use actuator with networking future and control it via Unistream.

Link to comment
Share on other sites

Hi kratmel, 

Yes I agree, working with analogue signals is much easier. But the parts (hardware) were already there... Now I have to figure out a way to work with what is given. 

Why do you think it will break eventually?  In the example in visilogic I attached, I can get hold of the position with every turn, then (not included in example, but possible) I can store it in another variable and limit it so it wont go too far.  However, lets see what can we do with UniLogic, or maybe I can go back to Visilogic and try to swap this configuration with another with my dealer. 

Tnx, BR

Link to comment
Share on other sites

  • MVP 2023

Hi Skof,

Stepper motor by definition - an open loop control system.
After switching it on, it must be set to a known position. (Homing process)
You probably think it will be able to stay where it left off.

However, this is only possible if the driver controls it by natural characteristics (magnetic step). That is, the 200-step/rotation motor must be electrically rotated only for 200 steps/rotation.

If you use a driver with step divider(from 2 to 128 or more) - after shutting it down, it will forget electrically divided step where it was (and motor will rotate a little by himself to the magnetic step position) - and there will be an offset that you will not be able to take into account . You can test it...

Therefore, either you have to go to the zero position (home sensor) every time you turn it on, or sooner or later there will be a moment when the engine breaks the valve.

Another way - make that the motor could not break the shaft mechanically (make mechanical stops), or electrically - put limit switches.

Can you post hardware setup (motor, driver, valve) foto?

Link to comment
Share on other sites

  • MVP 2023

There's an old example in Visilogic for a V120 where an output is physically connected to a HS input to get "stepper control".  This pre-dates the HSO option in Vision and was the way to get a grip on the number of pulses going out.  You could accelerate and decelerate the pulse train by modifying the frequency sent to the output and monitoring the pulse count from the HS input to figure out where you were.  A bit of a hack, yes, but it did work.

As I said, there's always a way.  The WCB2 block has two internal HS blocks that can be configured as HS input counters or PWM outputs.  In PWM mode, the frequency goes up to 100 kHz so we're within your requirements.

So this will handle one output.  You mentioned you want three.

The best option for you  is a hybrid system running an EXF-RC15 module off the UniStream's CANbus port.  This will give you the three outputs you want with the Vision-style HSO stepper configuration. 

Joe T.

Link to comment
Share on other sites

  • MVP 2023

HI Skof, for the reasons and mucking around already stated by Joe and Kratmel, I'd be changing to analogue actuation.

Most valves have the actuator as a separate device that is very easily changed, often only a few bolts.  The various actuators are not expensive.

In your case I feel it would be much cheaper to do this instead of going to extra costs and complexity, yet still let you use UniStream.

The valves you already have may be unusual in that the actuator is integrated into the valve, but I feel sure if you looked at the maker's info sheets you'd find that going the analogue path would eventually be much cheaper and let you continue with UniStream.  I've yet to see an actuator that can't be separated from the valve body with the body remaining sealed in the flow line.

Kratmel's good observations on how steppers can lose track of where they are is important even if things are 24/7.  It is a good idea to incorporate a home every now and then if you can.  With analogue actuators, most of them also come with An out so it is easy to get the valve to go to where you know a flow rate will be close, and then fine tune it with the flowmeter (assuming pressures and mediums are constants) to better remember that position etc.   3 point control also works ok if an external flow meter is in use, in that the closed loop lets you get there accurately, but I have found it is much easier on all the mechanicals to do this with analogue due to the "softer" nature of the control.    I've had Analogue actuation last many, many years, whereas other methods are generally much shorter life.  That may not match other people's experiences, but it is my gained knowledge from years of doing it.  Also, it is well worth remembering that any sort of actuator does have "slop" in the gear train that gradually increases over usage.

Finally I'm intrigued that your motor will "break the valve."   All the stepper driven stuff I work with cannot overpower the mechanicals enough to break things....that's the way they "home" at whichever end is chosen. 

cheers, Aus

Link to comment
Share on other sites

Hey guys, 

First, @kratmel tnx for the offset tip I will take it in consideration. 

Second, @Joe Tauser, tomorrow I will try to simulate and connect HSO with HSC input and check the counting. I have 2xWCB2 and the I/O on the PLC, so I am covered for 3 counts. I am not sure if I can divide the HSO signal in the same time to input and to the drive hmm ? I will test it. But, when the counter reaches let say some target value, and I disable the PWM, is it going to be fast enough to stop it in the right count, or maybe there is some interrupt I can use ? This I will check tomorrow too. 

Third, in the coming week I will visit customer site to check for hardware limitations and take some photos. I will definitely check for possibility of installing limit switches for protection and as home position. Unfortunately it is a problem visiting this period because of the COVID-19, but I will try to arrange. 

Finally, @Ausman, tnx for the comment, I will check customer site and see what can we do and calculate costs.  And for the braking part,  it is expression,  I am just cautious, although it is a strong stepper :)

BR

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...