feat: Add AGV Map Editor and Simulator tools
- Add AGVMapEditor: Visual map editing with drag-and-drop node placement * RFID mapping separation (physical ID ↔ logical node mapping) * A* pathfinding algorithm with AGV directional constraints * JSON map data persistence with structured format * Interactive map canvas with zoom/pan functionality - Add AGVSimulator: Real-time AGV movement simulation * Virtual AGV with state machine (Idle, Moving, Rotating, Docking, Charging, Error) * Path execution and visualization from calculated routes * Real-time position tracking and battery simulation * Integration with map editor data format - Update solution structure and build configuration - Add comprehensive documentation in CLAUDE.md - Implement AGV-specific constraints (forward/backward docking, rotation limits) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
135
Cs_HMI/AGVSimulator/Models/SimulationState.cs
Normal file
135
Cs_HMI/AGVSimulator/Models/SimulationState.cs
Normal file
@@ -0,0 +1,135 @@
|
||||
using System;
|
||||
|
||||
namespace AGVSimulator.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 시뮬레이션 상태 관리 클래스
|
||||
/// </summary>
|
||||
public class SimulationState
|
||||
{
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// 시뮬레이션 실행 중 여부
|
||||
/// </summary>
|
||||
public bool IsRunning { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 시뮬레이션 시작 시간
|
||||
/// </summary>
|
||||
public DateTime? StartTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 시뮬레이션 경과 시간
|
||||
/// </summary>
|
||||
public TimeSpan ElapsedTime => StartTime.HasValue ? DateTime.Now - StartTime.Value : TimeSpan.Zero;
|
||||
|
||||
/// <summary>
|
||||
/// 시뮬레이션 속도 배율 (1.0 = 실시간, 2.0 = 2배속)
|
||||
/// </summary>
|
||||
public float SpeedMultiplier { get; set; } = 1.0f;
|
||||
|
||||
/// <summary>
|
||||
/// 총 처리된 이벤트 수
|
||||
/// </summary>
|
||||
public int TotalEvents { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 총 이동 거리 (모든 AGV 합계)
|
||||
/// </summary>
|
||||
public float TotalDistance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 발생한 오류 수
|
||||
/// </summary>
|
||||
public int ErrorCount { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// 기본 생성자
|
||||
/// </summary>
|
||||
public SimulationState()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// 시뮬레이션 시작
|
||||
/// </summary>
|
||||
public void Start()
|
||||
{
|
||||
if (!IsRunning)
|
||||
{
|
||||
IsRunning = true;
|
||||
StartTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 시뮬레이션 정지
|
||||
/// </summary>
|
||||
public void Stop()
|
||||
{
|
||||
IsRunning = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 시뮬레이션 상태 초기화
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
IsRunning = false;
|
||||
StartTime = null;
|
||||
SpeedMultiplier = 1.0f;
|
||||
TotalEvents = 0;
|
||||
TotalDistance = 0;
|
||||
ErrorCount = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 이벤트 발생 시 호출
|
||||
/// </summary>
|
||||
public void RecordEvent()
|
||||
{
|
||||
TotalEvents++;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 이동 거리 추가
|
||||
/// </summary>
|
||||
/// <param name="distance">이동한 거리</param>
|
||||
public void AddDistance(float distance)
|
||||
{
|
||||
TotalDistance += distance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 오류 발생 시 호출
|
||||
/// </summary>
|
||||
public void RecordError()
|
||||
{
|
||||
ErrorCount++;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 통계 정보 조회
|
||||
/// </summary>
|
||||
/// <returns>통계 정보 문자열</returns>
|
||||
public string GetStatistics()
|
||||
{
|
||||
return $"실행시간: {ElapsedTime:hh\\:mm\\:ss}, " +
|
||||
$"이벤트: {TotalEvents}, " +
|
||||
$"총거리: {TotalDistance:F1}, " +
|
||||
$"오류: {ErrorCount}";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user