How can I get info about context of signal of my model when code generating

2 views (last 30 days)
I have been trying(ML2013b) to find a way of defining a signal object i.e. F_M_Xxx in my model and then I would expect that when signal is used to write something into it I would get a code RAISE_FAULT(&F_M_Xxx) whilst when the same signal is read then I would get GET_FAULT_STATUS(&F_M_Xxx). The scenario here can be when you have a block and it writes to Outport so my signal is on the line to that Outport, then at the same time Switch block takes it as an input.
I have to say that I explored Custom Storage Classes and came across GetSet custom class which seemed perfect but the restrictions of GetSet make it not possible for me to use it. So I just wonder if with those CSC I could develop a new class and then in its TLC somehow discover what context that variable/signal is used for read or for write and then customize the code in TLC script?
I tried with LibCustomStorageRecordIsBlockOutput but it is not what I want but well, close:
%case "contents"
%assign id = LibGetRecordIdentifier(record)
%assign isBlockOutput = LibCustomStorageRecordIsBlockOutput(record)
%if isBlockOutput
%assign rtn = "RAISE_FAULT(..)"
%else
%assign rtn = "GET_FAULT_STATUS(..)"
%endif
%return rtn
%break

Answers (0)

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!