for reasons too long to explain I would need to initialize a frame instance variable in a visualization :
myStringVariable : STRING := 'this is the initial value';
I want to be very clear, it is a visualization not a POU!
but this system doesn't work, it seems that the variable is not actually initialized, any idea how to make it?
I am sorry but my team has communicated the problem to me wrong, it is not that the initialization does not work as illustrated, on the contrary, it works very well, the problem is that it is not possible to initialize it because, the same view is loaded in different frames, it must be initialized differently, someone of us is thinking about a method like FB_init or some similar else.
Absolutely that works, I use it all the time. But that doesn't mean you're crazy or I'm crazy.
These are my questions for you
1)Is this a variable in the header of a visualization, global variable list, or POU?
2)Is the variable being used anywhere in your program and if it's in a POU is the POU in your task tree? It matters for variables being used by a fieldbus, they won't update unless used somewhere. Shouldn't matter for this though...
3)Is that variable being written to by something? If so that will overwrite your initialized value
4)Did you change the initialization value on the variable on a simulation or live system? It won't change until you do a cold/warm restart. Depending on if it's a retain value.
1)It is in the header of a visualization
2) the variable is used as bitmap ID in an element of the visualization
3)The variable is written only by the input events in the visualization
4)the variable is initialized only by the code in the way already exposed .. but it doesn’t work.
that definitly works.
If you got an issue, please attach an example project.
I'm sorry but, the project is too complex to be posted, it should be explained, I'll try again for the last time.
I have an image that uses a bitmap ID variable so configured:
bitmapID: STRING: = 'red_left_arrow';
'red_left_arrow' is a bitmap ID, that, in my project, representing a red arrow to the left.
the variable is contained in the visualization that contains the image, and can only be modified by the input configuration of objects that are in the same visualization. At the beginning of the process I expect, however, there will be displayed the image that represent a red left arrow images but it is displayed a blank image as long as an event does not modify the bitmap making it , for example, bitmapID := 'green_circle' and magically appears a green circle image.
the problem, of course, is the initial blank image.
Perhaps you can make a small project implementing only what is going wrong and then share that. Definitely the variable in the visualizations header, an element where it is used to change the bitmap ID, the bitmaps, and whatever is writing to it.
Just copy paste that all into a new project, and verify it acts the same before you share it. Then you don't have to share anything you're not allowed to.
Log in to post a comment.