system ModalSPScenario { active main thread Main() { Queue.type > {|tempQueue|}; CAD.Port {|tempPort|}; CorrelatorSubscriber {|tempCorSub|}; ComponentSubscriber {|tempComSub|}; Correlator.type {|tempCor|}; CAD.Component {|tempCom|}; loc loc0: live { {|tempQueue|}, {|tempPort|}, {|tempCorSub|}, {|tempComSub|}, {|tempCor|}, {|tempCom|} } do invisible { runRateQueues := Table.create > >(); {|tempQueue|} := Queue.create >(30); Table.put > >(runRateQueues, 1, {|tempQueue|}); {|tempQueue|} := Queue.create >(30); Table.put > >(runRateQueues, 5, {|tempQueue|}); {|tempQueue|} := Queue.create >(30); Table.put > >(runRateQueues, 20, {|tempQueue|}); {|tempQueue|} := Queue.create >(30); Table.put > >(runRateQueues, 40, {|tempQueue|}); EventChannel := CAD.createComponent("EventChannel"); CAD.addSubscriberList(EventChannel, "timeOut5"); CAD.addSubscriberList(EventChannel, "timeOut1"); CAD.addSubscriberList(EventChannel, "timeOut40"); CAD.addSubscriberList(EventChannel, "timeOut20"); GPS := CAD.createComponent("GPS"); {|tempPort|} := CAD.createPort(); CAD.registerPort(GPS, {|tempPort|}, "dataOut"); CAD.setPortMethodHandler<{|common.ReadData.data()|}>({|tempPort|}, "data", {|common.ReadData.data()|}.{|common.BMDevice.dataOut.data()|}); CAD.addSubscriberList(GPS, "outDataAvailable"); AirFrame := CAD.createComponent("AirFrame"); CAD.setAttribute<{|common.LazyActiveMode|}>(AirFrame, "bmLazyMode", {|common.LazyActiveMode|}.{|stale|}); {|tempPort|} := CAD.createPort(); CAD.registerPort(AirFrame, {|tempPort|}, "dataOut"); CAD.setPortMethodHandler<{|common.ReadData.data()|}>({|tempPort|}, "data", {|common.ReadData.data()|}.{|common.BMLazyActive.dataOut.data()|}); {|tempPort|} := CAD.createPort(); CAD.registerPort(AirFrame, {|tempPort|}, "dataIn"); CAD.addSubscriberList(AirFrame, "outDataAvailable"); NavDisplay := CAD.createComponent("NavDisplay"); {|tempPort|} := CAD.createPort(); CAD.registerPort(NavDisplay, {|tempPort|}, "dataIn2"); {|tempPort|} := CAD.createPort(); CAD.registerPort(NavDisplay, {|tempPort|}, "dataIn3"); {|tempPort|} := CAD.createPort(); CAD.registerPort(NavDisplay, {|tempPort|}, "dataIn1"); PilotControl := CAD.createComponent("PilotControl"); {|tempPort|} := CAD.createPort(); CAD.registerPort(PilotControl, {|tempPort|}, "dataWriteOut"); CAD.setPortMethodHandler<{|common.ReadWriteData.writeData()|}>({|tempPort|}, "writeData", {|common.ReadWriteData.writeData()|}.{|common.BMModeSource.dataWriteOut.writeData()|}); CAD.setPortMethodHandler<{|common.ReadWriteData.writeData()|}>({|tempPort|}, "writeData", {|common.ReadWriteData.writeData()|}.{|common.BMModeSource.dataWriteOut.writeData()|}); {|tempPort|} := CAD.createPort(); CAD.registerPort(PilotControl, {|tempPort|}, "dataOut"); CAD.setPortMethodHandler<{|common.ReadData.data()|}>({|tempPort|}, "data", {|common.ReadData.data()|}.{|common.BMModeSource.dataOut.data()|}); {|tempPort|} := CAD.createPort(); CAD.registerPort(PilotControl, {|tempPort|}, "modeToggle2"); {|tempPort|} := CAD.createPort(); CAD.registerPort(PilotControl, {|tempPort|}, "modeToggle1"); CAD.addSubscriberList(PilotControl, "outDataAvailable"); NavSteering := CAD.createComponent("NavSteering"); CAD.setAttribute<{|common.OnOffMode|}>(NavSteering, "corMode", {|common.OnOffMode|}.{|enabled|}); {|tempPort|} := CAD.createPort(); CAD.registerPort(NavSteering, {|tempPort|}, "modeChange"); CAD.setPortMethodHandler<{|common.ChangeMode.modeVar()|}>({|tempPort|}, "modeVar", {|common.ChangeMode.modeVar()|}.{|modalsp.BMModalTwoOrCorrelation.modeChange.modeVar()|}); CAD.setPortMethodHandler<{|common.ChangeMode.modeVar()|}>({|tempPort|}, "modeVar", {|common.ChangeMode.modeVar()|}.{|modalsp.BMModalTwoOrCorrelation.modeChange.modeVar()|}); {|tempPort|} := CAD.createPort(); CAD.registerPort(NavSteering, {|tempPort|}, "dataWriteOut"); CAD.setPortMethodHandler<{|common.ReadWriteData.writeData()|}>({|tempPort|}, "writeData", {|common.ReadWriteData.writeData()|}.{|modalsp.BMModalTwoOrCorrelation.dataWriteOut.writeData()|}); CAD.setPortMethodHandler<{|common.ReadWriteData.writeData()|}>({|tempPort|}, "writeData", {|common.ReadWriteData.writeData()|}.{|modalsp.BMModalTwoOrCorrelation.dataWriteOut.writeData()|}); {|tempPort|} := CAD.createPort(); CAD.registerPort(NavSteering, {|tempPort|}, "dataOut"); CAD.setPortMethodHandler<{|common.ReadData.data()|}>({|tempPort|}, "data", {|common.ReadData.data()|}.{|modalsp.BMModalTwoOrCorrelation.dataOut.data()|}); {|tempPort|} := CAD.createPort(); CAD.registerPort(NavSteering, {|tempPort|}, "dataIn2"); {|tempPort|} := CAD.createPort(); CAD.registerPort(NavSteering, {|tempPort|}, "dataIn1"); CAD.addSubscriberList(NavSteering, "outDataAvailable"); TacticalSteering := CAD.createComponent("TacticalSteering"); CAD.setAttribute<{|common.OnOffMode|}>(TacticalSteering, "bmModalMode", {|common.OnOffMode|}.{|enabled|}); {|tempPort|} := CAD.createPort(); CAD.registerPort(TacticalSteering, {|tempPort|}, "modeChange"); CAD.setPortMethodHandler<{|common.ChangeMode.modeVar()|}>({|tempPort|}, "modeVar", {|common.ChangeMode.modeVar()|}.{|common.BMModal.modeChange.modeVar()|}); CAD.setPortMethodHandler<{|common.ChangeMode.modeVar()|}>({|tempPort|}, "modeVar", {|common.ChangeMode.modeVar()|}.{|common.BMModal.modeChange.modeVar()|}); {|tempPort|} := CAD.createPort(); CAD.registerPort(TacticalSteering, {|tempPort|}, "dataOut"); CAD.setPortMethodHandler<{|common.ReadData.data()|}>({|tempPort|}, "data", {|common.ReadData.data()|}.{|common.BMModal.dataOut.data()|}); {|tempPort|} := CAD.createPort(); CAD.registerPort(TacticalSteering, {|tempPort|}, "dataIn"); CAD.addSubscriberList(TacticalSteering, "outDataAvailable"); Navigator := CAD.createComponent("Navigator"); {|tempPort|} := CAD.createPort(); CAD.registerPort(Navigator, {|tempPort|}, "dataWriteOut"); NavSteeringPoints := CAD.createComponent("NavSteeringPoints"); {|tempPort|} := CAD.createPort(); CAD.registerPort(NavSteeringPoints, {|tempPort|}, "dataWriteIn"); CAD.setPortMethodHandler<{|common.ReadWriteData.writeData()|}>({|tempPort|}, "writeData", {|common.ReadWriteData.writeData()|}.{|common.BMPassive.dataWriteIn.writeData()|}); CAD.setPortMethodHandler<{|common.ReadWriteData.writeData()|}>({|tempPort|}, "writeData", {|common.ReadWriteData.writeData()|}.{|common.BMPassive.dataWriteIn.writeData()|}); {|tempPort|} := CAD.createPort(); CAD.registerPort(NavSteeringPoints, {|tempPort|}, "dataOut"); CAD.setPortMethodHandler<{|common.ReadData.data()|}>({|tempPort|}, "data", {|common.ReadData.data()|}.{|common.BMPassive.dataOut.data()|}); CAD.addSubscriberList(NavSteeringPoints, "outDataAvailable"); {|tempComSub|} := new ComponentSubscriber; {|tempComSub|}.handlerFunction := EventHandlerType.{|common.BMDevice.timeOut()|}; {|tempComSub|}.portName := "timeOut"; {|tempComSub|}.component := GPS; {|tempComSub|}.isSynchronous := false; {|tempComSub|}.dispatchRate := 40; CAD.addSubscriber(EventChannel, "timeOut20", {|tempComSub|}); {|tempComSub|} := new ComponentSubscriber; {|tempComSub|}.handlerFunction := EventHandlerType.{|common.BMLazyActive.inDataAvailable()|}; {|tempComSub|}.portName := "inDataAvailable"; {|tempComSub|}.component := AirFrame; {|tempComSub|}.isSynchronous := false; {|tempComSub|}.dispatchRate := 40; CAD.addSubscriber(GPS, "outDataAvailable", {|tempComSub|}); CAD.connectPorts(Pair.create(AirFrame, "dataIn"), Pair.create(GPS, "dataOut")); {|tempCor|} := Correlator.create("common.DataAvailable correlation BinaryAnd (common.DataAvailable e1, common.DataAvailable e2) (e1)+(e2) { case true: push new common.DataAvailable { }; }"); {|tempCorSub|} := new CorrelatorSubscriber; {|tempCorSub|}.handlerFunction := EventHandlerType.{|modalsp.BinaryAnd.e1()|}; {|tempCorSub|}.portName := "e1"; {|tempCorSub|}.correlator := {|tempCor|}; CAD.addSubscriber(AirFrame, "outDataAvailable", {|tempCorSub|}); {|tempCorSub|} := new CorrelatorSubscriber; {|tempCorSub|}.handlerFunction := EventHandlerType.{|modalsp.BinaryAnd.e2()|}; {|tempCorSub|}.portName := "e2"; {|tempCorSub|}.correlator := {|tempCor|}; CAD.addSubscriber(TacticalSteering, "outDataAvailable", {|tempCorSub|}); {|tempComSub|} := new ComponentSubscriber; {|tempComSub|}.handlerFunction := EventHandlerType.{|modalsp.BMDisplayThreeCorrelation.inDataAvailable()|}; {|tempComSub|}.portName := "inDataAvailable"; {|tempComSub|}.component := NavDisplay; {|tempComSub|}.isSynchronous := false; {|tempComSub|}.dispatchRate := 20; Correlator.addSubscriber({|tempCor|}, {|tempComSub|}); {|tempCor|} := Correlator.create("common.DataAvailable correlation BinaryAnd (common.DataAvailable e1, common.DataAvailable e2) (e1)+(e2) { case true: push new common.DataAvailable { }; }"); {|tempCorSub|} := new CorrelatorSubscriber; {|tempCorSub|}.handlerFunction := EventHandlerType.{|modalsp.BinaryAnd.e1()|}; {|tempCorSub|}.portName := "e1"; {|tempCorSub|}.correlator := {|tempCor|}; CAD.addSubscriber(AirFrame, "outDataAvailable", {|tempCorSub|}); {|tempCorSub|} := new CorrelatorSubscriber; {|tempCorSub|}.handlerFunction := EventHandlerType.{|modalsp.BinaryAnd.e2()|}; {|tempCorSub|}.portName := "e2"; {|tempCorSub|}.correlator := {|tempCor|}; CAD.addSubscriber(NavSteering, "outDataAvailable", {|tempCorSub|}); {|tempComSub|} := new ComponentSubscriber; {|tempComSub|}.handlerFunction := EventHandlerType.{|modalsp.BMDisplayThreeCorrelation.inDataAvailable()|}; {|tempComSub|}.portName := "inDataAvailable"; {|tempComSub|}.component := NavDisplay; {|tempComSub|}.isSynchronous := false; {|tempComSub|}.dispatchRate := 20; Correlator.addSubscriber({|tempCor|}, {|tempComSub|}); CAD.connectPorts(Pair.create(NavDisplay, "dataIn1"), Pair.create(AirFrame, "dataOut")); CAD.connectPorts(Pair.create(NavDisplay, "dataIn2"), Pair.create(TacticalSteering, "dataOut")); CAD.connectPorts(Pair.create(NavDisplay, "dataIn3"), Pair.create(NavSteering, "dataOut")); {|tempComSub|} := new ComponentSubscriber; {|tempComSub|}.handlerFunction := EventHandlerType.{|common.BMModeSource.timeOut()|}; {|tempComSub|}.portName := "timeOut"; {|tempComSub|}.component := PilotControl; {|tempComSub|}.isSynchronous := false; {|tempComSub|}.dispatchRate := 1; CAD.addSubscriber(EventChannel, "timeOut1", {|tempComSub|}); CAD.connectPorts(Pair.create(PilotControl, "modeToggle1"), Pair.create(TacticalSteering, "modeChange")); CAD.connectPorts(Pair.create(PilotControl, "modeToggle2"), Pair.create(NavSteering, "modeChange")); {|tempComSub|} := new ComponentSubscriber; {|tempComSub|}.handlerFunction := EventHandlerType.{|modalsp.BMModalTwoOrCorrelation.inDataAvailableAirFrame()|}; {|tempComSub|}.portName := "inDataAvailableAirFrame"; {|tempComSub|}.component := NavSteering; {|tempComSub|}.isSynchronous := false; {|tempComSub|}.dispatchRate := 40; CAD.addSubscriber(AirFrame, "outDataAvailable", {|tempComSub|}); {|tempComSub|} := new ComponentSubscriber; {|tempComSub|}.handlerFunction := EventHandlerType.{|modalsp.BMModalTwoOrCorrelation.inDataAvailableNavSteeringPoints()|}; {|tempComSub|}.portName := "inDataAvailableNavSteeringPoints"; {|tempComSub|}.component := NavSteering; {|tempComSub|}.isSynchronous := false; {|tempComSub|}.dispatchRate := 40; CAD.addSubscriber(NavSteeringPoints, "outDataAvailable", {|tempComSub|}); CAD.connectPorts(Pair.create(NavSteering, "dataIn1"), Pair.create(NavSteeringPoints, "dataOut")); CAD.connectPorts(Pair.create(NavSteering, "dataIn2"), Pair.create(AirFrame, "dataOut")); {|tempComSub|} := new ComponentSubscriber; {|tempComSub|}.handlerFunction := EventHandlerType.{|common.BMModal.inDataAvailable()|}; {|tempComSub|}.portName := "inDataAvailable"; {|tempComSub|}.component := TacticalSteering; {|tempComSub|}.isSynchronous := false; {|tempComSub|}.dispatchRate := 40; CAD.addSubscriber(AirFrame, "outDataAvailable", {|tempComSub|}); CAD.connectPorts(Pair.create(TacticalSteering, "dataIn"), Pair.create(AirFrame, "dataOut")); {|tempComSub|} := new ComponentSubscriber; {|tempComSub|}.handlerFunction := EventHandlerType.{|common.BMPushDataSource.timeOut()|}; {|tempComSub|}.portName := "timeOut"; {|tempComSub|}.component := Navigator; {|tempComSub|}.isSynchronous := false; {|tempComSub|}.dispatchRate := 5; CAD.addSubscriber(EventChannel, "timeOut5", {|tempComSub|}); CAD.connectPorts(Pair.create(Navigator, "dataWriteOut"), Pair.create(NavSteeringPoints, "dataWriteIn")); globalClock := -1; CAD.configurationComplete(); start clock (); start timeoutSender (); start rateDispatcher (1); start rateDispatcher (5); start rateDispatcher (20); start rateDispatcher (40); } return; } enum {|EventType|} { {|common.DataAvailable|}, {|common.TimeOut|}, {|modalsp.CorrelatedDataAvailable|} } enum {|common.LazyActiveMode|} { {|fresh|}, {|stale|} } enum {|common.OnOffMode|} { {|enabled|}, {|disabled|} } function {|common.BMPassive.dataWriteIn.writeData()|}({|common.ReadWriteData.writeData()|} {|enumValue|}, CAD.Component {|this|}, string {|d|}) { string auto_local_0; loc loc_0: do invisible { auto_local_0 := {|d|}; } goto loc_1; loc loc_1: do invisible { CAD.setAttribute({|this|}, "buf", auto_local_0); } goto loc_2; loc loc_2: invisible invoke fireEventFromComponent({|this|}, "outDataAvailable", CAD.createEvent<{|EventType|}>({|EventType|}.{|common.DataAvailable|})) return; } function {|common.BMPassive.dataWriteIn.writeData()|}({|common.ReadWriteData.writeData()|} {|enumValue|}, CAD.Component {|this|}) returns string { string auto_local_0; loc loc_0: do invisible { auto_local_0 := CAD.getAttribute({|this|}, "buf"); } goto loc_1; loc loc_1: do invisible { } return auto_local_0; } function {|modalsp.BMModalTwoOrCorrelation.dataWriteOut.writeData()|}({|common.ReadWriteData.writeData()|} {|enumValue|}, CAD.Component {|this|}, string {|d|}) { string auto_local_0; loc loc_0: do invisible { auto_local_0 := {|d|}; } goto loc_1; loc loc_1: do invisible { CAD.setAttribute({|this|}, "buf", auto_local_0); } return; } function {|modalsp.BMModalTwoOrCorrelation.dataWriteOut.writeData()|}({|common.ReadWriteData.writeData()|} {|enumValue|}, CAD.Component {|this|}) returns string { string auto_local_0; loc loc_0: do invisible { auto_local_0 := CAD.getAttribute({|this|}, "buf"); } goto loc_1; loc loc_1: do invisible { } return auto_local_0; } function {|common.BMModeSource.dataWriteOut.writeData()|}({|common.ReadWriteData.writeData()|} {|enumValue|}, CAD.Component {|this|}, string {|d|}) { string auto_local_0; loc loc_0: do invisible { auto_local_0 := {|d|}; } goto loc_1; loc loc_1: do invisible { CAD.setAttribute({|this|}, "buf", auto_local_0); } return; } function {|common.BMModeSource.dataWriteOut.writeData()|}({|common.ReadWriteData.writeData()|} {|enumValue|}, CAD.Component {|this|}) returns string { string auto_local_0; loc loc_0: do invisible { auto_local_0 := CAD.getAttribute({|this|}, "buf"); } goto loc_1; loc loc_1: do invisible { } return auto_local_0; } function {|modalsp.BMModalTwoOrCorrelation.modeChange.modeVar()|}({|common.ChangeMode.modeVar()|} {|enumValue|}, CAD.Component {|this|}, {|common.OnOffMode|} {|m|}) { {|common.OnOffMode|} auto_local_0; loc loc_0: do invisible { auto_local_0 := {|m|}; } goto loc_1; loc loc_1: do invisible { CAD.setAttribute<{|common.OnOffMode|}>({|this|}, "corMode", auto_local_0); } return; } function {|modalsp.BMModalTwoOrCorrelation.modeChange.modeVar()|}({|common.ChangeMode.modeVar()|} {|enumValue|}, CAD.Component {|this|}) returns {|common.OnOffMode|} { {|common.OnOffMode|} auto_local_0; loc loc_0: do invisible { auto_local_0 := CAD.getAttribute<{|common.OnOffMode|}>({|this|}, "corMode"); } goto loc_1; loc loc_1: do invisible { } return auto_local_0; } function {|common.BMModal.modeChange.modeVar()|}({|common.ChangeMode.modeVar()|} {|enumValue|}, CAD.Component {|this|}, {|common.OnOffMode|} {|m|}) { {|common.OnOffMode|} auto_local_0; loc loc_0: do invisible { auto_local_0 := {|m|}; } goto loc_1; loc loc_1: do invisible { CAD.setAttribute<{|common.OnOffMode|}>({|this|}, "bmModalMode", auto_local_0); } return; } function {|common.BMModal.modeChange.modeVar()|}({|common.ChangeMode.modeVar()|} {|enumValue|}, CAD.Component {|this|}) returns {|common.OnOffMode|} { {|common.OnOffMode|} auto_local_0; loc loc_0: do invisible { auto_local_0 := CAD.getAttribute<{|common.OnOffMode|}>({|this|}, "bmModalMode"); } goto loc_1; loc loc_1: do invisible { } return auto_local_0; } function {|common.BMDevice.dataOut.data()|}({|common.ReadData.data()|} {|enumValue|}, CAD.Component {|this|}) returns string { string auto_local_0; loc loc_0: do invisible { auto_local_0 := CAD.getAttribute({|this|}, "data"); } goto loc_1; loc loc_1: do invisible { } return auto_local_0; } function {|common.BMModal.dataOut.data()|}({|common.ReadData.data()|} {|enumValue|}, CAD.Component {|this|}) returns string { string auto_local_0; loc loc_0: do invisible { auto_local_0 := CAD.getAttribute({|this|}, "buf"); } goto loc_1; loc loc_1: do invisible { } return auto_local_0; } function {|modalsp.BMModalTwoOrCorrelation.dataOut.data()|}({|common.ReadData.data()|} {|enumValue|}, CAD.Component {|this|}) returns string { string auto_local_0; loc loc_0: do invisible { auto_local_0 := CAD.getAttribute({|this|}, "buf"); } goto loc_1; loc loc_1: do invisible { } return auto_local_0; } function {|common.BMLazyActive.dataOut.data()|}({|common.ReadData.data()|} {|enumValue|}, CAD.Component {|this|}) returns string { string auto_local_2; {|common.LazyActiveMode|} auto_local_0; {|common.LazyActiveMode|} auto_local_3; string auto_local_5; {|common.LazyActiveMode|} auto_local_4; {|common.LazyActiveMode|} auto_local_1; loc loc_0: do invisible { auto_local_0 := CAD.getAttribute<{|common.LazyActiveMode|}>({|this|}, "bmLazyMode"); } goto loc_1; loc loc_1: do invisible { auto_local_1 := {|common.LazyActiveMode|}.{|stale|}; } goto loc_2; loc loc_2: do invisible { auto_local_4 := {|common.LazyActiveMode|}.{|fresh|}; } goto loc_3; loc loc_3: when auto_local_4 == auto_local_0 do invisible { } goto loc_8; when auto_local_1 == auto_local_0 do invisible { } goto loc_4; when !(auto_local_4 == auto_local_0) && !(auto_local_1 == auto_local_0) do invisible { } goto loc_8; loc loc_4: auto_local_2 := invisible invoke {|common.ReadData.data()|}({|this|}, "dataIn", "data") goto loc_5; loc loc_5: do invisible { CAD.setAttribute({|this|}, "buf", auto_local_2); } goto loc_6; loc loc_6: do invisible { auto_local_3 := {|common.LazyActiveMode|}.{|fresh|}; } goto loc_7; loc loc_7: do invisible { CAD.setAttribute<{|common.LazyActiveMode|}>({|this|}, "bmLazyMode", auto_local_3); } goto loc_8; loc loc_8: do invisible { auto_local_5 := CAD.getAttribute({|this|}, "buf"); } goto loc_9; loc loc_9: do invisible { } return auto_local_5; } function {|common.BMPassive.dataOut.data()|}({|common.ReadData.data()|} {|enumValue|}, CAD.Component {|this|}) returns string { string auto_local_0; loc loc_0: do invisible { auto_local_0 := CAD.getAttribute({|this|}, "buf"); } goto loc_1; loc loc_1: do invisible { } return auto_local_0; } function {|common.BMModeSource.dataOut.data()|}({|common.ReadData.data()|} {|enumValue|}, CAD.Component {|this|}) returns string { string auto_local_0; loc loc_0: do invisible { auto_local_0 := CAD.getAttribute({|this|}, "buf"); } goto loc_1; loc loc_1: do invisible { } return auto_local_0; } function {|modalsp.BMModalTwoOrCorrelation.inDataAvailableNavSteeringPoints()|}(EventHandlerType {|enumValue|}, CAD.Event {|event|}, Receiver {|this|}) { {|common.OnOffMode|} auto_local_0; string auto_local_3; {|common.OnOffMode|} auto_local_1; {|common.OnOffMode|} auto_local_4; string auto_local_2; loc loc_0: do invisible { auto_local_0 := CAD.getAttribute<{|common.OnOffMode|}>(((ComponentReceiver) ({|this|})).component, "corMode"); } goto loc_1; loc loc_1: do invisible { auto_local_1 := {|common.OnOffMode|}.{|enabled|}; } goto loc_2; loc loc_2: do invisible { auto_local_4 := {|common.OnOffMode|}.{|disabled|}; } goto loc_3; loc loc_3: when auto_local_4 == auto_local_0 do invisible { } return; when auto_local_1 == auto_local_0 do invisible { } goto loc_4; when !(auto_local_4 == auto_local_0) && !(auto_local_1 == auto_local_0) do invisible { } return; loc loc_4: auto_local_2 := invisible invoke {|common.ReadData.data()|}(((ComponentReceiver) ({|this|})).component, "dataIn1", "data") goto loc_5; loc loc_5: do invisible { CAD.setAttribute(((ComponentReceiver) ({|this|})).component, "buf", ""); } goto loc_6; loc loc_6: auto_local_3 := invisible invoke {|common.ReadData.data()|}(((ComponentReceiver) ({|this|})).component, "dataIn2", "data") goto loc_7; loc loc_7: do invisible { CAD.setAttribute(((ComponentReceiver) ({|this|})).component, "buf", ""); } goto loc_8; loc loc_8: invisible invoke fireEventFromComponent(((ComponentReceiver) ({|this|})).component, "outDataAvailable", CAD.createEvent<{|EventType|}>({|EventType|}.{|common.DataAvailable|})) return; } function {|modalsp.BMModalTwoOrCorrelation.inDataAvailableAirFrame()|}(EventHandlerType {|enumValue|}, CAD.Event {|event|}, Receiver {|this|}) { {|common.OnOffMode|} auto_local_1; {|common.OnOffMode|} auto_local_4; string auto_local_3; string auto_local_2; {|common.OnOffMode|} auto_local_0; loc loc_0: do invisible { auto_local_0 := CAD.getAttribute<{|common.OnOffMode|}>(((ComponentReceiver) ({|this|})).component, "corMode"); } goto loc_1; loc loc_1: do invisible { auto_local_1 := {|common.OnOffMode|}.{|enabled|}; } goto loc_2; loc loc_2: do invisible { auto_local_4 := {|common.OnOffMode|}.{|disabled|}; } goto loc_3; loc loc_3: when auto_local_4 == auto_local_0 do invisible { } return; when auto_local_1 == auto_local_0 do invisible { } goto loc_4; when !(auto_local_4 == auto_local_0) && !(auto_local_1 == auto_local_0) do invisible { } return; loc loc_4: auto_local_2 := invisible invoke {|common.ReadData.data()|}(((ComponentReceiver) ({|this|})).component, "dataIn1", "data") goto loc_5; loc loc_5: do invisible { CAD.setAttribute(((ComponentReceiver) ({|this|})).component, "buf", ""); } goto loc_6; loc loc_6: auto_local_3 := invisible invoke {|common.ReadData.data()|}(((ComponentReceiver) ({|this|})).component, "dataIn2", "data") goto loc_7; loc loc_7: do invisible { CAD.setAttribute(((ComponentReceiver) ({|this|})).component, "buf", ""); } goto loc_8; loc loc_8: invisible invoke fireEventFromComponent(((ComponentReceiver) ({|this|})).component, "outDataAvailable", CAD.createEvent<{|EventType|}>({|EventType|}.{|common.DataAvailable|})) return; } function {|common.BMModal.inDataAvailable()|}(EventHandlerType {|enumValue|}, CAD.Event {|event|}, Receiver {|this|}) { string auto_local_2; {|common.OnOffMode|} auto_local_1; {|common.OnOffMode|} auto_local_3; {|common.OnOffMode|} auto_local_0; loc loc_0: do invisible { auto_local_0 := CAD.getAttribute<{|common.OnOffMode|}>(((ComponentReceiver) ({|this|})).component, "bmModalMode"); } goto loc_1; loc loc_1: do invisible { auto_local_1 := {|common.OnOffMode|}.{|enabled|}; } goto loc_2; loc loc_2: do invisible { auto_local_3 := {|common.OnOffMode|}.{|disabled|}; } goto loc_3; loc loc_3: when auto_local_3 == auto_local_0 do invisible { } return; when auto_local_1 == auto_local_0 do invisible { } goto loc_4; when !(auto_local_3 == auto_local_0) && !(auto_local_1 == auto_local_0) do invisible { } return; loc loc_4: auto_local_2 := invisible invoke {|common.ReadData.data()|}(((ComponentReceiver) ({|this|})).component, "dataIn", "data") goto loc_5; loc loc_5: do invisible { CAD.setAttribute(((ComponentReceiver) ({|this|})).component, "buf", auto_local_2); } goto loc_6; loc loc_6: invisible invoke fireEventFromComponent(((ComponentReceiver) ({|this|})).component, "outDataAvailable", CAD.createEvent<{|EventType|}>({|EventType|}.{|common.DataAvailable|})) return; } function {|common.BMLazyActive.inDataAvailable()|}(EventHandlerType {|enumValue|}, CAD.Event {|event|}, Receiver {|this|}) { {|common.LazyActiveMode|} auto_local_0; loc loc_0: do invisible { auto_local_0 := {|common.LazyActiveMode|}.{|stale|}; } goto loc_1; loc loc_1: do invisible { CAD.setAttribute<{|common.LazyActiveMode|}>(((ComponentReceiver) ({|this|})).component, "bmLazyMode", auto_local_0); } goto loc_2; loc loc_2: invisible invoke fireEventFromComponent(((ComponentReceiver) ({|this|})).component, "outDataAvailable", CAD.createEvent<{|EventType|}>({|EventType|}.{|common.DataAvailable|})) return; } function {|common.BMPushDataSource.timeOut()|}(EventHandlerType {|enumValue|}, CAD.Event {|event|}, Receiver {|this|}) { AnyType.type auto_local_0; loc loc_0: do invisible { auto_local_0 := AnyType.create(0); } goto loc_1; loc loc_1: invisible invoke {|common.ReadWriteData.writeData()|}(((ComponentReceiver) ({|this|})).component, "dataWriteOut", "writeData", "") return; } function {|common.BMModeSource.timeOut()|}(EventHandlerType {|enumValue|}, CAD.Event {|event|}, Receiver {|this|}) { AnyType.type auto_local_0; AnyType.type auto_local_1; loc loc_0: do invisible { auto_local_0 := AnyType.create(0); } goto loc_1; loc loc_1: invisible invoke {|common.ChangeMode.modeVar()|}(((ComponentReceiver) ({|this|})).component, "modeToggle1", "modeVar", {|common.OnOffMode|}.{|enabled|}) goto loc_2; invisible invoke {|common.ChangeMode.modeVar()|}(((ComponentReceiver) ({|this|})).component, "modeToggle1", "modeVar", {|common.OnOffMode|}.{|disabled|}) goto loc_2; loc loc_2: do invisible { auto_local_1 := AnyType.create(0); } goto loc_3; loc loc_3: invisible invoke {|common.ChangeMode.modeVar()|}(((ComponentReceiver) ({|this|})).component, "modeToggle2", "modeVar", {|common.OnOffMode|}.{|enabled|}) return; invisible invoke {|common.ChangeMode.modeVar()|}(((ComponentReceiver) ({|this|})).component, "modeToggle2", "modeVar", {|common.OnOffMode|}.{|disabled|}) return; } function {|common.BMDevice.timeOut()|}(EventHandlerType {|enumValue|}, CAD.Event {|event|}, Receiver {|this|}) { AnyType.type auto_local_0; loc loc_0: do invisible { auto_local_0 := AnyType.create(0); } goto loc_1; loc loc_1: do invisible { CAD.setAttribute(((ComponentReceiver) ({|this|})).component, "data", ""); } goto loc_2; loc loc_2: invisible invoke fireEventFromComponent(((ComponentReceiver) ({|this|})).component, "outDataAvailable", CAD.createEvent<{|EventType|}>({|EventType|}.{|common.DataAvailable|})) return; } function {|modalsp.BMDisplayThreeCorrelation.inDataAvailable()|}(EventHandlerType {|enumValue|}, CAD.Event {|event|}, Receiver {|this|}) { string auto_local_2; string auto_local_0; string auto_local_1; loc loc_0: auto_local_0 := invisible invoke {|common.ReadData.data()|}(((ComponentReceiver) ({|this|})).component, "dataIn1", "data") goto loc_1; loc loc_1: do invisible { CAD.setAttribute(((ComponentReceiver) ({|this|})).component, "buf", auto_local_0); } goto loc_2; loc loc_2: auto_local_1 := invisible invoke {|common.ReadData.data()|}(((ComponentReceiver) ({|this|})).component, "dataIn2", "data") goto loc_3; loc loc_3: do invisible { CAD.setAttribute(((ComponentReceiver) ({|this|})).component, "buf", auto_local_1); } goto loc_4; loc loc_4: auto_local_2 := invisible invoke {|common.ReadData.data()|}(((ComponentReceiver) ({|this|})).component, "dataIn3", "data") goto loc_5; loc loc_5: do invisible { CAD.setAttribute(((ComponentReceiver) ({|this|})).component, "buf", auto_local_2); } return; } function {|modalsp.BinaryAnd.e2()|}(EventHandlerType eh, CAD.Event event, Receiver receiver) { List.type results; Correlator.type correlator; int i; loc loc0: live { results, correlator, i } do { correlator := (((CorrelatorReceiver) (receiver))).correlator; results := List.create(); Correlator.handleEvent(correlator, "e2", results); i := 0; } goto loc1; loc loc1: live { results, correlator, i } when i < List.size(results) do { } goto loc2; when !((i < List.size(results))) do { } goto loopEnd; loc loc2: live { results, correlator, i } invoke fireEventFromCorrelator(correlator, CAD.createEvent<{|EventType|}>({|EventType|}.{|common.DataAvailable|})) goto loc3; loc loc3: live { results, correlator, i } do { i := i + 1; } goto loc1; loc loopEnd: live {} do { } return; } function {|modalsp.BinaryAnd.e1()|}(EventHandlerType eh, CAD.Event event, Receiver receiver) { List.type results; Correlator.type correlator; int i; loc loc0: live { results, correlator, i } do { correlator := (((CorrelatorReceiver) (receiver))).correlator; results := List.create(); Correlator.handleEvent(correlator, "e1", results); i := 0; } goto loc1; loc loc1: live { results, correlator, i } when i < List.size(results) do { } goto loc2; when !((i < List.size(results))) do { } goto loopEnd; loc loc2: live { results, correlator, i } invoke fireEventFromCorrelator(correlator, CAD.createEvent<{|EventType|}>({|EventType|}.{|common.DataAvailable|})) goto loc3; loc loc3: live { results, correlator, i } do { i := i + 1; } goto loc1; loc loopEnd: live {} do { } return; } fun transiencePredicate() returns boolean = rategroupIdlenessTestFun(1) && rategroupIdlenessTestFun(5) && rategroupIdlenessTestFun(20) && rategroupIdlenessTestFun(40) && timeoutSenderIdlenessTestFun() && globalClock == 0; enum {|common.ReadWriteData.writeData()|} { {|common.BMPassive.dataWriteIn.writeData()|}, {|modalsp.BMModalTwoOrCorrelation.dataWriteOut.writeData()|}, {|common.BMModeSource.dataWriteOut.writeData()|} } virtual {|common.ReadWriteData.writeData()|} on {|common.ReadWriteData.writeData()|} { {|common.BMPassive.dataWriteIn.writeData()|} -> {|common.BMPassive.dataWriteIn.writeData()|} {|modalsp.BMModalTwoOrCorrelation.dataWriteOut.writeData()|} -> {|modalsp.BMModalTwoOrCorrelation.dataWriteOut.writeData()|} {|common.BMModeSource.dataWriteOut.writeData()|} -> {|common.BMModeSource.dataWriteOut.writeData()|} } function {|common.ReadWriteData.writeData()|}(CAD.Component consumer, string portName, string methodName) returns string { Pair.type remotePair; CAD.Component provider; string remotePortName; CAD.Port remotePort; {|common.ReadWriteData.writeData()|} handlerFunction; string result; loc loc0: live { remotePair, provider, remotePortName, remotePort, handlerFunction } do { remotePair := CAD.getProvider(Pair.create(consumer, portName)); } goto loc1; loc loc1: live { remotePair, provider, remotePortName, remotePort, handlerFunction } when remotePair == null do { Debug.printString("WARNING: no facet hooked up to "); Debug.printString(CAD.getComponentName(consumer)); Debug.printString("."); Debug.printString(portName); Debug.printString("\n"); } return result; when remotePair != null do { provider := Pair.first(remotePair); remotePortName := Pair.second(remotePair); remotePort := CAD.getPort(provider, remotePortName); handlerFunction := CAD.getPortMethodHandler<{|common.ReadWriteData.writeData()|}>(remotePort, methodName); } goto loc2; loc loc2: live { handlerFunction, provider, result } result := invoke virtual {|common.ReadWriteData.writeData()|}(handlerFunction, provider) return result; } enum {|common.ReadWriteData.writeData()|} { {|common.BMPassive.dataWriteIn.writeData()|}, {|modalsp.BMModalTwoOrCorrelation.dataWriteOut.writeData()|}, {|common.BMModeSource.dataWriteOut.writeData()|} } virtual {|common.ReadWriteData.writeData()|} on {|common.ReadWriteData.writeData()|} { {|common.BMPassive.dataWriteIn.writeData()|} -> {|common.BMPassive.dataWriteIn.writeData()|} {|modalsp.BMModalTwoOrCorrelation.dataWriteOut.writeData()|} -> {|modalsp.BMModalTwoOrCorrelation.dataWriteOut.writeData()|} {|common.BMModeSource.dataWriteOut.writeData()|} -> {|common.BMModeSource.dataWriteOut.writeData()|} } function {|common.ReadWriteData.writeData()|}(CAD.Component consumer, string portName, string methodName, string arg1) { Pair.type remotePair; CAD.Component provider; string remotePortName; CAD.Port remotePort; {|common.ReadWriteData.writeData()|} handlerFunction; loc loc0: live { remotePair, provider, remotePortName, remotePort, handlerFunction } do { remotePair := CAD.getProvider(Pair.create(consumer, portName)); } goto loc1; loc loc1: live { remotePair, provider, remotePortName, remotePort, handlerFunction } when remotePair == null do { Debug.printString("WARNING: no facet hooked up to "); Debug.printString(CAD.getComponentName(consumer)); Debug.printString("."); Debug.printString(portName); Debug.printString("\n"); } return; when remotePair != null do { provider := Pair.first(remotePair); remotePortName := Pair.second(remotePair); remotePort := CAD.getPort(provider, remotePortName); handlerFunction := CAD.getPortMethodHandler<{|common.ReadWriteData.writeData()|}>(remotePort, methodName); } goto loc2; loc loc2: live { handlerFunction, provider } invoke virtual {|common.ReadWriteData.writeData()|}(handlerFunction, provider, arg1) return; } enum {|common.ChangeMode.modeVar()|} { {|modalsp.BMModalTwoOrCorrelation.modeChange.modeVar()|}, {|common.BMModal.modeChange.modeVar()|} } virtual {|common.ChangeMode.modeVar()|} on {|common.ChangeMode.modeVar()|} { {|modalsp.BMModalTwoOrCorrelation.modeChange.modeVar()|} -> {|modalsp.BMModalTwoOrCorrelation.modeChange.modeVar()|} {|common.BMModal.modeChange.modeVar()|} -> {|common.BMModal.modeChange.modeVar()|} } function {|common.ChangeMode.modeVar()|}(CAD.Component consumer, string portName, string methodName) returns {|common.OnOffMode|} { Pair.type remotePair; CAD.Component provider; string remotePortName; CAD.Port remotePort; {|common.ChangeMode.modeVar()|} handlerFunction; {|common.OnOffMode|} result; loc loc0: live { remotePair, provider, remotePortName, remotePort, handlerFunction } do { remotePair := CAD.getProvider(Pair.create(consumer, portName)); } goto loc1; loc loc1: live { remotePair, provider, remotePortName, remotePort, handlerFunction } when remotePair == null do { Debug.printString("WARNING: no facet hooked up to "); Debug.printString(CAD.getComponentName(consumer)); Debug.printString("."); Debug.printString(portName); Debug.printString("\n"); } return result; when remotePair != null do { provider := Pair.first(remotePair); remotePortName := Pair.second(remotePair); remotePort := CAD.getPort(provider, remotePortName); handlerFunction := CAD.getPortMethodHandler<{|common.ChangeMode.modeVar()|}>(remotePort, methodName); } goto loc2; loc loc2: live { handlerFunction, provider, result } result := invoke virtual {|common.ChangeMode.modeVar()|}(handlerFunction, provider) return result; } enum {|common.ChangeMode.modeVar()|} { {|modalsp.BMModalTwoOrCorrelation.modeChange.modeVar()|}, {|common.BMModal.modeChange.modeVar()|} } virtual {|common.ChangeMode.modeVar()|} on {|common.ChangeMode.modeVar()|} { {|modalsp.BMModalTwoOrCorrelation.modeChange.modeVar()|} -> {|modalsp.BMModalTwoOrCorrelation.modeChange.modeVar()|} {|common.BMModal.modeChange.modeVar()|} -> {|common.BMModal.modeChange.modeVar()|} } function {|common.ChangeMode.modeVar()|}(CAD.Component consumer, string portName, string methodName, {|common.OnOffMode|} arg1) { Pair.type remotePair; CAD.Component provider; string remotePortName; CAD.Port remotePort; {|common.ChangeMode.modeVar()|} handlerFunction; loc loc0: live { remotePair, provider, remotePortName, remotePort, handlerFunction } do { remotePair := CAD.getProvider(Pair.create(consumer, portName)); } goto loc1; loc loc1: live { remotePair, provider, remotePortName, remotePort, handlerFunction } when remotePair == null do { Debug.printString("WARNING: no facet hooked up to "); Debug.printString(CAD.getComponentName(consumer)); Debug.printString("."); Debug.printString(portName); Debug.printString("\n"); } return; when remotePair != null do { provider := Pair.first(remotePair); remotePortName := Pair.second(remotePair); remotePort := CAD.getPort(provider, remotePortName); handlerFunction := CAD.getPortMethodHandler<{|common.ChangeMode.modeVar()|}>(remotePort, methodName); } goto loc2; loc loc2: live { handlerFunction, provider } invoke virtual {|common.ChangeMode.modeVar()|}(handlerFunction, provider, arg1) return; } enum {|common.ReadData.data()|} { {|common.BMDevice.dataOut.data()|}, {|common.BMModal.dataOut.data()|}, {|modalsp.BMModalTwoOrCorrelation.dataOut.data()|}, {|common.BMLazyActive.dataOut.data()|}, {|common.BMPassive.dataOut.data()|}, {|common.BMModeSource.dataOut.data()|} } virtual {|common.ReadData.data()|} on {|common.ReadData.data()|} { {|common.BMDevice.dataOut.data()|} -> {|common.BMDevice.dataOut.data()|} {|common.BMModal.dataOut.data()|} -> {|common.BMModal.dataOut.data()|} {|modalsp.BMModalTwoOrCorrelation.dataOut.data()|} -> {|modalsp.BMModalTwoOrCorrelation.dataOut.data()|} {|common.BMLazyActive.dataOut.data()|} -> {|common.BMLazyActive.dataOut.data()|} {|common.BMPassive.dataOut.data()|} -> {|common.BMPassive.dataOut.data()|} {|common.BMModeSource.dataOut.data()|} -> {|common.BMModeSource.dataOut.data()|} } function {|common.ReadData.data()|}(CAD.Component consumer, string portName, string methodName) returns string { Pair.type remotePair; CAD.Component provider; string remotePortName; CAD.Port remotePort; {|common.ReadData.data()|} handlerFunction; string result; loc loc0: live { remotePair, provider, remotePortName, remotePort, handlerFunction } do { remotePair := CAD.getProvider(Pair.create(consumer, portName)); } goto loc1; loc loc1: live { remotePair, provider, remotePortName, remotePort, handlerFunction } when remotePair == null do { Debug.printString("WARNING: no facet hooked up to "); Debug.printString(CAD.getComponentName(consumer)); Debug.printString("."); Debug.printString(portName); Debug.printString("\n"); } return result; when remotePair != null do { provider := Pair.first(remotePair); remotePortName := Pair.second(remotePair); remotePort := CAD.getPort(provider, remotePortName); handlerFunction := CAD.getPortMethodHandler<{|common.ReadData.data()|}>(remotePort, methodName); } goto loc2; loc loc2: live { handlerFunction, provider, result } result := invoke virtual {|common.ReadData.data()|}(handlerFunction, provider) return result; } enum EventHandlerType { {|modalsp.BinaryAnd.e2()|}, {|common.BMPushDataSource.timeOut()|}, {|common.BMModeSource.timeOut()|}, {|modalsp.BMModalTwoOrCorrelation.inDataAvailableNavSteeringPoints()|}, {|modalsp.BinaryAnd.e1()|}, {|modalsp.BMModalTwoOrCorrelation.inDataAvailableAirFrame()|}, {|modalsp.BMDisplayThreeCorrelation.inDataAvailable()|}, {|common.BMModal.inDataAvailable()|}, {|common.BMDevice.timeOut()|}, {|common.BMLazyActive.inDataAvailable()|} } virtual handleEvent on EventHandlerType { {|modalsp.BinaryAnd.e2()|} -> {|modalsp.BinaryAnd.e2()|} {|common.BMPushDataSource.timeOut()|} -> {|common.BMPushDataSource.timeOut()|} {|common.BMModeSource.timeOut()|} -> {|common.BMModeSource.timeOut()|} {|modalsp.BMModalTwoOrCorrelation.inDataAvailableNavSteeringPoints()|} -> {|modalsp.BMModalTwoOrCorrelation.inDataAvailableNavSteeringPoints()|} {|modalsp.BinaryAnd.e1()|} -> {|modalsp.BinaryAnd.e1()|} {|modalsp.BMModalTwoOrCorrelation.inDataAvailableAirFrame()|} -> {|modalsp.BMModalTwoOrCorrelation.inDataAvailableAirFrame()|} {|modalsp.BMDisplayThreeCorrelation.inDataAvailable()|} -> {|modalsp.BMDisplayThreeCorrelation.inDataAvailable()|} {|common.BMModal.inDataAvailable()|} -> {|common.BMModal.inDataAvailable()|} {|common.BMDevice.timeOut()|} -> {|common.BMDevice.timeOut()|} {|common.BMLazyActive.inDataAvailable()|} -> {|common.BMLazyActive.inDataAvailable()|} } record Subscriber { EventHandlerType handlerFunction;string portName; } record ComponentSubscriber extends Subscriber { CAD.Component component;boolean isSynchronous;int dispatchRate; } record CorrelatorSubscriber extends Subscriber { Correlator.type correlator; } record Receiver {} record CorrelatorReceiver extends Receiver { Correlator.type correlator; } record ComponentReceiver extends Receiver { CAD.Component component; } extension AnyType for edu.ksu.cis.projects.cadena.bogor.ext.AnyTypeModule { typedef type; expdef AnyType.type create <'a>('a); expdef 'a get <'a>(AnyType.type); } extension CAD for edu.ksu.cis.projects.cadena.bogor.ext.SystemModule { typedef Event; typedef Component; expdef CAD.Component createComponent (string); expdef CAD.Event createEvent <'enum$a>('enum$a); expdef 'enum$a getEventType <'enum$a>(CAD.Event); expdef string getComponentName (CAD.Component); actiondef configurationComplete (); expdef boolean hasAttribute (CAD.Component, string); expdef 'a getAttribute <'a>(CAD.Component, string); actiondef setAttribute <'a>(CAD.Component, string, 'a); typedef Port; expdef CAD.Port createPort (); actiondef registerPort (CAD.Component, CAD.Port, string); expdef CAD.Port getPort (CAD.Component, string); actiondef setPortMethodHandler <'a>(CAD.Port, string, 'a); expdef 'a getPortMethodHandler <'a>(CAD.Port, string); actiondef connectPorts (Pair.type , Pair.type ); expdef Pair.type getProvider (Pair.type ); actiondef addSubscriberList (CAD.Component, string); actiondef addSubscriber <'a>(CAD.Component, string, 'a); expdef 'a[] getSubscribers <'a>(CAD.Component, string); } extension Correlator for edu.ksu.cis.projects.cadena.bogor.ext.CorrelatorModule { typedef type; expdef Correlator.type create (string); actiondef handleEvent <'evtType>(Correlator.type, string, List.type<'evtType> ); actiondef addSubscriber <'a>(Correlator.type, 'a); expdef 'a[] getSubscribers <'a>(Correlator.type); } extension Debug for edu.ksu.cis.projects.cadena.bogor.ext.DebugModule { actiondef printString (string); actiondef printInt (int); } extension List for edu.ksu.cis.projects.cadena.bogor.ext.ListModule { typedef type<'a>; expdef List.type<'a> create <'a>(); expdef int size <'a>(List.type<'a> ); expdef 'a get <'a>(List.type<'a> , int); actiondef addFirst <'a>(List.type<'a> , 'a); actiondef addLast <'a>(List.type<'a> , 'a); actiondef addAllLast <'a>(List.type<'a> , List.type<'a> ); actiondef addAllFirst <'a>(List.type<'a> , List.type<'a> ); } extension Pair for edu.ksu.cis.projects.cadena.bogor.ext.PairModule { typedef type<'a, 'b>; expdef Pair.type<'a, 'b> create <'a, 'b>('a, 'b); expdef 'a first <'a, 'b>(Pair.type<'a, 'b> ); expdef 'b second <'a, 'b>(Pair.type<'a, 'b> ); } extension Queue for edu.ksu.cis.projects.cadena.bogor.ext.QueueModule { typedef type<'a>; expdef int size <'a>(Queue.type<'a> ); expdef int capacity <'a>(Queue.type<'a> ); expdef boolean isFull <'a>(Queue.type<'a> ); expdef boolean isEmpty <'a>(Queue.type<'a> ); expdef Queue.type<'a> create <'a>(int); expdef Queue.type<'a> createNamed <'a>(int, string); actiondef enqueue <'a>(Queue.type<'a> , 'a); expdef 'a getFront <'a>(Queue.type<'a> ); actiondef dequeue <'a>(Queue.type<'a> ); expdef boolean containsPair <'a>(Queue.type<'a> , 'a); } extension State for edu.ksu.cis.projects.bogor.module.ext.state.StateModule { expdef tid getCurrentThreadId (); expdef boolean isThreadAtLocation (tid, string, string); expdef boolean existsThreadAtLocation (string, string); expdef boolean existsThreadAtLocationWithParameter <'a>(string, string, string, 'a); expdef boolean existsThreadWithParameter <'a>(string, string, 'a); } extension Table for edu.ksu.cis.projects.cadena.bogor.ext.TableModule { typedef type<'a, 'b>; expdef Table.type<'a, 'b> create <'a, 'b>(); expdef 'b get <'a, 'b>(Table.type<'a, 'b> , 'a); actiondef put <'a, 'b>(Table.type<'a, 'b> , 'a, 'b); actiondef clear <'a, 'b>(Table.type<'a, 'b> ); expdef boolean containsKey <'a, 'b>(Table.type<'a, 'b> , 'a); actiondef remove <'a, 'b>(Table.type<'a, 'b> , 'a); } thread timeoutSender() { int localTime; loc init: live { localTime } when true do invisible { localTime := -(1); } goto block; loc block: live { localTime } when localTime != globalClock do invisible { } goto locInvokeTest1; loc locInvokeTest1: live { localTime } when globalClock % (40 / 1) == 0 do invisible { } goto locInvoke1; when globalClock % (40 / 1) != 0 do invisible { } goto locInvokeTest2; loc locInvoke1: live { localTime } invisible invoke fireEventFromComponent(EventChannel, "timeOut1", CAD.createEvent<{|EventType|}>({|EventType|}.{|common.TimeOut|})) goto locInvokeTest2; loc locInvokeTest2: live { localTime } when globalClock % (40 / 5) == 0 do invisible { } goto locInvoke5; when globalClock % (40 / 5) != 0 do invisible { } goto locInvokeTest3; loc locInvoke5: live { localTime } invisible invoke fireEventFromComponent(EventChannel, "timeOut5", CAD.createEvent<{|EventType|}>({|EventType|}.{|common.TimeOut|})) goto locInvokeTest3; loc locInvokeTest3: live { localTime } when globalClock % (40 / 20) == 0 do invisible { } goto locInvoke20; when globalClock % (40 / 20) != 0 do invisible { } goto locInvokeTest4; loc locInvoke20: live { localTime } invisible invoke fireEventFromComponent(EventChannel, "timeOut20", CAD.createEvent<{|EventType|}>({|EventType|}.{|common.TimeOut|})) goto locInvokeTest4; loc locInvokeTest4: live { localTime } when globalClock % (40 / 40) == 0 do invisible { } goto locInvoke40; when globalClock % (40 / 40) != 0 do invisible { } goto locInvokeTest5; loc locInvoke40: live { localTime } invisible invoke fireEventFromComponent(EventChannel, "timeOut40", CAD.createEvent<{|EventType|}>({|EventType|}.{|common.TimeOut|})) goto locInvokeTest5; loc locInvokeTest5: live { localTime } do invisible { } goto resetLocalTime; loc resetLocalTime: live { localTime } when true do { localTime := globalClock; } goto block; } thread clock() { loc loc0: live {} when true do { globalClock := (globalClock + 1) % 40; } goto loc0; } function fireEventFromCorrelator(Correlator.type cor, CAD.Event e) { Subscriber[] subscribers; CorrelatorReceiver corReceiver; int i; loc loc0: live { subscribers, corReceiver, i } do { subscribers := Correlator.getSubscribers(cor); i := 0; } goto loc1; loc loc1: live { subscribers, corReceiver, i } when i < subscribers.length do { } goto loc2; when !((i < subscribers.length)) do { } goto loc8; loc loc2: live { subscribers, corReceiver, i } when subscribers[i] instanceof CorrelatorSubscriber do { } goto loc3; when subscribers[i] instanceof ComponentSubscriber do { } goto loc5; when !((subscribers[i] instanceof CorrelatorSubscriber || subscribers[i] instanceof ComponentSubscriber)) do { } goto loc6; loc loc3: live { subscribers, corReceiver, i } do { corReceiver := new CorrelatorReceiver; corReceiver.correlator := (((CorrelatorSubscriber) (subscribers[i]))).correlator; } goto loc4; loc loc4: live { subscribers, corReceiver, i } invoke virtual handleEvent(subscribers[i].handlerFunction, e, null) goto loc7; loc loc5: live { subscribers, corReceiver, i } invoke queueEventForDispatch(((ComponentSubscriber) (subscribers[i])), e) goto loc7; loc loc6: live { subscribers, corReceiver, i } do { } goto loc7; loc loc7: live { subscribers, corReceiver, i } do { i := i + 1; } goto loc1; loc loc8: live { subscribers, corReceiver, i } do { } return; } function fireEventFromComponent(CAD.Component sourceComp, string port, CAD.Event event) { Subscriber[] consumers; CorrelatorSubscriber corSub; ComponentSubscriber compSub; CorrelatorReceiver corRecv; ComponentReceiver compRecv; int i; loc loc0: live { consumers, i } do { consumers := CAD.getSubscribers(sourceComp, port); i := 0; } goto loc1; loc loc1: live { consumers, i } when i < consumers.length do { } goto loc2; when !((i < consumers.length)) do { } goto loopEnd; loc loc2: live { consumers, i, corSub, compSub } when consumers[i] == null do { } goto locLoopBodyBottom; when !((consumers[i] == null)) do { } goto loc2a; loc loc2a: live { consumers, i, corSub, compSub } when consumers[i] instanceof CorrelatorSubscriber do { corSub := ((CorrelatorSubscriber) (consumers[i])); } goto loc3; when consumers[i] instanceof ComponentSubscriber do { compSub := ((ComponentSubscriber) (consumers[i])); } goto loc5; when !((consumers[i] instanceof CorrelatorSubscriber || consumers[i] instanceof ComponentSubscriber)) do { } goto locLoopBodyBottom; loc loc3: live { consumers, i, corSub, compSub, corRecv } do { corRecv := new CorrelatorReceiver; corRecv.correlator := corSub.correlator; } goto loc4; loc loc4: live { consumers, i, corSub, compSub, corRecv } invoke virtual handleEvent(corSub.handlerFunction, event, corRecv) goto locLoopBodyBottom; loc loc5: live { consumers, i, corSub, compSub, compRecv } when compSub.isSynchronous do { } goto useErm; when !(compSub.isSynchronous) do { } goto dontUseErm; loc useErm: live { consumers, i, corSub, compSub, compRecv } do { compRecv := new ComponentReceiver; compRecv.component := compSub.component; } goto useErm2; loc useErm2: live { consumers, i, corSub, compSub, compRecv } invoke virtual handleEvent(compSub.handlerFunction, event, compRecv) goto locLoopBodyBottom; loc dontUseErm: live { consumers, i, corSub, compSub, compRecv } invoke queueEventForDispatch(compSub, event) goto locLoopBodyBottom; loc locLoopBodyBottom: live { consumers, i, corSub, compSub } do { i := i + 1; } goto loc1; loc loopEnd: live {} do { } return; } function queueEventForDispatch(ComponentSubscriber subscriber, CAD.Event event) { Queue.type > q; int size; int capacity; loc loc0: live { q, size, capacity } do invisible { q := Table.get > >(runRateQueues, subscriber.dispatchRate); assert(q != null); size := Queue.size >(q); capacity := Queue.capacity >(q); } goto loc1; loc loc1: live { q, size, capacity } when size < capacity do { Queue.enqueue >(q, Pair.create(subscriber, event)); } return; when !((size < capacity)) do { } return; } thread rateDispatcher(int period) { Pair.type pair; EventHandlerType handler; CAD.Event event; CAD.Component receiverComp; Receiver receiver; Queue.type > dispatchingQueue; loc loc0a: live { pair, handler, event, receiver, receiverComp, dispatchingQueue } when true do invisible { } goto loc0; loc loc0: live { pair, handler, event, receiver, receiverComp, dispatchingQueue } when true do invisible { dispatchingQueue := Table.get > >(runRateQueues, period); } goto locX; loc locX: live { pair, handler, event, receiver, receiverComp, dispatchingQueue } when dispatchingQueue == null do invisible { } goto locIdle; when dispatchingQueue != null do invisible { } goto locIdle; loc locIdle: live { pair, handler, event, receiver, receiverComp, dispatchingQueue } when Queue.size >(dispatchingQueue) > 0 do invisible { pair := Queue.getFront >(dispatchingQueue); Queue.dequeue >(dispatchingQueue); handler := Pair.first(pair).handlerFunction; receiverComp := Pair.first(pair).component; event := Pair.second(pair); } goto loc2; loc loc2: live { pair, handler, event, receiver, receiverComp, dispatchingQueue } do { receiver := new ComponentReceiver; (((ComponentReceiver) (receiver))).component := receiverComp; } goto loc3; loc loc3: live { pair, handler, event, receiver, receiverComp, dispatchingQueue } invisible invoke virtual handleEvent(handler, event, receiver) goto locIdle; } fun getEventDispatchQueue(int period) returns Queue.type > = runRateQueues == null? null : Table.get > >(runRateQueues, period); fun eventQueueIsEmpty(int period) returns boolean = getEventDispatchQueue(period) == null? true : Queue.isEmpty >(getEventDispatchQueue(period)); fun rategroupIdlenessTestFun(int period) returns boolean = (State.existsThreadWithParameter("rateDispatcher", "period", period) => State.existsThreadAtLocationWithParameter("rateDispatcher", "locIdle", "period", period)) && eventQueueIsEmpty(period); fun timeoutSenderIdlenessTestFun() returns boolean = State.existsThreadAtLocation("timeoutSender", "block"); CAD.Component EventChannel; CAD.Component GPS; CAD.Component AirFrame; CAD.Component NavDisplay; CAD.Component PilotControl; CAD.Component NavSteering; CAD.Component TacticalSteering; CAD.Component Navigator; CAD.Component NavSteeringPoints; int globalClock; Table.type > > runRateQueues; }