Is there a way to find arrows without polarities? In GMB workshops in order to save time, the marking of polarities may sometimes be postponed until after the workshop. Duriong that work, esp. in a messy diagram, it would be good to have a way to find arrows without polarity marking. If there is no built-in tool for this in Vensim:
a) please file this as a feature request
b) is there a way to do this in the text version of the model? My guess is that this is stored in the sketch information?
How to find arrrows without polarities?
-
- Super Administrator
- Posts: 4834
- Joined: Wed Mar 05, 2003 3:10 am
Re: How to find arrrows without polarities?
There is no way to do this now. But we could add it under the "Edit" menu. There is already a bunch of select modes there, I can add "Arrows without a polarity marking".
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: How to find arrrows without polarities?
It's a work around, but in small model segments you can see the marked and unmarked arrows with the Causes/Uses tool. Right click on the Causes/Uses tool icon to show Tool Options, and for Arrows check Polarity (you can also click Color and Width). Tree size Depth = 3 and Height = 2 gives a manageable segment size. Click OK, select a variable, and the output shows which arrows in the displayed segment have/don't have polarities.
Checking in segments could be a good GMB breakout exercise - assign views to breakout teams, and step through all the variables using Causes/Uses (but not the shadow variables) in the view until all polarities are added. The Causes/Uses window can be pushed out of the way so the view can be edited (polarities added) with the segment still visible, but you need to close and reopen to see the changed (added) polarity markings.
Checking in segments could be a good GMB breakout exercise - assign views to breakout teams, and step through all the variables using Causes/Uses (but not the shadow variables) in the view until all polarities are added. The Causes/Uses window can be pushed out of the way so the view can be edited (polarities added) with the segment still visible, but you need to close and reopen to see the changed (added) polarity markings.
Re: How to find arrrows without polarities?
Adding this option the Edit menu would be nice! Kindly let me know when it gets implemented. Thanks also for the workaround-hint with cases/uses trees. Unfortunately that won't work for me as I am using PLE plus.
-
- Super Administrator
- Posts: 4834
- Joined: Wed Mar 05, 2003 3:10 am
Re: How to find arrrows without polarities?
It will be in the next release (I'm not sure when that will be). Keep an eye out here and on the various social media platforms for notification.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
-
- Senior Member
- Posts: 198
- Joined: Sun Oct 21, 2018 7:09 am
- Vensim version: DSS
Re: How to find arrrows without polarities?
A workaround for this (look at the screenshots below): go to View As Text and look for the properties of variables and arrows. In the lines that start with '1' (denoting arrows), if you find the 7th element is 0, it means that the arrow doesn't have any polarities. 43 and 45 correspond to positive and negative polarities, respectively. The 3rd and 4th elements in that row show the causal direction. In this case, it says '2,1', meaning that the arrow goes from variable 2 (birth rate) to variable 1 (population). Then, you can go back to View As Sketch, find those variables, and add the polarity.
Note that modifying those numbers in View AS Text may corrupt the Vensim file.
Alternatively, you can ask an LLM to automate this process by reading the mdl file directly and printing the missing polarities. I did it for the test model very quickly but haven't tested it for larger models. Make sure you have backups of your model if you're going to run such scripts.
I'll share the code and the model in the next comment.
(side note: I think it should be View as Test or View as Sketch with small a for conjunction, like Export as SVG)
Note that modifying those numbers in View AS Text may corrupt the Vensim file.
Alternatively, you can ask an LLM to automate this process by reading the mdl file directly and printing the missing polarities. I did it for the test model very quickly but haven't tested it for larger models. Make sure you have backups of your model if you're going to run such scripts.
I'll share the code and the model in the next comment.
(side note: I think it should be View as Test or View as Sketch with small a for conjunction, like Export as SVG)
-
- Senior Member
- Posts: 198
- Joined: Sun Oct 21, 2018 7:09 am
- Vensim version: DSS
Re: How to find arrrows without polarities?
here's the code and the model I tested:
Code: Select all
import csv
def find_variables_with_missing_polarities(mdl_file_path):
variable_mapping = {}
variables_with_missing_polarities = set()
with open(mdl_file_path, 'r', encoding='utf-8') as file:
reader = csv.reader(file)
lines = list(reader)
# First pass: build variable index to name mapping
for line in lines:
if not line:
continue
if line[0].strip() == '10':
try:
var_index = line[1].strip()
var_name = line[2].strip()
variable_mapping[var_index] = var_name
except IndexError:
continue # Skip malformed lines
# Second pass: find arrows with missing polarities
for line in lines:
if not line:
continue
if line[0].strip() == '1':
# Ensure there are enough elements
if len(line) < 7:
continue
try:
polarity = line[6].strip()
if polarity == '0':
source_index = line[2].strip()
target_index = line[3].strip()
source_name = variable_mapping.get(source_index, f"Unknown({source_index})")
target_name = variable_mapping.get(target_index, f"Unknown({target_index})")
variables_with_missing_polarities.add(source_name)
variables_with_missing_polarities.add(target_name)
except IndexError:
continue # Skip malformed lines
if variables_with_missing_polarities:
print("Variables with missing polarities on their arrows:")
for var in sorted(variables_with_missing_polarities):
print(f"- {var}")
else:
print("No variables with missing polarities found.")
# Example usage:
# Replace 'test.mdl' with the path to your mdl file
find_variables_with_missing_polarities('/Users/Ali/Desktop/test.mdl')
- Attachments
-
- test.mdl
- (1.47 KiB) Downloaded 270 times