¿ªÔÆÌåÓý


Re: LogixNG POM #logixng

 

Attached error.


Re: How do I import openpyxl?

 

¿ªÔÆÌåÓý

You can manage Excel files as .csv as well as .xls - just choose the format when you save the file

Phil G

On 22 May 2025, at 21:43, Nick Brownsberger via groups.io <nbrownsbe@...> wrote:

?
Dave,
?
To answer your question, I have an Excel spreadsheet listing about 600 cars with various information about them like type, road, number, etc. I'm using a barcode reader to identify a car ID as it rolls over a hump and send it to a Jython program. The program gets some car related information out of the spreadsheet such as car length and destination. Then it looks up the train and classification track assigned for that destination and throws turnouts to send the car to the right track.
?
Right now, using openpyxl, the program works outside of jmri to get the track I need, but it can't throw turnouts without being inside jmri.
?
It doesn't sound like openpyxl is compatible with jmri and Apache POI is way over my head.
?
I'm looking at using csv files, but manipulating a 600 record csv file sounds daunting. Or, I could instantiate a class of 600 cars in the Jython program which I was trying to avoid. I'm also rethinking my strategy as well.
?
Thanks to all,
Nick
?


Re: How do I import openpyxl?

 

On May 22, 2025, at 4:43?PM, Nick Brownsberger via groups.io <nbrownsbe@...> wrote:
I'm looking at using csv files, but manipulating a 600 record csv file sounds daunting. Or, I could instantiate a class of 600 cars in the Jython program which I was trying to avoid. I'm also rethinking my strategy as well.
Could you say a bit more about what problems you¡¯re thinking of for the CSV file?

Excel is quite happy writing and reading CSV files from its standard spreadsheets.

Bob

¡ª
Bob Jacobsen
rgj1927@...


Re: How do I import openpyxl?

 

Dave,
?
To answer your question, I have an Excel spreadsheet listing about 600 cars with various information about them like type, road, number, etc. I'm using a barcode reader to identify a car ID as it rolls over a hump and send it to a Jython program. The program gets some car related information out of the spreadsheet such as car length and destination. Then it looks up the train and classification track assigned for that destination and throws turnouts to send the car to the right track.
?
Right now, using openpyxl, the program works outside of jmri to get the track I need, but it can't throw turnouts without being inside jmri.
?
It doesn't sound like openpyxl is compatible with jmri and Apache POI is way over my head.
?
I'm looking at using csv files, but manipulating a 600 record csv file sounds daunting. Or, I could instantiate a class of 600 cars in the Jython program which I was trying to avoid. I'm also rethinking my strategy as well.
?
Thanks to all,
Nick
?


Re: DCC-EX Voltage/current meter #dcc-ex

 

There are two reasons why the current meter is not reporting.
a.? JMRI current meter uses the <c> command to obtain the information from the DCC-EX command station.? With limited memory, the <c> command is no longer available when Uno (or Nano) is the DCC-EX command station.? This change would be seen in version 5.2.25 and later versions.??
b.? JMRI does not enable current reporting by default.? When you open current meter, use the menu to enable it.? But when used with Uno, you will see the message 'None available'.?

Note that the <c> command is now obsolete, as it only reports for Track A.
There is a new command <JI>? (upper case j i) and it is available for use with Uno.

The DCC-EX discord server is good to discuss issues, including those related to JMRI when using DCC-EX.
?
Regards,

Ash__


Re: LogixNG POM #logixng

 

¿ªÔÆÌåÓý

Vinny,

> Now I'd like to ADD an IM value to the CV.
> In the snip I started out trying to just add a constant (50) but that didn't work.
> I think I need to use the Formula tab but not sure of the syntax.

What error message do you get?

Daniel


On 2025-05-21 22:39, Vinny DeRobertis via groups.io wrote:

I am using the POM function in LogixNG.
Currently setting a CV = to an IM value.
Works good.
Now I'd like to ADD an IM value to the CV.
In the snip I started out trying to just add a constant (50) but that didn't work.
I think I need to use the Formula tab but not sure of the syntax.?
--

Many thanks in advance!

Vinny DeRobertis ~ Apex, NC
New York & Hudson Valley RR

Windows 7 Pro / Java 11 / JMRI v5.10
Command Station: Digikeijs DR5000.
Booster: Digikeijs DR5033
(4) Samsung A7 10.4" Tablets
Fully Kiosk/Engine Driver v2.37.187
DCC/DMX Gateway: Pricom LLS.
LocoNet Input Modules: Digikeijs DR4088LN
DCC Output Modules:
Digikeijs DR4018 / Yamorc YD8116.
Sensors: Model Train Technology: DETECTOR-HO.
Turnout Motors: MTB MP1


Re: VSD dont work #vsdecoder

 

Okay, Klaus, thank you very much. I'll try again and let you know.


Re: I think I have JMRI 5 and JAVA 11 loaded on my Win 11 computer

 

Depending on the computer and what is now or may ever have been plugged into it, the correct COM port may or may not be COM3.
?
To check which COM port you need to assign into JMRI, open Device Manager, expand the "Ports" branch, and plug/unplug your interface device. The correct COM port will appear/disappear as you do this (may take several seconds to do so).
?
HTH,
Steve
"Breezlys"


Re: Trying to replicate 3-way LogixNG code #logixng

 

John,

There is no "text editor". ?You can get a text view of a LogixNG using the Browse option in the Select menu. ?However, that does not show all of the details.

Prior to LogixNG, I would use scripts to handle special cases. ?Many of those have been converted to LogixNG.

Dave Sand


----- Original message -----
From: "John Bauchiero via groups.io" <john4dhmr=[email protected]>
Subject: Re: [jmriusers] Trying to replicate 3-way LogixNG code
Date: Thursday, May 22, 2025 10:40 AM

Thanks Dave,

I still may not be sure what I am doing with LogixNG, though now being up to my ankles, can edit the existing code to fit my purposes. I¡¯ll assume since you didn¡¯t address the existence of a text editor for LogixNG, there isn't any. None the less, you've gotten my interest peaked to continue with more NG code.?

John ?Bauchiero
-?NCE PH-Pro & PowerCab, Pi4, DCC-EX
- JMRI 5.11.6
- Java 17.0.12

On May 22, 2025, at 1:06?AM, Dave Sand via groups.io <ds@...> wrote:

John,

If you have any LogixNG already created, loading an additional file with LogixNG does not work.

I have created an export file which only has the LogixNG with modified system names to prevent conflicts. ?There are no other table entries or panels. ?Load this after loading your regular file.


Dave Sand


----- Original message -----
From: "John Bauchiero via groups.io" <john4dhmr=[email protected]>
Subject: [jmriusers] Trying to replicate 3-way LogixNG code
Date: Wednesday, May 21, 2025 8:14 PM

Dave Sand,

I saw a copy of your 3way LogixNG.xml code (May 6th) which looked interesting (anyway, I assume it¡¯s yours). It operates much smoother than the Sensor/Route/Turnout conglomeration I developed to do the same thing. Up until now, I have been avoiding any Logix or LogixNG coding, at my age, I really didn¡¯t want to learn another programming language.?

Since the code operated the 3-way turnouts just the way I liked. My plan was to add it to my layout.xml with a modification adding of two extra tracks/turnouts. I tried merging the two xml files (but it created two separate panels), not ideal. I also tried the proper way, creating the code from scratch, but (for me) LogixNG is a steep learning curve. I don¡¯t understand the methodology of how to program by completing the dialog boxes. I got as far as the lines completing the (if-) then-else statements which I couldn¡¯t get it to look like your code, I became so frustrated, the project got put on the back burner.?

