Author Topic: How to design a PLC program (TwinCAT 3) with EA  (Read 11250 times)

qwerty

  • EA Guru
  • *****
  • Posts: 12334
  • Karma: +347/-287
  • I'm no guru at all
    • View Profile
Re: How to design a PLC program (TwinCAT 3) with EA
« Reply #15 on: February 02, 2021, 03:33:02 am »
Context menu of the class in the browser: Add/Statemachine. This is for the technical aspect.

If you have a use case (and you should) there can be the need to describe the state machine from a business perspective. And that would go under the use case.

q.
« Last Edit: February 02, 2021, 03:34:50 am by qwerty »

Oliver Tonn

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Re: How to design a PLC program (TwinCAT 3) with EA
« Reply #16 on: February 02, 2021, 06:39:04 pm »
Context menu of the class in the browser: Add/Statemachine. This is for the technical aspect.

If you have a use case (and you should) there can be the need to describe the state machine from a business perspective. And that would go under the use case.

q.
Thanks for your answer. I know how to create a state machine, but I wasn't sure where to add it in this case, this was clarified by your answer.
Send from something with internet access.

PeterHeintz

  • EA User
  • **
  • Posts: 894
  • Karma: +55/-18
    • View Profile
Re: How to design a PLC program (TwinCAT 3) with EA
« Reply #17 on: February 02, 2021, 09:47:48 pm »
Hi Oliver,
from my brief look on what you have done, I think it is ok. However, there are different ways to do things. E.g. you could put your VAR_INPUT, VAR_OUTPUT and VAR in its own cases and classify attributes by these class within your class representing the FB.
Another way would be to build a port in port structure by adding each class representing your VAR_INPUT, VAR_OUTPUT ports representing your variables  and adding to your FB class two ports which are classified by your VAR_INPUT, VAR_OUTPUT classes.
This is probably the way I would do that and I would use SysML Bock Definition Diagrams which is in fact a class diagram but allows to give a port a direction as in, out, inout as well.
Your state machine (I do not talk about the state machine diagram) you can put wherever you want. What you have to do, is to express that the state machine defines the behavior of your class. I do not remember how this is done in UML because I do SysML. In SysML you either define a behavioral classifier property or you use an allocation relation. In UML this stuff might just have an other name.
Best regards,

Peter Heintz

Oliver Tonn

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Re: How to design a PLC program (TwinCAT 3) with EA
« Reply #18 on: February 04, 2021, 05:16:41 am »
from my brief look on what you have done, I think it is ok.
Hello Peter,
thanks for your answer, that's good to hear/read. I wasn't sure, if adding two instances of the ENUM was correct, but due to the fact, that the FB uses two instances of the ENUM it seems to be logic to add two. Sorry for asking again, but when I'm adding an instance of the FB I really don't need to add instances of the ENUM used by this instance of the FB?
However, there are different ways to do things. E.g. you could put your VAR_INPUT, VAR_OUTPUT and VAR in its own cases and classify attributes by these class within your class representing the FB.
Sorry, but how? I must admit the solution with the stereotypes looks quite appealing to me.
Your state machine (I do not talk about the state machine diagram) you can put wherever you want. What you have to do, is to express that the state machine defines the behavior of your class. I do not remember how this is done in UML because I do SysML. In SysML you either define a behavioral classifier property or you use an allocation relation. In UML this stuff might just have an other name.
OK, thanks.
One last questions. When placing instances in the diagrams the content of the element isn't shown any more, e.g. the atributes and/or operations of a class. Is it possible to configure EA so these things are also displayed in an instance? I couldn't find any possibility in the compendium.
« Last Edit: February 04, 2021, 05:18:31 am by Oliver Tonn »
Send from something with internet access.

qwerty

  • EA Guru
  • *****
  • Posts: 12334
  • Karma: +347/-287
  • I'm no guru at all
    • View Profile
Re: How to design a PLC program (TwinCAT 3) with EA
« Reply #19 on: February 04, 2021, 05:23:30 am »
No. Creating an instance means you now have an object. That has no attributes but instances (run states). These can be shown and assigned with concrete values.

q.

Oliver Tonn

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Re: How to design a PLC program (TwinCAT 3) with EA
« Reply #20 on: February 04, 2021, 11:14:05 pm »
OK, I understand, thannks.
Send from something with internet access.

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1111
  • Karma: +102/-9
  • Its the results that count
    • View Profile
