Message Boards Message Boards

0
|
4669 Views
|
6 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

What are valid realExpressions?

Dear users of SystemModeler

Mathematica expressions sometimes may replace several WSM blocks. I have searched for help on realExpression, but I have not found much. See, I want to use an expression like this one:

0.25*(1 + 0.15*sin(80*Modelica.Constants.pi time + Modelica.Constants.pi));

Why is this not valid?

Thanks in advance. Jesus

6 Replies

Great!!

Cheers Jesus

Alternatively, You can enter the code in the text view of the model instead of using realExpression. In some cases this might be easier/clearer. (and you can reference other blocks such as blockname.variable)

Regards

Neil

POSTED BY: Neil Singer

Yes.

You have to reference other components as pulse1.y

Like this:

enter image description here

POSTED BY: Neil Singer

Neil, Can I use signal components such as Modelica.Blocks.Sources.Pulse within a realExpression?

Thanks again

Jesus

Thank you Neil,

I guess, I expend too much time in the Mathematica syntax.

Thank you so much.

Jesus

Jesus,

You need to use valid Modelica syntax. For your expression, this works.

0.25 * (1 + 0.15 * sin(80 * Modelica.Constants.pi * time + Modelica.Constants.pi))

You left out the multiplication (*) and no semicolon at the end

Regards,

Neil

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

Group Abstract Group Abstract