#pragma once #include #include #include #include #include "PLC/EnvState.h" using namespace std; struct LaserParam { double laserPower; double laserDefocus; double laserSpeed; LaserParam() { laserPower = 0.0; laserDefocus = 0.0; laserSpeed = 0.0; } }; struct MStatue { int64_t m_MoldPos; //脉冲数 int64_t m_PowderPos; //脉冲数 int64_t m_ArmPos; //脉冲数 int64_t m_TotalPrintTime; //打印时间 毫秒 //int64_t m_TotalLaserUsedTime; //出光时间 毫秒 MStatue() { m_MoldPos=0; m_PowderPos = 0; m_ArmPos = 0; //m_TotalLaserUsedTime = 0; m_TotalPrintTime = 0; } }; struct StateBean { unsigned int layerIndex; unsigned int maxLayerIndex; float jobProgress; vector laserParams; double layerThick; string systemState; unsigned int jobCostMil; unsigned int remainMil; double realCostSeconds; time_t currentTime; explicit StateBean() { jobProgress = 0.0f; layerIndex = 0; maxLayerIndex = 0; remainMil = 0; layerThick = 0; jobCostMil = 0; realCostSeconds = 0; systemState = u8"停止"; time(¤tTime); } }; enum AutoPrintCtrlState { NoAuto=0, AutoPrint, AutoPause }; struct EnvInfo { float m_OxygenRealTimeValue1; float m_OxygenRealTimeValue2; float m_WindValue; float m_AnaWindValue; float m_AmbientTemp; float m_InnerTemp; float m_PlatformTemp; float m_PlatformTempSettingValue; float m_WaterTemp; float m_PrintPressure; float m_AvgPrintPressure; float m_MoldPos; float m_LinearEncoderPos; float m_PowderPos; float m_ArmPos; float m_SupplyPos; float m_MoldLoadTorque; float m_PowderLoadTorque; float m_ArmLoadTorque; float m_SupplyLoadTorque; float m_PipeWaterTemp; float m_FanVoltage; float m_FanFrequency; bool m_IsUpDownLimit; //升降限位 bool m_IsDedustingStopAlarm; float m_PowderQty; float m_ProtectGasPressure; float m_PrintPowderPressureDif; float m_PowderJarPressureDif; bool m_IsOxygenSensorConnect; bool m_IsChillerComConnect; bool m_IsCameraConnect; bool m_IsHeatingConnect; bool m_IsFreqAlarm; bool m_IsPurifierConnectAlarm; float m_RemainPowder; unsigned int jobCostMil; unsigned int remainMil; double realCostSeconds; string m_CurrentAlarmInfo; EnvState m_EnvState; }; class SystemInfo { public: SystemInfo(); ~SystemInfo(); void LockInfo(); void UnlockInfo(); void GetEnvInfo(EnvInfo& envInfo); void SetDedustingStopAlarm(bool bvalue); bool IsDedustingStopAlarm(); float GetComPrintOxygen1() { float rel = 0.0f; LockInfo(); rel = m_ComPrintOxygen1; UnlockInfo(); return rel; } float GetComPrintOxygen2() { float rel = 0.0f; LockInfo(); rel = m_ComPrintOxygen2; UnlockInfo(); return rel; } float GetComOutsideOxygen() { float rel = 0.0f; LockInfo(); rel = m_ComOutsideOxygen; UnlockInfo(); return rel; } float GetPowderQty(); float GetPrintPressure() { float rel = 0.0f; LockInfo(); rel = m_EnvState.m_PrintPressureAnalog; UnlockInfo(); return rel; } float GetOxygenRealTimeMaxValue() { float value = 0.0f; LockInfo(); value = (m_ComPrintOxygen1 > m_ComPrintOxygen2 ? m_ComPrintOxygen1 : m_ComPrintOxygen2); UnlockInfo(); return value; } float GetOxygenRealTimeMinValue() { float value = 0.0f; LockInfo(); value = (m_ComPrintOxygen1 < m_ComPrintOxygen2 ? m_ComPrintOxygen1 : m_ComPrintOxygen2); UnlockInfo(); return value; } public: StateBean m_StateBean; MStatue m_MStatue; CRITICAL_SECTION m_MStatueCS; EnvState m_EnvState; float m_ComPrintOxygen1; //通讯氧含量 float m_ComPrintOxygen2; float m_ComOutsideOxygen; float m_PrintTemp; float m_PrintHumidity; float m_WindValue; float m_PlatformTemp; float m_PlatformTempSettingValue; float m_WaterTemp; //float m_PrintPressure; float m_PowderQtyPos; float m_FanFrequency; float m_PipeWaterTemp; float m_MoldMainPos; float m_MoldSlavePos; float m_ArmPos; bool m_IsOxygenSensorConnect; bool m_IsHeatingConnect; int64_t m_PrintRemainTime; int64_t m_PauseRemainTime; AutoPrintCtrlState m_AutoPrintCtrlState; short m_TestAdc[5]; long m_TestOutputState; long m_TestInputState; long m_TestExtout1State; long m_TestExtin1State; bool m_IsDedustingStopAlarm; string m_ProductVersion; float m_RemainPowder; bool m_PrintAirEvacuationNeedOpen; bool m_PurifierCtrlPrintAirEvacuation; CRITICAL_SECTION m_InfoCs; }; extern SystemInfo* g_SystemInfo;