WEICZ20/moonbit-computer-interlocking/src/interlocking does not have a README file
pub(all) struct ActiveRouteState {
rule : InterlockingRule
state : RouteState
release_stage : ReleaseStage
unlocked_sections : FixedArray[Bool]
occupied_sections : FixedArray[Bool]
highest_observed_section_index : Int
occupancy_order_violation : Bool
observed_train_id : String
entry_time_ms : Int64
} derive(Debug)pub(all) struct FlankProtection {
turnout_id : TurnoutId
required_position : TurnoutPosition
description : String
} derive(Debug)fn FlankProtection::new(turnout_id : TurnoutId, required_position : TurnoutPosition, description : String) -> FlankProtectionpub(all) struct InterlockingRule {
id : RouteId
name : String
route_type : RouteType
entry_signal : SignalId
exit_signal : SignalId
switches : Array[SwitchRequirement]
flank_switches : Array[FlankProtection]
track_sections : Array[TrackId]
hostile_route_ids : Array[RouteId]
target_aspect : SignalAspect
approach_section : TrackId?
} derive(Debug)fn InterlockingRule::new(id : RouteId, name : String, route_type : RouteType, entry_signal : SignalId, exit_signal : SignalId, switches : Array[SwitchRequirement], flank_switches : Array[FlankProtection], track_sections : Array[TrackId], hostile_route_ids : Array[RouteId], target_aspect : SignalAspect, approach_section : TrackId?) -> InterlockingRulepub(all) struct InterlockingTable {
rules : Map[Int, InterlockingRule]
active_routes : Map[Int, ActiveRouteState]
active_route_flags : FixedArray[Bool]
signal_pair_index : Map[Int, RouteId]
track_to_routes : Map[Int, Array[RouteId]]
turnout_to_routes : Map[Int, Array[RouteId]]
acquired_turnout_scratch : FixedArray[TurnoutId]
acquired_track_scratch : FixedArray[TrackId]
acquired_turnout_count : Int
acquired_track_count : Int
next_route_id : Int
} derive(Debug)fn InterlockingTable::audit_safety(self : InterlockingTable, station : Station) -> SafetyAuditReportfn InterlockingTable::cancel_route(self : InterlockingTable, station : Station, route_id : RouteId) -> Result[Unit, String]fn InterlockingTable::enforce_emergency_fail_safe(self : InterlockingTable, station : Station) -> Intfn InterlockingTable::get_active_route(self : InterlockingTable, route_id : RouteId) -> ActiveRouteState?fn InterlockingTable::get_routes_by_track(self : InterlockingTable, track_id : TrackId) -> Array[RouteId]fn InterlockingTable::lookup_route_by_signals(self : InterlockingTable, entry : SignalId, exit : SignalId) -> RouteId?fn InterlockingTable::process_sectional_release(self : InterlockingTable, station : Station, route_id : RouteId) -> SectionalReleaseResultfn InterlockingTable::process_sectional_release_fast(self : InterlockingTable, station : Station, route_id : RouteId) -> ReleaseCountersfn InterlockingTable::register_rule(self : InterlockingTable, name : String, route_type : RouteType, entry_signal : SignalId, exit_signal : SignalId, switches : Array[SwitchRequirement], flank_switches : Array[FlankProtection], track_sections : Array[TrackId], hostile_route_ids : Array[RouteId], target_aspect : SignalAspect, approach_section : TrackId?) -> RouteIdfn InterlockingTable::register_rule_checked(self : InterlockingTable, name : String, route_type : RouteType, entry_signal : SignalId, exit_signal : SignalId, switches : Array[SwitchRequirement], flank_switches : Array[FlankProtection], track_sections : Array[TrackId], hostile_route_ids : Array[RouteId], target_aspect : SignalAspect, approach_section : TrackId?) -> Result[RouteId, String]fn InterlockingTable::request_and_lock_route(self : InterlockingTable, station : Station, route_id : RouteId) -> RouteLockResultfn InterlockingTable::request_and_lock_route_fast(self : InterlockingTable, station : Station, route_id : RouteId) -> Boolfn InterlockingTable::scan_safety_summary(self : InterlockingTable, station : Station) -> ScanSafetySummaryfn InterlockingTable::validate_active_route_lifecycle(self : InterlockingTable, station : Station, route_id : RouteId) -> RouteLifecycleAuditfn InterlockingTable::verify_all_safety_invariants(self : InterlockingTable, station : Station) -> Array[SafetyInvariantViolation]pub(all) struct ReleaseCounters {
sections_unlocked : Int
switches_unlocked : Int
is_route_completed : Bool
entered_route : Bool
} derive(Debug)pub(all) struct SafetyAuditReport {
violations : Array[SafetyViolation]
fatal_count : Int
warning_count : Int
can_clear_signal : Bool
} derive(Debug)pub(all) struct SafetyViolation {
kind : SafetyViolationKind
severity : SafetySeverity
affected_route_id : RouteId?
description : String
} derive(Debug)fn SafetyViolation::new(kind : SafetyViolationKind, severity : SafetySeverity, affected_route_id : RouteId?, description : String) -> SafetyViolationpub(all) struct ScanSafetySummary {
checked_routes : Int
fatal_count : Int
warning_count : Int
can_clear_signal : Bool
} derive(Debug)pub(all) struct SwitchRequirement {
turnout_id : TurnoutId
required_position : TurnoutPosition
} derive(Debug)fn SwitchRequirement::new(turnout_id : TurnoutId, required_position : TurnoutPosition) -> SwitchRequirementfn determine_signal_aspect_for_route(route_type : RouteType, is_diverging : Bool, exit_signal_aspect : SignalAspect) -> SignalAspectfn update_distant_signal_linkage(station : Station, linkage : DistantSignalLinkage) -> Result[Unit, String]Install
Download zipMoonBit Railway Computer Interlocking (CI) Safety Logic Engine