LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

simulation sample spreadsheet data

Hi folks,

 

I have a question about how to implement a data reading procedure from a spreadsheet file (Excel) into the Simulation frame.  I have attached my LabVIEW program developed so far.

 

'W' is temporarily set at a constant but I need this to be from a 'Sample & Hold' function from a source data file of sampled (1 second) data.  The capture or trigger point for reading the 'W' data will be at specific points during the simulation by means of a marker within the 'W' data array.

 

I need to allow the simulation program to step through a data set from spreadsheet (Excel)
that contains the 'W' data in 1 second intervals.  At specific points in the data set the
'W' value is sampled and held, to be fed into the adaptive control algorithm as shown.

 

One problem is that if W is exactly 100 then the program locks due to
divide by zero (0) issue.

 

If anyone can suggest the way forward it would be appreciated.

 

Kind regards

Download All
0 Kudos
Message 1 of 4
(2,430 Views)

what happens if you implement a case to compare the 100 value in 'W'? if the comparison is true you could change that value to 99.999? Works or you need high precision in those calculations?

 

Regards

0 Kudos
Message 2 of 4
(2,398 Views)

Thanks, I believe the Case structure will overcome the problem with division with zero.  The main issue that I have is how to implement my data set (in Excel spreadsheet) into the Simulation frame.  I have the data list, in 1 second interval sampling, and I can easily put a marker at the point where I want to trigger the 'W' to be sampled and held for the adaptive control section.  I'm puzzled how I can implement this but the basic outline is as follows:

 

(1)  At each 1 second interval read data from the spreadsheet

(2)  If the data carries a marker (I guess that this could be in another column) then set 'W' to the data value and use in the adaptive control section.

(3)  Continue reading through the data spreadsheet until next marker is reached then update and use 'W' accordingly.

 

I have two uses for the data being read from the spreadsheet (a) I want to generate a graphical bar of the data value that is updated at each 1 second data sample value, (b) I want to use the data at the marker point to include in the 'W' adaptive control section (as described above).

 

Any ideas or pointers how to implement this would be great.

0 Kudos
Message 3 of 4
(2,379 Views)

One idea to implement this: it looks like in your application you need to follow some steps and you need to take decisions (if or else…) depending on different factors. For these cases a state machine could be helpful. So you could take into account this design pattern:

State machine

 

Regards

0 Kudos
Message 4 of 4
(2,362 Views)