Zugriff auf den Grenzwerttext einer Rema
Hallo,
ich möchte in einer ProjectWizardExtension auf einen bestimmten Grenzwert einer Variablen zugreifen und diesen dann in eine andere kopieren.
Soll heißen:
In einer Integer-Variablen wird der Wert 15 reingeschrieben-> Der Grenzwerttext von Position 15 der Rema "soll in den String "Grenzwert" kopiert werden.
Folgenden Code habe ich bis jetzt:
C# Code:
using System;
using Scada.AddIn.Contracts;
using Scada.AddIn.Contracts.Variable;
using Scada.AddIn.Contracts.ReactionMatrix;
namespace TransferStoertexte
{
///
/// Description of Project Wizard Extension.
///
[AddInExtension("TransferStoertexte", "Kopiert den Grenzwerttext der Störung in eine Variable")]
public class ProjectWizardExtension : IProjectWizardExtension
{
#region IProjectWizardExtension implementation
public void Run(IProject context, IBehavior behavior)
{
// enter your code which should be executed on triggering the function "Execute Project Wizard Extension" in the SCADA Runtime
string zzstrTest;
IVariable myVar = context.VariableCollection["zziAWIndex"]; // Position in Rema
IVariable myVar2 = context.VariableCollection["zzstrTest"]; // Grenzwerttext aus Remaposition
IReactionMatrixCollection zenonRemas = context.ReactionMatrixCollection; // Sammel alle zenon Remas
IReactionMatrix zenonRema = zenonRemas["Gesamt_Stoer_Z1"]; // Wähle Rema "Gesamt_Stoer_Z1" aus
int Stoernummer;//
Stoernummer = (int)myVar.GetValue(0); //Zuweisung: Wert aus myVar -> Stoernummer
//store reference of Condition
ICondition remaCondition = zenonRema[Stoernummer]; // Position gemäß Variable "Stoernummer"
zzstrTest = remaCondition.LimitValueText;
myVar2 = zzstrTest; //Hier stimmt irgendwas nicht
}
#endregion
}
}
This is a migrated post! Originally posted on 02.04.2020 by user wenzm. Please be aware that information can be outdated.