Skip to content

Commit

Permalink
refactor(daisi): Use separate ns-3 applications per application for CPPS
Browse files Browse the repository at this point in the history
Related to #105
  • Loading branch information
ltoenning committed Sep 25, 2023
1 parent 2bce0e2 commit 9174c2b
Show file tree
Hide file tree
Showing 10 changed files with 298 additions and 193 deletions.
46 changes: 33 additions & 13 deletions daisi/src/cpps/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,39 @@
add_subdirectory(scenariofile)

add_library(daisi_cpps_common_cpps_application STATIC)
target_sources(daisi_cpps_common_cpps_application
add_library(daisi_cpps_common_material_flow_logical_agent_application STATIC)
target_sources(daisi_cpps_common_material_flow_logical_agent_application
PRIVATE
cpps_application.cpp
cpps_application.h
material_flow_logical_agent_application.h
material_flow_logical_agent_application.cpp
)
target_link_libraries(daisi_cpps_common_cpps_application
target_link_libraries(daisi_cpps_common_material_flow_logical_agent_application
PUBLIC
ns3::libapplications
ns3::libnetwork
daisi_cpps_amr_physical_amr_physical_asset
daisi_cpps_logical_amr_amr_logical_agent
daisi_cpps_common_cpps_logger_ns3
daisi_cpps_logical_material_flow_material_flow_logical_agent
ns3::libapplications
daisi_cpps_logical_material_flow_material_flow_logical_agent
)

add_library(daisi_cpps_common_amr_logical_agent_application STATIC)
target_sources(daisi_cpps_common_amr_logical_agent_application
PRIVATE
amr_logical_agent_application.h
amr_logical_agent_application.cpp
)
target_link_libraries(daisi_cpps_common_amr_logical_agent_application
PUBLIC
ns3::libapplications
daisi_cpps_logical_amr_amr_logical_agent
)

add_library(daisi_cpps_common_amr_physical_asset_application STATIC)
target_sources(daisi_cpps_common_amr_physical_asset_application
PRIVATE
daisi_socket_manager
amr_physical_asset_application.h
amr_physical_asset_application.cpp
)
target_link_libraries(daisi_cpps_common_amr_physical_asset_application
PUBLIC
ns3::libapplications
daisi_cpps_amr_physical_amr_physical_asset
)

add_library(daisi_cpps_common_cpps_logger_ns3 STATIC)
Expand Down Expand Up @@ -59,7 +77,9 @@ target_link_libraries(daisi_cpps_common_cpps_manager
daisi_cpps_amr_physical_amr_physical_asset
daisi_cpps_amr_model_amr_static_ability
daisi_cpps_logical_amr_amr_logical_agent
daisi_cpps_common_cpps_application
daisi_cpps_common_material_flow_logical_agent_application
daisi_cpps_common_amr_logical_agent_application
daisi_cpps_common_amr_physical_asset_application
daisi_cpps_logical_material_flow_material_flow_logical_agent
daisi_manager_sola_helper
ns3::libcore
Expand Down
26 changes: 26 additions & 0 deletions daisi/src/cpps/common/amr_logical_agent_application.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2023 The SOLA authors
//
// This file is part of DAISI.
//
// DAISI is free software: you can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation; version 2.
//
// DAISI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
// Public License for more details.
//
// You should have received a copy of the GNU General Public License along with DAISI. If not, see
// <https://www.gnu.org/licenses/>.
//
// SPDX-License-Identifier: GPL-2.0-only

#include "amr_logical_agent_application.h"

namespace daisi::cpps {
ns3::TypeId AmrLogicalAgentApplication::GetTypeId() {
static ns3::TypeId tid = ns3::TypeId("AmrLogicalAgentApplication")
.SetParent<Application>()
.AddConstructor<AmrLogicalAgentApplication>();
return tid;
}
} // namespace daisi::cpps
36 changes: 36 additions & 0 deletions daisi/src/cpps/common/amr_logical_agent_application.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright 2023 The SOLA authors
//
// This file is part of DAISI.
//
// DAISI is free software: you can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation; version 2.
//
// DAISI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
// Public License for more details.
//
// You should have received a copy of the GNU General Public License along with DAISI. If not, see
// <https://www.gnu.org/licenses/>.
//
// SPDX-License-Identifier: GPL-2.0-only

#ifndef DAISI_CPPS_COMMON_AMR_LOGICAL_AGENT_APPLICATION_H_
#define DAISI_CPPS_COMMON_AMR_LOGICAL_AGENT_APPLICATION_H_

#include <memory>

#include "cpps/logical/amr/amr_logical_agent.h"
#include "ns3/application.h"

namespace daisi::cpps {

/// Wrapper to run an AMR Logical Agent as a ns3::Application
struct AmrLogicalAgentApplication final : public ns3::Application {
static ns3::TypeId GetTypeId();

std::unique_ptr<logical::AmrLogicalAgent> application;
};

} // namespace daisi::cpps

#endif
26 changes: 26 additions & 0 deletions daisi/src/cpps/common/amr_physical_asset_application.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2023 The SOLA authors
//
// This file is part of DAISI.
//
// DAISI is free software: you can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation; version 2.
//
// DAISI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
// Public License for more details.
//
// You should have received a copy of the GNU General Public License along with DAISI. If not, see
// <https://www.gnu.org/licenses/>.
//
// SPDX-License-Identifier: GPL-2.0-only

#include "amr_physical_asset_application.h"

namespace daisi::cpps {
ns3::TypeId AmrPhysicalAssetApplication::GetTypeId() {
static ns3::TypeId tid = ns3::TypeId("AmrPhysicalAssetApplication")
.SetParent<Application>()
.AddConstructor<AmrPhysicalAssetApplication>();
return tid;
}
} // namespace daisi::cpps
36 changes: 36 additions & 0 deletions daisi/src/cpps/common/amr_physical_asset_application.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright 2023 The SOLA authors
//
// This file is part of DAISI.
//
// DAISI is free software: you can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation; version 2.
//
// DAISI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
// Public License for more details.
//
// You should have received a copy of the GNU General Public License along with DAISI. If not, see
// <https://www.gnu.org/licenses/>.
//
// SPDX-License-Identifier: GPL-2.0-only

#ifndef DAISI_CPPS_COMMON_AMR_PHYSICAL_ASSET_APPLICATION_H_
#define DAISI_CPPS_COMMON_AMR_PHYSICAL_ASSET_APPLICATION_H_

#include <memory>

#include "cpps/amr/physical/amr_physical_asset.h"
#include "ns3/application.h"

namespace daisi::cpps {

/// Wrapper to run an AMR Physical Asset as a ns3::Application
struct AmrPhysicalAssetApplication final : public ns3::Application {
static ns3::TypeId GetTypeId();

std::unique_ptr<AmrPhysicalAsset> application;
};

} // namespace daisi::cpps

#endif
59 changes: 0 additions & 59 deletions daisi/src/cpps/common/cpps_application.cpp

This file was deleted.

50 changes: 0 additions & 50 deletions daisi/src/cpps/common/cpps_application.h

This file was deleted.

Loading

0 comments on commit 9174c2b

Please sign in to comment.