You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

Reply
 
Thread Tools Display Modes
Old April 4th, 2021, 12:23 AM   #31
Saffa
Member
New Zealand

Saffa is offline
 
Join Date: Feb 2012
Location: Bay of Plenty
Posts: 1,201
Kalabdel, I do agree with you that having access to the PLC code is a requirement, and that it should be written such that anyone with suitable expertise in the system being controlled can follow.

There was a similar thread a few weeks ago about this.

I think some members here who build specialist machines, or things which they make dozens or hundreds of each year believe that the HMI should provide all diagnostics. Yes maybe, if but there will always be some situation the original designer didn't think of. Or a hardware issue that needs resolving. For example i had to get another integrator in to change IO allocation for a flow switch on a little Siemens S7-300 because the input went bad. The HMI might have been able to show me the status, but i don't know many machine builders that let me programmatically swap IO. German machine, local agent here isn't a PLC guy, would have had to ship out something from the factory overseas, machine down for 6 weeks. Not an option. Now there's time to get a replacement card and restore everything to how it was.

And for a big facility with thousands of IO, having full diagnostics on each IO point via SCADA is something you only get at the DCS level. Access to the code is the poor mans DCS grade diags.

I think Steve Bailey was more taking a dig at the fact that it's very easy to criticize others when you're not in their shoes. Yeah I've seen some terrible code, but I've also had to write some pretty nasty stuff to get something up and running again, and then the client never fronts up with the money to fix it properly... now you come along and say "geez, look at this **** code that Saffa wrote!" Without knowing the context.

Not defending poor design and poor programming, but it's not always black and white who should get the blame for it...
  Reply With Quote
Old April 4th, 2021, 02:24 AM   #32
Peter Nachtwey
Member
United States

Peter Nachtwey is online now
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: United Welfare States of America
Posts: 7,407
The original problem wasn't that hard.
What language is best depends on what you are trying to do. Also, different manufacturers provide different debugging facilities.
For motion control we use a form of SFC or state machine and ST. For discrete digital control LD and FBD are fine.
We provide debugging tools that are superior to any PLC I have seen or seen posted on this forum.


Before I came to Delta I worked for a OEM that made projects that were too complicated for the average mill electrician to get into. All debugging was done using the HMI. It was more than sufficient since there were wait conditions for every step and time outs. If an error message appeared it was a mechanical or electrical problem.


I don't think I have seen near as much terrible code as terrible mechanical/hydraulic designs. I can remember one case there the programmer was way over his head and couldn't get the job done even with a trip to Delta to get help. Sometimes the trigonometry and motion planning is way too much. The forum can see how this could be after the recent thread about computing the formulas for a seven segment motion.
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon
  Reply With Quote
Old April 4th, 2021, 08:41 AM   #33
drbitboy
Lifetime Supporting Member
United States

drbitboy is online now
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 2,603
Here is the behavior coded in a language similar enough to ST that the ST version would be almost exactly the same.

@swedeleaner: educate me as to how this is somehow so much better that I should become a language bigot.

Code:
      logical function not a challenge(input_1,scan_ms)
      implicitnone
      logical input_1
      real scan_ms
      real accum_input_ms / 0.0 /
      real output_on_ms / -1.0 /
      integer accum_pulses / 0 /
      save
      if (input_1) then
        accum_input_ms = accum_input_ms + scan_ms
      else
        if (accum_input_ms.ge.40.0 .and. accum_input_ms.le.60.0) then
          accum_pulses = accum_pulses + 1
        endif
        accum_input_ms = 0.0
      endif
      if (accum_pulses.eq.4) then
        accum_pulses = 0
        output_on_ms = 75.0
      endif
      not a challenge = output_on_ms.ge.0.0
      if (not a challenge) output_on_ms = output_on_ms - scan_ms
      return
      end
And here is what it looks like in a Real Programmer™ language :
Code:
int not_a_challenge(int input_1, float scan_ms) {
int rtn;
static float accum_input_ms;
static float output_on_ms = -1.0;
static int accum_pulses;
  accum_input_ms += input_1 ? scan_ms : -accum_input_ms;
  accum_pulses += !input_1 && accum_input_ms >= 40.0 && accum_input_ms <= 60.0 ? 1 : 0;
  if (accum_pulses==4) {
    accum_pulses = 0;
    output_on_ms = 75.0;
  }
  rtn = output_on_ms >= 0.0;
  if (rtn) output_on_ms -= scan_ms;
  return rtn;
}

