×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Need advice for using simulink for control of basic system

Need advice for using simulink for control of basic system

Need advice for using simulink for control of basic system

(OP)
Hello,
I have been told that simulink is a fairly good and easy way to design control systems.

What I'm trying to do should be very easy. I have a very simple system that I already have code to handle outputs and inputs to the physical equipment. The system consists of sensors, etc which have either an on or an off function.
What I want to do is be able to use simulink to control this system. It would be simple things like if sensor 1 is on, turn on motor 1. if sensor 2 is on do this, etc.

Everything I have found is more complex than what I need (involving transfer functions, various equations and so on).
If anyone could point me in the right direction as to what to look, read, or whatever, it would be much appreciated.

RE: Need advice for using simulink for control of basic system

(OP)
To be more specific, I need to continuously track several variables and respond to changes in them. I believe this may be a state space but everything I find assumes prior knowledge of control systems (which I do not have) and does not explain what various models and terms mean.

So what I want to do is something along the lines of:
if (x == 1 and y == 0){ //arbitrary condition
   output1 = 1;     //turn on something
}
if(some condition){
}
if(some other condition){
}

The inputs from sensors would be checked every 0.1 second and compared against these conditions.

RE: Need advice for using simulink for control of basic system

It is not state space. It sounds like you need Stateflow, which is a Simulink package for state transition functions.

xnuke
"Live and act within the limit of your knowledge and keep expanding it to the limit of your life." Ayn Rand, Atlas Shrugged.
Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.

RE: Need advice for using simulink for control of basic system

You can do all of that with an embedded function in Simulink.
Just requires that you know how to program in m-code.

You can even extract the states from a DE sing an S-function.

For example: your
"if (x == 1 and y == 0){ //arbitrary condition
   output1 = 1;     //turn on something
"
can be written almost exactly as it is in the embedded function. The 'x' and 'y' can be inputs to the function.   

peace
Fe

RE: Need advice for using simulink for control of basic system

(OP)
@xnuke
Thanks a lot. I'll look into it.

@FeX32
That is true. However, I need some way to control how often and how long it takes for each sampling rate. My reason (hopefully not misguided) for looking into Simulink is to do just that.
e.g. the input needs to be read every x seconds, and should not take longer than x seconds to sample again. So other computations cannot delay the time to update the inputs.

RE: Need advice for using simulink for control of basic system

You can change the "sampling rate" or solver tolerance in the Configuration Settings.
Click fixed time step and choose a time step 'x' that you are referring to.  

peace
Fe

RE: Need advice for using simulink for control of basic system

Simulink is not inherently parallel, therefore there is some danger that a simple program will experience timing conflicts.

However there are toolboxes available for all sorts of things, and blocks for sample and hold, for example.

 

Cheers

Greg Locock


New here? Try reading these, they might help FAQ731-376: Eng-Tips.com Forum Policies  http://eng-tips.com/market.cfm?

RE: Need advice for using simulink for control of basic system

(OP)
@xnuke: Stateflow is exactly what I needed. Many thanks. You wouldn't believe how much time I wasted reading about simulink and its various features without ever coming across mention of stateflow.

Everyone else: thank you as well.

Yeah, simulink isn't exactly parallel, however I'm pretty sure what it does is good enough for my purposes. Right now I just want to get it to work (Having problems loading C++ dll's). I'll keep the sample and hold blocks in mind and look into it once I figure out what I'm doing wrong.

RE: Need advice for using simulink for control of basic system

Seems to be a bit of an overkill, isn't it?  From your description, you are looking for a finite state machine, or a giant CASE statement.

You might want to look at Labview, or something similar, since that's what Labview is actually designed for.

TTFN

FAQ731-376: Eng-Tips.com Forum Policies

RE: Need advice for using simulink for control of basic system

(OP)
Labview looks pretty cool.
Trust me, I wouldn't be using MATLAB if I had a choice. Unfortunately, I'm writing this for someone who wants it in MATLAB so that he can integrate it with his MATLAB programs for statistical data analysis. Although, I'm starting to wonder if that's necessary...

RE: Need advice for using simulink for control of basic system

I don't know for sure, but my understanding is that Matlab can be integrated with Labview.

TTFN

FAQ731-376: Eng-Tips.com Forum Policies

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources