Prev: PMSG
Next: Enumeration
From: Colin on 12 Aug 2010 03:28 Is it possible to have a subsytem activated by multiple action ports? The following algorithm is what I want to implement: if x do fnc end if y do fnc end if z do fnc end where x, y and z are complex functions, so I'd prefer to keep them as separate blocks. However, they all result in fnc being called. I could duplicate the fnc block, but this seems an odd thing to have to do. Thanks for any ideas.
From: Will Campbell on 12 Aug 2010 08:42 Hi Colin, I would use a Logical Operator block from the Logic and Bit Operations library. Set it to 3 inputs and make the condition an OR. Supply x, y, and z to the block, and feed the output to your Enabled Subsystem. This should do the trick. Alternatively, you can supply a Muxed signal to your action port. This is equivalent to the OR construct, but it's a little less clear in my mind. What's your ELSE condition when x, y, and z are false? You might need to play with your Enabled Subsystem outport "Initial output" and "Output when disabled" options. Good luck, -Will
From: Colin on 13 Aug 2010 04:43 "Will Campbell" <will.campbell(a)mathworks.com> wrote in message <i40q61$a46$1(a)fred.mathworks.com>... > Hi Colin, > I would use a Logical Operator block from the Logic and Bit Operations > library. Set it to 3 inputs and make the condition an OR. Supply x, y, and > z to the block, and feed the output to your Enabled Subsystem. This should > do the trick. > > Alternatively, you can supply a Muxed signal to your action port. This is > equivalent to the OR construct, but it's a little less clear in my mind. > > What's your ELSE condition when x, y, and z are false? You might need to > play with your Enabled Subsystem outport "Initial output" and "Output when > disabled" options. > > Good luck, > -Will > Hi Will, Thanks for the response. Unfortunately the algorithm isn't a simple OR, as if all conditions are true, I want to call the function 3 times, where as with an OR it will only get called once. When x,y and z are false, then the function simply isn't called, and I move on to the next simulation step. Any further ideas are appreciated. Colin
From: Fangjun Jiang on 13 Aug 2010 08:45 "Colin " <colin.notthis.rogers(a)selexgalileo.northis.com> wrote in message <i430io$b6d$1(a)fred.mathworks.com>... > "Will Campbell" <will.campbell(a)mathworks.com> wrote in message <i40q61$a46$1(a)fred.mathworks.com>... > > Hi Colin, > > I would use a Logical Operator block from the Logic and Bit Operations > > library. Set it to 3 inputs and make the condition an OR. Supply x, y, and > > z to the block, and feed the output to your Enabled Subsystem. This should > > do the trick. > > > > Alternatively, you can supply a Muxed signal to your action port. This is > > equivalent to the OR construct, but it's a little less clear in my mind. > > > > What's your ELSE condition when x, y, and z are false? You might need to > > play with your Enabled Subsystem outport "Initial output" and "Output when > > disabled" options. > > > > Good luck, > > -Will > > > > Hi Will, > Thanks for the response. Unfortunately the algorithm isn't a simple OR, as if all conditions are true, I want to call the function 3 times, where as with an OR it will only get called once. > When x,y and z are false, then the function simply isn't called, and I move on to the next simulation step. > > Any further ideas are appreciated. > > Colin Try this, Make each of your x, y and z subsystem generate a function-call, use a Mux block to mux them and then trig your function. I tried this. It worked.
|
Pages: 1 Prev: PMSG Next: Enumeration |