Group Abstract Group Abstract

Message Boards Message Boards

0
|
7.1K Views
|
5 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Externally controlling a Boolean pulse generator

Posted 5 years ago

I am using a Boolean pulse generator in one of my models and plan to wrap a control system that will vary the period. I have already set the period as a parameter and perhaps should have chosen a variable. My question: how do I set the value from outside? I have added a connector and tried to use it to set the value for the pulse generator but the compilation fails.

What is the method of dynamically controlling the period of a Boolean pulse generator? Or, is there another component I should be using?

Thanks in advance for any help,

Mark

POSTED BY: Mark Ross
5 Replies
Posted 5 years ago

Hi Neil,

Thank you for the reply and the example! Yes, this is just what I want: the ability to dynamically set the period.

Regards,

Mark

POSTED BY: Mark Ross

Mark,

I put together a quick example for you of a way to get a variable pulse width output (I assumed that this is what you wanted):

enter image description here

With a combi time table of:

enter image description here

This gives the variable pulses:

enter image description here

Note that I chose "ConstantSegments" under smoothness and "HoldLastPoint" under extrapolation to make the table easier to construct.

My table entries are frequency in hertz (0.2 hz, followed by 0.4hz, 1hz, etc.) but you can change that easily to period if that helps your model. Attached is the model.

Regards,

Neil

Attachments:
POSTED BY: Neil Singer
POSTED BY: Neil Singer
Posted 5 years ago

I have pruned this down to its most basic example. Please see attached.

This shows the example where I want to vary the period of the Boolean pulse generator based on a parameter or variable. I did try changing the output of the table to a "variable" but that made no difference.

When I attempt to compile, it gives this error message:

Building "BooleanExample" as experiment "BooleanExample 1" started at 15:01:07 
Error: interactive [2:40-2:59] Component pulse1.period of variability PARAM has binding somePeriod of higher variability VAR.
Build finished at 15:01:09 (took 00:01).
Error: No executable generated /Users/markross/Library/Caches/com.wolfram.SystemModeler/WolframSystemModeler-12.1/sme.12.1.0_1595973667_1557810404.exe
Error: No settings file generated /Users/markross/Library/Caches/com.wolfram.SystemModeler/WolframSystemModeler-12.1/sme.12.1.0_1595973667_1557810404.sim

I have used the Boolean pulse generator where I set the period to some parameter and that works as expected. The ability to dynamically change the period is what I have not been able to figure out.

POSTED BY: Mark Ross

Welcome to Wolfram Community! Please make sure you know the rules: https://wolfr.am/READ-1ST Your post is too vague. Please describe your subject extensively providing the details, examples, code, and other relevant ideas, so it is clear what exactly you are looking for and the relevance to Wolfram Technologies.

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