Mimo ofdm simulation

hi,
I just downloaded mimo-ofdm http://users.ece.utexas.edu/~jandrews/molabview.html
Unfortunately, I am getting error that "an exception occurred within the external code called by call library function.." VI simulator.vi was stopped at node " " at a call to NI_AALBase.lvlib:Complex A x B.vi:4.
Can anyone help me with this ?
Any help is greatly appreciated.
Thanks,
Vijayant Bhatnagar

I have seen this happen when the vi cannot find the library. If it is a dll, it should be either in the system32 directory or in the same directory as the VI.
Also, this can happen if the call is of the wrong type. If you open the vi, and check the settings for how the call is made, you will see 2 possibilities. One the Functions tab you will see a selection called "Calling Convention" One is stdcall and the other is C. I suggest trying both ways if this is your code you are operating.
The last possibility is that the function is not being called properly and there is a fault internal to the called code. Sometimes, during the error stack rewind, it will make it back to labview code, but not with information that labview can handle. It then gives a generic error message. If all else fails, look for another version of the api that you are using, or make absolutly sure that the parameters you send in are appropriate for the call... for instance you would not send in a 0 for the divisor if it was a divide function.
Good luck,
CyberTazer
Software Systems Engineer

Similar Messages

  • 6x6 MIMO-OFDM System with NI USRP thread coding error

    Hi,
    I am newbie in this field. I have tried the 6x6 MIMO example and change it to 2x2 MIMO (by using combination of 4 USRP and 2 MIMO cable). However it occured an error as shown below:
    Hope you can guide me regarding this matter.
    Thank you.
    Rushidi

    Hi Sshearman,
    Example doesn't requires the external PPS, I have try it without any external PPS,and it works. The problem was in the shame, in example transmitters TX2,TX3 and TX5 are connected directly with Gb Ethernet cable with switch and PC, and for their channels (1,2 and 4), trigger parameters must be set. In the schema, there is some text string (1,2,4), who defines channels in witch trigger must be set.
    I was connected two NI USRPs 2920 on channel 0 and 1, but i didn't change txt string. After changing txt string to (0,1), everything works correctly.
    I have another question. 
    I tryed to set mimo 2x2 with alamauthi codeing like in example http://www.ni.com/white-paper/13878/en. Everythime this error pops up:
    "A stream command was ishued in the past". What can i do to solve this problem?
    Thanks
    Pixus

  • Difference between NI-USRP and UHD

    Hello
    My project goal is to develop both the driver code for a custom daughterboard and a Labview vi control panel to modify the daughterboards properties.
    I have been developing the UHD in Linux to include support for the daughterboard follwing the format of the existing Ettus boards. This all works fine in conjunction with GNU radio/GRC.
    Now that I am trying to develop a Labview application to control the board I have had to move away from Linux as there is no Labview support for the USRP in Lunix.
    I am just getting going here with Windows and am about to install the NI-USRP support package for Labview.
    I am concerned this is a dead end though. What is the NI-USRP? Is it a wrapper that allows Labview to interface with the UHD API? Or is it an alternate driver to the UHD?
    I was planning on building the UHD in windows to including the patch I have made for our daughterboard and then develop a higher level control system in Labview. In my reading thus far however, it looks as though the NI-USRP doesn't talk to the UHD, it is a self contained driver with it's own hardware support. If the UHD and NI-USRP are mutually exclusive, how am I going to build the NI-USRP from source? (assuming it is proprietary code)
    More generally I could phrase my question as: How do I develop driver support for my daughterboard such that I can use it with Labview?
    After-all, I understood one of the major purposes the USRP is sold for, is to enable daughter board development. It stands to reason then that it should be possible to use NI's development environment? 
    Any advice on what I need to install/acquire to set up a:
    Labview -> driver -> USRP -> custom daughterboard
    development environment would be greatly appreciated.  
    Alex
    Solved!
    Go to Solution.

    Thank you for your response. Perhaps, myquestion was unclear, I did not mean to ask if NI-USRP was replacing UHD in general. I was asking if NI-USRP was playing the same role for LabView that gr-UHD plays in the GnuRadio environment.
    Perhaps I should explain my application and see if you can help. I have developed some MIMO OFDM code in LabView (w/ the Modulation Toolkit and Mathscript) for USRP N210. I am trying to evaluate the performance of reconfigurable antennas in a MIMO OFDM system. The reconfigurable antennas require control signals and I would like to be able to do this from within Labview by  writing/reading to/from the Debug port of the USRP board. I have done something similar in GnuRadio by making modifications to the FPGA image and using a function from gr-UHD package called "set_user_register". Would it be possible to call this function from Labview? If not, can you provide some guidance on what other methods I may be able to use to write/read to the Debug port of the USRP board?
    Thanks,
    Simon

  • Mimo simulation in Control Design & simulation toolbox

    Hi,
    I am running is simulation with MIMO system represented as state space in control design and simulation toolkit. I see that I am not able to give vector with 2 inputs to the MIMO model. By default state space is represented by a SISO model. Can anybody guide how can one give two inputs to the state space model and run it as a MIMO system.
    Thanks and best regards,
    Amit Kalyani 

    You should be able to double click on the State-Space VI which will bring up State-Space Configuration Dialog Window. You will be able to use the drop down Polymorphic instance to selec a MIMO system. Or another way of doing this is to change the parameter source to Terminal, then wire in your MIMO model directly.
    Andy Chang
    National Instruments
    LabVIEW Control Design and Simulation

  • How to run simulations of MIMO models having direct feedthrough, using the control and simulation loop?

    say i have the MIMO model of a system in transfer function as
    4s + 4       0
    10s+1
                                    =   G(s)
    0             3s + 3
                   10s+1
    this model has direct feedthrough. how do i run simulations of to say, a 2 step inputs?
    I don't get any output signals. please, see attached VI file.
    thank you.
    Attachments:
    Q1 test.vi ‏56 KB

    Hi tomcruize79
    Thanks for using the forums!  Sorry for the delay in getting back to you - how have you been getting on with this?
    One thing to note is that you can use the Signal Generator VI to generate a function as an input.  Try this with your model and let me know how you get on.
    Regards,
    Peter D

  • PM, QPSK, QAM, OFDM software simulations and examples

    Hi everyone,
                       I am trying to find examples on Phase Modulation and other modulation examples (but currently PM modulation is the 1st priority) but i look for the tutorial in NI website they only provide Amplitude and Frequency Modulations Examples on software simulation. Anybody knows where to find or even has this modulation example can you please tell me because i really need it for my project. Thanks!

    Hi,
        actually i just trying to use examples in NI for my project as a VI exercise  to let understand the concept of each modulation. Because in NI tutorial website, there are simple software simulation exercises to let people download and know the concept of each modulation. I am trying to use these examples in my project to let people understand more in the modulation. Please see the exercise i have uploaded you will understand more. I have downloaded AM, FM, ASK, FSK and PSK but i still need others. Now, i trying to finish the catergory for analog modulation, AM, FM and PM. So i finding PM modulation now, the url u have written i seen it before but i think i cant find what i want. that's y i am also asking if anyone happen to have it or create it by yourself, would you mind 'sharing' it with me by uploading the files if you happen to have it.
    Attachments:
    [Universal Communication Training Kit] HI.vi ‏115 KB
    Universal Toolkit.PNG ‏138 KB

  • Control Design and Simulation and DAQ

    I'm learning Control Design and Simulations. I have some questions about it.
    1. For System Identification use, we can find the transfer function/model of the system by feeding data measurement from the system. But, how long data do we need to be sufficent for Identification System to estimate the model? Until the get saturated value (steady state)? or any other intervals? What if the system is unstable? How will Identification System Toolkit estimate that case?
    2. For connecting to hardware, we just connect the clock in the simulation loop to the hardware? And the simulation loop will simulate the blocks inside once it got the trigger/data from the DAQ? what about the step time and solver? Do they follow the timing from hardware? or they will run on their own supplied values/clock?if we use USB DAQ, we can't have any clock from it (as far as I know it's because USB connection is not that stable for clocking since it might be any jitters or delays.) So, how do we configure the timing parameter for USB DAQ?
    3. There is possibility to convert model in transfer function to state space, how do we know the states inside that conversion?
    Any helps would be great...
    Thanks in advance...

    Dear Chin ho,
    After going through your questions I found some documentation which will be useful for you. But I you still have more questions, you can reply me any time.
    1- About the data and amount of it I couldn't find any info but maybe you can use the new functions in LV version 2009 and find your answer.
    Estimating States of Nonlinear Stochastic State-Space Models with Extended Kalman Filters
    In previous versions of the LabVIEW Control Design and Simulation Module, you can use the Discrete Kalman Filter function and the Continuous Kalman Filter function to estimate the states of a linear discrete or linear continuous stochastic state-space model, respectively. In the LabVIEW 2009 Control Design and Simulation Module, you can use the Continuous Extended Kalman Filter function and the Discrete Extended Kalman Filter function to estimate the states of a nonlinear continuous or a nonlinear discrete stochastic state-space model, respectively.
    The Continuous Extended Kalman Filter function and the Discrete Extended Kalman Filter function estimate model states of a partially observable plant based on noisy measurements. First, use the SIM Discrete Nonlinear Plant Model template VI or the SIM Continuous Nonlinear Plant Model template VI, located in the labview\templates\Control and Simulation directory, to define the system model. Then use the the Discrete Nonlinear Noisy Plant function or the Continuous Nonlinear Noisy Plant function to simulate the discrete or continuous nonlinear model, respectively, with the addition of noise. Finally, use the Continuous Extended Kalman Filter function or the Discrete Extended Kalman Filter function to estimate the states of your model.
    The Continuous Extended Kalman Filter function and the Discrete Extended Kalman Filter function linearize the nonlinear system either by calculating a Jacobian matrix internally or by using an external Jacobian matrix that you define. Use the SIM Continuous Jacobians template VI or the SIM Discrete Jacobians template VI, located in the labview\templates\Control and Simulation directory, to define an external Jacobian matrix.
    Refer to the LabVIEW Control Design User Manual, accessible by navigating to the labview\manuals directory and opening CD_User_Manual.pdf, for more information about estimating the states of nonlinear stochastic state-space models with extended Kalman filters.
    2- I think that I found a pdf document about this part of your question which will be helpful. If you would like to give your email address, I can send it to you.
    3- About this part you can check the help function in LabVIEW when you open the "CD Convert Transfer function To State-space" function in your front panel.
    I pasted some info about the mathematic part below.
    The LabVIEW Control Design and Simulation Module provides tools to study the dynamics of systems described by linear time-invariant (LTI) continuous and discrete models. You can create deterministic state-space, transfer function, and zero-pole-gain models. You also can create stochastic state-space models and the second-order statistics noise models.  You can use these forms to describe both single-input single-output (SISO) and multiple-input multiple-output (MIMO) systems.
    Continuous transfer function and zero-pole-gain models use the s variable to define time, whereas discrete transfer function and zero-pole-gain models use the z variable to define time.  Continuous state-space models use the t variable to define time, whereas discrete state-space models use the k variable to define time. 
    Deterministic State-Space Model
    Continuous
    x(t) = Ax("t) + Bu(t)
    y(t) = Cx(t) + Du(t)
    Discrete
    x(k + 1) = Ax(k) + Bu(k)
    y(k) = Cx(k) + Du(k)
    Stochastic State-Space Model
    Continuous
    x(t) = Ax(t) + Bu(t) + Gw(t)
    y(t) = Cx(t) + Du(t) + Hw(t) + v(t)
    Discrete
    x(k + 1) = Ax(k) + Bu(k) + Gw(k)
    y(k) = Cx(k) + Du(k) + Hw(k) + v(k)
    Second-Order Statistics Noise Model
    Q = E{w . wT} – E{w} . ET{w}
    R = E{v . vT} – E{v} . ET{v}
    N = E{w . vT} – E{w} . ET{v}
    where
    t is continuous time.
    k is the model sampling time multiplied by the discrete time step, where the discrete time step equals 0, 1, 2, …
    x is the model state vector.
    u is the model input vector.
    y is the model output vector.
    w is the process noise vector.
    v is the measurement noise vector.
    A is an n × n state matrix of the given model.
    B is an n × m input matrix of the given model.
    C is an r × n output matrix of the given model.
    D is an r × m direct transmission matrix of the given model.
    n is the number of model states.
    m is the number of model inputs.
    r is the number of model outputs.
    G is a matrix relating w to the model states.
    H is a matrix relating w to the model outputs.
    Q is the auto-covariance matrix of w.
    R is the auto-covariance matrix of v.
    N is the cross-covariance matrix between w and v.
    E{} denotes the expected value or the mean of the enclosed term(s).

  • Build Waveform, SI Module Residual Analysis, System Identification MIMO

    Hi, I have a question stemming from this page, with the residual analysis model: http://zone.ni.com/reference/en-XX/help/372458D-01/lvsysidconcepts/case_study_validating/#Simulation...
    So this is for ARX, a SISO function. I want to do the same with a State Space MIMO function. I'm having some trouble with the Build Waveform, the types for the waveform doesn't match up. It appears there's another dimension to the autocorrelation/crosscorrelation, which is causing some issue. Is there a way I can do this with a MIMO so I can build the waveform?
    Thanks,
    Andrea
    Solved!
    Go to Solution.

    Hello Andrea,
    You should be able to work with the Index Array function and the MIMO Waveform configuration of the SI Model Residual Analysis VI. As seen in the snippet below, you can wire the 2D Waveform array into the Index Array function and the default output will be a 1D Waveform array.
    Then, using the Index Array function again, we are left with the waveform that existed in the zeroth row and the zeroth column of that initial 2D Waveform array. Once we have extracted out the desired waveform, we can use the Get Waveform Components function or wire the data directly to an indicator.
    When working through this exercise, you may find using the Context Help window to be very useful. With the Context Help Window (press CTRL+H), you can mouse over wires and determine their data type.
    For more information concerning array manipulation, I highly recommend looking through the examples in the NI Example Finder’s Fundamentals»Arrays and Clusters directory. You can open the NI Example Finder by navigating to Help»Find Examples....
    Cameron F
    Applications Engineer
    National Instruments

  • Running under simulator

    Hi everyone,
    Is there a code snippet to tell if the application is running in the simulator or on the actual device?
    thanks
    tony

    Yes, thank you...
    I implemented it in this way....
    NSString *device = [[UIDevice currentDevice] model];
    if ([device isEqualToString:@"iPod touch"])
    else
    thanks for the direction
    take care
    tony
    Message was edited by: alt-088

  • View salary details in a single screen in Simulation

    Hi All,
    InPayroll Simulation is there any way to view the salry details in a sigle screen , insted of going to the drop down and view
    SD

    Try to run with 'Display variant Rem. Statement' parmaneter populated .

  • Error while creating a Quotation in dp81 with simulation

    hi Guys,
    My client has a simulation for an operative project. First a quotation was created through sales pricing in dp81. its rejected. now he wants to create another quotation with simulation. when the inputs are given its gives error as " The reference has already been completely copied or rejected".  Can anyone explain why this is happening and what is the solution.

    Hi,
    This is might be due the completion rule of the item category of the inquiry.
    Check first the item category of the inquiry sales document you are using. Second go to Tcode VOV7, completion rule field of the item category you are using should be empty in order to be able to create more than one quotation from dp81.
    Regards

  • Error while simulating Pay Plan

    Hi
    I created a pay plan item and trying to simulate the pay plan.I am getting the error "Error in debit entry Simulation".  Could anyone suggest how to get around this error
    Thanks and Regards
    Varadarajan B

    Hi Varadarajan,
    At first I assume that you are talking about an FS-CD Payment Plan. Is this correct? At second I assume you are referring to the Structure "SVVSCPOS_B" (Direct Input Structure of Payment Plan Items). Is this correct as well?
    If, and only if both assumptions are right: what 'nature' does the underlaying Payment Plan Item have? I assume it isn't a One-Time Payment (means: PSNGL = ' ' blank), when you execute 'Simulate Payment Plan' for a particular Insurance Object - Business Partner - Relationship, based on at least one item, or multiple items in table "VVSCPOS" (Payment Plan Item).
    Moreover: Are all important FS-CD Posting Areas (for example see transaction "FQC0", and table "TFK033C") properly configured?
    How did you create the Payment Plan and the Payment Plan Item(s)? I strongly recommend pretending being a feeder system and utilizing the special transaction 'VKTT'. Starting with "Read Partner - Application Server partner_std.txt > Continue" you will find in the main menu "Goto" for branching to Partner, Account, Ins. Object, or Payment Plan. Thus, you should create via VKTT
    a Business Partner,
    a Contract Account (with Relationship to this Business Partner),
    an Insurance Object (with Relationship to this Business Partner) and assigned to the Contract Account, see 2.;
    Thereafter you should create 4. an appropraite Payment Plan, of course with at least 5. one Payment Plan Item. Don't forget to save all your cases ;-)
    This approach will enable and support you to retest your scenario, and to analyze errors fast and easily, when you launch Collections/Disbursements > Master Data > Insurance Object > Change (transaction "INSOCHANGE") for the Insurance Object - see 3. - and the Payment Plan/Payment Plant Item - see 4. and 5. - you created through VKTT.
    If an error message occur, you should go to the Help and analyze the provided text. The AGS xSearch could help you in finding the root cause, please see "Home | SAP Support Portal"  <Login with your S-User or C-User) > "Knowledge Base &amp;amp; Incidents | SAP Support Portal" > "Search for a Solution | SAP Support Portal".
    Does this help?
    Kind regards,
    Jochem

  • IPhone core data - fetched managed objects not being autoreleased on device (fine on simulator)

    I'm currently struggling with a core data issue with my app that defies (my) logic. I'm sure I'm doing something wrong but can't see what. I am doing a basic executeFetchRequest on my core data entity, but the array of managed objects returned never seems to be released ONLY when I run it on the iPhone, under the simulator it works exactly as expected. This is despite using an NSAutoreleasePool to ensure the memory footprint is minimised. I have also checked with Instruments and there are no leaks, just ever increasing allocations of memory (by '[NSManagedObject(_PFDynamicAccessorsAndPropertySupport) allocWithEntity:]'). In my actual app this eventually leads to a didReceiveMemoryWarning call. I have produced a minimal program that reproduces the problem below. I have tried various things such as faulting all the objects before draining the pool, but with no joy. If I provide an NSError pointer to the fetch no error is returned. There are no background threads running.
    +(natural_t) get_free_memory {
        mach_port_t host_port;
        mach_msg_type_number_t host_size;
        vm_size_t pagesize;
        host_port = mach_host_self();
        host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t);
        host_page_size(host_port, &pagesize);
        vm_statistics_data_t vm_stat;
        if (host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size) != KERN_SUCCESS) {
            NSLog(@"Failed to fetch vm statistics");
            return 0;
        /* Stats in bytes */
        natural_t mem_free = vm_stat.free_count * pagesize;
        return mem_free;
    - (void)viewDidLoad
        [super viewDidLoad];
        // Set up the edit and add buttons.
        self.navigationItem.leftBarButtonItem = self.editButtonItem;
        UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(insertNewObject)];
        self.navigationItem.rightBarButtonItem = addButton;
        [addButton release];
        // Obtain the Managed Object Context
        NSManagedObjectContext *context = [(id)[[UIApplication sharedApplication] delegate] managedObjectContext];
        // Check the free memory before we start
        NSLog(@"INITIAL FREEMEM: %d", [RootViewController get_free_memory]);
        // Loop around a few times
        for(int i=0; i<20; i++) {
            // Create an autorelease pool just for this loop
            NSAutoreleasePool *looppool = [[NSAutoreleasePool alloc] init];
            // Check the free memory each time around the loop
            NSLog(@"FREEMEM: %d", [RootViewController get_free_memory]);
            // Create a minimal request
            NSEntityDescription *entityDescription = [NSEntityDescription                                                 
                                                  entityForName:@"TestEntity" inManagedObjectContext:context];
            // 'request' released after fetch to minimise use of autorelease pool       
            NSFetchRequest *request = [[NSFetchRequest alloc] init];
            [request setEntity:entityDescription];
            // Perform the fetch
            NSArray *array = [context executeFetchRequest:request error:nil];       
            [request release];
            // Drain the pool - should release the fetched managed objects?
            [looppool drain];
        // Check the free menory at the end
        NSLog(@"FINAL FREEMEM: %d", [RootViewController get_free_memory]);
    When I run the above on the simulator I get the following output (which looks reasonable to me):
    2011-06-06 09:50:28.123 renniksoft[937:207] INITIAL FREEMEM: 14782464
    2011-06-06 09:50:28.128 renniksoft[937:207] FREEMEM: 14807040
    2011-06-06 09:50:28.135 renniksoft[937:207] FREEMEM: 14831616
    2011-06-06 09:50:28.139 renniksoft[937:207] FREEMEM: 14852096
    2011-06-06 09:50:28.142 renniksoft[937:207] FREEMEM: 14872576
    2011-06-06 09:50:28.146 renniksoft[937:207] FREEMEM: 14897152
    2011-06-06 09:50:28.149 renniksoft[937:207] FREEMEM: 14917632
    2011-06-06 09:50:28.153 renniksoft[937:207] FREEMEM: 14938112
    2011-06-06 09:50:28.158 renniksoft[937:207] FREEMEM: 14962688
    2011-06-06 09:50:28.161 renniksoft[937:207] FREEMEM: 14983168
    2011-06-06 09:50:28.165 renniksoft[937:207] FREEMEM: 14741504
    2011-06-06 09:50:28.168 renniksoft[937:207] FREEMEM: 14770176
    2011-06-06 09:50:28.174 renniksoft[937:207] FREEMEM: 14790656
    2011-06-06 09:50:28.177 renniksoft[937:207] FREEMEM: 14811136
    2011-06-06 09:50:28.182 renniksoft[937:207] FREEMEM: 14831616
    2011-06-06 09:50:28.186 renniksoft[937:207] FREEMEM: 14589952
    2011-06-06 09:50:28.189 renniksoft[937:207] FREEMEM: 14610432
    2011-06-06 09:50:28.192 renniksoft[937:207] FREEMEM: 14630912
    2011-06-06 09:50:28.194 renniksoft[937:207] FREEMEM: 14651392
    2011-06-06 09:50:28.197 renniksoft[937:207] FREEMEM: 14671872
    2011-06-06 09:50:28.200 renniksoft[937:207] FREEMEM: 14692352
    2011-06-06 09:50:28.203 renniksoft[937:207] FINAL FREEMEM: 14716928
    However, when I run it on an actual iPhone 4 (4.3.3) I get the following result:
    2011-06-06 09:55:54.341 renniksoft[4727:707] INITIAL FREEMEM: 267927552
    2011-06-06 09:55:54.348 renniksoft[4727:707] FREEMEM: 267952128
    2011-06-06 09:55:54.702 renniksoft[4727:707] FREEMEM: 265818112
    2011-06-06 09:55:55.214 renniksoft[4727:707] FREEMEM: 265355264
    2011-06-06 09:55:55.714 renniksoft[4727:707] FREEMEM: 264892416
    2011-06-06 09:55:56.215 renniksoft[4727:707] FREEMEM: 264441856
    2011-06-06 09:55:56.713 renniksoft[4727:707] FREEMEM: 263979008
    2011-06-06 09:55:57.226 renniksoft[4727:707] FREEMEM: 264089600
    2011-06-06 09:55:57.721 renniksoft[4727:707] FREEMEM: 263630848
    2011-06-06 09:55:58.226 renniksoft[4727:707] FREEMEM: 263168000
    2011-06-06 09:55:58.726 renniksoft[4727:707] FREEMEM: 262705152
    2011-06-06 09:55:59.242 renniksoft[4727:707] FREEMEM: 262852608
    2011-06-06 09:55:59.737 renniksoft[4727:707] FREEMEM: 262389760
    2011-06-06 09:56:00.243 renniksoft[4727:707] FREEMEM: 261931008
    2011-06-06 09:56:00.751 renniksoft[4727:707] FREEMEM: 261992448
    2011-06-06 09:56:01.280 renniksoft[4727:707] FREEMEM: 261574656
    2011-06-06 09:56:01.774 renniksoft[4727:707] FREEMEM: 261148672
    2011-06-06 09:56:02.290 renniksoft[4727:707] FREEMEM: 260755456
    2011-06-06 09:56:02.820 renniksoft[4727:707] FREEMEM: 260837376
    2011-06-06 09:56:03.334 renniksoft[4727:707] FREEMEM: 260395008
    2011-06-06 09:56:03.825 renniksoft[4727:707] FREEMEM: 259932160
    2011-06-06 09:56:04.346 renniksoft[4727:707] FINAL FREEMEM: 259555328
    The amount of free memory reduces each time round the loop in proportion to the managed objects I fetch e.g. if I fetch twice as many objects then the free memory reduces twice as quickly - so I'm pretty confident it is the managed objects that are not being released. Note that the entities that are being fetched are very basic, just two attributes, a string and a 16 bit integer. There are 1000 of them being fetched in the examples above. The code I used to generate them is as follows:
    // Create test entities
    for(int i=0; i<1000; i++) {
        id entity = [NSEntityDescription insertNewObjectForEntityForName:@"TestEntity" inManagedObjectContext:context];
        [entity setValue:[NSString stringWithFormat:@"%d",i] forKey:@"name"];
        [entity setValue:[NSNumber numberWithInt:i] forKey:@"value"];
    if (![context save:nil]) {
        NSLog(@"Couldn't save");
    If anyone can explain to me what is going on I'd be very grateful! This issue is the only only one holding up the release of my app. It works beautifully on the simulator!!
    Please let me know if there's any more info I can supply.

    Update: I modified the above code so that the fetch (and looppool etc.) take place when a timer fires. This means that the fetches aren't blocked in viewDidLoad.
    The result of this is that the issue happens exactly as before, but the applicationDidReceiveMemoryWarning is fired as expected:
    2011-06-08 09:54:21.024 renniksoft[5993:707] FREEMEM: 6131712
    2011-06-08 09:54:22.922 renniksoft[5993:707] Received memory warning. Level=2
    2011-06-08 09:54:22.926 renniksoft[5993:707] applicationDidReceiveMemoryWarning
    2011-06-08 09:54:22.929 renniksoft[5993:707] FREEMEM: 5615616
    2011-06-08 09:54:22.932 renniksoft[5993:707] didReceiveMemoryWarning
    2011-06-08 09:54:22.935 renniksoft[5993:707] FREEMEM: 5656576

  • Função para cálculo de impostos( Simulação de Geração de NF).

    Boa noite pessoal !
    Alguém conhece alguma função no SAP que posso utilizar para efetuar cálculo de impostos ???
    Trata-se de um programa customizado (Z) e preciso fazer o cálculo de todos impostos, seria como uma simulação de Geração de NF (J1B1N) .
    Agradeço desde já.
    Wagner Duarte

    Bom dia Wagner,
    Você pode utilizar a FM  J_1B_NF_VALUE_DETERMINATION:
    Exemplo:
    DATA: BEGIN OF wk_header.
               INCLUDE STRUCTURE j_1bnfdoc.
       DATA: END OF wk_header.
       DATA: BEGIN OF wk_header_add.
               INCLUDE STRUCTURE j_1bindoc.
       DATA: END OF wk_header_add.
       DATA: BEGIN OF wk_partner OCCURS 0.
               INCLUDE STRUCTURE j_1bnfnad.
       DATA: END OF wk_partner.
       DATA: BEGIN OF wk_item OCCURS 0.
               INCLUDE STRUCTURE j_1bnflin.
       DATA: END OF wk_item.
       DATA: BEGIN OF wk_item_tax OCCURS 0.
               INCLUDE STRUCTURE j_1bnfstx.
       DATA: END OF wk_item_tax.
       DATA: BEGIN OF wk_item_add OCCURS 0.
               INCLUDE STRUCTURE j_1binlin.
       DATA: END OF wk_item_add.
       DATA: BEGIN OF wk_header_msg OCCURS 0.
               INCLUDE STRUCTURE j_1bnfftx.
       DATA: END OF wk_header_msg.
       DATA: BEGIN OF wk_refer_msg OCCURS 0.
               INCLUDE STRUCTURE j_1bnfref.
       DATA: END OF wk_refer_msg.
       CALL FUNCTION 'J_1B_NF_DOCUMENT_READ'
         EXPORTING
           doc_number         = i_docnum
         IMPORTING
           doc_header         = wk_header
         TABLES
           doc_partner        = wk_partner
           doc_item           = wk_item
           doc_item_tax       = wk_item_tax
           doc_header_msg     = wk_header_msg
           doc_refer_msg      = wk_refer_msg
         EXCEPTIONS
           document_not_found = 1
           docum_lock         = 2
           OTHERS             = 3.
       CALL FUNCTION 'J_1B_NF_VALUE_DETERMINATION'
         EXPORTING
           nf_header   = wk_header
         IMPORTING
           ext_header  = wk_header_add
         TABLES
           nf_item     = wk_item
           nf_item_tax = wk_item_tax.

  • Unable to connect offcard terminal with jcop simulator

    Hi all,
    I have made a JavaCard applet, called DisplayApplet.
    I am using Eclipse with the JCOP tools plugin.
    But now I want to make use of an own Terminal that connects to the applet and communicates to it using APDUs.
    I don't have a smart card reader/card, so I want to use the simulation environment.
    Now I read that I must use the "Remote" value in the JCTerminal constructor to connect to the simulation environment, but it doesn't work (of course I specify the remote value as input parameter).
    I am unable to open a terminal.
    I get the following exception at the term.open() command:
    can't find/open/connect/reset smartcard/reader:
    Failed to open [localhost:8050]: Connection refused: connect
    Can anyone tell me what's wrong and how I can connect from an own made terminal to a JCOP simulation (I want to run the terminal within Eclipse, because I want to add a UI later on top of it) ??
    Here is the code of my own made HostTerminal:
    import com.ibm.jc.*;
    public class HostTerminal {
         public static final String remoteTermName = "Remote";
         public static final String nativeTermName = "pcsc:4";
         public static final String remoteTermPara = null;
         public static final String nativeTermPara = null;
         public static void main(String[] args) {
              String termName = nativeTermName;
              String termPara = nativeTermPara;
              if (args.length > 0) {
                                   if (!args[0].equals("native")) {
                        if (args[0].equals("remote")) {
                             termName = remoteTermName;
                             termPara = remoteTermPara;
                        } else {
                             try {
                                  System.out.println("args[0] > " + args[0]);
                                  System.out.println("args[1] > " + args[1]);
                                  termName = args[0];
                                  termPara = args[1];
                             } catch (Exception e) {
                                  System.out.println("invalid command line options");
                                  System.exit(1);
              // create terminal, i.e. create a connection to a reader
              // and wait for a card insertion
              JCTerminal term = null;
              try {
                   term = JCTerminal.getInstance("Remote", null);
                   term.open();
                   term.waitForCard(5000);
              } catch (Exception e) {
                   System.out.println(
                        "can't find/open/connect/reset smartcard/reader: "
                             + e.getMessage());
                   System.exit(1);
              System.out.println("Connected to reader and card terminal ...");
              // now get the object representing the connection to the card
              JCard card = null;
              try {
                   card = new JCard(term, null, 1000);
              } catch (Exception e) {
                   System.out.println(
                        "can't connect to card in reader: " + e.getMessage());
                   System.exit(1);
              String s;
              // get atr of card and print it
              try {
                   ATR atr = card.getATR();
                   s = JCInfo.atrToString(atr);
                   System.out.println("Connected to card and received ATR: " + s);
              } catch (Exception e) {
                   System.out.println("can't get ATR: " + e.getMessage());
                   System.exit(1);
              // Note here that the DisplayApplet has to have to aid "display". The IDE
              // supports ascii characters in AIDs by using | when editing AIDs.
              // For instance, |display results in 636F756E746572.
              System.out.println("Selecting Display applet ...");
              DisplayApplet displayApplet = null;
              try {
                   byte[] aid = ("phil0Display").getBytes();
                   displayApplet = new DisplayApplet(card, aid);
                   displayApplet.select();
                   s = JCInfo.toHex(aid, 0, aid.length);
                   System.out.println(
                        "Selecting of Display applet with aid " + s + " succeeded");
              } catch (Exception e) {
                   System.out.println("can't select Display: " + e.getMessage());
                   System.exit(1);
              }

    If you run the JavaCard simulator from within Eclipse make sure you disconnect the JCOP shell before trying to connect via JCTerminal() from your Java program. Use the command /close
    If you want to disconnect the JCOP shell automatically modify your "Java Card Application" run-configuration:
    set Shell commands to execute: to /close
    BTW: You were talking about JCOP 3.0, the Eclipse 2.1-plugin or do you use the new pre-release version JCOP 3.1 for Eclipse 3?

Maybe you are looking for