diff --git a/schema/appmodel/application.schema.xml b/schema/appmodel/application.schema.xml
index a75dba2..74c8923 100644
--- a/schema/appmodel/application.schema.xml
+++ b/schema/appmodel/application.schema.xml
@@ -571,6 +571,12 @@
+
+
+
+
diff --git a/schema/appmodel/trigger.schema.xml b/schema/appmodel/trigger.schema.xml
index 398da30..333c2b7 100644
--- a/schema/appmodel/trigger.schema.xml
+++ b/schema/appmodel/trigger.schema.xml
@@ -80,7 +80,7 @@
-
+
@@ -216,10 +216,10 @@
-
-
-
-
+
+
+
+
@@ -469,6 +469,9 @@
+
+
+
diff --git a/src/TPWriterApplication.cpp b/src/TPWriterApplication.cpp
index 646d675..7975380 100644
--- a/src/TPWriterApplication.cpp
+++ b/src/TPWriterApplication.cpp
@@ -13,14 +13,15 @@
#include "conffwk/Configuration.hpp"
#include "oks/kernel.hpp"
#include "confmodel/Connection.hpp"
-#include "confmodel/Service.hpp"
#include "confmodel/NetworkConnection.hpp"
+#include "appmodel/ReadoutApplication.hpp"
+#include "confmodel/Service.hpp"
+#include "appmodel/SourceIDConf.hpp"
#include "appmodel/TPStreamWriterApplication.hpp"
#include "appmodel/TPStreamWriterModule.hpp"
#include "appmodel/TPStreamWriterConf.hpp"
#include "appmodel/NetworkConnectionRule.hpp"
#include "appmodel/NetworkConnectionDescriptor.hpp"
-#include "appmodel/SourceIDConf.hpp"
#include "appmodel/appmodelIssues.hpp"
#include "logging/Logging.hpp"
@@ -79,5 +80,54 @@ TPStreamWriterApplication::generate_modules(std::shared_ptr& disabled_resources) const {
+ // Disabled if:
+ // 1. I am explicitly disabled
+ // 2. All ReadoutApplications are disabled
+ // 3. TPGeneration is disabled in all readout applications
+
+ // First we can just check if the application itself is disabled
+ if (disabled_resources.contains(UID())) {
+ return true;
+ }
+
+ // Now for the tricky bit, we need to loop over the connections
+ for(auto& rule : get_network_rules()){
+ /// HACK (minor): We assume TPs will always contain this exact datatype
+ auto data_type = rule->get_descriptor()->get_data_type();
+
+ if (data_type != "TPSet"){
+ continue;
+ }
+
+
+ // We now loop over the parents
+ for (auto parent : configuration().referenced_by(*rule, "network_rules", false, false, false, 0)){
+
+ auto readout = parent->cast();
+ if(!readout){
+ continue;
+ }
+
+ // Check if readout is actually used by the configuration!
+ if(configuration().referenced_by(*readout, "*", false, false, false, 0).empty()){
+ continue;
+ }
+
+ /// If the RA is disabled then so is its TP
+ if(readout->compute_disabled_state(disabled_resources)){
+ continue;
+ }
+
+ // If the TP is enabled on ANY RA then we're enabled
+ if(readout->get_tp_generation_enabled()){
+ TLOG()<<"Found "<UID()<<" with TPG enabled";
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+}
+}
\ No newline at end of file
diff --git a/src/TriggerApplication.cpp b/src/TriggerApplication.cpp
index 19115a7..ed697b2 100644
--- a/src/TriggerApplication.cpp
+++ b/src/TriggerApplication.cpp
@@ -33,6 +33,7 @@
#include "appmodel/SourceIDConf.hpp"
+#include "appmodel/ReadoutApplication.hpp"
#include "appmodel/TriggerApplication.hpp"
#include "appmodel/appmodelIssues.hpp"
@@ -224,6 +225,56 @@ TriggerApplication::generate_modules(std::shared_ptr& disabled_resources) const {
+ // Disabled if:
+ // 1. I am explicitly disabled
+ // 2. All ReadoutApplications are disabled
+ // 3. TAGeneration is disabled in all readout applications related to this application by the network rules
+
+ // First we can just check if the application itself is disabled
+ if ( Resource::compute_disabled_state(disabled_resources) ) {
+ return true;
+ }
+
+ // Now for the tricky bit, we need to loop over the connections
+ for(auto& rule : get_network_rules()){
+ /// HACK (minor): We assume TPs will always contain this exact datatype
+ auto data_type = rule->get_descriptor()->get_data_type();
+
+ if (data_type != "TriggerActivity"){
+ continue;
+ }
+
+ // We now loop over the object using the same descriptor.
+ for (auto parent : configuration().referenced_by(*rule, "network_rules", false, false, false, 0)){
+
+ auto readout = parent->cast();
+ if(!readout){
+ continue;
+ }
+
+ // Check if readout is actually used by the configuration!
+ if(configuration().referenced_by(*readout, "*", false, false, false, 0).empty()){
+ continue;
+ }
+
+ /// If the RA is disabled then so is its TP
+ if(readout->compute_disabled_state(disabled_resources)){
+ continue;
+ }
+
+ // If the TA is enabled on ANY RA then we're enabled
+ // Here we are assuming consistency is enforced by the readout application itself. If TA is enabled, TP should be enabled too.
+ if(readout->get_ta_generation_enabled()){
+ TLOG()<<"Found "<UID()<<" with TA enabled";
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
} // namespace appmodel
} // namespace dunedaq