Extension de télégrammes - TIAPortal

Fonctions pour SINUMERIK ONE

ft:publication_title
Fonctions pour SINUMERIK ONE
Product
TIAPortal
Version
V20
Publication date
01/2025
Language
fr-FR
Extension de télégrammes

L'exemple suivant montre comment insérer une extension et modifier la taille d'un télégramme standard. Pour l'accès, un objet entraînement est nécessaire.

Insérer une extension et modifier la taille d'un télégramme standard Copie le code de programme suivant dans le presse-papiers

using Siemens.Engineering.MC.Drives;

TelegramComposition telegrams = drvObj.Telegrams;

Telegram telegram = telegrams.Find(TelegramType.MainTelegram);

Console.WriteLine("The Cu has the telegram: " + telegram.TelegramNumber);

Console.WriteLine("The Setpoint channel-specific size of the telegram is: " + telegram.GetOutputSize());

foreach (var address in telegram.Addresses)

{

  if (address.IoType == AddressIoType.Output)

  {

    Console.WriteLine("The Setpoint channel-specific IO start address of the telegram on the connected PLC is: " + address.StartAddress);

  }

  else if(address.IoType == AddressIoType.Input)

  {

    Console.WriteLine("The Actual value channel-specific IO start address of the telegram on the connected PLC is: " + address.StartAddress);

  }

}

// Add an additional telegram

if (drvObj.Telegrams.CanInsertAdditionalTelegram(2,4))

{

  drvObj.Telegrams.InsertAdditionalTelegram(2,4);

}

// Add a 3 word extension to the main telegram

Telegram mainTelegram == drvObj.Telegrams.Find(TelegramType.MainTelegram);

Int32 newSize = mainTelegram.GetSize(AddressIoType.Input) + 3;

if (mainTelegram.CanChangeSize(AddressIoType.Input, newSize, true))

{

  mainTelegram.ChangeSize(AddressIoType.Input, newSize, true)

}