修复了质量模型中的错误

This commit is contained in:
jinchao 2025-06-04 15:26:50 +08:00
parent b2e5036b2c
commit 3fe2d4aa0e
11 changed files with 30 additions and 14 deletions

1
.gitignore vendored
View File

@ -38,3 +38,4 @@ build/
#log #log
log/ log/
logs/ logs/
Packages/

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<Model>
<Name>XNGroundHandling</Name>
<Description>ATA04地面操纵模型</Description>
<Author>Jin</Author>
<Version>1.0.0</Version>
<CreateTime>2025-02-19 16:22:17</CreateTime>
<ChangeTime>2025-02-19 16:22:19</ChangeTime>
<Node>0-0</Node>
<Priority>99</Priority>
<MathLib>ATA04_SACSCGroundHandling_2.0.143.1H_20250506/libSACSCGroundHandling.so.2.0.143.1H</MathLib>
<CommandList/>
</Model>

Binary file not shown.

Binary file not shown.

View File

@ -78,12 +78,13 @@ void XNModelManager::LoadModel(const std::string &modelPath, const std::string &
model->SetFramework(GetFramework()); model->SetFramework(GetFramework());
model->SetInitializeType(initialType); model->SetInitializeType(initialType);
model->SetThreadID(threadID); model->SetThreadID(threadID);
std::filesystem::path parentPath = std::filesystem::path(modelPath).parent_path(); std::string workPath = GetFramework()->GetWorkPath() + "/Packages/";
model->SetLibPath(parentPath.string()); model->SetLibPath(workPath);
if (initialType == 0) { if (initialType == 0) {
// 使用std::filesystem处理路径 // 使用std::filesystem处理路径
std::filesystem::path configPath = std::filesystem::path configPath =
parentPath / (className + "_V" + modelVersion + ".mcfg"); std::filesystem::path(modelPath).parent_path()
/ (className + "_V" + modelVersion + ".mcfg");
model->SetXmlPath(configPath.string()); model->SetXmlPath(configPath.string());
} else if (initialType == 1) { } else if (initialType == 1) {
model->SetXmlPath(planeName + "," + className + "," + modelVersion); model->SetXmlPath(planeName + "," + className + "," + modelVersion);

View File

@ -390,19 +390,16 @@ void XNModelObject::ParseConfig()
std::string mathlib = XNSim::getStringFromSqlite3(stmt, 13); std::string mathlib = XNSim::getStringFromSqlite3(stmt, 13);
if (mathlib.length() > 0) { if (mathlib.length() > 0) {
// 使用标准C++文件路径处理 // 使用标准C++文件路径处理
std::filesystem::path xmlPath(GetXmlPath()); //std::filesystem::path xmlPath(GetXmlPath());
d->_sLibPath = xmlPath.parent_path().string() + "/" + mathlib; //d->_sLibPath = xmlPath.parent_path().string() + "/" + mathlib;
std::string libPath = d->_sLibPath + "/" + mathlib;
// 使用标准C++动态库加载 // 使用标准C++动态库加载
d->_dynamicLib = dlopen(d->_sLibPath.c_str(), RTLD_LAZY); d->_dynamicLib = dlopen(libPath.c_str(), RTLD_LAZY);
if (d->_dynamicLib) { // 动态库加载成功 if (d->_dynamicLib) { // 动态库加载成功
LOG_INFO("0x2163 Model %1 loaded algorithm dynamic library %2 successfully!", LOG_INFO("0x2163 模型 %1 加载数据包模型动态库 %2 成功!", GetObjectName(), libPath);
GetObjectName(), d->_sLibPath);
} else { } else {
LOG_WARNING( LOG_WARNING("0x2160 模型 %1 未找到数据包模型动态库 %2, 将不调用数据包模型!",
"0x2160 Model %1 failed to find algorithm dynamic library %2, will not call " GetObjectName(), libPath);
"algorithm!",
GetObjectName(), d->_sLibPath);
d->_dynamicLib = nullptr; d->_dynamicLib = nullptr;
} }
} }

View File

@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16)
project(XNGroundHandling LANGUAGES CXX) project(XNGroundHandling LANGUAGES CXX)
set(MODEL_VERSION "1.0.0.0") set(MODEL_VERSION "2.0.143.1")
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)

View File

@ -49,6 +49,10 @@ void XNWeightBalance::PrepareForExecute()
{ {
T_D(); T_D();
XNModelObject::PrepareForExecute(); XNModelObject::PrepareForExecute();
InitializeData();
d->_inputInterface.Initialize(GetFramework(), GetUniqueId(), 1);
d->_outputInterface.Initialize(GetFramework(), GetUniqueId(), 2);
d->_heartbeatInterface.Initialize(GetFramework(), GetUniqueId(), 2);
} }
void XNWeightBalance::StepUpdate() void XNWeightBalance::StepUpdate()