224130d99f
tests / build-and-test (push) Failing after 35s
New LimitMonitorStore keyed by VID; each entry is a vector of LimitDefinition (LIMITID + upper/lower deadband as arbitrary Items). S2F45/F46 set, S2F47/F48 read. VLAACK validates each VID exists. Four new SxFy in the catalog; codegen handles the nested list-of-(VID, list-of-LimitDefinition) shape. LimitDefinition is defined in store/limits.hpp and referenced as external_struct so the data model and the message codecs share one type. The actual "value crossed limit" detection + CEID emission is left to the application's set_value path (E30 §6.21 leaves *how* the equipment detects crossings up to the implementer). COMPLIANCE.md: Limits Monitoring Additional capability flips ✅. Tests: 80 cases / 465 assertions. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
62 lines
2.3 KiB
C++
62 lines
2.3 KiB
C++
#pragma once
|
|
|
|
#include "secsgem/gem/store/alarms.hpp"
|
|
#include "secsgem/gem/store/clock.hpp"
|
|
#include "secsgem/gem/store/equipment_constants.hpp"
|
|
#include "secsgem/gem/store/event_reports.hpp"
|
|
#include "secsgem/gem/store/host_commands.hpp"
|
|
#include "secsgem/gem/store/limits.hpp"
|
|
#include "secsgem/gem/store/recipes.hpp"
|
|
#include "secsgem/gem/store/spool.hpp"
|
|
#include "secsgem/gem/store/status_variables.hpp"
|
|
|
|
namespace secsgem::gem {
|
|
|
|
// Composite over the seven focused stores. Each store is independently
|
|
// testable and independently usable — the application can keep a reference
|
|
// to just `alarms` and ignore the rest if that's all it needs. Variable
|
|
// lookups span SVIDs and DVIDs through this composite (the host's view
|
|
// per E30 §6.11).
|
|
struct EquipmentDataModel {
|
|
StatusVariableStore svids;
|
|
DataVariableStore dvids;
|
|
EquipmentConstantStore ecids;
|
|
EventReportSubscriptions events;
|
|
AlarmRegistry alarms;
|
|
RecipeStore recipes;
|
|
Clock clock;
|
|
HostCommandRegistry commands;
|
|
SpoolStore spool;
|
|
LimitMonitorStore limits;
|
|
|
|
// Convenience: VID -> value lookup spanning SVIDs and DVIDs.
|
|
std::optional<s2::Item> vid_value(uint32_t vid) const {
|
|
if (auto v = svids.value(vid)) return v;
|
|
if (auto v = dvids.value(vid)) return v;
|
|
return std::nullopt;
|
|
}
|
|
bool vid_exists(uint32_t vid) const {
|
|
return svids.has(vid) || dvids.has(vid);
|
|
}
|
|
|
|
// Sugar that adapts the EventReportSubscriptions API to the host-supplied
|
|
// VID list shape (matches what parse_s2f33 / parse_s2f35 yield).
|
|
DefineReportAck define_reports(
|
|
const std::vector<std::pair<uint32_t, std::vector<uint32_t>>>& rows) {
|
|
return events.define_reports(rows, [this](uint32_t vid) { return vid_exists(vid); });
|
|
}
|
|
LinkEventAck link_event_reports(
|
|
const std::vector<std::pair<uint32_t, std::vector<uint32_t>>>& rows) {
|
|
return events.link_event_reports(rows);
|
|
}
|
|
EnableEventAck enable_events(bool enable, const std::vector<uint32_t>& ceids) {
|
|
return events.enable_events(enable, ceids);
|
|
}
|
|
bool is_event_enabled(uint32_t ceid) const { return events.is_enabled(ceid); }
|
|
std::vector<ReportData> compose_reports_for(uint32_t ceid) const {
|
|
return events.compose_for(ceid, [this](uint32_t vid) { return vid_value(vid); });
|
|
}
|
|
};
|
|
|
|
} // namespace secsgem::gem
|