News:

  • April 30, 2026, 12:29:38 PM

Login with username, password and session length

Author Topic: A Question on Nested If's Again  (Read 54933 times)

Mike Nash

  • Hero Member
  • *****
  • Posts: 652
Re: A Question on Nested If's Again
« Reply #30 on: January 30, 2017, 01:42:41 PM »
Evilbeard:
You also may need step 1 of the rampsoak to be Init to R103 to initialize the rampsoak. It's been a while so I can't remember if it worked without it or not.

Mike:
I noticed that same problem with .Done. So instead I use a check for .TimeLeft=0 (for .Done) and .TimeLeft>0 (for Not .Done).

Without the Init in step one, I don't get it to work. Without the Init to Setpoint it doesn't work correctly either. (Calling the output "Setpoint" keeps tripping me up. I can guess why it got called that, but it stills feels strange.)

Mike:
I noticed that same problem with .Done. So instead I use a check for .TimeLeft=0 (for .Done) and .TimeLeft>0 (for Not .Done).

This will happen on Program->Run transition, the .Done will NOT be ON, but the .TimeLeft should be 0.  Start Up conditions are one "gotcha" with ladder logic.

OK, but the .Done gets downright frantic looking when .TimeLeft reaches zero.  ;)


New platform adds S-Curve motion and has the concept of virtual axes. As long as you aren't using them for actual motion and/or don't require more than 4, you could use the motion engine to drive other stuff.

But this is more of a preplanned move S-Curve, correct? I am still seeking the elusive (to me anyway) dynamic version as alot of VFDs and DC Drives have. So far I haven't glommed onto their secret recipe. It doesn't have to be perfect but does need to be smooth and respond to a setpoint change at any point in time.

I do use pulse and direction controls at times, so I value any new tools. I also desire to stay away from actual stepper motors and use servos instead. Steppers don't always play nice.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6154
  • Yes Pinky, Do-more will control the world!
Re: A Question on Nested If's Again
« Reply #31 on: January 30, 2017, 02:04:10 PM »
But this is more of a preplanned move S-Curve, correct? I am still seeking the elusive (to me anyway) dynamic version as alot of VFDs and DC Drives have. So far I haven't glommed onto their secret recipe. It doesn't have to be perfect but does need to be smooth and respond to a setpoint change at any point in time.

I do use pulse and direction controls at times, so I value any new tools. I also desire to stay away from actual stepper motors and use servos instead. Steppers don't always play nice.

Position moves, yes, pre-planned. Velocity moves, no, variable.

Speaking from (scar inducing) experience, S-Curve positioning is fairly painful for dynamic stuff. It was bad enough for pre-planned moves when using a mostly stateless implementation due to resource constraints. Not too bad if the path is pre-computed and stored.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Mike Nash

  • Hero Member
  • *****
  • Posts: 652
Re: A Question on Nested If's Again
« Reply #32 on: January 30, 2017, 09:03:29 PM »
But this is more of a preplanned move S-Curve, correct? I am still seeking the elusive (to me anyway) dynamic version as alot of VFDs and DC Drives have. So far I haven't glommed onto their secret recipe. It doesn't have to be perfect but does need to be smooth and respond to a setpoint change at any point in time.

I do use pulse and direction controls at times, so I value any new tools. I also desire to stay away from actual stepper motors and use servos instead. Steppers don't always play nice.

Position moves, yes, pre-planned. Velocity moves, no, variable.

Speaking from (scar inducing) experience, S-Curve positioning is fairly painful for dynamic stuff. It was bad enough for pre-planned moves when using a mostly stateless implementation due to resource constraints. Not too bad if the path is pre-computed and stored.

Well it is actually velocity S-Curve I am looking for, easier to keep tensions in a web if the ramp start and finish accel rates are also accelerated. It's so intuitive, yet so hard to program even for non-positioning.

Evilbeard

  • Hero Member
  • *****
  • Posts: 160
