my knowledge of C# is very very weak and I assume that only solution to my problem is to program script in iX Developer (X2 Pro 12).
To be more precise, I have 2 questions/problems:
1. I have an alias screen with trend. I used software that I found on this forum ('AliasTrend') as a template for my program but in 'AliasTrend' there is no manipulation with 'TrendViewer.ValueScaleMinimum/Maximum' that I need to implement. To elaborate, I have several analog input tags with different MIN and MAX values. I tried to program something, as shown below, but based on my program I need to enter twice in alias screen to update min/max values (probably FOR loop executes only once when screen is opened). As I said, my knowledge of C# is very very weak.
Code: Select all
public partial class Screen2
{
void Screen2_Opened(System.Object sender, System.EventArgs e)
{
// Copies the Alias instance name to variable "CurrentAnalog" as well as to the Tag "CurrentInstance"
string CurrentAnalog = this.InstanceName;
Globals.Tags.CurrentInstance.Value = CurrentAnalog;
// Clears all pens/curves from TrendViewer
for (int i = 0; i < 3; i++)
{
TrendViewer.Curves[i].IsVisible = false;
}
// Enables the specific pens/curves for the alias instance and tag "InstanceNumber"
if (CurrentAnalog == "PT_101")
{
TrendViewer.ValueScaleMinimum = this.min;
TrendViewer.ValueScaleMaximum = this.max;
TrendViewer.Curves[0].IsVisible = true;
Globals.Tags.InstanceNumber.Value = 0;
}
else if (CurrentAnalog == "PT_102")
{
TrendViewer.ValueScaleMinimum = this.min;
TrendViewer.ValueScaleMaximum = this.max;
TrendViewer.Curves[1].IsVisible = true;
Globals.Tags.InstanceNumber.Value = 1;
}
else if (CurrentAnalog == "TT_101")
{
TrendViewer.ValueScaleMinimum = this.min;
TrendViewer.ValueScaleMaximum = this.max;
TrendViewer.Curves[2].IsVisible = true;
Globals.Tags.InstanceNumber.Value = 2;
}
}
}
}
Thank you in advance for your assistance,
Best regards
Luka