Implemenying Global constants through out a project or module in LABVIEW

I am looking for the best method for implementing global constants in a project, the method I use now is to make a vi which returns a single indicator value that has been wired to a constant.  This works nicely but it seems like a lot of unnecessary overhead.  I was hoping for a way of performing something similar to a header file (*.h) in c which uses a #define preprocessed directive.  This has no overhead since it replaces the named constant with the global constant value.  A typedef is similar to this but it has the problem that the constant appears as a constant and does not allow for a custom icon to be associated with it.  I guess the ideal situation would be if typedefs allowed for custom icons on the block diagrams for constant instances.  Is this possible?  It would make coding much more readable.  A header file could be simulated with a library of typedefs (scripting might even allow a .h file to be auto-generated)  Any ideas on this.  Other solutions. 
Paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA

I look forward to the new LV8 features, I hope to begin the migration process this winter when work slows down a little.  The only advantage to a preprocessed directive is that is will replace the code before processing (like cutting and pasting the value in place of the constant, with no function call overhead.  This could only be a problem with CPU intensive code.  See the following "toy" example.
//haven't been programming in c lately so don't jump on my syntax.
#define PI 3.14
void calculateManyCircleAreas()
float area = 0.0;
for (r=0;r<10000000;r++){area = (PI*r*r);
void calculateManyCircleAreas2()
float area = 0.0;
for (r=0;r<10000000;r++){area = (getPI()*r*r);}
float getPI(){return 3.14;}
the first example simply replaces the named constant with a value, while the second example uses a function call, requiring pushing the return value on the stack along with an Instruction pointer, and 2 required jumps in program flow.  Your solution is none the less the best I have seen and what I am using.  Labview used to have the same problem with commenting (ie placing code in a case statement and hardwiring it to a false Boolean) where the code was not removed by the complier but simply not executed (not quite the same thing) but this too looks to be fixed in LV8.
Thanks,
Paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA

Similar Messages

  • Best Practice for Global Constants in IRPT files?

    Hi,
    For Global constants that need to be accessed inside IRPT files and would only change as the code migrates from Dev->Test-> Production, what is the preferred method of storing and accessing these constants in a reusable way so that we donu2019t have to change the code of individual irpt files.  Additionally, this should not be stored in a code file, as the QA team is uncomfortable with changing code files as we migrate through environments. 
    It seems like just using a constant only .js file would work, but are there other methods and what is the preferred way of configuring global constants/variables?
    Thanks for the help.
    Kerby

    Hi Kerby,
    I was planning on putting all the config values in the database.  Then there is no changing of files that are inside the deployment package.
    Another idea, particularly if this is not a database app:
    What I did for a Portal dynpro app was have multiple properties files named with the host name.
    myDevHostName.properties and myQAHostName.properties and myProdHostName.properties. 
    They all got deployed with the app.  The code used the host name to open the appropriate file.
    Probably need a custom action block though because I only saw the IP address in the attribute
    list and not the server name.  And not so good when system names change...
    http://<servername>:<portnumber>/XMII/PropertyAccessServlet?mode=List&Content-Type=text/html
    --Amy Smith
    --Haworth

  • My apple ID and password, recognized through out the Cloud, is not being recognized in the itunes store. I am signed into itunes.When I want to change something in my account, the sign in prompt comes up and doesn't recognize my PW

    My apple ID and password, recognized through out the Cloud, is not being recognized in the itunes store. I am signed into itunes.When I want to change something in my account, the sign in prompt comes up and doesn't recognize my PW

    Solved the problem. I had to allow cookies for safari and it run - as here: Re: itunes keeps asking for my apple id password. it's NOT entered incorrectly.

  • Why can't I check out a project?

    I've got TFS 2013 Express installed on my desktop PC (an older HP Pavilion Elite desktop running Windows 8.1 Pro). Sometimes when I get into Visual Studio 2013, open up a solution and try to check out a project within the solution, with less than 100 files
    in it, TFS never finishes checking out the project/files.
    Why is that? What's going on and what can I do about it?
    Rod

    Hi Rod,
    It would be better to let us know the detailed scenario and reproduce steps. When you work with TFS, you can edit your source code by Visual Studio after connecting to the team project in TFS. And you can change the source files in source control explorer
    and it will be checked out automatically. 
    You can create a new workspace and then do a workspace mapping to get the source files to a new local path. And then try with the new workspace. If the issue persists, please elaborate more details with screenshots.
    Best regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • I like and use Top Sites but it has become unsuable with this constant blacking out and reloading the thumbnails.  My MBP has not seen a problem at all.   I have been searching every other day for over a month trying to find a fix in Windows Safari with n

    I like and use Top Sites but it has become unsuable with this constant blacking out and reloading the thumbnails.  My MBP has not seen a problem at all.
    I have been searching every other day for over a month trying to find a fix in Windows Safari with no joy.  I want to resolve, not switch browsers. Please offer up a solution that only refreshes the Top Site thumbnails once a day or as some controlable interval.  Started about two versions ago, now on ver 5.1.5. Windows 7 64bit.
    Safari 5.1.5 for Win64 bit, Windows 7!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    I think I solved the wifi connection problem, just by switching off completely the router! sounds trivial, but in this case it worked!!!
    the funny behaviour of the trackpad/cursor still persists. any suggestion???
    thanks again

  • Global attributes in a template project

    Hello folks,
    We are setting up a demo of global template functionalites in SM. In the template project we have created we need advice on how to go about with the following.
    1) What do the attributes - global, local, harmonized etc.mean from a businesss perspective. The help documentation provided by SAP is not clear enough. Can someone share their practical expericence regarding this.
    2) In the project structure created - on what criteria should the project/business team set the appropriate global attribute.
    3) What is the effect of setting up of this global attributes - should any implementation projects created in the future has to refer the master template proj.
    Probably I am asking quite a lot but the questions seem to be related .
    Thank you.
    ^
    Mark

    Hi Mark,
    First of all, it is advised to use this functionality only if you foresee a case of 'active' rollout based projects leveraging these templates. If, a Template Project is created merely to hold an inventory of process definitions, with future usage only as a 'possibility', you need not activate the 'Global Rollout' functionality and attend to the decision making on it at a much later date, when necessity arises. This is not something mandatory to take up right upfront, unless there is a case for it.
    1) In terms of practical use in project, I have rarely come across projects which have sought to use the whole range of these attributes; I have been using SolMan since May 2004 and since those days, the usual ones I have had a need to use are at extreme ends of the spectrum - Global or Initial. All those in between vary in their nuances and normally not as much missed ! In early days (SolMan 3.1, there weren't as many varieties).
    With regard to the specific ways in which these vary,
    [this link|http://help.sap.com/saphelp_sm40/helpdata/en/45/5af1f3e5f81dece10000000a155369/content.htm] in SAP Online help is the best source to find how these attributes impact. Of course, you may have already seen this.
    2) The Project Team should have one main consideration - whether to control the structure and content of a delivered scenario centrally or to allow some changes at local rollout level. Accordingly, set the attribute and pass on the same attributes to all layers below that node in one stroke (if the attribute is to remain the same for all contents underneath)
    3) The effect is in 'changeability' or the flexibility to adapt the scenario borrowed from Template to suit local rollout/implementation needs.  For instance, if the Global Template team has spent thousands of man hours in coming up with a Finance scenario that's Sarbanes-Oxley compliance or GRC proofed, with all local requirements already fed into the Template, it makes sense to define the Scenario or Process as 'Global' and expect all rollouts to make use of it exactly the same way.
    If, on the other hand, there is a CRM/ SCM scenario on optimising Order fulfilment, an Asia-Pacific plant rollout may considerably differ in process steps from North American and such scenarios/ processes can be Initial or Local
    Trust this helps.
    Regards,
    Srini

  • When I try to register my apple tv, I can't do it, because they ask me for a MPN number that I don't have, because I through out the package. What can I do without having the MPN number?

    I bought my Apple TV in Singapore and I haven’t used it yet. When I try to rent a film, comes the message that may signature is not working for security issues.
    However, when I go to the Apple Web site, click "Support", and then "Register an Apple Product", I can´t do it, because they ask me for a MPN number that I don’t have, because I through out the package. What can I do without having the MPN number?
    Thanks!

    Call Apple Care for your country and ask for help resetting the questions.

  • How to reuse constant mapping in a project?

    Hi,
    I have a issue here.
    I have few constant values such as load_date (sysdate), load_by and few other columns. Currently i'm recreating this constant values in each mappings.
    How do I create a global constant which can be used as plug and map to my target table???
    Please help me.
    Regards
    Raj

    I don't think you can directly create a global constant collection.
    But, what you would suggest is that you create one empty mapping that contains only the constants and perhaps any other configurations you always use (e.g. max number of errors, analyze percentage etc). Every time you create a new mapping, you copy this " empty template" and use it as your new mapping. That way you already have your constants plus any other items all your mappings should contain (in my case I have pre-mappings and post-mappings that all mappings should contain).
    Hope this helps,
    Borkur

  • How to define a global constant in OWB

    Hi,
    How can i define a global constant in a module, which can be used in all my mappings?
    ~Prabha

    I have the following approach.
    You can declare public constants within a package specification.
    Then, import this package spec into OWB repository.

  • How to organize the context object through out the application process

    Hi,
    Here in my application is using the following steps for a process.
    - Login
    - Search
    - Update
    - Logout
    In those above steps, Login, Search, and Update actions are touching to database/LDAP every time. In each time, Im creating new Context object, I think this is a bad approach. When I hit the login, I need to get the connection object and use that for rest of the actions(search and update).
    So can we organize the single context object through out the application? And where do we need to close the Context object?

    Don't worry about it. The provider will reuse connections behind the scenes. They're not tied directly to Contexts.

  • Global error page for portal project

    Hi
    This is regarding weblogic 8.1.
    We have a portal project which contains several portlets. For handling exceptions
    in a page flow we have a global error page at the project root level and each
    portlet redirects to this error page /error.jsp in case of any errors.
    When the user is redirected to this error page the page is displayed in the portlet
    context. How can we make this error page to take up the whole screen and display
    it outside of the portlet context so that all other links within the portal (books
    and pages) are not displayed to the user.
    In all cases, the redirection to the error page occurs from a page flow.
    Thanks in advance,
    Sameer

    Sameer,
    Please post this question to the weblogic.developer.interest.portal
    newsgroup.
    Thanks
    Raj Alagumalai
    WebLogic Workshop Support
    "Sameer Dalal" <[email protected]> wrote in message
    news:3f4bd37f$[email protected]..
    >
    Hi
    This is regarding weblogic 8.1.
    We have a portal project which contains several portlets. For handlingexceptions
    in a page flow we have a global error page at the project root level andeach
    portlet redirects to this error page /error.jsp in case of any errors.
    When the user is redirected to this error page the page is displayed inthe portlet
    context. How can we make this error page to take up the whole screen anddisplay
    it outside of the portlet context so that all other links within theportal (books
    and pages) are not displayed to the user.
    In all cases, the redirection to the error page occurs from a page flow.
    Thanks in advance,
    Sameer

  • CC 2014 trial. MPEG MOVIE clips flickering on my time line! after render, and after export. tried all kinds of sequence settings,taking out transitions and effects ,even the audio tracks.....still flickering. They play fine outa the project files!?  HELLL

    CC 2014 trial. MPEG MOVIE clips flickering on my time line! after render, and after export. tried all kinds of sequence settings,taking out transitions and effects ,even the audio tracks.....still flickering. They play fine outa the project files!?  HELLLLLPPPPP!!!!

    We can not see your computer, your settings or even know what your source files are because we are not in the same room as you are!
    We cant see what you are doing wrong ...so you will have to tell us a lot more and show us some screen grabs of your settings.

  • I am trying to add, through an amplification project, the field counts alte

    hello dear, 
    I have a countable document with several positions with classes of costs, which have imputation object the order co. 
    I am trying to add, through an amplification project, the field counts alternative to transaction KSB1. 
    the problem that I have in the routine, is that, he/she repeats the last bill alternative to all the positions of the cost classes. 
    the routine is the following one: 
    clear CS_RECORD-ZZ_LOKKT. 
    select * from bseg where bukrs eq ld_documents-bukrs 
                             and belnr eq ld_documents-docnr 
                             and gjahr eq ld_documents-ac_gjahr. 
            if not bseg-kostl is initial. 
               CS_RECORD-ZZ_LOKKT = BSEG-LOKKT. 
            endif. 
    endselect. 
    example of the result that it shows me:                                                                               
    It counts Alternative 
    30101001 COMMISSION SUB-AGENCY 113,64       6220000 
    30202001 SALARIES                             142,05       6220000 
    grateful of their help, 
    greetings 
    jorge silva

    Make the back of the car a 3D layer. Add a camera. Animate the camera so the motiion looks right.
    Another option, track something in the frame that is in the same plane as the back of the car. Track scale. Apply the tracked scale information to the back of the car layer.
    A better way to get better suggestions. Post a screenshot of the video or better yet, upload the video to You-tube and let us see what you are trying to do.

  • Global.MPT is Read Only (Project Pro 2013)

    Hello,
    After a crash of Win 7, the Global.MPT file of my Project 2013 is left read only.
    How can I set it back to read/write?
    Thanks

    Dale,
    You are right: after the computer reboot, the Global.mpt file went back to Read/Write mode!
    Thanks 

  • Global Constants / Variable in OSB

    I want to define global Constants / Variable in OSB and I want to access them in XSLT when I am tranforming the requests...
    Any idea how can I do that?
    I want to use these variables and constants for server name and ports (in different environment) and some other stuff.

    We have done a similar implementation for the same scenario. We have created a Xquery where we put in the configuration information as an XML and then in the pipeline stages we use the Assign the Xquery to a a temporary variable and then use the values of the xml using relative xpath expressions.
    This way any time we need to make any changes to the confguration we know once place we can change and it gets reflected in the complete code base.
    Below is how we have done it:
    - create a Xquery with xml configurations (say commonconfig.xq)
    - then using the Assign action get the output of this xquery into a temp var (say commonConfig)
    - then use the configurable values using the relative xpath in the Assign action (say Assign $commonConfig/param1/text() to param1Value
    Let me know if you need further information.
    Thanks,
    Patrick

Maybe you are looking for