Codesys variable not expanding in offline mode and not able to add comments

Join Date
Dec 2015
Location
Windsor
Posts
27
Hi ,

I am not able to expand any global variable in offline mode, also not able to add comments to the elements of the variable since it does not expand and give me the option to enter comments in offline programming, I was only able to add comments in the definition of the struct data type but not for each instance in the global variable list that uses this data type. Please help me out if there's a way.

Regards
SB

offline.PNG online.PNG
 
Hi Sameer. Tried a number of things but I am afraid what you want to do is not possible. Not 100% sure though, but over 99% sure.
 
Hey Alfredo, thanks for responding. If it is true that's a bummer. So difficult to make meaningful programming without having comments. This is a major drawback if you ask me, I'll keep searching for answers and may be ask codesys to help on this.
 
If you create a custom type you can add comments to each element of the custom type. That means you will need to create a custom type for each variable you create, so you can have unique comments. Please see below and let me know if this is helpful.

20210429Codesys.jpg
 
Alfredo, thanks for the response. The comments in the picture were funny lol. The problem is that I have DUTs that have variables of another DUT type and inside those DUTs I have more DUTs. A simple kind of DUT which have basic data types would work like you showed but if the custom data type uses variables with struct type would it still expand and allow me to add comments?
 
I think you can use user data types that are themselves made of other user data types. I can try something on Saturday, unfortunately not today.
 
I think that if you need comments on these data structures, it indicates the program needs to be redesigned. It sounds like you want to mix domain information with implementation details. It’s typically (almost universally) better to separate these.

Comments should be about “why” not “what”. And there should typically be few of them. Lots of comments is a red flag for re-design.

I’ve made exceptions for storing meta data in comments for other applications to consume, generally limited to auto-generated help documentation where the user would not have access to the code. If you have access to the source code, the source code should generally explain what’s going on without comments.
 
Hey jhenson29, thanks for responding. We have various sequence of operations and use the same data structure. For example a cycle. An autocycle Would have process 1 to process 10 complete, all jobs complete and things like that. But each cell would have different things happening at these processes. So it might not be what you're used to but it definitely makes sense in our industry to use comments that define what's happening at that process.
 
Yes you can. And that's why it'll be difficult to create them separately for each variable
I am not following you on this. You need to create user data types for each set of comments that you need your application variables to have. It would take some time to create all the required user data types, and that would require some work. Is this what you mean by "difficult"? I do not see other way of achieving what you want, which is variables within structs with bespoke comments. Maybe I do not understand your requirement properly
 
Hey Alfredo, I was just mentioning that you can create user defined with members that are user defined and so on. And by difficult I meant yes it will be difficult to create data type for each variable I want to use the user defined data type for and honestly defeats the purpose of being user defined type because you want to be able to create the data type once and use it over and over again. But thank you for your input on this.
 
Hey jhenson29, thanks for responding. We have various sequence of operations and use the same data structure. For example a cycle. An autocycle Would have process 1 to process 10 complete, all jobs complete and things like that. But each cell would have different things happening at these processes. So it might not be what you're used to but it definitely makes sense in our industry to use comments that define what's happening at that process.

Try using enumerations for this..
 

Similar Topics

Hello, I have a codesys controller which I am looking to communicate with an external. User interface via mqtt. I subscribe to a topic and...
Replies
6
Views
1,468
Hi all, I'm just starting out in the plc world. For school we had some introduction into codesys v3.5, basically we get given visualizations and...
Replies
9
Views
2,406
SoMachine v.4.3. I have an interesting question, hoping someone here as some advice. My customer has a Lexium 32 servo drive. We are reading...
Replies
4
Views
3,114
Hello, i am kinda new at codesys and i want to make a comunication between one ifm cr0403 plc and a cr0451 hmi i have read a lot on the forums and...
Replies
3
Views
1,914
Hi, I am new to codesys programming and need some help converting a word variable into 2 byte variables. If anyone provides the sample in Codesys...
Replies
9
Views
22,993
Back
Top Bottom