Simulink If block error "Port 1 must directly or indirectly connect to one If Action Subsystem"

64 views (last 30 days)
Hello, I am working to use an If block and If action blocks to set shift points for a vehicle model, the code that I am going after would be:
If u1 > 57.3421
6th Gear If Action Block activated
elseif u1 > 46.2345
5th Gear If Action Block activated
elseif u1 > 35.9144
4th Gear If Action Block activated
elseif u1 > 25.6962
3rd Gear If Action Block activated
elseif u1 > 4.2575
2nd Gear If Action Block activated
else
1st Gear If Action Block activated
end
but I keep recieving an error that Port 1 must be connected to an If action block. Any suggestions on how to fix this?
Attached are pictures of the example I was using to build this and the model I have created.

Answers (1)

Fangjun Jiang
Fangjun Jiang on 28 Sep 2023
Edited: Fangjun Jiang on 28 Sep 2023
Outport 1 of the If block is also connected to another destination but it was not shown in the snapshot. Dis-connect that branch and do the same for the rest.
Outputs from the if, else, and elseif ports are action signals to If Action Subsystem blocks. They can't be connected to other places.
  2 Comments
John Harrison
John Harrison on 28 Sep 2023
Thank you, I had those ports connected to other If Action subsystem blocks, but after reworking the system so one If port goes to one if Action block it worked.
Fangjun Jiang
Fangjun Jiang on 28 Sep 2023
The trigger signals can only be connected to one destination. That was my impression and I suspect that was the cause of your issue. But I couldn't find any statement on this from the Simulink document.

Sign in to comment.

Categories

Find more on Modeling in Help Center and File Exchange

Tags

Products


Release

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!