Compare commits
No commits in common. "3fe2d4aa0ed3ee38fc4981d9a5dd2694aa48a51f" and "fefd229495f7b2ae4869d765874c232f591f5434" have entirely different histories.
3fe2d4aa0e
...
fefd229495
1
.gitignore
vendored
1
.gitignore
vendored
@ -38,4 +38,3 @@ build/
|
||||
#log
|
||||
log/
|
||||
logs/
|
||||
Packages/
|
||||
|
@ -1,13 +0,0 @@
|
||||
<?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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -169,18 +169,6 @@ public:
|
||||
*/
|
||||
void SetSetFreq(double setFreq);
|
||||
|
||||
/**
|
||||
* @brief 获取模型动态库路径
|
||||
* @return const std::string&: 模型动态库路径
|
||||
*/
|
||||
const std::string &GetLibPath();
|
||||
|
||||
/**
|
||||
* @brief 设置模型动态库路径
|
||||
* @param sLibPath: std::string类型,模型动态库路径
|
||||
*/
|
||||
void SetLibPath(const std::string &sLibPath);
|
||||
|
||||
/**
|
||||
* @brief 单步执行函数
|
||||
* @details 模型默认的周期性执行函数
|
||||
|
@ -78,8 +78,6 @@ void XNModelManager::LoadModel(const std::string &modelPath, const std::string &
|
||||
model->SetFramework(GetFramework());
|
||||
model->SetInitializeType(initialType);
|
||||
model->SetThreadID(threadID);
|
||||
std::string workPath = GetFramework()->GetWorkPath() + "/Packages/";
|
||||
model->SetLibPath(workPath);
|
||||
if (initialType == 0) {
|
||||
// 使用std::filesystem处理路径
|
||||
std::filesystem::path configPath =
|
||||
|
@ -192,18 +192,6 @@ void XNModelObject::SetSetFreq(double setFreq)
|
||||
d->_setFreq = setFreq;
|
||||
}
|
||||
|
||||
const std::string &XNModelObject::GetLibPath()
|
||||
{
|
||||
T_D();
|
||||
return d->_sLibPath;
|
||||
}
|
||||
|
||||
void XNModelObject::SetLibPath(const std::string &sLibPath)
|
||||
{
|
||||
T_D();
|
||||
d->_sLibPath = sLibPath;
|
||||
}
|
||||
|
||||
// 初始化函数
|
||||
void XNModelObject::Initialize()
|
||||
{
|
||||
@ -390,16 +378,19 @@ void XNModelObject::ParseConfig()
|
||||
std::string mathlib = XNSim::getStringFromSqlite3(stmt, 13);
|
||||
if (mathlib.length() > 0) {
|
||||
// 使用标准C++文件路径处理
|
||||
//std::filesystem::path xmlPath(GetXmlPath());
|
||||
//d->_sLibPath = xmlPath.parent_path().string() + "/" + mathlib;
|
||||
std::string libPath = d->_sLibPath + "/" + mathlib;
|
||||
std::filesystem::path xmlPath(GetXmlPath());
|
||||
d->_sLibPath = xmlPath.parent_path().string() + "/" + mathlib;
|
||||
|
||||
// 使用标准C++动态库加载
|
||||
d->_dynamicLib = dlopen(libPath.c_str(), RTLD_LAZY);
|
||||
d->_dynamicLib = dlopen(d->_sLibPath.c_str(), RTLD_LAZY);
|
||||
if (d->_dynamicLib) { // 动态库加载成功
|
||||
LOG_INFO("0x2163 模型 %1 加载数据包模型动态库 %2 成功!", GetObjectName(), libPath);
|
||||
LOG_INFO("0x2163 Model %1 loaded algorithm dynamic library %2 successfully!",
|
||||
GetObjectName(), d->_sLibPath);
|
||||
} else {
|
||||
LOG_WARNING("0x2160 模型 %1 未找到数据包模型动态库 %2, 将不调用数据包模型!",
|
||||
GetObjectName(), libPath);
|
||||
LOG_WARNING(
|
||||
"0x2160 Model %1 failed to find algorithm dynamic library %2, will not call "
|
||||
"algorithm!",
|
||||
GetObjectName(), d->_sLibPath);
|
||||
d->_dynamicLib = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -169,18 +169,6 @@ public:
|
||||
*/
|
||||
void SetSetFreq(double setFreq);
|
||||
|
||||
/**
|
||||
* @brief 获取模型动态库路径
|
||||
* @return const std::string&: 模型动态库路径
|
||||
*/
|
||||
const std::string &GetLibPath();
|
||||
|
||||
/**
|
||||
* @brief 设置模型动态库路径
|
||||
* @param sLibPath: std::string类型,模型动态库路径
|
||||
*/
|
||||
void SetLibPath(const std::string &sLibPath);
|
||||
|
||||
/**
|
||||
* @brief 单步执行函数
|
||||
* @details 模型默认的周期性执行函数
|
||||
|
@ -124,7 +124,7 @@ bool XNScenarioManager::ParseScenarioXml(const std::string &XmlPath)
|
||||
std::string libName = service->Attribute("ClassName");
|
||||
std::string serviceVersion = service->Attribute("Version");
|
||||
libName = XNSim::getFileNameWithoutExt(libName);
|
||||
std::string dynamicLibName = servicePath + "/lib" + libName + ".so." + serviceVersion;
|
||||
std::string dynamicLibName = servicePath + "lib" + libName + ".so." + serviceVersion;
|
||||
// 加载动态库
|
||||
GetFramework()->GetServiceManager()->LoadService(dynamicLibName, libName,
|
||||
serviceVersion, 0);
|
||||
@ -177,7 +177,7 @@ bool XNScenarioManager::ParseScenarioXml(const std::string &XmlPath)
|
||||
std::string libName = model->Attribute("ClassName");
|
||||
std::string modelVersion = model->Attribute("Version");
|
||||
libName = XNSim::getFileNameWithoutExt(libName);
|
||||
std::string dynamicLibName = modelPath + "/lib" + libName + ".so." + modelVersion;
|
||||
std::string dynamicLibName = modelPath + "lib" + libName + ".so." + modelVersion;
|
||||
// 加载动态库
|
||||
GetFramework()->GetModelManager()->LoadModel(dynamicLibName, libName, modelVersion,
|
||||
planeName, 0, threadID);
|
||||
@ -195,12 +195,12 @@ bool XNScenarioManager::ParseConfig(const std::string &ConfigID)
|
||||
{
|
||||
T_D();
|
||||
// 获取数据库路径
|
||||
std::string XNCorePath = std::getenv("XNCore");
|
||||
if (XNCorePath.empty()) {
|
||||
std::string dbPath = std::getenv("XNCore");
|
||||
if (dbPath.empty()) {
|
||||
LOG_ERROR("0x1015 未设置XNCore环境变量, 引擎将退出!");
|
||||
return false;
|
||||
}
|
||||
std::string dbPath = XNCorePath + "/database/XNSim.db";
|
||||
dbPath += "/database/XNSim.db";
|
||||
|
||||
// 打开数据库
|
||||
sqlite3 *db;
|
||||
@ -239,31 +239,15 @@ bool XNScenarioManager::ParseConfig(const std::string &ConfigID)
|
||||
std::string version = XNSim::getStringFromSqlite3(stmt, 4);
|
||||
std::string kernel = XNSim::getStringFromSqlite3(stmt, 5);
|
||||
std::string rootPath = XNSim::getStringFromSqlite3(stmt, 7);
|
||||
if (rootPath.empty()) {
|
||||
LOG_WARNING("0x1020 未设置工作目录,使用默认工作目录: %1", XNCorePath);
|
||||
rootPath = XNCorePath;
|
||||
}
|
||||
GetFramework()->SetWorkPath(rootPath);
|
||||
// 设置模型库目录
|
||||
std::string modelPath = rootPath + XNSim::getStringFromSqlite3(stmt, 8);
|
||||
if (modelPath.empty()) {
|
||||
LOG_WARNING("0x1020 未设置模型库目录,使用默认模型库目录: %1/Models", XNCorePath);
|
||||
modelPath = XNCorePath + "/Models";
|
||||
}
|
||||
GetFramework()->SetModelPath(modelPath);
|
||||
// 设置服务库目录
|
||||
std::string servicePath = rootPath + XNSim::getStringFromSqlite3(stmt, 9);
|
||||
if (servicePath.empty()) {
|
||||
LOG_WARNING("0x1020 未设置服务库目录,使用默认服务库目录: %1/Services", XNCorePath);
|
||||
servicePath = XNCorePath + "/Services";
|
||||
}
|
||||
GetFramework()->SetServicePath(servicePath);
|
||||
// 设置域ID
|
||||
uint32_t domainID = std::stoul(XNSim::getStringFromSqlite3(stmt, 10));
|
||||
if (domainID == 0 || domainID > 225) {
|
||||
LOG_WARNING("0x1020 域ID设置错误,使用默认域ID: 10");
|
||||
domainID = 10;
|
||||
}
|
||||
GetFramework()->GetDDSManager()->SetDomainID(domainID);
|
||||
// 读取CPU亲和性
|
||||
std::string cpuAff = XNSim::getStringFromSqlite3(stmt, 6);
|
||||
@ -295,7 +279,7 @@ bool XNScenarioManager::ParseConfig(const std::string &ConfigID)
|
||||
std::string ServiceName = XNSim::getStringFromSqlite3(servicesStmt, 3);
|
||||
|
||||
ClassName = XNSim::getFileNameWithoutExt(ClassName);
|
||||
std::string dynamicLibName = servicePath + "/lib" + ClassName + ".so." + ServiceVersion;
|
||||
std::string dynamicLibName = servicePath + "lib" + ClassName + ".so." + ServiceVersion;
|
||||
// 加载动态库
|
||||
GetFramework()->GetServiceManager()->LoadService(dynamicLibName, ClassName, ServiceVersion,
|
||||
1);
|
||||
@ -389,7 +373,7 @@ bool XNScenarioManager::ParseConfig(const std::string &ConfigID)
|
||||
std::string ModelName = XNSim::getStringFromSqlite3(modelsStmt, 3);
|
||||
|
||||
ClassName = XNSim::getFileNameWithoutExt(ClassName);
|
||||
std::string dynamicLibName = modelPath + "/lib" + ClassName + ".so." + ModelVersion;
|
||||
std::string dynamicLibName = modelPath + "lib" + ClassName + ".so." + ModelVersion;
|
||||
// 加载动态库
|
||||
LOG_INFO("0x1021 加载模型: %1", dynamicLibName);
|
||||
GetFramework()->GetModelManager()->LoadModel(dynamicLibName, ClassName, ModelVersion,
|
||||
|
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(XNGroundHandling LANGUAGES CXX)
|
||||
|
||||
set(MODEL_VERSION "2.0.143.1")
|
||||
set(MODEL_VERSION "1.0.0.0")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
@ -49,10 +49,6 @@ void XNWeightBalance::PrepareForExecute()
|
||||
{
|
||||
T_D();
|
||||
XNModelObject::PrepareForExecute();
|
||||
InitializeData();
|
||||
d->_inputInterface.Initialize(GetFramework(), GetUniqueId(), 1);
|
||||
d->_outputInterface.Initialize(GetFramework(), GetUniqueId(), 2);
|
||||
d->_heartbeatInterface.Initialize(GetFramework(), GetUniqueId(), 2);
|
||||
}
|
||||
|
||||
void XNWeightBalance::StepUpdate()
|
||||
|
Loading…
x
Reference in New Issue
Block a user