Last edited by drbitboy; April 4th, 2021 at 09:04 AM. Reason: fix typo
  Reply With Quote
Old April 4th, 2021, 09:05 AM   #34
swedeleaner
Member
Sweden

swedeleaner is offline
 
Join Date: Dec 2013
Location: Göteborg
Posts: 104
[QUOTE=drbitboy;882067]Here is the behavior coded in a language similar enough to ST that the ST version would be almost exactly the same.

@swedeleaner: educate me as to how this is somehow so much better that I should become a language bigot.

I think you already are a language bigot by defending the use of LAD. Sorry, not sorry pal.

I for one use FBD for the most part, ST or IL for some operations and SFC when sequencing becomes crucial for getting things right.

I’ve never seen the need for LAD in any of my programing tasks, so you educate me. And that was my point earlier on, when is LAD superior...
  Reply With Quote
Old April 4th, 2021, 12:19 PM   #35
drbitboy
Lifetime Supporting Member
United States

drbitboy is online now
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 2,603
Quote:
Originally Posted by swedeleaner View Post
I think you already are a language bigot by defending the use of LAD. Sorry, not sorry pal.

I thought you posted that you were done trolling .

There is only one person (and it ain't me) posting on this thread with the claim that any one language is superior or inferior to another, and denigrating others for using it.

By any objective metric, all the languages are (assumed) Turing complete, so none are superior. That leaves subjective, and application- and site-specific, metrics, so declaring any language superior or inferior is declaring oneself normative, which is a natural human tendency, but also the height of ... well, many things, and finally something we should grow out of with wisdom.

To everyone else: I know, DNFTT.

Last edited by drbitboy; April 4th, 2021 at 12:21 PM.
  Reply With Quote
Old April 4th, 2021, 12:31 PM   #36
swedeleaner
Member
Sweden

swedeleaner is offline
 
Join Date: Dec 2013
Location: Göteborg
Posts: 104
Dr Buttieboy, you did a call out.
Even a troll that is well fed can’t keep away from that.

Here you go, happy?
  Reply With Quote
Old April 4th, 2021, 03:09 PM   #37
Phrog30
Member
United States

Phrog30 is offline
 
Join Date: Dec 2006
Location: Montgomery, Alabama
Posts: 782
[QUOTE=swedeleaner;882068]
Quote:
Originally Posted by drbitboy View Post

I’ve never seen the need for LAD in any of my programing tasks, so you educate me. And that was my point earlier on, when is LAD superior...
I'll educate you... because the customer says so! That doesn't make it superior, nor inferior. Educate yourself on why ladder exists in the first place. That reason is still why it's used today. There is nothing wrong with using it, nor is there anything wrong with the language you choose. Go away!!
  Reply With Quote
Old April 4th, 2021, 03:14 PM   #38
Phrog30
Member
United States

Phrog30 is offline
 
Join Date: Dec 2006
Location: Montgomery, Alabama
Posts: 782
Quote:
Originally Posted by AustralIan View Post
So is the consensus then, we are not going to answer the question, because we are 95% confident it is homework
100%. Ok, I'll give you 99.9%
  Reply With Quote
Old April 4th, 2021, 03:44 PM   #39
swedeleaner
Member
Sweden

swedeleaner is offline
 
Join Date: Dec 2013
Location: Göteborg
Posts: 104
If you had read my posts you would have known I´ve already granted it a place in the hall of fame. I merely asked for when it´s favorable/superior to other languages in this (or previous) decade. But all you guys do is getting angry and scream "EVERYBODY WINS, stop being a dick, read up fool"
  Reply With Quote
Old April 4th, 2021, 04:07 PM   #40
drbitboy
Lifetime Supporting Member
United States

drbitboy is online now
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 2,603
it's neither superior nor inferior, in this or any other decade. i really don't understand how one could say it is either.


Quote:
What is this obsession with ladder logic anyway?

I get that IL translates well to LAD, but really can’t see the point of ladder in 2020?

Are you claiming that does not infer it is inferior now?

Last edited by drbitboy; April 4th, 2021 at 04:09 PM.
  Reply With Quote
Old April 4th, 2021, 04:11 PM   #41
goghie
Supporting Member
Serbia

goghie is offline
 
Join Date: Jan 2008
Location: Belgrade
Posts: 413
Mitsubishi made good compromise. There are four ways of making program:
1. Ladder with command "ST in Ladder", where you can "wrap" Structure Text in Ladder output box.
2. FBD/LD where you can mix both Ladder and Function Block Diagram in almost every way you like.
3. SFC, but with option to make transitions by directly connecting FBD/LD line output.
4. ST.
After using all that options I ended making almost all programs with FBD or ST. Before I was using extensively Ladder or ST.
If you write programs where maintenance are technicians write in LD.
If you write programs where maintenance are engineers write in FBD.
If you write programs where maintenance are IT guys write in ST.
There few situations where SFC is useful.
Never write in IL.
  Reply With Quote
Old April 4th, 2021, 04:47 PM   #42
jhenson29
Member
United States

jhenson29 is offline
 
Join Date: Mar 2021
Location: St. Louis, MO
Posts: 59
Quote:
Originally Posted by drbitboy View Post
I thought you posted that you were done trolling .

There is only one person (and it ain't me) posting on this thread with the claim that any one language is superior or inferior to another, and denigrating others for using it.

By any objective metric, all the languages are (assumed) Turing complete, so none are superior. That leaves subjective, and application- and site-specific, metrics, so declaring any language superior or inferior is declaring oneself normative, which is a natural human tendency, but also the height of ... well, many things, and finally something we should grow out of with wisdom.

To everyone else: I know, DNFTT.
You posted a claimed comparable example of ST...with 50% more LOC than needed to get the logic across. And the troll is...?
  Reply With Quote
Old April 4th, 2021, 05:13 PM   #43
drbitboy
Lifetime Supporting Member
United States

drbitboy is online now
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 2,603
Quote:
Originally Posted by jhenson29 View Post
You posted a claimed comparable example of ST...with 50% more LOC than needed to get the logic across. And the troll is...?
That was only ST-ish, feel free to post a better approach; the point is whether that is somehow superior to ladder. I would only claim it's basically the same.
  Reply With Quote
Old April 4th, 2021, 05:16 PM   #44
Phrog30
Member
United States

Phrog30 is offline
 
Join Date: Dec 2006
Location: Montgomery, Alabama
Posts: 782
Quote:
Originally Posted by swedeleaner View Post
If you had read my posts you would have known I´ve already granted it a place in the hall of fame. I merely asked for when it´s favorable/superior to other languages in this (or previous) decade. But all you guys do is getting angry and scream "EVERYBODY WINS, stop being a dick, read up fool"
I have better things to do than read your nonsense. I would love to see some of your work. I bet it is laughable. I could be wrong, but most people like you that bark high and mighty stuff usually churn out garbage.
  Reply With Quote
Old April 4th, 2021, 05:19 PM   #45
jhenson29
Member
United States

jhenson29 is offline
 
Join Date: Mar 2021
Location: St. Louis, MO
Posts: 59
Quote:
Originally Posted by drbitboy View Post
That was only ST-ish, feel free to post a better approach; the point is whether that is somehow superior to ladder. I would only claim it's basically the same.
I’m more talking about all of the variable declarations and such at the top while the LAD was allowed to reference global variable registers.

Sure...it’s all equal for small/trivial examples. Everything is fast for small n too...

I’m not sure it helps to point out that they’re all Turing complete. There are plenty of esoteric languages that are Turing compete. Are you evaluating those for your next project? Or are those other “subjective” metrics more meaningful than you let on?
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
PLC basic question Karoly LIVE PLC Questions And Answers 2 June 2nd, 2012 11:16 PM
MPI comunication Manuel Raposo LIVE PLC Questions And Answers 22 July 16th, 2007 07:24 AM
[S5-155U CPU948]About PLC Communication Question. apple LIVE PLC Questions And Answers 2 July 20th, 2006 06:07 AM
plc5 with AB 1771-DB basic module, its urgent plz help me nileshsurya LIVE PLC Questions And Answers 6 July 20th, 2005 02:45 AM
Question re:PLC to PLC interaction. c0met LIVE PLC Questions And Answers 5 March 22nd, 2004 12:16 PM


All times are GMT -4. The time now is 02:15 PM.


.