Is there a way to change the default values of a data type defined in the BasicLib?
I am creating control module types with the input and output parameters of the BoolConnection type. I would like to change the default values of the Forward.Status input and output parameters within the control module type (default 16#C) to differentiate between a connected parameter which would have a default status of 16#C versus a non-connected parameter which would have another predefined status.
Please advise.
Answers
From my experience you could do that from outside the control module.
You could write in the application :
xxx.Forward.Status:=16#A;
You will need to make a copy of the data type where you would like different default component values, rename it to whatever, and exchange the data type of the desired parameter in the control module you are using with your own. If you're using a control module from a standard library, you will need to make a copy of this as well. Enter whatever default values you would like in the Default Value row of your new data type, and you're good to go.
If you are connecting only components of your parameter rather than the entire data type, be aware that you will not be asked to connect components which have default values configured in the data type.
My suggestion:
If <BoolConnection>.Forward.Connected then
<BoolConnection>.Forward.Status := 16#C0 (* Good Status or the status you want to assign*)
else
<BoolConnection>.Forward.Status := 16#1 (* Connection down *)
end_if;
if you want to change this status value during first execution during application startup, then write it inside the code tab with prefix 'Start_'.
by sanjeeva Rank: 92 on 9/20/2016 7:45:55 PM | Like (0) | Report
Thank you for the answers up to now.
As additional information,
I need a different default status for the <BoolConnection>.Forward.Status (let's say 16#1 as proposed by skhpatnaik) for the input parameters for new control module types that are being created.
The output parameters of the existing control modules in the AC800M libraries or variables would have the default Forward.Status of 16#C on a unit error (or other errors).
This would allow me to compare the statuses of each input parameters of the new control module types against 16#1 to see if the parameters are connected.
The <BoolConnection>.Forward.Connected is not sufficient as when the variable is being communicated through a communication variable, the value of <BoolConnection>.Forward.Connected is false on a communication failure (or if communication has not yet started).
So basically, I need different default values for <BoolConnection>.Forward.Status for the input parameters and the output paramters. Please let me know if further clarification is required.
Add new comment