03-12-2015 12:10 PM
Dear all,
I am on the verge of creating a fuzzy random coefficeint (FRC) for an adaptive controller in LabVIEW. The original design is made in MATLAB/SIMULINK and I am trying to translate functions in LabVIEW for my own design.
The MATLAB function is then called in Simulink and outputs results. What I am stuck with is how PERSISTENT is maintained in LabVIEW. Consider following script:
e=[0.2 0.3];
current_error=e(1);
simulation_time=e(2);
persistent count;
persistent previous_error;
if isempty(count)
count=0;
end
if isempty(previous_error)
previous_error=0;
end
count=count+1;
control_activity=(current_error+previous_error)/count;
previous_error=current_error+previous_error;
The above script keeps the values of persistent variables (count,previous_error) intact whenever this function is called in Simulink. But in LabVIEW how it is done?
I will probably call the same function made in LabVIEW in some main loop. Am I supposed to use shift registers to pass values between iterations?
Will it serve the purpose of variable persistency?
There is a same post of same problem in this forum but the guy over there wants to keep values intact when the VI is run. I, on the ther hand, want to keep my values in a jar whenever my function is called in a loop.
HELP!!
Regards.
Solved! Go to Solution.
03-12-2015 12:22 PM
@NapDynamite wrote:
The above script keeps the values of persistent variables (count,previous_error) intact whenever this function is called in Simulink. But in LabVIEW how it is done?
I will probably call the same function made in LabVIEW in some main loop. Am I supposed to use shift registers to pass values between iterations?Will it serve the purpose of variable persistency?
Yes, use shift registers