We are still working on migrating to the new Bosch Connected Industry Online Portal. Stay tuned! Click here for the latest updates.
03-13-2024 01:48 PM
Hi,
here's the situation: I copied the program from the PLC. On my laptop I have an older version of that same PLC-program. I have to upgrade my old version to be the same as the program on the PLC.I compare them, and found some differencies. Used OES is v4.8.5. The standards are the same.
Q1: What can I do to not have this Module1.Extension.rStationData REF= DataHandling.StationData.Module1; line in StationUnit.OnApplyParameter exported from the OES into Twincat? A new export from OES does not solve my issue. I also tried with reloading standards, I got the same results.
old version on left side // version from PLC on the right side
Q2: I have 4 OpconDatAccess addons on Module1 level (TypeDataAccessModule1, ResultDataAccessModule1, CgDataAccessModule1, GrrDataAccessModule1). What has to be set in OES to have rStationData : REFERENCE TO Module1StationDataStruct; exported into TypeDataAccessModule1Addon (FB) in Twincat? I have the same problem with all four addons. I can't add that Module1StationDataStruct structure as reference in OES. On Station level the DistributeToModelTree parameter is checked for StationData as shown on the screenshot.
Thanks!
Solved! Go to Solution.
03-14-2024 06:24 AM - edited 03-14-2024 06:25 AM
Question 1: I'm not familiar with the details of these OES versions, but what probably happened is that the station was done with an older version of OES. In that version the extension didn't recveive the model tree struct references, but in OES4.8.5 they do. If you want to change this then you need to override the default export template. I haven't tested but this feature should be available in OES4.8.5 (I think it was already in OES3).
To do that, first select a template folder. This has to be done here:
I have only seen the STD used for this but you could also use a folder inside the station.
Inside this folder you need to put the new template with the same folder structure and name like in your OES installation. The file you want to change is in <Default OES installation path>\OpCon\Templates\_Common\UnitOnApplyParameters.otd. For me the correct path with the standard installation is C:\Program Files (x86)\OpCon\OES V4.8\OpCon\Templates\_Common\UnitOnApplyParameters.otd.
Copy this file and put it into your template folder, for example when using the path in the screenshot, it needs to go into Std\Templates\_Common\UnitOnApplyParameters.otd.
Now OES will use this file for export instead of the one in your OES installation folder. So you can modify it and make it skip the extension export. I looked at the file and it's the lines 219 and 226 you want to delete I think (I haven't tested this!)
Question 2: I think this is not possible. Model tree struct variables are only distributed to child units (and their extensions, unless you do Q1 solution) and to chains, but not to add-ons. Just manually add the references in TwinCAT, that's what I would do. Although you don't get much benefit from this over using the global variable directly, judging by the screenshots.
03-14-2024 10:51 AM
Just out of curiosity: Is there any OES version that does this export to the add-ons?
03-14-2024 02:29 PM - edited 03-14-2024 02:33 PM
Both differences have the same reason: A bugfix that came with OES 4.8.3. There is no point in trying to get back to the original code that was downloaded to the PLC. Your new code is better!
Before the bugfix, every FB was added the rStationData VAR_INPUT (as in Q2). These references were only initialized for the Unit instance and sequence FBs though, so accessing them inside the Extension or add-on FBs would always have caused runtime errors.
The bugfix removed these reference VAR_INPUTs from all FBs except Unit, Extension and sequences. In OnApplyParameters, the code line (Q1) was added so the reference of the Extension instance is initialized and can be used.
So, @MarvinW 's answer is technically correct, but I would not recommend doing that!