diff --git a/CtrEditor.csproj b/CtrEditor.csproj
index eab6b69..9a88f2c 100644
--- a/CtrEditor.csproj
+++ b/CtrEditor.csproj
@@ -58,8 +58,8 @@
-
-
+
+
diff --git a/MainViewModel.cs b/MainViewModel.cs
index 9be5ac6..61d074b 100644
--- a/MainViewModel.cs
+++ b/MainViewModel.cs
@@ -39,7 +39,9 @@ namespace CtrEditor
public ObservableCollection ListaOsBase { get; } = new ObservableCollection();
private ObservableCollection _objetosSimulables = new ObservableCollection();
public PLCViewModel plcViewModelData;
- public Stopwatch stopwatch;
+ public Stopwatch stopwatch_PLCRefresh;
+ public Stopwatch stopwatch_SimRefresh;
+
private bool isSimulationRunning;
private bool isConnected;
@@ -88,7 +90,8 @@ namespace CtrEditor
TBConnectPLCCommand = new RelayCommand(ConnectPLC, () => !IsConnected);
TBDisconnectPLCCommand = new RelayCommand(DisconnectPLC, () => IsConnected);
- stopwatch = new Stopwatch();
+ stopwatch_PLCRefresh = new Stopwatch();
+ stopwatch_SimRefresh = new Stopwatch();
}
public void LoadInitialData()
@@ -172,6 +175,7 @@ namespace CtrEditor
_timerSimulacion.Start();
simulationManager.stopwatch.Start();
+ stopwatch_SimRefresh.Start();
IsSimulationRunning = true;
}
@@ -179,11 +183,18 @@ namespace CtrEditor
{
_timerSimulacion.Stop();
simulationManager.stopwatch.Stop();
+ stopwatch_SimRefresh.Stop();
IsSimulationRunning = false;
}
private void OnTickSimulacion(object sender, EventArgs e)
{
+ // Detener el cronómetro y obtener el tiempo transcurrido en milisegundos
+ stopwatch_SimRefresh.Stop();
+ float elapsedMilliseconds = (float)stopwatch_SimRefresh.Elapsed.TotalMilliseconds;
+
+ // Reiniciar el cronómetro para la próxima medición
+ stopwatch_SimRefresh.Restart();
foreach (var objetoSimulable in ObjetosSimulables)
objetoSimulable.UpdateGeometryStep();
@@ -191,7 +202,7 @@ namespace CtrEditor
simulationManager.Step();
foreach (var objetoSimulable in ObjetosSimulables)
- objetoSimulable.UpdateControl();
+ objetoSimulable.UpdateControl((int)elapsedMilliseconds);
}
@@ -213,16 +224,16 @@ namespace CtrEditor
if (!isConnected)
IsConnected = true;
// Detener el cronómetro y obtener el tiempo transcurrido en milisegundos
- stopwatch.Stop();
- float elapsedMilliseconds = (float)stopwatch.Elapsed.TotalMilliseconds;
+ stopwatch_PLCRefresh.Stop();
+ float elapsedMilliseconds = (float)stopwatch_PLCRefresh.Elapsed.TotalMilliseconds;
// Reiniciar el cronómetro para la próxima medición
- stopwatch.Restart();
+ stopwatch_PLCRefresh.Restart();
foreach (var objetoSimulable in ObjetosSimulables)
objetoSimulable.UpdatePLC(plcViewModelData.PLCInterface, (int) elapsedMilliseconds);
} else
- stopwatch.Stop();
+ stopwatch_PLCRefresh.Stop();
}
diff --git a/MainWindow.xaml b/MainWindow.xaml
index d7a6a26..b65635a 100644
--- a/MainWindow.xaml
+++ b/MainWindow.xaml
@@ -121,7 +121,7 @@
-