Group Abstract Group Abstract

Message Boards Message Boards

0
|
5.9K Views
|
5 Replies
|
2 Total Likes
View groups...
Share
Share this post:

how to use mathematical functions in system modeler

Posted 11 years ago

hi friends

i am trying to use mathematical function, particularly 'mod' in system modeler. i want to find remainder of some continuous stream and pass it on for further processing. please suggest. i am new to modeler and i am sure i am missing some simple thing

POSTED BY: manu gaurav
5 Replies

i tried writing the code as attached in the file. it is giving error. can you please suggest as i think it is syntactical error for not able to call mathematica functions. for simplicityr sake it is also copied below

block my_mod1 "find remainder after division" Modelica.Blocks.Interfaces.RealInput u "input signal connector" Modelica.Blocks.Interfaces.RealOutput y "output signal connector"

equation y = Mod[u,360]

end my_mod1;

Attachments:
POSTED BY: manu gaurav

In SystemModeler the functions have lowercase names, and you use () instead of [], below is a modified version of your code that should do the trick:

block my_mod1 "find remainder after division"
  Modelica.Blocks.Interfaces.RealInput u "input signal connector" ;
  Modelica.Blocks.Interfaces.RealOutput y "output signal connector" ;
equation
  y = mod(u, 360);
end my_mod1;
POSTED BY: Mikael Forsgren
POSTED BY: manu gaurav
POSTED BY: Mikael Forsgren

i tried writing the code as attached in the file. it is giving error. can you please suggest as i think it is syntactical error for not able to call mathematica functions. for simplicity sake it is also copied below

block my_mod1 "find remainder after division" Modelica.Blocks.Interfaces.RealInput u "input signal connector" Modelica.Blocks.Interfaces.RealOutput y "output signal connector" equation y = Mod[u,360] end my_mod1;

POSTED BY: manu gaurav
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard