BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Rube Goldberg Code

I love how we are having a conversation about who's producing a more efficient Rube. The irony.

Certified-LabVIEW-Architect_rgb.jpgCertified_TestStand_Architect_rgb.jpg


"I won't be wronged. I won't be insulted. I won't be laid a-hand on. I don't do these things to other people, and I require the same from them." John Bernard Books

Message 1961 of 2,571
(11,136 Views)

It's good to be self aware, and not take yourself too seriously.  Those are the people that are usually the ones most open to seeing things a different way, or changing for the better.  That being said if you post some of my code as a Rube my knee jerk reaction will be to defend it.

Message 1962 of 2,571
(11,127 Views)

Interesting implementation of a Producer/consumer. Lets use a string as a command, but transmit the data as a local variable! 😄

Seen here: https://www.laserquantum.com/download-ds.cfm?id=885

Well, you can even buy the software: https://www.laserquantum.com/products/detail.cfm?id=60

(well, I hope the driver was made by an intern, and the sold product got cleaned up...or not... 🙂 )

 

Example PSU Control_BD.png

0 Kudos
Message 1963 of 2,571
(11,060 Views)

Per a suggestion, this piece of thread on improvements of code moved to LabVIEW board.

0 Kudos
Message 1964 of 2,571
(10,862 Views)

Lots of fun to rewrite an old application. I find "interesting" code parts every day! 🙂

Interfacing a RS232 chiller. Error status response in 1 byte:

 

faults_table.png

Implementation:

Ok, lets check for hexa values to capture error. The only problem, what if more than 1 error flag is present in the byte? Magic! No error! 😄

 

error_code_converter_BD.png

Fixed version:

 

ThermoCube_200.lvlib_Get_Error_status_BD.png

 

 

Another interesting approach: the device expects the temperature setpoint to be sent as 2 bytes hexa string. Lets convert it this way: 😄

 

Set_temperature_BD.png

 

Would not be easier this way? :

 

ThermoCube_200.lvlib_Set_Temperature_BD.png

 

0 Kudos
Message 1965 of 2,571
(10,844 Views)

@Blokk wrote:

 

ThermoCube_200.lvlib_Set_Temperature_BD.png

 


Instead of the Type Cast and the Reverse String, use Flatten Into String.  It has an input for setting the endianness (set it to Little Endian).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 1966 of 2,571
(10,829 Views)

This is the classic case when posting a "fix" for a Rube-Goldberg construct is actually also a little Rube-Goldberg! 😄

Thanks crossrulz! 🙂

0 Kudos
Message 1967 of 2,571
(10,821 Views)

@Blokk wrote:

This is the classic case when posting a "fix" for a Rube-Goldberg construct is actually also a little Rube-Goldberg! 😄

Thanks crossrulz! 🙂


Well, here's another thing.  You can make that VI a little more efficient by not using the Case Structure around the code.  In the event of an error, none of the VISA functions will actually run.  But you are optimized for when an error occurs instead of when there is no error.  Which will happen A LOT more than the other?  I sure hope it is the no error case.  For more information see here: An End to Brainless LabVIEW Programming (there are some other really good things in that presentation).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 1968 of 2,571
(10,801 Views)

@crossrulz wrote:

@Blokk wrote:

This is the classic case when posting a "fix" for a Rube-Goldberg construct is actually also a little Rube-Goldberg! 😄

Thanks crossrulz! 🙂


Well, here's another thing.  You can make that VI a little more efficient by not using the Case Structure around the code.  In the event of an error, none of the VISA functions will actually run.  But you are optimized for when an error occurs instead of when there is no error.  Which will happen A LOT more than the other?  I sure hope it is the no error case.  For more information see here: An End to Brainless LabVIEW Programming (there are some other really good things in that presentation).


Yes. Starting a subVI always with an Error case around became kind of habit for me. But I guess the speed penalty doing this in usual codes are negligible (but of course I just do not need error cases for such VIs, that is for sure!)...

 

edit: and the presentation is very good!

0 Kudos
Message 1969 of 2,571
(10,793 Views)

@Blokk wrote:

@crossrulz wrote:

@Blokk wrote:

This is the classic case when posting a "fix" for a Rube-Goldberg construct is actually also a little Rube-Goldberg! 😄

Thanks crossrulz! 🙂


Well, here's another thing.  You can make that VI a little more efficient by not using the Case Structure around the code.  In the event of an error, none of the VISA functions will actually run.  But you are optimized for when an error occurs instead of when there is no error.  Which will happen A LOT more than the other?  I sure hope it is the no error case.  For more information see here: An End to Brainless LabVIEW Programming (there are some other really good things in that presentation).


Yes. Starting a subVI always with an Error case around became kind of habit for me. But I guess the speed penalty doing this in usual codes are negligible (but of course I just do not need error cases for such VIs, that is for sure!)...

 

edit: and the presentation is very good!


If you go back through this thread.... You will find the penultimate case 

Spoiler

"Should be" isn't "Is" -Jay
0 Kudos
Message 1970 of 2,571
(10,637 Views)