chore: Reorganizacion de carpetas libreria.
This commit is contained in:
-3
@@ -1,3 +0,0 @@
|
||||
MultiLingualTexts:
|
||||
- id: MLC_Vf
|
||||
es-ES: OB121_ProgrammingError
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
MultiLingualTexts:
|
||||
- id: MLC_4gR
|
||||
es-ES: OB122_IOAccessError
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
MultiLingualTexts:
|
||||
- id: MLC_eF
|
||||
es-ES: OB40_HardwareInterrupt
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
MultiLingualTexts:
|
||||
- id: MLC_4H3
|
||||
es-ES: OB80_TimeErrorInterrupt
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
{
|
||||
S7_Author := "ABH";
|
||||
S7_BlockTitle := "MLC_3EY";
|
||||
S7_Family := "ZeusControl";
|
||||
S7_IECCheck := "TRUE";
|
||||
S7_Optimized := "TRUE";
|
||||
S7_PreferredLanguage := "LAD";
|
||||
S7_Version := "1.0"
|
||||
}
|
||||
ORGANIZATION_BLOCK "OB82_DiagnosticErrorInterrupt"
|
||||
{ S7_Language := "LAD" }
|
||||
NETWORK
|
||||
RUNG wire#powerrail
|
||||
END_RUNG
|
||||
END_NETWORK
|
||||
END_ORGANIZATION_BLOCK
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
MultiLingualTexts:
|
||||
- id: MLC_3EY
|
||||
es-ES: OB82_DiagnosticErrorInterrupt
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
MultiLingualTexts:
|
||||
- id: MLC_4gu
|
||||
es-ES: OB83_PullOrPlugOfModules
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
MultiLingualTexts:
|
||||
- id: MLC_45M
|
||||
es-ES: OB86_RackOrStationFailure
|
||||
+3
-11
@@ -1,15 +1,12 @@
|
||||
{
|
||||
S7_Author := "ABH";
|
||||
S7_BlockTitle := "MLC_xQ";
|
||||
S7_Family := "ZeusControl";
|
||||
S7_IECCheck := "TRUE";
|
||||
S7_Optimized := "TRUE";
|
||||
S7_PreferredLanguage := "LAD";
|
||||
S7_Version := "1.0"
|
||||
S7_Version := "0.1"
|
||||
}
|
||||
ORGANIZATION_BLOCK "OB100_Startup"
|
||||
VAR_TEMP
|
||||
t_DummyInt : Int;
|
||||
t_dummyInt : Int;
|
||||
END_VAR
|
||||
|
||||
{
|
||||
@@ -20,14 +17,9 @@ ORGANIZATION_BLOCK "OB100_Startup"
|
||||
RUNG wire#powerrail
|
||||
{ S7_Templates := "date_type := DTL" }
|
||||
RD_LOC_T(
|
||||
RET_VAL => #t_DummyInt,
|
||||
RET_VAL => #t_dummyInt,
|
||||
OUT => "DB1_SYS".FechaHoraNuevaManual
|
||||
)
|
||||
END_RUNG
|
||||
END_NETWORK
|
||||
{ S7_Language := "LAD" }
|
||||
NETWORK
|
||||
RUNG wire#powerrail
|
||||
END_RUNG
|
||||
END_NETWORK
|
||||
END_ORGANIZATION_BLOCK
|
||||
-2
@@ -1,5 +1,3 @@
|
||||
MultiLingualTexts:
|
||||
- id: MLC_xQ
|
||||
es-ES: OB100_Startup
|
||||
- id: MLC_3Ju
|
||||
es-ES: Al arrancar, actualizamos la fecha y hora nueva para editar desde HMI/SCADA
|
||||
+1
-4
@@ -1,11 +1,8 @@
|
||||
{
|
||||
S7_Author := "ABH";
|
||||
S7_BlockTitle := "MLC_Vf";
|
||||
S7_Family := "ZeusControl";
|
||||
S7_IECCheck := "TRUE";
|
||||
S7_Optimized := "TRUE";
|
||||
S7_PreferredLanguage := "LAD";
|
||||
S7_Version := "1.0"
|
||||
S7_Version := "0.1"
|
||||
}
|
||||
ORGANIZATION_BLOCK "OB121_ProgrammingError"
|
||||
{ S7_Language := "LAD" }
|
||||
+2
-5
@@ -1,13 +1,10 @@
|
||||
{
|
||||
S7_Author := "ABH";
|
||||
S7_BlockTitle := "MLC_4gR";
|
||||
S7_Family := "ZeusControl";
|
||||
S7_IECCheck := "TRUE";
|
||||
S7_Optimized := "TRUE";
|
||||
S7_PreferredLanguage := "LAD";
|
||||
S7_Version := "1.0"
|
||||
S7_Version := "0.1"
|
||||
}
|
||||
ORGANIZATION_BLOCK "OB122_IOAccessError"
|
||||
ORGANIZATION_BLOCK "OB122_IO_AccessError"
|
||||
{ S7_Language := "LAD" }
|
||||
NETWORK
|
||||
RUNG wire#powerrail
|
||||
+1
-4
@@ -1,11 +1,8 @@
|
||||
{
|
||||
S7_Author := "ABH";
|
||||
S7_BlockTitle := "MLC_eF";
|
||||
S7_Family := "ZeusControl";
|
||||
S7_IECCheck := "TRUE";
|
||||
S7_Optimized := "TRUE";
|
||||
S7_PreferredLanguage := "LAD";
|
||||
S7_Version := "1.0"
|
||||
S7_Version := "0.1"
|
||||
}
|
||||
ORGANIZATION_BLOCK "OB40_HardwareInterrupt"
|
||||
{ S7_Language := "LAD" }
|
||||
+1
-4
@@ -1,11 +1,8 @@
|
||||
{
|
||||
S7_Author := "ABH";
|
||||
S7_BlockTitle := "MLC_4H3";
|
||||
S7_Family := "ZeusControl";
|
||||
S7_IECCheck := "TRUE";
|
||||
S7_Optimized := "TRUE";
|
||||
S7_PreferredLanguage := "LAD";
|
||||
S7_Version := "1.0"
|
||||
S7_Version := "0.1"
|
||||
}
|
||||
ORGANIZATION_BLOCK "OB80_TimeErrorInterrupt"
|
||||
{ S7_Language := "LAD" }
|
||||
+1
-4
@@ -1,11 +1,8 @@
|
||||
{
|
||||
S7_Author := "ABH";
|
||||
S7_BlockTitle := "MLC_4gu";
|
||||
S7_Family := "ZeusControl";
|
||||
S7_IECCheck := "TRUE";
|
||||
S7_Optimized := "TRUE";
|
||||
S7_PreferredLanguage := "LAD";
|
||||
S7_Version := "1.0"
|
||||
S7_Version := "0.1"
|
||||
}
|
||||
ORGANIZATION_BLOCK "OB83_PullOrPlugOfModules"
|
||||
{ S7_Language := "LAD" }
|
||||
+1
-4
@@ -1,11 +1,8 @@
|
||||
{
|
||||
S7_Author := "ABH";
|
||||
S7_BlockTitle := "MLC_45M";
|
||||
S7_Family := "ZeusControl";
|
||||
S7_IECCheck := "TRUE";
|
||||
S7_Optimized := "TRUE";
|
||||
S7_PreferredLanguage := "LAD";
|
||||
S7_Version := "1.0"
|
||||
S7_Version := "0.1"
|
||||
}
|
||||
ORGANIZATION_BLOCK "OB86_RackOrStationFailure"
|
||||
{ S7_Language := "LAD" }
|
||||
@@ -0,0 +1,328 @@
|
||||
{
|
||||
S7_BlockNumber := "50";
|
||||
S7_EditorMode := "SCL";
|
||||
S7_IECCheck := "TRUE";
|
||||
S7_Optimized := "TRUE";
|
||||
S7_Version := "0.1"
|
||||
}
|
||||
FUNCTION "FC50_MAIN" : Void
|
||||
VAR_INPUT
|
||||
{ S7_MLC := "MLC_3wR" }
|
||||
CPU_MarcasCiclo : Byte;
|
||||
{ S7_MLC := "MLC_3Se" }
|
||||
CPU_MarcasSistema : Byte;
|
||||
{ S7_MLC := "MLC_4gv" }
|
||||
RedProfinet : HW_IOSYSTEM;
|
||||
{ S7_MLC := "MLC_45H" }
|
||||
SegGeneralDisp : Bool;
|
||||
END_VAR
|
||||
|
||||
{ S7_Language := "SCL" }
|
||||
NETWORK
|
||||
REGION DESCRIPCION
|
||||
(*
|
||||
###### (C)Copyright ZeusControl 2026 - 2026
|
||||
|
||||
---
|
||||
### Información del Sistema
|
||||
| Hardware Compatible | Entorno de Ingeniería |
|
||||
|---------------------|-----------------------|
|
||||
| PLC serie 1200/1500 | TIA Portal 18 |
|
||||
|
||||
---
|
||||
> **Restricciones:** Ninguna.
|
||||
|
||||
---
|
||||
### Descripción Funcional
|
||||
|
||||
Función central para la organizacion de llamadas previas al programa de usuario.
|
||||
|
||||
En ella se realizan las siguientes acciones:
|
||||
|
||||
- Llamada a FC sistema.
|
||||
- Llamada a gestor dispositivos
|
||||
- Llamada a dispositivos
|
||||
- Llamada a multiplexados
|
||||
|
||||
---
|
||||
### Dependencias Requeridas
|
||||
| Tipo | Elementos |
|
||||
|------|-----------|
|
||||
| FC | - |
|
||||
| FB | - |
|
||||
| DB | - |
|
||||
| UDT | - |
|
||||
|
||||
---
|
||||
### Historial de Cambios
|
||||
| Versión | Fecha | Técnico | Cambios |
|
||||
|----------|------------|---------|---------|
|
||||
| 01.00.00 | 21.07.2026 | (ABH) | Primera version. |
|
||||
*)
|
||||
END_REGION DESCRIPCION
|
||||
|
||||
|
||||
// ==========================================================================================================
|
||||
REGION PRE_PROGRAMA
|
||||
|
||||
// ==========================================================================================================
|
||||
REGION SISTEMA
|
||||
|
||||
"FC1_ZC_SISTEMA"(CPU_MarcasCiclo := "Clock_Byte",
|
||||
CPU_MarcasSistema := "System_Byte",
|
||||
RedProfinet := "Local~PROFINET_IO-System");
|
||||
|
||||
END_REGION SISTEMA
|
||||
|
||||
|
||||
// ==========================================================================================================
|
||||
REGION DISPOSITIVOS
|
||||
|
||||
// ==========================================================================================================
|
||||
REGION LLAMADA_GESTOR_DISPOSITIVOS
|
||||
|
||||
// Gestor dispositivos
|
||||
"FC9_DISPOSITIVOS"();
|
||||
|
||||
END_REGION LLAMADA_GESTOR_DISPOSITIVOS
|
||||
|
||||
|
||||
// ==========================================================================================================
|
||||
REGION LLAMADA_ED
|
||||
|
||||
// Gestion multiplexado
|
||||
"FC2800_ZC_ED_MUX"("DB1_SYS".ARRANQUE);
|
||||
|
||||
// Gestion dispositivo
|
||||
"FC2000_ZC_ED"(Pulso1seg := "DB1_SYS".Pulso1seg,
|
||||
Simulacion := "DB1_SYS".SIM,
|
||||
UsuarioActual := "DB1_SYS".Usuario.Actual,
|
||||
FechaHoraActual := "DB1_SYS".FechaHoraActual);
|
||||
|
||||
END_REGION LLAMADA_ED
|
||||
|
||||
|
||||
// ==========================================================================================================
|
||||
REGION LLAMADA_EA
|
||||
|
||||
// Gestion multiplexado
|
||||
"FC2801_ZC_EA_MUX"("DB1_SYS".ARRANQUE);
|
||||
|
||||
// Gestion dispositivo
|
||||
"FC2001_ZC_EA"(Pulso1seg := "DB1_SYS".Pulso1seg,
|
||||
Simulacion := "DB1_SYS".SIM,
|
||||
Arranque := "DB1_SYS".ARRANQUE,
|
||||
Ack := "DB1_SYS".ACK,
|
||||
UsuarioActual := "DB1_SYS".Usuario.Actual,
|
||||
FechaHoraActual := "DB1_SYS".FechaHoraActual);
|
||||
END_REGION LLAMADA_EA
|
||||
|
||||
|
||||
// ==========================================================================================================
|
||||
REGION LLAMADA_SD
|
||||
|
||||
// Gestion multiplexado
|
||||
"FC2805_ZC_SD_MUX"("DB1_SYS".ARRANQUE);
|
||||
|
||||
// Gestion dispositivo
|
||||
"FC2005_ZC_SD"(Pulso1seg := "DB1_SYS".Pulso1seg,
|
||||
Simulacion := "DB1_SYS".SIM,
|
||||
Arranque := "DB1_SYS".ARRANQUE,
|
||||
Ack := "DB1_SYS".ACK,
|
||||
SeguridadesOK := #SegGeneralDisp,
|
||||
UsuarioActual := "DB1_SYS".Usuario.Actual,
|
||||
FechaHoraActual := "DB1_SYS".FechaHoraActual);
|
||||
|
||||
END_REGION LLAMADA_SD
|
||||
|
||||
|
||||
// ==========================================================================================================
|
||||
REGION LLAMADA_SA
|
||||
|
||||
// Gestion multiplexado
|
||||
"FC2806_ZC_SA_MUX"("DB1_SYS".ARRANQUE);
|
||||
|
||||
// Gestion dispositivo
|
||||
"FC2006_ZC_SA"(Ack := "DB1_SYS".ACK,
|
||||
SeguridadesOK := #SegGeneralDisp,
|
||||
UsuarioActual := "DB1_SYS".Usuario.Actual,
|
||||
FechaHoraActual := "DB1_SYS".FechaHoraActual);
|
||||
|
||||
END_REGION LLAMADA_SA
|
||||
|
||||
|
||||
// ==========================================================================================================
|
||||
REGION LLAMADA_V
|
||||
|
||||
// Gestion multiplexado
|
||||
"FC2810_ZC_V_MUX"(Arranque := "DB1_SYS".ARRANQUE,
|
||||
SeguridadesOK := TRUE);
|
||||
|
||||
// Gestion dispositivo
|
||||
"FC2010_ZC_V"(Pulso1seg := "DB1_SYS".Pulso1seg,
|
||||
Simulacion := "DB1_SYS".SIM,
|
||||
Arranque := "DB1_SYS".ARRANQUE,
|
||||
Ack := "DB1_SYS".ACK,
|
||||
SeguridadesOK := #SegGeneralDisp,
|
||||
UsuarioActual := "DB1_SYS".Usuario.Actual,
|
||||
FechaHoraActual := "DB1_SYS".FechaHoraActual);
|
||||
|
||||
END_REGION LLAMADA_V
|
||||
|
||||
|
||||
// ==========================================================================================================
|
||||
REGION LLAMADA_M
|
||||
|
||||
// Gestion multiplexado
|
||||
"FC2815_ZC_M_MUX"(Arranque := "DB1_SYS".ARRANQUE,
|
||||
SeguridadesOk := TRUE);
|
||||
|
||||
// Gestion dispositivo
|
||||
"FC2015_ZC_M"(Pulso1seg := "DB1_SYS".Pulso1seg,
|
||||
Simulacion := "DB1_SYS".SIM,
|
||||
Ack := "DB1_SYS".ACK,
|
||||
SeguridadesOK := #SegGeneralDisp,
|
||||
UsuarioActual := "DB1_SYS".Usuario.Actual,
|
||||
FechaHoraActual := "DB1_SYS".FechaHoraActual);
|
||||
|
||||
END_REGION LLAMADA_M
|
||||
|
||||
|
||||
// ==========================================================================================================
|
||||
REGION LLAMADA_M_VF
|
||||
|
||||
// Gestion multiplexado
|
||||
"FC2816_ZC_M_VF_MUX"(Arranque := "DB1_SYS".ARRANQUE,
|
||||
SeguridadesOK := TRUE);
|
||||
|
||||
// Gestion dispositivo
|
||||
"FC2016_ZC_M_VF"(Pulso1seg := "DB1_SYS".Pulso1seg,
|
||||
Simulacion := "DB1_SYS".SIM,
|
||||
Arranque := "DB1_SYS".ARRANQUE,
|
||||
Ack := "DB1_SYS".ACK,
|
||||
SeguridadesOK := #SegGeneralDisp,
|
||||
UsuarioActual := "DB1_SYS".Usuario.Actual,
|
||||
FechaHoraActual := "DB1_SYS".FechaHoraActual);
|
||||
|
||||
END_REGION LLAMADA_M_VF
|
||||
|
||||
|
||||
// ==========================================================================================================
|
||||
REGION LLAMADA_M_SINA
|
||||
|
||||
// Gestion multiplexado
|
||||
"FC2817_ZC_M_SINA_MUX"(Arranque := "DB1_SYS".ARRANQUE,
|
||||
SeguridadesOk := TRUE);
|
||||
|
||||
// Gestion dispositivo
|
||||
"DB2717_INST_M_SINA"(Pulso1seg := "DB1_SYS".Pulso1seg,
|
||||
Simulacion := "DB1_SYS".SIM,
|
||||
Arranque := "DB1_SYS".ARRANQUE,
|
||||
Ack := "DB1_SYS".ACK,
|
||||
SeguridadesOK := #SegGeneralDisp,
|
||||
UsuarioActual := "DB1_SYS".Usuario.Actual,
|
||||
FechaHoraActual := "DB1_SYS".FechaHoraActual);
|
||||
|
||||
END_REGION LLAMADA_M_SINA
|
||||
|
||||
|
||||
// ==========================================================================================================
|
||||
REGION LLAMADA_TQ
|
||||
|
||||
// Gestion multiplexado
|
||||
"FC2840_ZC_TQ_MUX"("DB1_SYS".ARRANQUE);
|
||||
|
||||
|
||||
END_REGION LLAMADA_TQ
|
||||
|
||||
|
||||
// ==========================================================================================================
|
||||
REGION LLAMADA_TQ_AE
|
||||
|
||||
// Gestion multiplexado
|
||||
"FC2841_ZC_TQ_AE_MUX"(Arranque := "DB1_SYS".ARRANQUE);
|
||||
|
||||
// Gestion dispositivo
|
||||
"FC2041_ZC_TQ_AE"(Pulso1seg := "DB1_SYS".Pulso1seg,
|
||||
Arranque := "DB1_SYS".ARRANQUE,
|
||||
Ack := "DB1_SYS".ACK);
|
||||
|
||||
END_REGION LLAMADA_TQ_AE
|
||||
|
||||
|
||||
// ==========================================================================================================
|
||||
REGION LLAMADA_TOT
|
||||
|
||||
// Gestion multiplexado
|
||||
"FC2825_ZC_TOT_MUX"(Arranque := "DB1_SYS".ARRANQUE);
|
||||
|
||||
// Gestion dispositivo
|
||||
"FC2025_ZC_TOT"(Pulso100ms := "DB1_SYS".Pulso1seg,
|
||||
Simulacion := "DB1_SYS".SIM,
|
||||
Arranque := "DB1_SYS".ARRANQUE);
|
||||
|
||||
END_REGION LLAMADA_TOT
|
||||
|
||||
|
||||
// ==========================================================================================================
|
||||
REGION LLAMADA_TEMP_FF
|
||||
|
||||
// Gestion dispositivo
|
||||
"FC2026_ZC_FF"("DB1_SYS".Pulso1seg);
|
||||
|
||||
// Gestion dispositivo
|
||||
"FC2027_ZC_FF_SEC"("DB1_SYS".Pulso1seg);
|
||||
|
||||
// Gestion dispositivo
|
||||
"FC2028_ZC_TEMP"("DB1_SYS".Pulso1seg);
|
||||
|
||||
END_REGION LLAMADA_TEMP_FF
|
||||
|
||||
|
||||
// ==========================================================================================================
|
||||
REGION LLAMADA_MEDIAS
|
||||
|
||||
// Gestion dispositivo
|
||||
"FC2037_ZC_MEDIA"(Pulso1seg := "DB1_SYS".Pulso1seg);
|
||||
|
||||
// Gestion dispositivo
|
||||
"FC2038_ZC_MEDIA_VOL"(Pulso1seg := "DB1_SYS".Pulso1seg);
|
||||
|
||||
END_REGION LLAMADA_MEDIAS
|
||||
|
||||
|
||||
// ==========================================================================================================
|
||||
REGION LLAMADA_PID
|
||||
|
||||
// Gestion multiplexado
|
||||
"FC2835_ZC_PID_MUX"("DB1_SYS".ARRANQUE);
|
||||
|
||||
END_REGION LLAMADA_PID
|
||||
|
||||
END_REGION DISPOSITIVOS
|
||||
|
||||
END_REGION PRE_PROGRAMA
|
||||
|
||||
|
||||
// ==========================================================================================================
|
||||
REGION PROGRAMA_USUARIO
|
||||
|
||||
"FC55_PROGRAMA_USUARIO"();
|
||||
|
||||
END_REGION PROGRAMA_USUARIO
|
||||
|
||||
|
||||
// ==========================================================================================================
|
||||
REGION POST_PROGRAMA
|
||||
|
||||
|
||||
|
||||
|
||||
END_REGION POST_PROGRAMA
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
END_NETWORK
|
||||
END_FUNCTION
|
||||
@@ -0,0 +1,9 @@
|
||||
MultiLingualTexts:
|
||||
- id: MLC_3wR
|
||||
es-ES: Byte Marca de ciclo CPU
|
||||
- id: MLC_3Se
|
||||
es-ES: Byte Marcas de sistema
|
||||
- id: MLC_4gv
|
||||
es-ES: ID Profinet IO System
|
||||
- id: MLC_45H
|
||||
es-ES: Seguridad general dispositivos
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
S7_BlockTitle := "MLC_3ck";
|
||||
S7_IECCheck := "TRUE";
|
||||
S7_Optimized := "TRUE";
|
||||
S7_PreferredLanguage := "LAD";
|
||||
S7_Version := "0.1"
|
||||
}
|
||||
ORGANIZATION_BLOCK "OB1_MAIN"
|
||||
VAR_TEMP
|
||||
for_i : Int;
|
||||
END_VAR
|
||||
|
||||
{
|
||||
S7_Language := "LAD";
|
||||
S7_NetworkTitle := "MLC_hY"
|
||||
}
|
||||
NETWORK
|
||||
RUNG wire#powerrail
|
||||
"FC50_MAIN"(
|
||||
CPU_MarcasCiclo := "Clock_Byte",
|
||||
CPU_MarcasSistema := "System_Byte",
|
||||
RedProfinet := "Local~PROFINET_IO-System",
|
||||
SegGeneralDisp := TRUE
|
||||
)
|
||||
END_RUNG
|
||||
END_NETWORK
|
||||
END_ORGANIZATION_BLOCK
|
||||
@@ -0,0 +1,5 @@
|
||||
MultiLingualTexts:
|
||||
- id: MLC_3ck
|
||||
es-ES: PRINCIPAL
|
||||
- id: MLC_hY
|
||||
es-ES: ===================== MAIN
|
||||
-192
@@ -1,192 +0,0 @@
|
||||
{
|
||||
S7_Author := "ABH";
|
||||
S7_BlockComment := "MLC_Qe";
|
||||
S7_BlockNumber := "15105";
|
||||
S7_BlockTitle := "MLC_4rc";
|
||||
S7_EditorMode := "SCL";
|
||||
S7_Family := "ZeusControl";
|
||||
S7_IECCheck := "TRUE";
|
||||
S7_Optimized := "TRUE";
|
||||
S7_Version := "1.0"
|
||||
}
|
||||
FUNCTION_BLOCK "FB15105_ZC_CALCULO_CURVA"
|
||||
VAR_INPUT
|
||||
{ S7_MLC := "MLC_5Bz" }
|
||||
ValorActual : Real;
|
||||
{ S7_MLC := "MLC_tn" }
|
||||
NumeroPuntos : Int := 10;
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
{ S7_MLC := "MLC_3eH" }
|
||||
Valor : Real;
|
||||
END_VAR
|
||||
VAR
|
||||
s_ValorActual : Real;
|
||||
s_Valor : Real;
|
||||
s_NumeroPuntos : Int;
|
||||
END_VAR
|
||||
VAR RETAIN
|
||||
{ S7_MLC := "MLC_4k7" }
|
||||
s_PuntoX : Array[1..#MAX_PUNTOS] of Real := [
|
||||
10.0,
|
||||
20.0,
|
||||
30.0,
|
||||
40.0,
|
||||
50.0,
|
||||
60.0,
|
||||
70.0,
|
||||
80.0,
|
||||
90.0,
|
||||
100.0
|
||||
];
|
||||
{ S7_MLC := "MLC_4Nw" }
|
||||
s_PuntoY : Array[1..#MAX_PUNTOS] of Real := [
|
||||
10.0,
|
||||
20.0,
|
||||
30.0,
|
||||
40.0,
|
||||
50.0,
|
||||
60.0,
|
||||
70.0,
|
||||
80.0,
|
||||
90.0,
|
||||
100.0
|
||||
];
|
||||
END_VAR
|
||||
VAR_TEMP
|
||||
for_i : Int;
|
||||
dx : Real;
|
||||
dy : Real;
|
||||
END_VAR
|
||||
VAR CONSTANT
|
||||
{ S7_MLC := "MLC_WH" }
|
||||
MAX_PUNTOS : Int := 10;
|
||||
END_VAR
|
||||
|
||||
{ S7_Language := "SCL" }
|
||||
NETWORK
|
||||
REGION DESCRIPCION
|
||||
//=======================================================================
|
||||
// (C)Copyright ZeusControl 2023 - 2023
|
||||
//=======================================================================
|
||||
(*
|
||||
### Información del Sistema
|
||||
| Hardware Compatible | Entorno de Ingeniería |
|
||||
|---------------------|-----------------------|
|
||||
| PLC serie 1200/1500 | TIA Portal 18 |
|
||||
|
||||
---
|
||||
### Descripción Funcional
|
||||
El bloque `FB15105_ZC_CALCULO_CURVA` implementa una función de interpolación lineal por tramos sobre una curva configurable de hasta `#MAX_PUNTOS` puntos `(X, Y)`. A partir de un valor de entrada `ValorActual`, devuelve el valor de salida interpolado `Valor`, permitiendo linealizar señales no lineales como sondas de nivel, curvas de bombas o perfiles de consigna.
|
||||
|
||||
Funcionalidades principales:
|
||||
- Validación del número de puntos activos: `#NumeroPuntos` se acota entre 2 (mínimo necesario para definir un segmento) y la constante de dimensionamiento `#MAX_PUNTOS`.
|
||||
- Relleno automático: los puntos no utilizados por encima de `#s_NumeroPuntos` se rellenan con el último valor válido, manteniendo la coherencia del array para los cálculos posteriores.
|
||||
- Corrección de monotonía: se fuerza la coordenada `X` a ser monótona creciente o igual hacia adelante, evitando inversiones de tramo que producirían divisiones por `dx` negativas o nulas.
|
||||
- Saturación de entrada: si `#ValorActual` está por debajo del primer punto, la salida toma directamente el primer `Y`; si está por encima del último, toma el último `Y`, abortando el resto del escaneo para optimizar el tiempo de ciclo.
|
||||
- Búsqueda del segmento activo: recorre los `#MAX_PUNTOS - 1` segmentos y detecta aquel en el que se encuentra el valor de entrada.
|
||||
- Interpolación lineal: calcula los deltas `dx` y `dy` del segmento y aplica la ecuación `Y = (X - X1) * (dY / dX) + Y1`. En caso de `dx` nulo (tramo vertical o degenerado) se asigna directamente el `Y` del extremo inferior para evitar división por cero.
|
||||
- Publicación del resultado en la salida `#Valor` una vez finalizado el cálculo.
|
||||
|
||||
> **Restricciones:** Ninguna.
|
||||
|
||||
---
|
||||
### Dependencias Requeridas
|
||||
| Tipo | Elementos |
|
||||
|------|-----------|
|
||||
| FC | - |
|
||||
| FB | - |
|
||||
| DB | - |
|
||||
| UDT | - |
|
||||
|
||||
---
|
||||
### Historial de Cambios
|
||||
| Versión | Fecha | Técnico | Cambios |
|
||||
|----------|------------|---------|---------|
|
||||
| 01.00.00 | 02.10.2023 | (ABH) | Primera versión. |
|
||||
*)
|
||||
END_REGION DESCRIPCION
|
||||
|
||||
|
||||
// ===============================================================================================================
|
||||
REGION LIMITES_VALORES
|
||||
|
||||
#s_ValorActual := #ValorActual;
|
||||
#s_NumeroPuntos := #NumeroPuntos;
|
||||
|
||||
// Límite en configuración de número de puntos activos
|
||||
IF #s_NumeroPuntos < 2 THEN
|
||||
#s_NumeroPuntos := 2; // Una curva necesita mínimo 2 puntos (X1, Y1) a (X2, Y2)
|
||||
ELSIF #s_NumeroPuntos > #MAX_PUNTOS THEN
|
||||
#s_NumeroPuntos := #MAX_PUNTOS;
|
||||
END_IF;
|
||||
|
||||
// Relleno automático de los puntos no utilizados con el último valor válido
|
||||
FOR #for_i := #s_NumeroPuntos TO #MAX_PUNTOS DO
|
||||
#s_PuntoX[#for_i] := #s_PuntoX[#s_NumeroPuntos];
|
||||
#s_PuntoY[#for_i] := #s_PuntoY[#s_NumeroPuntos];
|
||||
END_FOR;
|
||||
|
||||
// Corrección de monotonía (Asegurar que X siempre sea creciente o igual)
|
||||
FOR #for_i := #MAX_PUNTOS TO 2 BY -1 DO
|
||||
IF #s_PuntoX[#for_i] < #s_PuntoX[#for_i - 1] THEN
|
||||
#s_PuntoX[#for_i] := #s_PuntoX[#for_i - 1];
|
||||
END_IF;
|
||||
END_FOR;
|
||||
|
||||
// Saturación del valor de entrada a los extremos de la curva configurada
|
||||
IF #s_ValorActual <= #s_PuntoX[1] THEN
|
||||
#s_ValorActual := #s_PuntoX[1];
|
||||
#s_Valor := #s_PuntoY[1];
|
||||
#Valor := #s_Valor;
|
||||
RETURN; // Si está por debajo, asignamos y abortamos scan (Optimización)
|
||||
|
||||
ELSIF #s_ValorActual >= #s_PuntoX[#MAX_PUNTOS] THEN
|
||||
#s_ValorActual := #s_PuntoX[#MAX_PUNTOS];
|
||||
#s_Valor := #s_PuntoY[#MAX_PUNTOS];
|
||||
#Valor := #s_Valor;
|
||||
RETURN; // Si está por encima, asignamos y abortamos scan
|
||||
END_IF;
|
||||
|
||||
END_REGION LIMITES_VALORES
|
||||
|
||||
|
||||
// ===============================================================================================================
|
||||
REGION CALCULO_SALIDA
|
||||
|
||||
// Búsqueda del segmento activo e interpolación lineal
|
||||
FOR #for_i := 1 TO (#MAX_PUNTOS - 1) DO
|
||||
|
||||
IF (#s_ValorActual >= #s_PuntoX[#for_i]) AND (#s_ValorActual <= #s_PuntoX[#for_i + 1]) THEN
|
||||
|
||||
// Cálculo de deltas
|
||||
#dx := #s_PuntoX[#for_i + 1] - #s_PuntoX[#for_i];
|
||||
#dy := #s_PuntoY[#for_i + 1] - #s_PuntoY[#for_i];
|
||||
|
||||
// Proteccion por división por Cero
|
||||
IF #dx <= 0.0 THEN
|
||||
#s_Valor := #s_PuntoY[#for_i]; // Tramo vertical o nulo
|
||||
ELSE
|
||||
// Ecuación de la recta: Y = (X - X1) * (dY / dX) + Y1
|
||||
#s_Valor := ((#s_ValorActual - #s_PuntoX[#for_i]) * (#dy / #dx)) + #s_PuntoY[#for_i];
|
||||
END_IF;
|
||||
|
||||
// Segmento encontrado y calculado. Cortamos el bucle inmediatamente.
|
||||
EXIT;
|
||||
END_IF;
|
||||
|
||||
END_FOR;
|
||||
|
||||
END_REGION CALCULO_SALIDA
|
||||
|
||||
|
||||
// ===============================================================================================================
|
||||
REGION SALIDA
|
||||
|
||||
#Valor := #s_Valor;
|
||||
|
||||
END_REGION SALIDA
|
||||
|
||||
|
||||
END_NETWORK
|
||||
END_FUNCTION_BLOCK
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
MultiLingualTexts:
|
||||
- id: MLC_4rc
|
||||
es-ES: FB15105_ZC_CALCULO_CURVA
|
||||
- id: MLC_Qe
|
||||
es-ES: Bloque de funcion para calculo curva de 10 puntos maximo.
|
||||
- id: MLC_5Bz
|
||||
es-ES: Valor actual
|
||||
- id: MLC_tn
|
||||
es-ES: Numero de puntos
|
||||
- id: MLC_3eH
|
||||
es-ES: Valor resultante curva
|
||||
- id: MLC_4k7
|
||||
es-ES: Valor X
|
||||
- id: MLC_4Nw
|
||||
es-ES: Valor Y
|
||||
- id: MLC_WH
|
||||
es-ES: Numero maximo de puntos
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
{
|
||||
S7_Author := "ABH";
|
||||
S7_BlockComment := "MLC_4Et";
|
||||
S7_BlockNumber := "2717";
|
||||
S7_BlockTitle := "MLC_Wv";
|
||||
S7_Family := "ZeusControl";
|
||||
S7_Optimized := "TRUE";
|
||||
S7_StandardRetain := "FALSE";
|
||||
S7_Version := "1.0"
|
||||
}
|
||||
DATA_BLOCK DB2717_INST_M_SINA : FB2017_ZC_M_SINA
|
||||
Pulso1seg := FALSE;
|
||||
Simulacion := FALSE;
|
||||
Ack := FALSE;
|
||||
SeguridadesOK := TRUE;
|
||||
HWIDSTW[0] := 0;
|
||||
HWIDZSW[0] := 0;
|
||||
SinaSpeed[0].EnableAxis := FALSE;
|
||||
SinaSpeed[0].AckError := FALSE;
|
||||
SinaSpeed[0].SpeedSp := 0.0;
|
||||
SinaSpeed[0].RefSpeed := 0.0;
|
||||
SinaSpeed[0].ConfigAxis := 16#003F;
|
||||
SinaSpeed[0].HWIDSTW := 0;
|
||||
SinaSpeed[0].HWIDZSW := 0;
|
||||
SinaSpeed[0].AxisEnabled := FALSE;
|
||||
SinaSpeed[0].Lockout := FALSE;
|
||||
SinaSpeed[0].ActVelocity := 0.0;
|
||||
SinaSpeed[0].Error := FALSE;
|
||||
SinaSpeed[0].Status := 16#0000;
|
||||
SinaSpeed[0].DiagId := 16#0000;
|
||||
SinaSpeed[0].STW1 := 16#0000;
|
||||
SinaSpeed[0].VelocitySP := 16#0000;
|
||||
SinaSpeed[0].ZSW1 := 16#0000;
|
||||
SinaSpeed[0].VelocityAV := 16#0000;
|
||||
END_DATA_BLOCK
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
MultiLingualTexts:
|
||||
- id: MLC_Wv
|
||||
es-ES: DB2717_INST_M_SINA
|
||||
- id: MLC_4Et
|
||||
es-ES: Instancia bloque de funcion FB2017_M_SINA
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user