2/12/2019 10:02 PM | |
Joined: 3/16/2015 Last visit: 10/10/2021 Posts: 1250 Rating:
|
Thanks #dp. I was referring to the use of inline statement for example : If intState = 0 then bM10.0 := True Else bM10.0 := False; Is written as bM10.0 := intState = 0; I have never seen that before. The most inline I saw in some SCL examples was: bMotor1 := bMotor1 AND bStoppButton; I searched again manuals and online and couldn't find a single example similar to your use of either Case or the above example which I consider an IF statement of a sort. Of course I know they work as I already tried them but would love to see a source which hopefully will contain more tricks. Thanks Kal |
Last edited by: Kal.A at: 2/12/2019 10:17:17 PMLast edited by: Kal.A at: 2/12/2019 10:17:45 PM |
|
2/12/2019 11:24 PM | |
Joined: 9/23/2005 Last visit: 8/13/2024 Posts: 4660 Rating:
|
Well, you need to be at least a little bit weird to do such things or a geek Everyone can come up with this:
With this, only a few:
Or even, in times of V15:
|
Regards, |
|
This contribution was helpful to
1 thankful Users |
2/13/2019 5:25 AM | |
Posts: 2826 Rating:
|
@jacek:
OT:I think my counter is stuck.. any suggestions? I would like to put a warning sticker on that code. Each time I am paired with a new team partner, I am reminded of what goes for easy understandable code. Brilliant code like that line is not of those easily understandable. Too many people will have to standstill and think about this line. It potentially wastes time for people doing fault-finding. @Kal:
I understand now what you are asking. The specific case you are talking of would - by me - not be counted as a trick. It is literally a translation of coding that would be done in LAD. There is no list of tips and tricks that I am using. There is the study of other people's code. There are things (code flow) that I have learnt just be looking at the libraries that Siemens provides. You should aim your question at the greats like smiffy and jacek. You have to weight the brilliancy and elegance to what is understandable after one glance. |
Last edited by: #dP at: 2/13/2019 9:58:53 AM |
|
This contribution was helpful to
1 thankful Users |
Follow us on