Is there an editor to directly type-in the code, leaving the debugger to point out syntax errors? I would like an easier way to replicate your code. Thank you in advance for your expertise.?
?
John ?Bauchiero
-?NCE PH-Pro & PowerCab, Pi4, DCC-EX
- JMRI 5.11.6
- Java 17.0.12



Re: Add default consist to train #operationspro

 

Dan,
?I will give it a try. ?I will need to drop the loco consist prior to the train going back into staging at the end of the route.

?


Re: How do I import openpyxl?

 

Nick,

What are you trying to do? ?

  • Example 1: ?Create a list of sensors in a spreadsheet and use that list to create the sensors in the JMRI sensor table.
  • Example 2: ?Read the contents of turnout table and create a spreadsheet to document what has been done.

These Jython programs refer to CSV files:
  • CsvToTurnouts.py
  • FileLogging.py
  • LCC/CSVToNodeBackup.py
  • LCC/NodeBackupToCSV.py
  • LocoNetSlotsReadCSV.py
  • RosterCsvExport.py
  • SampleLnStats.py
  • TurnoutStatePersistence.py
TurnoutStatePersistence.py is a good example. ?When JMRI is stopped, the current turnout states are written to a CSV file. ?After starting and loading the xml data file, the script is run to set the turnouts to the previous state.

Note: ?CSV (comma separated values), not CVS.


Dave Sand



----- Original message -----
From: "Nick Brownsberger via groups.io" <nbrownsbe=[email protected]>
Subject: Re: [jmriusers] How do I import openpyxl?
Date: Thursday, May 22, 2025 11:38 AM

Thanks all. Is nothing simple anymore?
-
I'm looking at Apache POI but the download process confusing.
-
Dave, Can you suggest some cvs examples? I looked in the Jython folder but none were obvious.
?
Nick
?
?


Re: How do I import openpyxl?

 

For reading a CSV file, try jython/CsvToTurnouts.py

From it¡¯s header:

# Read a CSV (comma-separated variable) file containing
#
# System Name
# User Name (optional)
# Comment (optional)
#
# and create a turnout from each line.
# Stops when it first encounters a line without
# three fields; remove all your blank lines!
# Values can be enclosed in quotes (single or double) if desired.

Also, the jython/TurnoutStatePersistence.py script does both CSV read and write, but it has a bunch of other stuff in it too.

Bob

On May 22, 2025, at 12:38?PM, Nick Brownsberger via groups.io <nbrownsbe@...> wrote:

Thanks all. Is nothing simple anymore?
-
I'm looking at Apache POI but the download process confusing.
-
Dave, Can you suggest some cvs examples? I looked in the Jython folder but none were obvious.
Nick
_._,_._,
¡ª
Bob Jacobsen
rgj1927@...


Re: How do I import openpyxl?

 

Thanks all. Is nothing simple anymore?
-
I'm looking at Apache POI but the download process confusing.
-
Dave, Can you suggest some cvs examples? I looked in the Jython folder but none were obvious.
?
Nick
?
?


Re: How do I import openpyxl?

 

Nick and Nick,

The following comments are not authoritative.
  • openpyxl needs to be "installed" in the Jython install location using pip or equivalent.
  • JMRI includes the standalone version of Jython 2.7.4 but there is no "Jython install" location.
  • It is possible to run Jython from the command line: ?java -jar /Applications/JMRI/lib/jython-standalone-2.7.4.jar. ?This will not include the JMRI context.
  • It appears that openpyxl supports Python3. ?The latest versions might not support Python 2.7.4.
  • Recent releases of macOS only support Python3.

---------------------

I recommend using the CSV approach. ?Excel can export and import CSV files. ?There are several examples of using CSV files in the jython directory.

LogixNG can also use CSV files as a data source. ?However, writing a CSV file is not supported.


Dave Sand






----- Original message -----
From: "nicholas murphy via groups.io" <nicholas_murphy=[email protected]>
Subject: Re: [jmriusers] How do I import openpyxl?
Date: Thursday, May 22, 2025 10:22 AM

