La fine delle esportazioni manuali
Estrarre una lista di 500 variabili da TIA Portal a Excel è un compito faticoso. Con T-IA Connect, puoi trasformare qualsiasi blocco dati (DB) o tabella delle variabili in un oggetto JSON strutturato con una singola richiesta API.
Prerequisiti
- TIA Portal project open
- Active T-IA Connect server
- Postman or a script for testing
Passo 1: Elencare le variabili (Tag)
Per recuperare un'intera tabella delle variabili, usa l'endpoint /api/tags. Riceverai un array de oggetti contenenti nome, indirizzo, tipo di dati e commento.
[
{
"name": "Main_Conveyor_Start",
"address": "%I0.0",
"dataType": "Bool",
"comment": "Start button for the main conveyor"
},
{
"name": "Emergency_Stop",
"address": "%I0.1",
"dataType": "Bool",
"comment": "Safety E-Stop"
}
]Passo 2: Esportare un blocco dati (DB)
T-IA Connect può leggere la struttura interna dei DB, anche strutture nidificate e array. Questo è l'ideale per generare automaticamente file di configurazione.
{
"blockName": "DB_Config",
"members": [
{ "name": "MaxSpeed", "type": "Real", "value": 1500.0 },
{ "name": "IsActive", "type": "Bool", "value": true },
{ "name": "Parameters", "type": "Struct", "members": [...] }
]
}Passo 3: Conversione in Excel/CSV
Una volta ottenuto il JSON, è banale convertirlo in Excel tramite un semplice script Python o uno strumento online.
Le format JSON est compatible avec 100% des outils modernes de Data Science. Vous pouvez l'importer dans Excel via l'onglet Données > Obtenir des données > À partir d'un fichier > À partir d'un JSON.