Re: A Question on Nested If's Again
« Reply #33 on: February 02, 2017, 07:30:36 AM »
Evilbeard:
I put the run contact after the Invert. That is my C3700. The Delta->Invert just means "no change". So Delta's OR'd together that you want to watch for changes (change in SP or change in ramp rate), then the Invert, then AND with the Run Bit.

Put C0 after your Invert and the 3rd rampsoak is not needed.

You also may need step 1 of the rampsoak to be Init to R103 to initialize the rampsoak. It's been a while so I can't remember if it worked without it or not.

Yeah, I don't know why I thought I'd need the redundancy of the run circuit. I was thinking that it would cause it to eliminate the delta contact when it was in run for some reason. I didn't use Step 1 as an Init because I want it to function at whatever the Setpoint is at. I figured it was redundant having a step saying Init to Speed, when I want to change speed anyway. I tested it in the simulator, and it seems to function fine. Whenever the rampsoak function is active, it just takes the speed, ramps it to the setspeed and then finishes. If I push stop and change from the "accel/decal" rampsoak to the "stop" rampsoak, the line ramps to a stop.

UPDATE: I streamlined the program in the production machine, and it worked like a charm. So much simpler.

It seems like this eliminates the 3 subroutines I wrote to do this. WHERE WERE YOU A MONTH AGO?!!!  Thanks a ton! This will clean up my program tremendously!
« Last Edit: February 03, 2017, 07:16:28 AM by Evilbeard »

Mike Nash

  • Hero Member
  • *****
  • Posts: 652
Re: A Question on Nested If's Again
« Reply #34 on: February 23, 2017, 08:02:11 PM »
Foiled again.  :(


Evilbeard

  • Hero Member
  • *****
  • Posts: 160
Re: A Question on Nested If's Again
« Reply #35 on: February 24, 2017, 07:10:19 AM »
Foiled again.  :(



What about just making another program to run using RUN and EXIT to leave it, much like a subroutine?

Mike Nash

  • Hero Member
  • *****
  • Posts: 652
Re: A Question on Nested If's Again
« Reply #36 on: February 24, 2017, 08:04:07 PM »
Well, you know it was really about trying to build a reusable block. A block that fits on a single rung in the ladder where it is used. A packaged subroutine or function block can be fleshed out (Pinky) more, but in the "control the world" area, I would like it to be clean and readable (which my nested IF was definitely not!)

I had my doubts when I tried it, "That'll never work!" but got a little hopeful when it pasted in from v1.4.3 ... which lasted right up until I tried to edit the RAMPSOAK.

Ah well, it'll be better to wait for those passed values that aren't global anyway. And I see 2.0.3 came out less than 24 hours after I got 2.0.2 installed. ;)

But the nested IF should work OK there if I need to use it before the new improved DmD gets here next month... right?

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6154
  • Yes Pinky, Do-more will control the world!
Re: A Question on Nested If's Again
« Reply #37 on: February 24, 2017, 08:31:04 PM »
A RAMPSOAK is a timed operation. Where would you invoke it, and how do you define completion?
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Mike Nash

  • Hero Member
  • *****
  • Posts: 652
Re: A Question on Nested If's Again
« Reply #38 on: February 24, 2017, 09:45:54 PM »
A RAMPSOAK is a timed operation. Where would you invoke it, and how do you define completion?

Ahh! I do believe the RAMPSOAK was offered up by yourself as a possible means to achieve a ramp function for an analog speed reference, if perhaps not in such detail. It is invoked when Line Run is pressed and only devoked when everything has stopped and turned off. As for completion, there is no completion so long as there is an operator who desires to change the speed on any whim whatsoever, never devoking the machine when a simple sweep of the speed pot fully counter-clockwise to the stop and a quarter turn past that will suffice. This is why I am looking for a ramp. Preferably the delectable, dynamic S-ramp that has been so elusive to achieve, except when it is simply included as a function as programmed by someone apparently much smarter than I.

Of course you did mention it before subroutines were available. (Why is there no tounge-in-cheek emoticon?)