Hi,?

?

This is what Copilot said about running openpyxl in Jython:

?

'Using openpyxl with Jython can be challenging. Openpyxl relies on certain Python features that may not be fully compatible with Jython, which runs on the Java Virtual Machine (JVM). Users have reported issues when trying to install and use openpyxl with Jython 2.7, including import errors and missing dependencies.

If you're working with Jython and need to handle Excel files, you might want to explore Apache POI, a Java-based library for working with Excel formats. Alternatively, consider using Python instead of Jython if openpyxl is essential for your project.

Would you like help finding an alternative approach?'

?

Regards

?

Nick

?

?



Re: Trying to replicate 3-way LogixNG code #logixng

 

¿ªÔÆÌåÓý

Thanks Dave,

I still may not be sure what I am doing with LogixNG, though now being up to my ankles, can edit the existing code to fit my purposes. I¡¯ll assume since you didn¡¯t address the existence of a text editor for LogixNG, there isn't any. None the less, you've gotten my interest peaked to continue with more NG code.?

John ?Bauchiero
-?NCE PH-Pro & PowerCab, Pi4, DCC-EX
- JMRI 5.11.6
- Java 17.0.12

On May 22, 2025, at 1:06?AM, Dave Sand via groups.io <ds@...> wrote:

John,

If you have any LogixNG already created, loading an additional file with LogixNG does not work.

I have created an export file which only has the LogixNG with modified system names to prevent conflicts. ?There are no other table entries or panels. ?Load this after loading your regular file.


Dave Sand


----- Original message -----
From: "John Bauchiero via groups.io" <john4dhmr=[email protected]>
Subject: [jmriusers] Trying to replicate 3-way LogixNG code
Date: Wednesday, May 21, 2025 8:14 PM

Dave Sand,

I saw a copy of your 3way LogixNG.xml code (May 6th) which looked interesting (anyway, I assume it¡¯s yours). It operates much smoother than the Sensor/Route/Turnout conglomeration I developed to do the same thing. Up until now, I have been avoiding any Logix or LogixNG coding, at my age, I really didn¡¯t want to learn another programming language.?

Since the code operated the 3-way turnouts just the way I liked. My plan was to add it to my layout.xml with a modification adding of two extra tracks/turnouts. I tried merging the two xml files (but it created two separate panels), not ideal. I also tried the proper way, creating the code from scratch, but (for me) LogixNG is a steep learning curve. I don¡¯t understand the methodology of how to program by completing the dialog boxes. I got as far as the lines completing the (if-) then-else statements which I couldn¡¯t get it to look like your code, I became so frustrated, the project got put on the back burner.?

Is there an editor to directly type-in the code, leaving the debugger to point out syntax errors? I would like an easier way to replicate your code. Thank you in advance for your expertise.?
?
John ?Bauchiero
-?NCE PH-Pro & PowerCab, Pi4, DCC-EX
- JMRI 5.11.6
- Java 17.0.12



Re: How do I import openpyxl?

 

Hi,?

?

This is what Copilot said about running openpyxl in Jython:

?

'Using openpyxl with Jython can be challenging. Openpyxl relies on certain Python features that may not be fully compatible with Jython, which runs on the Java Virtual Machine (JVM). Users have reported issues when trying to install and use openpyxl with Jython 2.7, including import errors and missing dependencies.

If you're working with Jython and need to handle Excel files, you might want to explore Apache POI, a Java-based library for working with Excel formats. Alternatively, consider using Python instead of Jython if openpyxl is essential for your project.

Would you like help finding an alternative approach?'

?

Regards

?

Nick

?

?


I think I have JMRI 5 and JAVA 11 loaded on my Win 11 computer

 

