MPC Time Varying Output Constraints
Does anyone have experience with implementing time-varying output constraints for an MPC controller (from the Control Design Module)?
So far, from playing around with the example VIs it seems that I'm stuck with fixed values.
Cheers.
Hi Signorec,
Can I ask what example VIs you've been looking at? The ones that come with the Control Design Module in LabVIEW example finder?
When you say time-varying output constraints do you mean be able to change the MPC configuration settings during run time? From the examples I can find it seems that you set it all up and leave it to run. Where as you would like to be able to tweak the settings at particular times? Is that correct?
Assuming that it is the implmentation of the MPC controllor occurs within a Control & Simulation Loop. To change any constraints on the MPC you would need to stop that loop, change the settings and re-initalise the process before running that Control & Simulation Loop again. You can implement this with a state machine architecture or a while loop and some logic. I would recommend the state machine personally.
Please let me know if I have misinterprted the question or if there's something unclear. If you want me to take a look at an example you're working from I can show you the basic architecture you would need if you like?
Best wishes,
Charlotte N.
Applications Engineer, NI UK & Ireland
Similar Messages
-
Issues with using SV Time-Varying Loudness.vi
Hi,
I am rather new to Labview and am having issues getting my Time-Varying Loudness calcuations to come out correctly. Attached is my current VI and a .csv file of a set of my data (calibrated in Pa. Sample rate = 50kHz for 5 seconds). When i run the VI it does not output what I would expect. Here are my questions:
Time-Varying Loudness:
1) What are there so many signals? There are hundreds of lines, but I only expected one.
2) Why is my x-axis not a range of 1 to 24 like Barks should be?
1/3 Octave Band Analsysis:
1) Why does it look incorrect? Their shouldnt be a linear increase as a function of frequency...
The data is of a part being squeezed and making a squeek. So it is a transient noise that happens around 2 seconds. Additionaly, how would I go about making a waterfall (Time(s),Frequency(Hz),Amplidtude(sones)) of this signal? Is there any easy way? or do I have to make all three signals and add them to make one plot?
Thank you for your help! Let me know if you need more infromation,
-Troy
p.s. i included a picture of the results as well.
Solved!
Go to Solution.
Attachments:
TimeVaryingIssue.zip 668 KBHi Troy,
1) The SV Specific Loudness VI "chunks" data into 2 ms blocks, and then returns these as individual Specific Loudness vs. Sone plots. The colored lines you are seeing on your graph are representative of the 2,500 2 ms time periods within your five-second acquisition. Each of these plots contains 241 points, however they should occur in ten sample "steps", one for each sone. The digital filter's buffer takes a bit to fill and kick in properly, however, so you may want to give your first few rows( 0-.02 seconds or so) a closer look before using them- you may see a number of unexpected zeroes around the lowest sones.
2) Since you are using a chart, the x-axis will increment with every subsequent run (the previous data is retained.) If you only want to display the most recent data, I would recommend switching to a graph, which can also be found in the graph controls palette. Also, see above (#1) for why the x-axis is longer than 24 points.
3) Remember that dB is a unitless measure, and can only be used in reference to another value. A typical reference for sound is 20 uPa, however you will likely need to equalize your input data and determine/set a dB reference. You may want to take a look at SVL Scale voltage to EU.vi (EU stands for equalized units) and SVL Set dB reference.vi. In your case, I believe the Octave plot is showing your dB relative to a default value of 1. The values should be accurate with respect to one another, but you will need to provide a reference value to calibrate the scale.
4) I think that this VI serves as a good example of how to go about creating a waterfall plot:
Waterfall Display for Octave (DAQmx)
http://zone.ni.com/devzone/cda/epd/p/id/5562
You will need to break up your waveform into chunks, much like the specific loudness VI, but the basic concept is roughly the same (take waveform chunk, take octave measurement of chunk, append octave measurement output cluster to array of clusters, repeat for remainder of waveform, display)
Phew! That was quite a bit of information. Let me know if that makes sense, and don't be intimidated by the detail and/or unfamiliar functions or methods - you're definitely on the right track, or at the very least asking the right questions.
Tom L. -
hi all,
can anyone plz tell me the use of Varying? tell me with example. actually i m using statement like below but i m getting only 0 values.--
DATA: BEGIN OF WAGETYPES,
LGA LIKE P0008-LGA01,
BET LIKE P0008-BET01,
END OF WAGETYPES.
DO 20 TIMES VARYING WAGETYPES
FROM P0008-LGA01
NEXT P0008-LGA02.
IF WAGETYPES-LGA IS INITIAL.
EXIT.
endif.
DO 15 TIMES VARYING WAGETYPES
FROM P0589-LGA01
NEXT P0589-LGA02.
IF WAGETYPES-LGA IS INITIAL.
EXIT.
endif.
problem is that i m not getting any value in output only showing 0 value. can anyone please solve this issue?
regards Nitin.Hi Saurabh,
Check this sample code
REPORT z_sdn.
PARAMETERS:
p_pernr TYPE pa0000-pernr,
p_dat TYPE t548t-datar.
DATA:
BEGIN OF fs_pa0000,
pernr TYPE pa0000-pernr,
END OF fs_pa0000,
w_dtype TYPE pa0041-dar01,
w_dat TYPE pa0041-dat01.
DATA: fs_548 TYPE t548t.
DATA: t_548 LIKE
TABLE OF
fs_548.
DATA:
t_pa0000 LIKE
TABLE OF
fs_pa0000.
DATA:
fs_p41 TYPE p0041.
DATA:
t_p41 TYPE
TABLE OF
p0041.
START-OF-SELECTION.
PERFORM get_pernr.
PERFORM get_data.
PERFORM disp_data.
*& Form get_pernr
* text
* --> p1 text
* <-- p2 text
FORM get_pernr .
SELECT pernr
FROM pa0000
INTO TABLE t_pa0000
WHERE pernr EQ p_pernr
AND begda LT sy-datum
AND endda GT sy-datum.
ENDFORM. " get_pernr
*& Form get_data
* text
* --> p1 text
* <-- p2 text
FORM get_data .
LOOP AT t_pa0000 INTO fs_pa0000.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
pernr = fs_pa0000-pernr
infty = '0041'
TABLES
infty_tab = t_p41
EXCEPTIONS
infty_not_found = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDLOOP.
ENDFORM. " get_data
*& Form disp_data
* text
* --> p1 text
* <-- p2 text
FORM disp_data .
READ TABLE t_p41 INTO fs_p41 INDEX 1.
DO 12 TIMES VARYING w_dtype FROM fs_p41-dar01 NEXT fs_p41-dar02
VARYING w_dat FROM fs_p41-dat01 NEXT fs_p41-dat02.
IF p_dat EQ w_dtype.
SELECT *
FROM t548t
INTO TABLE t_548
WHERE datar = w_dtype
AND sprsl = 'EN'.
READ TABLE t_548 INTO fs_548 INDEX 1.
WRITE: /2 'Personnel Number'(002),
15 'Begin Date'(003),
28 'End Date'(004),
40 'Date Type'(005),
53 'Date'(006),
65 'Date Text'(007).
WRITE: / fs_p41-pernr UNDER text-002,
fs_p41-begda UNDER text-003,
fs_p41-endda UNDER text-004,
w_dtype UNDER text-005,
w_dat UNDER text-006,
fs_548-dtext UNDER text-007.
EXIT.
ENDIF.
ENDDO.
ENDFORM. " disp_data
Regards
Abhijeet -
Hello All
How is the time variants gets the data, Do we need to LOAD data from Source system, like how we do for Master Data Load ?
Thanks, looks silly questions, but good to understand ....
BIHi,
In rsa1 of BW goto the source systems. Right click on your source system and select Transfer Global Settings. This will do your job. You need not to LOAD any data from Source system.
Hope this Helps,
Thanks,
Amit -
Time origin of "Global Start Time" in Output Node of Time Loop
Hi All,
Please, do you know how the time returned by Global Time Start (after converting in milliseconds) in the Output Node of a Timed Loop is related to the time returned by “Tick Count (ms)” (if the latter is read at the very start of the loop)?
The look similar but they are not the same.
Is it right that the time returned by Time in the Node of an Event Structure is the value of “Tick Count (ms)” when the event takes place?
Have an awesome day,
LucaQHi LucaQ,
This is a really interesting question. To answer the easy part, the Tick Count and the Time event data node for an event structure both output the same thing, the ms clock value obtained from the OS.
The Global Start Time node outputs a nanosecond-resolution clock value. I'm a little fuzzy on details, but my neighbors and I believe that this clock comes directly from the processor (or more directly at least). If you look at the differences between this nanosecond clock and the ms clock for the OS, you'll see that the OS ms clock "lags behind." For example, look at these values output by the 2 clocks:
Global Start Time:
335654376684899
ms timer value:
335650557
If you scale the nanosecond value up to ms, you see that 335654376.7 is greater than 335650557.
I believe this time offset can be accounted for if we assume that the OS (such as Windows) takes this nanosecond clock and derives a ms clock from it. In addition, it will take some time for that ms value to propagate through the various levels of software up to your end-user application level. The nanosecond clock comes directly from the processor, and the Timed Loop uses lower-level functions to obtain it. Because it has fewer layers of processing to pass through, it is a higher (more recent) number.
In light of all this, I would use the Global Start Time only for comparing against other Timed Loop nanosecond clock values like Global End Time. Do not expect to scale it and subtract a ms clock value to get the time elapsed or anything like that.
Jarrod S.
National Instruments -
Time varying velocity input for servo motor
I 'm running a PXI-8145RT CPU with a 7344 motion controller.I want to load a time varying velocity profile for my servo motor.How can I do this? The "load velocity" tile does not have an input for such a profile,but only for a maximum velocity that will be reached after a certain time.
Are you using the Motion Assistant or a programming language like LabVIEW? If you are using the motion assistant, you can do a contoured move with a Position-Velocity-Time Profile. I have never done this, but it sounds to be what you are looking for. This assumes that you have a controller that can do contoured moves.
Hope that this helps,
Bob
Bob Young - Test Engineer - Lapsed Certified LabVIEW Developer
DISTek Integration, Inc. - NI Alliance Member
mailto:[email protected] -
Import times vary-explain this to me please
Why is it that when I’m importing a CD to iTunes (this is with either a new CD or an old CD) the import times vary so drastically?
2. It displays the objects on the stage. (It displays them one by one in the order in which they
were dragged to the stage from the Library when you designed the game in the FLA.)what does he mean by saying display them on the stage?? because i cant see them without addchild method and he said the swf file display them??!!!!!!!!
are you using pure AS3 or are you using the design tool in CS4/5
when using the design tool in CS4/5 you can have objects in the library and drag them to the stage. this will automatically at the objects to the stage without having to call addChild()
if you are using pure AS3 you don't have access to this and you have to explicity add all you objects using addChild
Here’s the issue: if the class’s constructor method includes a reference to the stage or an object that
is on the stage that hasn’t yet been displayed, you’ll get an error message saying this: here i cant understand any single word!!
Error #1009: Cannot access a property or method of a null object reference.
you would only need to add a reference to the stage for non DisplayObjects (e.g. generally things that aren't sprites or MovieClips)
All DisplayObjects have access to the stage via the stage property. The stage property for an object is always null until you call addChild, not when they are constructed as you mention.
if you are trying to use the stageWidth and stageHeight property you shouldn't do this in the constructor of the object instead you would need to add an Event.ADDED_TO_STAGE listener and then do any configuration based ont he stage within this listener.
hope that clears it up a little -
Frequency analysis of time varying data
I want to add a routine for frequency analysis of before and after strong impulse on a body.
Some vibration sensors will be attached to the body.
In this case, I was told I need to use a time-varying method like wavelet or any other to analysis instead of simple FFT.
I installed wavelet package but I have no idea how to use it.
(Wavelet method seems to be popular in reduction of noise.)
Only what I want to know is the frequency elements in dynamics.
Can you recommend any tools (functions) for my purpose?
Are there some LabVIEW examples?
I am using LV2009 and some extra toolkits (developer suites).
labmaster.labmaster wrote:
I want to ask some curious things.
1. I have to analysis the spectrum of frequency in dynamic signal.
In case of presenting dB, how to know the frequencies?
2. In high sampling rate (1MHz), the low frequency element can't be analyzed. (too small window for 60Hz in my last example).
If so, generally, do I have to down sampling to ~1kHz for the 1MHz in wavelet or short time FT?
Take a look on how the Express VI you are using are made. The Express VI you are using is located here
C:\Program files\National Instruments\LabVIEW 2010\vi.lib\addons\Time Frequency Analysis\_express\_TimeFrequencySpectrogramConfig.llb
The VI you need to open is the configure.vi. Copy this VI to your user.lib folder before doing any work on it.
To answer your first question. The dB setting will change the Y axis scaling, and not the X axis scaling. Which is the frequncy axis
The step between each frequncy bin will be( number of Frequency bins/(Fsample/2)). So using 1 MHz may reduce resolution. Perhaps 10 KHz will be bettter for you to use.
Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far) -
Mapping "Time-variant"dimension
Hi,
how can I map in AWM a dimension which has a level "time-variant"? Maybe I must add to the dimension a level which refers to key of Time Dimension?
Thanks
GiancarloGiancarlo,
Thanks for the tables and mappings. It always helps to have specific details. The next question is how do you want to report this data? I assume you want to know the total revenue by city and date. E.g.
select sum(revenue), c.city, t.month_id
from
customer_dim_table c, time_dim_table t, fact_table f
where <natural joins>
group by c.city, t.month_id
I assume you also want to know the result by customer name (which I will assume for the sake of argument is a unique identifier). E.g.
select sum(revenue), c.customer_name, t.month_id
from
customer_dim_table c, time_dim_table t, fact_table f
where <natural joins>
group by c.customer_name, t.month_id
Finally, I expect you want the same thing where the group by doesn't include month. e.g.
select sum(revenue), c.customer_name
from
customer_dim_table c, time_dim_table t, fact_table f
where <natural joins>
group by c.customer_name
Is this accurate? The answer will help determine a proper hierarchy structure for the customer dimension.
On another issue, are you only interested in the simple aggregates or do you also want calculated measures (such as year to date)? The answer to this will let me know if you could use rewrite on a cube materialized view, which simplifies matters a little.
One more question. How are you using the 'validity' column? Specifically, what happens if customer 'Patrick Jackson' remains in NY for another month. Will you add a third row (with validity = 3) or are you assuming that the system is smart enough to know that if there is no validity = 3 row, then it should look for validity = 2 (etc)? -
How to use the Time Variants PYTD and Prior Year Annual?
Hi,
We have a time dimension which has the generic columns i.e Month, Year.
We need to calculate the Time variants for the Facts Say Sales. I was able to calculate the Prior Month, Current YTD
I have some doubts regarding the other variants:
1. Prior Year : Does this include the Prior Year Annual?
2. Prior YTD: How to calculate it?
Somehow I am getting the same results for PYTD and Prior Year.
The formula used are :
Prior Year:
AGO(Sales, Year, 1)
PYTD:
AGO(Sales CYTD, Year, 1)
Has anybody encountered similar issue?I assume the Sales measure is a monthly measure. The Prior year calculation as I described will give you the sales for the same month in the previous year when selecting month in your report. When selecting year it will add up all months of the prior year until now and you will indeed see the Prior year YTD.
If you want to see the total sales for the previous year you have to use the same calculation as 'Prior year' and map it to the year level of your time dimension. This will work as a 'partition by year'. -
hi all,
i have to pic the value of BET01.....BET15 from PA0589 according to PERNR where LGA01 = '4004'.
but i m not able to find the same. can anyone please halp me?
codes:
INFOTYPES: 0589.
DATA : BEGIN OF itab OCCURS 0 ,
pernr LIKE pa0000-pernr , "Personel no.
END OF itab .
DATA: BEGIN OF wagetypes,
lga LIKE p0008-lga01,
bet LIKE p0008-bet01,
END OF wagetypes.
DATA : BEGIN OF it_itab OCCURS 0 ,
pernr LIKE pa0000-pernr , "Personel no.
lga01 LIKE pa0589-lga01,
bet01 LIKE pa0589-bet01,
begda LIKE pa0589-begda , "Lta start date
lgart LIKE pa0015-lgart, "SUBTYPE OF INFOTYPE
endda LIKE pa0015-endda , "LTA Taken Date
betrg LIKE pa0015-betrg, "LTA Amount
zuord LIKE pa0015-zuord, "Assignment number
ename LIKE pa0001-ename , "Employee name
ent_amt TYPE p DECIMALS 2,
pending TYPE p DECIMALS 2, "Pending LTA amount
END OF it_itab .
START-OF-SELECTION.
SELECT pernr INTO TABLE itab FROM pa0000 WHERE pernr IN pernr AND endda = '99991231' AND stat2 = '3'.
SORT itab BY pernr.
LOOP AT itab.
rp_provide_from_last p0589 space pn-begda pn-endda.
DO 15 TIMES VARYING wagetypes-lga
FROM p0589-lga01
NEXT p0589-lga02
VARYING wagetypes-bet
FROM p0589-bet01
NEXT p0589-bet02.
IF wagetypes-lga EQ '4004'.
CLEAR wa_itab.
MOVE p0589-pernr TO wa_itab-pernr.
MOVE p0589-begda TO wa_itab-begda.
MOVE wagetypes-lga TO wa_itab-lga01.
MOVE wagetypes-bet TO wa_itab-bet01.
APPEND wa_itab TO it_itab.
ELSE.
EXIT.
ENDIF.
ENDDO.
actually i need amount according to wage type '4004', and this wage type can maintain the value in any colom of table pa0589 as ita define as LGA01....to....LGA15 and respective amount maintained in BET01.....to.....BET15.
so please help me.
regards saurabh.
Edited by: saurabh srivastava on Jan 17, 2009 6:26 AM
Edited by: saurabh srivastava on Jan 17, 2009 6:40 AM
Edited by: saurabh srivastava on Jan 17, 2009 7:22 AMHi, Saurabh,
Following code may help you in this way here i am getting wage types 3003, 3004 and 3005.
get payroll.
clear: p0001.
rp_provide_from_last p0001 space payroll-evp-fpbeg payroll-evp-fpend.
if ( payroll-evp-srtza = 'A' ).
clear: orgeh_val .
clear: wa_wpbp.
loop at payroll-inter-wpbp into wa_wpbp ."where pernr = pernr.
orgeh_val = wa_wpbp-orgeh.
endloop.
" Test on orgeh_val to get it's ist level node and 2nd level node value
if orgeh_val in department.
objid_root_level = orgeh_val.
objid_child_level = orgeh_val.
else.
perform get_2_dept using orgeh_val changing objid_root_level objid_child_level.
objid_root_level = objid_root_level.
objid_child_level = objid_child_level.
endif.
"-------------- End of getting ist level and 2nd level node value---------------------
"----- Now get it's lgart value-------------->
loop at payroll-inter-rt into wa_rt where lgart = '3003' or lgart = '3004' or lgart = '3005'.
if sy-subrc = 0.
clear wa_it_final.
" BREAK-POINT.
wa_it_final-objid = objid_root_level.
wa_it_final-orgeh = objid_child_level.
wa_it_final-tot_emp = 1.
wa_it_final-amount = wa_rt-betrg.
collect wa_it_final into it_final.
endif.
endloop.
"BREAK-POINT.
endif.
Please Reply if any Issue,
Kind Regards,
Faisal -
Error : One of the statements DO ... VARYING ... or WHILE ... VARY ... attempted
to access data outside of the legal range. The legal range was
specified either explicitly by a RANGE addition or implicitly according
to the rules for Unicode programs.
XF123-BEDG1 : CHAR 30
XF123-BEDG2 : CHAR 30
IF123-TABL1 : TABL1(5) TYPE C
IF123-TABL2 : TABL2(5) TYPE C
DATA: BEDNG LIKE TF123-BEDG1,
TABLE LIKE IF123-TABL1.
DO 5 TIMES VARYING BEDNG FROM XF123-BEDG1 NEXT XF123-BEDG2
VARYING TABLE FROM IF123-TABL1 NEXT IF123-TABL2.Maybe you can consider using sapiconv to convert the encoding of files.
See SAP Note 752859. Thank you.
cheers,
Vincent -
Driving times vary from Maps and Google maps?
When I plot a trip I find driving times vary significantly from Maps and Google maps. I wonder what the paramieters are for attaching driving times to routes? I would hope that it were speed limits.
Basically it is average driving time. Speed limits is a factor but so is congestion, terrain, weather, construction, etc. Since Apple and Google get their data from different sources, the results are always going to be different.
-
Code taking too much time to output
Following code is taking too much time to execute . (some time giving Time_out )
ind = sy-tabix.
SELECT SINGLE * FROM mseg INTO mseg
WHERE bwart = '102' AND
lfbnr = itab-mblnr AND
ebeln = itab-ebeln AND
ebelp = itab-ebelp.
IF sy-subrc = 0.
DELETE itab INDEX ind.
CONTINUE.
Is there any other way to write this code to reduce the output time.
ThanksHi,
I think you are executing this code in a loop which is causing the problem. The rule is "Never put SELECT statements inside a loop".
Try to rewrite the code as follows:
* Outside the loop
SELECT *
from MSEG
into table lt_mseg
for all entries in itab
where bwart = '102' AND
lfbnr = itab-mblnr AND
ebeln = itab-ebeln AND
ebelp = itab-ebelp.
Then inside the loop, do a READ on the internal table
Loop at itab.
read table lt_mseg with key bwart = '102'. "plus other conditions
if sy-subrc ne 0.
delete itab. "index is automatically determined here from SY-TABIX
endif.
endloop.
I think this should optimise performance. You can check your code's performance using SE30 or ST05.
Hope this helps! Please revert if you need anything else!!
Cheers,
Shailesh.
Always provide feedback for helpful answers! -
How to show number of times as output?
i have a table books_issue_details. I would like to show as output
books table:
book_id,book_name,author_name,etc..
book_issue_details
columns book_id,issue_id,student_id,issue_date
output:
title 1 has been issued o times
title 2 has been issued 4 timesUse outer join:
with books as (
select 1 book_id,'A' book_name from dual union all
select 2,'B' from dual
book_issue_detail as (
select 2 book_id,99 student_id from dual
select 'Title ' || t1.book_name || ' has been issued ' || count(t2.book_id) || ' times.' cnt
from books t1
left join
book_issue_detail t2
on t2.book_id = t1.book_id
group by t1.book_id,
t1.book_name
CNT
Title A has been issued 0 times.
Title B has been issued 1 times.
SQL> SY.
Maybe you are looking for
-
How do I burn a CD or DVD w/photos from iPhoto
Lost my photos and spent over 2 hours w/Apple Support getting them back into my iPhoto --- but, now I want to burn them on a CD or DVD to have them as back-up (I was walked through the process w/support, but after that and many other things done -- t
-
I just put two sequences together and exported them both for the web. I noticed in the clips that one has a letterbox around it and is not in the correct aspect ratio, which should be 16:9. The other sequence that was exported is 16:9 with no letterb
-
My flash and torch isn't working on my 5c why?
When I try to put the flash on when taking a picture it will not work and also the torch isnt working on my iPhone 5c ..helpppp
-
Is it possible to add a timestamp when I'm creating new signed applet. There is a problem with the signing that after the validity period there is a warning message that the certificate is out of the date. (I never want this warning dialog, I'm signi
-
Some mail shows up in inbox...some doesn't
I am using GMAIl. I receive most new email in my inbox but some seem to just stay in the Gmail>All Mail folder. Any ideas?