Re: How to design a PLC program (TwinCAT 3) with EA
« Reply #21 on: February 14, 2021, 09:18:56 am »
Don't PLC come with their own set of tools for designing and programming them. I'd just use the software suite that comes with the PLC to be honest.
Happy to help
:)

Oliver Tonn

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Re: How to design a PLC program (TwinCAT 3) with EA
« Reply #22 on: February 17, 2021, 08:37:16 pm »
Hello Sunshine,
all PLC manufacturer have there own set of tools for programming the software, but most of them don't have any tools for designing it. Beckhoffs IDE have UML possibilities, but as I mentioned before the functionality isn't quite appealing (e.g. no instances possible), that's why I'm using EA.
Send from something with internet access.

Martin_Bohring

  • EA Novice
  • *
  • Posts: 12
  • Karma: +5/-2
    • View Profile
Re: How to design a PLC program (TwinCAT 3) with EA
« Reply #23 on: February 18, 2021, 03:52:24 am »
Hello,
it has been a long time since I have done PLC like development (porting a Soft PLC to an Embedded system), so my back then knowledge is clearly outdated.
I remember the PLC developers having a graphical development environment (With FB, structured Text, ...)

So there already is an already accepted graphical notation on the FB level of abstraction.
If you plan to generate Structured Text Code from a SysML Model than that is certainly possible, but I would advise against it.
You already have a graphical notation and a text syntax that complement each other and can converted into each other.

Therefore I believe SysML can only be of value for you, if you move 2 to 3 abstraction levels up when using SysML.
So maybe allocation of functions to HW nodes (and the functions are then realized by some FB on a PLC for example)

Or modelling the interplay of several of those HW nodes and their functions (using State Diagrams, Sequence Diagrams, ...)
Also indicating which requirements are realized by which HW or SW block can give a nice high level view (so nothing falls between the cracks)

So as it already has been said: It really depends what your goals are and on what abstraction level you want to use SysML

qwerty

  • EA Guru
  • *****
  • Posts: 12334
  • Karma: +347/-287
  • I'm no guru at all
    • View Profile
Re: How to design a PLC program (TwinCAT 3) with EA
« Reply #24 on: February 18, 2021, 04:11:09 am »
I think the most difficult part would be to move up those 2 or 3 steps. Those PLC guys live in the signal lines world and you can hardly drag them out there. It might be possible, but it's not easy.

q.

PeterHeintz

  • EA User
  • **
  • Posts: 894
  • Karma: +55/-18
    • View Profile
Re: How to design a PLC program (TwinCAT 3) with EA
« Reply #25 on: February 18, 2021, 04:49:11 am »
I was a PLC guy, and I was able to move up. ;)

And yes, if one do not move up at least to one level higher in absraction, using EA would make no sence.
Best regards,

Peter Heintz

qwerty

  • EA Guru
  • *****
  • Posts: 12334
  • Karma: +347/-287
  • I'm no guru at all
    • View Profile
Re: How to design a PLC program (TwinCAT 3) with EA
« Reply #26 on: February 18, 2021, 05:05:04 am »
You probably know your comrades from the past. And you probably know that you're part of the exceptional group that was able to step out. I did not say it's impossible. Just hard.

q.

Oliver Tonn

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Re: How to design a PLC program (TwinCAT 3) with EA
« Reply #27 on: February 19, 2021, 12:46:50 am »
@Martin_Bohring: The problem is, that you can't convert from a graphical design (e.g. FBD) to structured text. Maybe some IDEs allow it but most don't. And I wouldn't describe FBD as a design tool nor would I use it for that. It is one of many possible programming languages to do the implementation, but not the design. And you can't plan things like ENUMs or Structs (Data types) with it.
My goal isn't to create code automatically from the design, but to show other people how I think the problem, in this case a machine simulation, could be solved and to design the data structure and the possible states.

@qwerty: The problem is, that we have to live in the signal lines world, because that's what a PLC does, processing signals (Binary and analog). The PLC has to react to signal changes cyclically and has to set signals/outputs according to the inputs.
« Last Edit: February 19, 2021, 12:48:49 am by Oliver Tonn »
Send from something with internet access.