I am trying to get to look at the MACROs from my Clubs Layout, but I thought I needed the internet to my Computer so I got the Clubs computer win11 with Java and Jmri on and I got the some results cannot find USB PORT 3 on both with most of the other options.
?
So this leads me to with or with out the Internet is not really needed, just to check if JMRI and JAVA are working, but mine not connected to the Internet as the Clubs laptop is up the other end of the Club room with Jmri/Java sorting out locos and CVs and other things ok.
?
I have used most of the options with the setup with the both computers, so what else do I need to do to be able to get to the Reading of the Macros.
?
Thanks Graeme
?


DCC-EX Voltage/current meter #dcc-ex

 

I have my windows 10 laptop running JMRI v5.6 with DCC-EX running on an Arduino uno, connected to my laptop via USB, paired with the DCC-EX MotorShield8874.?

When I open the ¡®voltage / current meter¡¯ in Panel Pro, all I get is hyphens - no actual current reading in digits.
?
I¡¯ve had the current meter working before, on an older version of JMRI, running a standard motor shield with the Arduino, but I¡¯ve not tested the current meter since I fitted the new 8874 motor shield.
?
I wanted to check there isn¡¯t anything I¡¯ve missed or failed to configure specifically in JMRI for this before looking into the hardware.
?
Many thanks,
Dan
?


Re: How do I import openpyxl?

 

¿ªÔÆÌåÓý

Nick,

I'm not sure it's even possible to include openpyxl. JMRI uses Jython, not Python. Jython is similar to Python but written in Java. It allows Java programs like JMRI to run Python scripts. But since it is written in Java, I don't think it can use Python libraries, unless they are migrated to Jython.

Daniel


On 2025-05-22 13:13, Nick Brownsberger via groups.io wrote:

Dave,
?
Thanks. I'd like to avoid using a cvs file because I use the spreadsheet to maintain my car fleet as well as in the Jython script.
?
Robert,
?
I tried the path.append statement but it didn't work. My file structure is:
/Applications/JMRI 5.10/openpyxl315/openpyxl.
-
"openpyxl" is just a file. There is no "openpyxl.py" script. Inside the openpyxl file is an "__init__.py" script and other files including /workbook with another "__init__.py" inside.
-
I tried these small scripts:
import os
import sys
sys.path.append("/Applications/JMRI 5.10/openpyxl315/openpyxl")
- and
import os
import sys
sys.path.append("/Applications/JMRI 5.10/openpyxl315/openpyxl/__init__.py")
-
I ran them outside of jmri in BBedit and inside jmri using the script menu. But as I said, they didn't work when I ran my script which included the lines:
import os
import sys
import time
import openpyxl - sys console says "ImportError: No module named openpyxl"
-
How should the path.amend statement read, and should I run it from the jmri script menu or from Bbedit or from the Terminal?
?
Thanks again to both of you.
Nick


Re: How do I import openpyxl?

 

Dave,
?
Thanks. I'd like to avoid using a cvs file because I use the spreadsheet to maintain my car fleet as well as in the Jython script.
?
Robert,
?
I tried the path.append statement but it didn't work. My file structure is:
/Applications/JMRI 5.10/openpyxl315/openpyxl.
-
"openpyxl" is just a file. There is no "openpyxl.py" script. Inside the openpyxl file is an "__init__.py" script and other files including /workbook with another "__init__.py" inside.
-
I tried these small scripts:
import os
import sys
sys.path.append("/Applications/JMRI 5.10/openpyxl315/openpyxl")
- and
import os
import sys
sys.path.append("/Applications/JMRI 5.10/openpyxl315/openpyxl/__init__.py")
-
I ran them outside of jmri in BBedit and inside jmri using the script menu. But as I said, they didn't work when I ran my script which included the lines:
import os
import sys
import time
import openpyxl - sys console says "ImportError: No module named openpyxl"
-
How should the path.amend statement read, and should I run it from the jmri script menu or from Bbedit or from the Terminal?
?
Thanks again to both of you.
Nick