Is there a way to create a custom config?
Search
Is there a way to create a custom config?
HI,
Is there a way to create a custom config, such as the "Default value" config? Instead of setting a default value in the online value, I'd like to make a function (via code) that takes the original value and sets the online value accordingly.
I appreciate any help you can provide.
Elad
Is there a way to create a custom config, such as the "Default value" config? Instead of setting a default value in the online value, I'd like to make a function (via code) that takes the original value and sets the online value accordingly.
I appreciate any help you can provide.
Elad
- hpuchegger
- Posts: 86
- Joined: Fri Oct 08, 2021 10:38 am
Re: Is there a way to create a custom config?
DId you already try our WinCC OA AI Assistant? It gives me following information:
In WinCC OA, you can create custom configurations similar to the "Default value" configuration by implementing a function in your code that sets the online value based on the original value. This can be achieved using the Control language (CTRL) or through the WinCC OA API.
To set the online value programmatically, you can define a custom function that retrieves the original value and applies your logic to set the online value accordingly. This can be done using the setValue() function or similar methods available in the API.
For example, you might create a CTRL script that looks something like this:
This script would need to be executed in the appropriate context, such as a control loop or triggered by an event.
Maybe you can try if this works for you.
Br, Herbert
In WinCC OA, you can create custom configurations similar to the "Default value" configuration by implementing a function in your code that sets the online value based on the original value. This can be achieved using the Control language (CTRL) or through the WinCC OA API.
To set the online value programmatically, you can define a custom function that retrieves the original value and applies your logic to set the online value accordingly. This can be done using the setValue() function or similar methods available in the API.
For example, you might create a CTRL script that looks something like this:
Code: Select all
main() {
// Retrieve the original value
originalValue = getValue("YourDataPointName:_original.._value");
// Apply your custom logic
onlineValue = originalValue * 2; // Example logic
// Set the online value
setValue("YourDataPointName:_online.._value", onlineValue);
}
Maybe you can try if this works for you.
Br, Herbert
-
- Posts: 373
- Joined: Tue Jan 15, 2019 3:12 pm
Re: Is there a way to create a custom config?
If you do not mind adding an extra datapoint element, then you should look at the DP function.
Re: Is there a way to create a custom config?
If you want to set a value for a DP element you can only set the _original.._value.
The _online.._value is in the domain of the Event Manager as an read only config and cannot be modified by an external source.
Why do you want to modify the "_online.._value"?
Best Regards
Leopold Knipp
Senior Support Specialist
The _online.._value is in the domain of the Event Manager as an read only config and cannot be modified by an external source.
Why do you want to modify the "_online.._value"?
Best Regards
Leopold Knipp
Senior Support Specialist
Re: Is there a way to create a custom config?
Herbert, unfortunately, the AI assistant sometimes invents things
You can't do a dpSet on the online value.
gschijndel, I'm trying to avoid the extra DP element.
Leopold, I want to set the online value since I'm getting a value as the original, and I want to change it using some logic. For example, a mapping function, where I receive 2, and I want to set it as 3, I get 4 and I want to set it as 2, etc.

gschijndel, I'm trying to avoid the extra DP element.
Leopold, I want to set the online value since I'm getting a value as the original, and I want to change it using some logic. For example, a mapping function, where I receive 2, and I want to set it as 3, I get 4 and I want to set it as 2, etc.
Re: Is there a way to create a custom config?
Hey,
Are those values coming through a driver? If yes maybe you could use msg conversion?
BR
Alex
Are those values coming through a driver? If yes maybe you could use msg conversion?
BR
Alex
Re: Is there a way to create a custom config?
Thank you, Alex.
Some of them are coming via a driver, and the msg config is an option for those. However, with a msg config I lose the option to see the source\raw value, which I want to be able to.
And, this does not work for non-driver values.
Elad
Some of them are coming via a driver, and the msg config is an option for those. However, with a msg config I lose the option to see the source\raw value, which I want to be able to.
And, this does not work for non-driver values.
Elad
-
- Posts: 373
- Joined: Tue Jan 15, 2019 3:12 pm
Re: Is there a way to create a custom config?
gschijndel, I will have to check. There are other limitations for this config.
Thanks!
Thanks!
Re: Is there a way to create a custom config?
The _general config will be no option in this case from my point of view.
Using the _general config will have the following disadvantages:
-- No archiving of _general config attributes
-- No possibility to do an alarming for the values written to the _general config
Best Regards
Leopold Knipp
Senior Support Specialist
Using the _general config will have the following disadvantages:
-- No archiving of _general config attributes
-- No possibility to do an alarming for the values written to the _general config
Best Regards
Leopold Knipp
Senior Support Specialist