キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

Script for creating cases for Case Structure

解決済み
解決策を見る

Hello,

I need some help. I am creating a battery emulator that consists of 3 power supplies controlled through LabVIEW. Each supply represents one cell, and its output voltage is set according to the emulated battery capacity. The capacity is calculated in LabVIEW from current and simulation time.

The capacity–voltage data are taken from the datasheet. I export them with a web tool into a text file, which contains pairs of capacity and corresponding voltage values (see Picture 3). At the moment, I manually rewrite these values into a Case Structure, as shown in Picture 1 and Picture 2.

My question is: Is there an easier way to create this case structure than rewriting all cases by hand? For example, can the Case Structure be generated automatically from a file, or is there a better LabVIEW approach for this task? Just to keep 2-digit precision, I need to write around 120 separate cases (4.20 V - 3.00 V).I would also like to emulate curves for different discharge currents, which would multiply the number of cases even more.

 

Thanks a lot in advance for any advice.

 

Picture 1 and 2: Case structure with capacity ranges and corresponding voltages

Picture 3: Example of exported text file with capacity–voltage pairs

Picture 4: VI graphical interface

 

Best regards AlgrunNos

すべてをダウンロード
0 件の賞賛
メッセージ1/10
1,318件の閲覧回数
解決策
受理者 AlgrunNos

Hi Algrun,

 


@AlgrunNos wrote:

My question is: Is there an easier way to create this case structure than rewriting all cases by hand?


Sure!!!

Why do you insist on using a case structure at all?

Why not use the Interpolate1DArray function on an array of points???

 

Suggestions:

You can implement either interpolating or "stepped" output behaviour!

(You need to implement some more error checking, like using InRangeAndCoerce to handle invalid inputs…)

 

Why don't you attach real data? Do you know we cannot debug/edit/run images with LabVIEW?

Why do you make it so hard to help you by attaching just some images?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
メッセージ2/10
1,306件の閲覧回数

Don't use case structures (which are excessively deep).

Just make a lookup table that gets filled in with info from the datasheet.

メッセージ3/10
1,209件の閲覧回数
解決策
受理者 AlgrunNos

@GerdW wrote:

 


Suggestions:

 


You can use Interpolate array on an array of clusters? 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 件の賞賛
メッセージ4/10
1,194件の閲覧回数

Hi Yamaeda,

 


@Yamaeda wrote:

@GerdW wrote:

 


You can use Interpolate array on an array of clusters? 


It is an array of points!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 件の賞賛
メッセージ5/10
1,189件の閲覧回数

@Yamaeda wrote:
You can use Interpolate array on an array of clusters? 

Yes, "index&bundle" creates an array of points. Very useful! Without that, we need quite a bit more code for the same functionality.

(Of course the points need to be sorted in X.)

 

altenbach_0-1756305805214.png

 

0 件の賞賛
メッセージ6/10
1,153件の閲覧回数

@altenbach wrote:
Without that, we need quite a bit more code for the same functionality.

Well, it is just a little bit more code and I am never quite sure what's more efficient 😄

 

altenbach_0-1756307352554.png

 

メッセージ7/10
1,148件の閲覧回数

Thank you very much for your help. I’m sorry, I didn’t mean to make it difficult to read. The original VI is quite complicated, and I just wanted to extract the part with the problem. Next time, I’ll try to make a separate VI focusing only on the issue. That would probably be better.

0 件の賞賛
メッセージ8/10
1,064件の閲覧回数

@altenbach wrote:

@Yamaeda wrote:
You can use Interpolate array on an array of clusters? 

Yes, "index&bundle" creates an array of points. Very useful! Without that, we need quite a bit more code for the same functionality.

(Of course the points need to be sorted in X.)

 

altenbach_0-1756305805214.png

 


I read the sentence but somehow didn't realize it. It would be nice if they showed it in the picture and/or had a linked example ...

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
メッセージ9/10
1,008件の閲覧回数

@Yamaeda wrote:


I read the sentence but somehow didn't realize it. It would be nice if they showed it in the picture and/or had a linked example ...


back to the roots and writing demos 😉

0 件の賞賛
メッセージ10/10
780件の閲覧回数